Problem Statement
Definition
- Class:
- ShipBoxes
- Method:
- bestCost
- Parameters:
- int[], int[]
- Returns:
- int
- Method signature:
- int bestCost(int[] box1, int[] box2)
- (be sure your method is public)
Constraints
- box1 and box2 must each contain exactly 3 elements.
- Each element of box1 and box2 will be between 1 and 10,000, inclusive.
Examples
{1,4,9}
{1,4,9}
Returns: 140
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.
{10000,10000,10000}
{10000,10000,10000}
Returns: 1200000000
{314,159,262}
{271,818,282}
Returns: 1483466
{1,1,1}
{1,1,1}
Returns: 12
{1,9000,9000}
{40,40,40}
Returns: 164214000
{9627,9344,3773}
{5652,5696,5646}
Returns: 669089316
{3285,9049,7352}
{1391,3122,6053}
Returns: 318705840
{1857,3875,5935}
{5651,3546,7847}
Returns: 282384980
{595,3423,3181}
{3779,1834,9227}
Returns: 151279196
{4924,9230,904}
{5355,9133,1219}
Returns: 183518540
{5367,4548,548}
{5503,1254,14}
Returns: 66464564
{4086,1440,3451}
{6510,9955,5144}
Returns: 399544420
{4817,1091,7468}
{5355,2401,9625}
Returns: 245103390
{2316,5275,1301}
{4423,5514,3712}
Returns: 187491120
{5929,4836,7469}
{2525,2418,5740}
Returns: 327557686
{6570,6076,5880}
{7595,3,1835}
Returns: 324635290