Hash Table
141. Linked List Cycle
Detect whether a singly-linked list loops back on itself. The obvious answer — a hash set of visited nodes — is O(n) memory, and the point of this problem is to do better. Floyd's tortoise-and-hare…
Loading…
Detect whether a singly-linked list loops back on itself. The obvious answer — a hash set of visited nodes — is O(n) memory, and the point of this problem is to do better. Floyd's tortoise-and-hare…
Loading…