NumPy allowed · plain Python earns 10 bonus points
Implement the O(n) hash-set solution to Longest Consecutive Sequence -- the classic case where sorting FEELS natural but is actually the wrong complexity, and a hash set achieves true O(n).
Implement longest_consecutive(nums): put every number in a set; for each number that is the START of a run (i.e. number-1 is NOT in the set), count forward (number+1, number+2, ...) to find that run's length, and track the best.
longest_consecutive(nums: list[int]) -> int