Bending Spoons interview question

The problems are each containing sub problems