frog interview question

Needed to solve a business case.