Amazon interview question

2 problem solving hard questions