Amazon Interview Question

I was asked to solve a coding problem before the interview