<jupyter_start><jupyter_text>问题描述：    在二维空间中散布着许多球形气球。对于每个气球，提供的输入是水平方向的开始和结束坐标。    由于它是水平的，因此y坐标无关紧要，因此只需要x轴方向的起点和终点坐标就足够了。    开始总是小于结束。最多会有10^4个气球。        可以从沿x轴的不同点垂直垂直地向上射出一个箭头。    如果气球 在 start < 位置 < end 之间时。可以击破气球。    箭头数量没有限制。一次射出的箭头会无限上行。        求：爆破所有气球所必须射出的最少箭头数。例题1：    Input: [[10,16], [2,8], [1,6], [7,12]]    Output: 2    Explanation:        One way is to shoot one arrow for example at x = 6         (bursting the balloons [2,8] and [1,6]) and another arrow at x = 11 (bursting the other two balloons).<jupyter_code>class Solution:
    def findMinArrowShots(self, points) -> int:
        if len(points) <= 1:
            return len(points)
        
        sorted_points = sorted(points, key=lambda x: x[1])
        print(sorted_points)

        shot_times = 1
        shot_inter = [sorted_points[0][0], sorted_points[0][1]]
        for i in range(1, len(sorted_points)):
            if sorted_points[i][0] < shot_inter[1]:
                shot_inter[0] = sorted_points[i][0]
            elif sorted_points[i][0] == shot_inter[1]:
                shot_inter[0] = sorted_points[i][0]
                shot_inter[1] =sorted_points[i][0]
            else:
                shot_inter = sorted_points[i]
                shot_times += 1
            print(shot_inter)
        return shot_times            
points_ =  [[10,16], [2,8], [1,6], [7,12]]
solution = Solution()
solution.findMinArrowShots(points_)
points_ =  [[10,16], [2,8], [1,6], [7,12]]
sorted_points = sorted(points_, key = lambda x: (x[1], x[1] - x[0])) # Sort by left cordinate, then by width
sorted_points<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13167701863354037, 'fraction_numerical': 0.04161490683229813, 'mean_word_length': 2.764018691588785, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 6, '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': '569844', 'license': 'Apache-2.0', 'n_tokens_mistral': 712, 'n_tokens_neox': 724, 'n_words': 125, 'path': 'Greedy/previous/452. Minimum Number of Arrows to Burst Balloons.ipynb', 'repo_name': 'YuHe0108/Leetcode', 'size': '1610'}