easy python


  • 0
    F
        def findLongestChain(self, pairs):
            from operator import itemgetter
            pairs = sorted(pairs, key=itemgetter(1))
            keys = [pairs[0][1]]
            for pair in pairs:
                if pair[0] > keys[-1]:
                    keys.append(pair[1])
            return len(keys)

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.