Domanda di colloquio di MTX Group

Asked for logic for random problem made by interviewer