Cirrus Logic Interview Question

Given an unsorted array of integers, write a function to return the length of the longest consecutive elements sequence. Your algorithm should run in on time.