classSolution: deflongestConsecutive(self, nums: List[int]) -> int: longest_streak = 0 # num_set = set(nums) nums_dict = {} for num in nums: nums_dict[num] = 1 for num in nums_dict.keys(): if num - 1notin nums_dict.keys(): current_num = num current_streak = 1