We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 75c9a4a commit 8dd7af8Copy full SHA for 8dd7af8
longest-consecutive-sequence/wisdom08.py
@@ -0,0 +1,10 @@
1
+def longestConsecutive(nums):
2
+ longest = 0
3
+
4
+ for num in nums:
5
+ length = 1
6
+ while num + length in nums:
7
+ length += 1
8
+ longest = max(longest, length)
9
10
+ return longest
0 commit comments