Update 0056.合并区间.md

Update Java solution. For sorting, no need to compare the second element in an interval.
This commit is contained in:
Yang
2021-06-01 14:41:22 -04:00
committed by GitHub
parent 7b3f8ea4dd
commit 67313906d1

View File

@ -144,11 +144,7 @@ class Solution {
Arrays.sort(intervals, new Comparator<int[]>() {
@Override
public int compare(int[] o1, int[] o2) {
if (o1[0] != o2[0]) {
return Integer.compare(o1[0],o2[0]);
} else {
return Integer.compare(o1[1],o2[1]);
}
return Integer.compare(o1[0], o2[0]);
}
});