Implemented the solution to find the length of the longest consecutive sequence