Explains fast and slow pointers for cycle detection, midpoint finding, and fixed-gap linked-list problems.
Feb 18, 2020 · 1579 words
Explains fast and slow pointers for cycle detection, midpoint finding, and fixed-gap linked-list problems.
Use LeetCode 11 to derive the two-pointer solution and its correctness by reasoning about the search space.
Uses Two Sum and sorted-matrix search to explain how two pointers systematically shrink a search space.
Connects binary-tree traversal with backtracking through path tracking, undoing choices, and search trees.
Uses Path Sum to explain how to define binary-tree subproblems, recursive functions, and base cases.
Introduces a two-pointer linked-list traversal framework and applies it to safely reverse a singly linked list.