Amazon interview question

Problem similar to something in cracking the coding interview