GlobalLogic interview question

Prototype