Enosis Solution interview question

The question was based on beginner-level competitive programming problem types.