CIBC interview question

A question to understand problem solving skills