CAPGEMINI Hiring Challenge | On Campus OA (2024) | Problem Maximum Ice Cream Bars
Capgemini · Question · Posted Jun 2026
Problem Statement You are given an integer array costs where costs[i] represents the cost of the i-th ice cream bar, and an integer coins representing the total number of coins available. You want to buy the maximum number of ice cream bars using the available coins. You can buy each ice cream bar at most once. Return the maximum number of ice cream bars you can purchase. Test Case 1 Input costs = [1,3,2,4,1] coins = 7 Output 4 Explanation ...
The full answer & interview discussion are available to premium members.
Log in Create a free account