Amazon interview question

LP very imp as well as coding