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):