add the solution of longest consecutive sequence problem in leetcode and refactor code