Two friends like to pool their money and go to the ice cream parlor. They always choose two distinct flavors and they spend all of their money.
Given a list of prices for the flavors of ice cream, select the two that will cost all of the money they have.
The two flavors that cost and meet the criteria. Using -based indexing, they are at indices and .
Complete the icecreamParlor function in the editor below.
icecreamParlor has the following parameter(s):
The first line contains an integer, , the number of trips to the ice cream parlor. The next sets of lines each describe a visit.
Each trip is described as follows:
Note: The index within the cost array represents the flavor of the ice cream purchased.
2 t = 2
4 k = 4
5 cost size n = 5
1 4 5 3 2 cost = [1, 4, 5, 3, 2]
4 k = 4
4 cost size n = 4
2 2 4 3 cost=[2, 2,4, 3]
Sunny and Johnny make the following two trips to the parlor: