Your question is Longest Consecutive Sequence Length. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
At Stripe, event IDs may arrive out of order. Given an unsorted array of integers nums, return the length of the longest sequence of consecutive integers.
A consecutive sequence contains values that differ by 1, and the elements do not need to appear next to each other in the input array.
nums, a list of integersnums0.def longest_consecutive(nums):