Amazon interview question

Some simple algorithmic questions