Company: HackerRank
Difficulty: medium
Given a country name, find the chocolate from that country that provides the most energy per gram using a chocolate database. In the original assessment the database is reached with HTTP GET requests to https://jsonmock.hackerrank.com/api/chocolates?countryOfOrigin=<country> , paginated with &page=<num> . The API response contains page , per_page , total , total_pages and data , where each data object holds countryOfOrigin , brand , type , nutritionalInformation (including kcal ), prices (array) and weights (array). Example record excerpt: { "type": "Truffle", "brand": "Tony's Chocolonely", "prices": [614, 283, 564, 365, 689], "weights": [125, 71, 116, 100, 126], "countryOfOrigin": "Norway", "nutritionalInformation": { "fats": 1.01, "kcal": 115, "carbs": 7.49 } } Task For a given country, return the brand and type of chocolate, in the format brand:type , that provides the most energy per gram, where energy = floor(kcal * 0.01 * weight) For chocolates with multiple weigh