Platform
Resources
Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.
nums
You must write an algorithm that runs in O(n).
O(n)
Example
nums = [100, 4, 200, 1, 3, 2] => 4 // [1, 2, 3, 4]
function LongestConsecutive(nums: int[]) -> int
Found a bug? Or annoyed about something in the language? Tell us.