We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5ef5ac commit 5835dc6Copy full SHA for 5835dc6
solution/2400-2499/2406.Divide Intervals Into Minimum Number of Groups/README_EN.md
@@ -130,16 +130,12 @@ func (h *hp) Pop() any {
130
```ts
131
function minGroups(intervals: number[][]): number {
132
intervals.sort((a, b) => a[0] - b[0]);
133
- const q = new PriorityQueue({
134
- compare: (e1, e2) => {
135
- return e1 - e2;
136
- },
137
- });
138
- for (const e of intervals) {
139
- if (!q.isEmpty() && q.front() < e[0]) {
+ const q = new PriorityQueue({ compare: (a, b) => a - b });
+ for (const [l, r] of intervals) {
+ if (!q.isEmpty() && q.front() < l) {
140
q.dequeue();
141
}
142
- q.enqueue(e[1]);
+ q.enqueue(r);
143
144
return q.size();
145
0 commit comments