Skip to content

Commit

Permalink
Update 0056.合并区间.md
Browse files Browse the repository at this point in the history
Update Java solution. For sorting, no need to compare the second element in an interval.
  • Loading branch information
yang170 authored Jun 1, 2021
1 parent 7b3f8ea commit 6731390
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions problems/0056.合并区间.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
});

Expand Down

0 comments on commit 6731390

Please sign in to comment.