Kalido interview question

a great aptitude question in problem solving.