Coding Trainer

Linked List Cycle

EasyFast & Slow PointersLC #141

Problem

Given the head of a linked list, determine if it has a cycle. Return true if there is a cycle, false otherwise. Solve in O(1) memory.

Example: [3,2,0,-4] with tail → node 1: true