Algorithmic Patterns
Sliding Window, Two Pointers, Heap, Binary Search, Trie, Union-Find, time complexity
Technical Reference & Key Concepts
**Sliding Window** Array/string problems involving a contiguous subarray. Maintain window `[left, right]`, adjust bounds. O(N) time, O(1) space. **Two Pointers** Sorted arrays or linked lists. Start pointers at ends and move inward, or fast/slow for cycle detection. O(N) time. **Top K Elements (Heap)** "Top K", "kth smallest/largest" -> Min-Heap or Max-Heap of size K. O(N log K) time. **Binary Search on Answer** When asked for "minimum X such that condition Y holds", binary search the answer space. O(log range x check cost). **Trie (Prefix Tree)** For autocomplete, spell check, IP routing. Each node represents a prefix. Search is O(L) where L is word length. **Union-Find (Disjoint Set)** For dynamic connectivity, graph components, Kruskal's MST. Path compression + union by rank gives near O(1) amortized.
Practice discussing these concepts out loud in live voice drills on GitGrilled.