From 67313906d16f8cf0e613968bf0f9b8031a273cdd Mon Sep 17 00:00:00 2001 From: Yang Date: Tue, 1 Jun 2021 14:41:22 -0400 Subject: [PATCH] =?UTF-8?q?Update=200056.=E5=90=88=E5=B9=B6=E5=8C=BA?= =?UTF-8?q?=E9=97=B4.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update Java solution. For sorting, no need to compare the second element in an interval. --- problems/0056.合并区间.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/problems/0056.合并区间.md b/problems/0056.合并区间.md index eb8e7bff..f42fced7 100644 --- a/problems/0056.合并区间.md +++ b/problems/0056.合并区间.md @@ -144,11 +144,7 @@ class Solution { Arrays.sort(intervals, new Comparator() { @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]); } });