mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
Update 0056.合并区间.md
Update Java solution. For sorting, no need to compare the second element in an interval.
This commit is contained in:
@ -144,11 +144,7 @@ class Solution {
|
|||||||
Arrays.sort(intervals, new Comparator<int[]>() {
|
Arrays.sort(intervals, new Comparator<int[]>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(int[] o1, int[] o2) {
|
public int compare(int[] o1, int[] o2) {
|
||||||
if (o1[0] != o2[0]) {
|
return Integer.compare(o1[0], o2[0]);
|
||||||
return Integer.compare(o1[0],o2[0]);
|
|
||||||
} else {
|
|
||||||
return Integer.compare(o1[1],o2[1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user