Minimum Elevator Time to Move Boxes Up

Asked at Publicis Sapient · Coding Questions · Difficulty: Medium

An office is moving to the top floor of a building with floors `0` to `n`. Boxes are spread over the lower floors `0` to `n - 1`, and one elevator must carry every box up to floor `n`. Each elevator trip can pick up only one box per floor, so floors with many boxes need many trips. Find the least total travel time needed to bring all boxes up.

Loading the problem…