PROBLEM STATEMENT
Billy Joe wants to take his date, Bobbi Sue, out to eat. Living by the age old
adage, "Take the money and run", he decides to go to a fast food restaurant,
which serves drinks, side orders, and sandwiches. A complete meal must contain
one of each of the three.
DEFINITION
Class name: Fastfood
Method name: cheapest
Parameters: int[], int[], int[]
Returns: int
The method signature is: (make sure it is declared public)
int cheapest(int[] drink, int[] side, int[] sandwich);
Each int[] contains the respective prices of items in cents for that category.
Given these lists of prices, determine the cheapest meal that Billy Joe can buy.
TopCoder will enforce the following restrictions:
* Each int[] will contain between 1 and 50 elements, inclusive.
* Each element of each int[] will be between 1 and 1000, inclusive.
Example 1:
drink = {5, 3, 7}
side = {3, 5, 2}
sandwich = {8, 10, 12}
The cheapest combination which includes one item from each list is:
3 cents for a drink
2 cents for a side
8 cents for a sandwich.
3 + 2 + 8 = 13. Thus, the method returns 13.
Example 2:
drink = {1, 2, 1}
side = {10}
sandwich = {3, 6, 2}
Cheapest combination is drink - 1 cent, side - 10 cents, and sandwich - 2 cents.
Method returns 1 + 10 + 2 = 13.
Example 3:
drink = {6, 1, 9}
side = {65, 1, 3}
sandwich = {100, 6, 2}
Method returns 4.
Example 4:
drink = {11, 2, 3}
side = {27, 2, 1}
sandwich = {10, 62, 21}
Method returns 13.