Skip to content

Commit fd771bf

Browse files
committed
Time: 190 ms (96.85%), Space: 17 MB (14.26%) - LeetHub
1 parent 6514b72 commit fd771bf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from operator import itemgetter
2+
class Solution:
3+
def findLongestChain(self, pairs: List[List[int]]) -> int:
4+
pairs.sort(key=itemgetter(1))
5+
6+
ans = pairs[:1]
7+
8+
for b, e in pairs[1:]:
9+
if ans[-1][1] < b:
10+
ans.append((b, e))
11+
12+
return len(ans)

0 commit comments

Comments
 (0)