Deque patterns for window extrema, dynamic programming, and prefix candidates.