One Package for All Products
Problem statement
products and packages contain triples in the fixed order [length, width, height].
For this exercise, a package can contain a product if each product dimension is at most the corresponding package dimension. Rotation is not allowed and touching the boundary is allowed.
Return true if one package can individually contain every product, and false otherwise. Products are tested separately against that same package; this is not a simultaneous three-dimensional packing problem.
Examples
Example 1
products = [[2,4,3],[3,2,5]]packages = [[3,4,5],[5,3,5]]return = truePackage [3,4,5] individually contains both products in their fixed orientation.
Unlock this recently reported problem
FastPrep Pro gives you full access to interview problems reported within the last week.
- Full problem statement and constraints
- 2 more worked examples, explained
- Guided hints and editorial
- Run your code on real test cases
$99 billed yearly — or $19 month-to-month. Cancel anytime.