Problem Family Derivation¶
Base template problems and their derived variants. Learn the base pattern first, then apply to variants with small modifications.
SubstringSlidingWindow¶
π― Base Template: LeetCode 3 - Longest Substring Without Repeating Characters¶
Canonical sliding window template with last-seen index array. Uses jump optimization instead of while-loop contraction. This is the BASE TEMPLATE for all SubstringSlidingWindow problems.
Derived Problems¶
- π΄ LeetCode 76 - Minimum Window Substring β
O(|s| + |t|) time, O(|t|) space - LeetCode 0159 (metadata not yet added)
- π‘ LeetCode 209 - Minimum Size Subarray Sum β
O(n) time, O(1) space - π‘ LeetCode 340 - Longest Substring with At Most K Distinct Characters β
O(n) time, O(K) space - π‘ LeetCode 438 - Find All Anagrams in a String β
O(|s| + |p|) time, O(1) space for maps, O(k) for output - π‘ LeetCode 567 - Permutation in String β
O(|s1| + |s2|) time, O(1) space