Skip to content

Commit e10c1c9

Browse files
authored
Update Longest Consecutive Sequence - Leetcode 128.py
1 parent 4444560 commit e10c1c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Longest Consecutive Sequence - Leetcode 128.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ def longestConsecutive(self, nums: List[int]) -> int:
33
s = set(nums)
44
longest = 0
55

6-
for num in nums:
6+
for num in s: # Fixed to loop through the set, this is important
77
if num - 1 not in s:
88
next_num = num + 1
99
length = 1

0 commit comments

Comments
 (0)