https://leetcode.com/problems/maximum-ice-cream-bars/


Time Limit Exceeded


```typescript
function maxIceCream(costs: number[], coins: number): number {
    //8:40
    costs.sort((a, b)=>a - b)
    const original_costs = [...costs]
    const original_coins = coins
    
    let max_number = 0
    
    let myMaxIceCreamFunction = (costs: number[], coins: number) => {
        if ((coins > 0) && (costs.length > 0) && (costs[0] <= coins)) {
           for (const [i, cost] of costs.entries()) {
               if (cost <= coins) {
                   const newCosts = [...costs]
                   newCosts.shift()
                   myMaxIceCreamFunction(newCosts, coins-cost)
               } else {
                   break
               }
           }
        } else {
            const new_number = original_costs.length - costs.length
            if (new_number > max_number) {
                max_number = new_number
            }
        }
    }
    
    myMaxIceCreamFunction(costs, coins)
    
    return max_number
    //8:55
    //debug until 9:01
};
```
