Amazon interview question

Questions from Data structures and algos