Tap here to switch tabs
Problem
Submissions

Problem: Maximum Ice Cream Bars

med
30 min
Try to solve the Maximum Ice Cream Bars problem.

Statement

There are nn ice cream bars available in a store. You are given an integer array costs of length nn, where costs[i] denotes the price of the ice cream bar at index i. You are also given an integer coins representing the initial number of coins you possess.

Return the maximum number of ice cream bars you can purchase with coins coins.

Note: The ice cream bars can be purchased in any order.

Constraints:

  • costs.length ==n== n

  • 1≤n≤1051 \leq n \leq 10^5

  • 1≤1 \leq costs[i] ≤105\leq 10^5

  • 1≤1 \leq coins ≤108\leq 10^8

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Ice Cream Bars

med
30 min
Try to solve the Maximum Ice Cream Bars problem.

Statement

There are nn ice cream bars available in a store. You are given an integer array costs of length nn, where costs[i] denotes the price of the ice cream bar at index i. You are also given an integer coins representing the initial number of coins you possess.

Return the maximum number of ice cream bars you can purchase with coins coins.

Note: The ice cream bars can be purchased in any order.

Constraints:

  • costs.length ==n== n

  • 1≤n≤1051 \leq n \leq 10^5

  • 1≤1 \leq costs[i] ≤105\leq 10^5

  • 1≤1 \leq coins ≤108\leq 10^8