Amazon Robotics interview question

Leetcode style question about fitting packages into spaces