Bending Spoons interview question

To solve a logical task.