| ||Find the least-cost 3D box that can hold two given 3D boxes.
The boxes must be kept orthogonal (not tilted) although
they can be rotated at any multiple of 90 degrees in 3-space.
Cost is the total area of cardboard required for the enclosing box,
where four sides have one layer of cardboard and two ends
have two layers of cardboard. The two boxes that
are enclosed may not overlap (consider them already filled).
You are given the dimensions of the two boxes as ints, where
each int contains exactly three elements.|
|Method signature:||int bestCost(int box1, int box2)|
|(be sure your method is public)|
|-||box1 and box2 must each contain exactly 3 elements.|
|-||Each element of box1 and box2 will be between 1 and 10,000, inclusive.|
|These two boxes have the shape of the monolith from 2001, A Space Odyssey---mostly flat. The most economical way to ship them is to stack them on top of each other and put the flaps at the small ends. The top of the box then is 4x9, the sides are 2x9, and the ends are 2x4; the total area of cardboard required is thus 140.|