Domanda di colloquio di Bending Spoons

logic problems, algorithm questions involving loops