---
# System prepended metadata

title: '[LeeteCode - Weekly Contest 237](https://leetcode.com/contest/weekly-contest-237/)'
tags: [LeetCode Contest]

---

---
titile: Weekly Contest 237
tags: LeetCode Contest
---

[LeeteCode - Weekly Contest 237](https://leetcode.com/contest/weekly-contest-237/)
===

Q1 - 1832. Check if the Sentence Is Pangram
---

```cpp=
class Solution {
public:
    bool checkIfPangram(string sentence) {
        set<char> letters;
        for(char ch: sentence){
            letters.insert(ch);
        }
        return letters.size() == 26;
    }
};
```

Q2 - 1833. Maximum Ice Cream Bars
---

```cpp=
class Solution {
public:
    int maxIceCream(vector<int>& costs, int coins) {
        
        vector<int> counts(100001);
        for(int cost: costs){
            counts[cost]++;
        }
        
        int ret = 0;
        for(int i = 1; coins >= i && i <= 100000; i++){
            if(counts[i] > 0){
                int num = min(coins / i, counts[i]);
                ret += num;
                coins -= num * i;
                // cout<<ret<<endl;
            }
        }
        
        return ret;
    }
};
```

Q3 - 1834. Single-Threaded CPU
---

```cpp=
class Solution {
public:
    vector<int> getOrder(vector<vector<int>>& tasks) {
        
        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> minHeapTasks;
        for(int i = 0; i < tasks.size(); i++){
            minHeapTasks.push({tasks[i][0], i});
        }
        
        vector<int> ret;
        long long cur = 0;
        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> minHeapTimes;
        while(minHeapTasks.size() || minHeapTimes.size()){
            if(minHeapTimes.empty()){
                cur = max(cur, (long long)minHeapTasks.top().first);
            }
            
            while(minHeapTasks.size() && minHeapTasks.top().first <= cur){
                int i = minHeapTasks.top().second;
                minHeapTimes.push({tasks[i][1], i});
                minHeapTasks.pop();
            }
            
            auto [time, i] = minHeapTimes.top();
            minHeapTimes.pop();
            
            cur += time;
            ret.push_back(i);
        }
        
        return ret;
    }
};
```

Q4 -  
---

```cpp=

```
