Skip to content

Commit 5835dc6

Browse files
authored
Update README_EN.md
1 parent b5ef5ac commit 5835dc6

File tree

1 file changed

+4
-8
lines changed
  • solution/2400-2499/2406.Divide Intervals Into Minimum Number of Groups

1 file changed

+4
-8
lines changed

solution/2400-2499/2406.Divide Intervals Into Minimum Number of Groups/README_EN.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,12 @@ func (h *hp) Pop() any {
130130
```ts
131131
function minGroups(intervals: number[][]): number {
132132
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]) {
133+
const q = new PriorityQueue({ compare: (a, b) => a - b });
134+
for (const [l, r] of intervals) {
135+
if (!q.isEmpty() && q.front() < l) {
140136
q.dequeue();
141137
}
142-
q.enqueue(e[1]);
138+
q.enqueue(r);
143139
}
144140
return q.size();
145141
}

0 commit comments

Comments
 (0)