solution to Linked List Cycle