<jupyter_start><jupyter_text>![image.png](attachment:image.png)<jupyter_code>def findLongestChain(self, pairs):
        cur, ans = float('-inf'), 0
        for x, y in sorted(pairs, key = lambda z:z[1]):
            if cur < x:                                
                cur = y
                ans += 1
        return ans
L=[[-6,9],[1,6],[8,10],[-1,4],[-6,-2],[-9,8],[-5,3],[0,3]]

findLongestChain(0,L)
L=[[-6,9],[1,6],[8,10],[-1,4],[-6,-2],[-9,8],[-5,3],[0,3]]
sorted(L, key=lambda x:x[1])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.25426944971537, 'fraction_numerical': 0.07400379506641366, 'mean_word_length': 2.4966887417218544, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '325089', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 232, 'n_tokens_neox': 219, 'n_words': 30, 'path': '646. Maximum Length of Pair Chain.ipynb', 'repo_name': 'kkoo1122/Leetcode_Practice', 'size': '527'}