Description
Submission
class Solution { public: int maxIceCream(vector<int>& costs, int coins) { sort(costs.begin(), costs.end()); int ret = 0; for(int i = 0; i < costs.size() && coins >= costs[i]; ++i) { coins -= costs[i]; ++ret; } return ret; } };