Amazon interview question

asked minimization LC Med problem