Amazon interview question

LC 587, Remove boxes, no follow up