GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.hackerrank.com — Ice Cream Parlor | HackerRank We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies. 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. Example. The two flavors that cost and meet the criteria. Using -based indexing, they are at indices and . Function Description Complete the icecreamParlor function in the editor below. icecreamParlor has the following parameter(s):
Returns
Input Format 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. Constraints
Sample Input STDIN Function ----- -------- 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] Sample Output Explanation Sunny and Johnny make the following two trips to the parlor:
Cookie support is required to access HackerRankSeems like cookies are disabled on this browser, please enable them to open this website |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |