feat(content): add new patterns
This commit is contained in:
@@ -127,3 +127,53 @@ patterns:
|
||||
- Longest common prefix
|
||||
- Word break problems
|
||||
- Spell checker
|
||||
|
||||
- name: Prefix Sum
|
||||
slug: prefix-sum
|
||||
description: Precompute cumulative sums to answer range queries in O(1) time.
|
||||
when_to_use: |
|
||||
- Range sum queries
|
||||
- Subarray sum equals target
|
||||
- Product of array except self
|
||||
- Count subarrays with given sum
|
||||
- 2D matrix region sums
|
||||
|
||||
- name: LinkedList In-Place Reversal
|
||||
slug: linkedlist-reversal
|
||||
description: Reverse linked list nodes in-place by manipulating pointers without extra space.
|
||||
when_to_use: |
|
||||
- Reverse entire linked list
|
||||
- Reverse a portion of linked list
|
||||
- Reverse in groups of K
|
||||
- Palindrome linked list check
|
||||
- Reorder list problems
|
||||
|
||||
- name: Overlapping Intervals
|
||||
slug: intervals
|
||||
description: Process and merge intervals that share common ranges.
|
||||
when_to_use: |
|
||||
- Merge overlapping intervals
|
||||
- Insert interval into sorted list
|
||||
- Meeting rooms scheduling
|
||||
- Find gaps between intervals
|
||||
- Interval intersection problems
|
||||
|
||||
- name: Binary Tree Traversal
|
||||
slug: tree-traversal
|
||||
description: Visit tree nodes in specific orders - preorder, inorder, postorder, or level-order.
|
||||
when_to_use: |
|
||||
- Serialize/deserialize trees
|
||||
- Validate BST (inorder)
|
||||
- Copy or compare trees
|
||||
- Path sum problems
|
||||
- Tree construction from traversals
|
||||
|
||||
- name: Matrix Traversal
|
||||
slug: matrix-traversal
|
||||
description: Navigate 2D grids using DFS, BFS, or directional iteration.
|
||||
when_to_use: |
|
||||
- Number of islands / connected regions
|
||||
- Shortest path in grid
|
||||
- Flood fill
|
||||
- Rotting oranges
|
||||
- Word search in grid
|
||||
|
||||
Reference in New Issue
Block a user