Refactor Longest Consecutive Sequence