Pattern Recognition Drill
Easy Linked Lists
The Problem
Delete the node at position k (0-indexed) in a linked list.
What approach would you use?
Think about it before scrolling down.
Walk to node k-1, set prev.next = prev.next.next. O(k) time.
Common Trap
Forgetting to handle deletion of the head node (k=0) or going past the end.