Amazon Interview Question

asked minimization LC Med problem