correct and optimize one

longest consecutive sequence