Leetcode medium question, solvable within 30 minutes or so.
Given an unsorted integer array nums, return the length of the longest sequence of consecutive integers. The sequence values must increase by exactly one, and the elements do not need to be adjacent in the input. Implement longest_consecutive(nums) and return an integer.
def longest_consecutive(nums):