Ezvor

1580. Put Boxes Into the Warehouse II

MediumArray Preparing judge… LeetCode
ArrayGreedySorting

Hints

Hint 1
Try to put at least one box in the house pushing it from either side.
Hint 2
Once you put one box to the house, you can solve the problem with the same logic used to solve version I. You have a warehouse open from the left only and a warehouse open from the right only.