Tell me about how you would approach a coding problem using DSA.
Use that approach to implement a function that returns the length of the longest consecutive integer sequence in an unsorted array. Explain the data structure choice, complexity, edge cases, and testing strategy.
Input: an integer array nums. Output: one integer. The function must run in expected O(n) time.
def longest_consecutive(nums):