Skip to content

Latest commit

 

History

History
104 lines (65 loc) · 3.58 KB

File metadata and controls

104 lines (65 loc) · 3.58 KB

✅ Arrays / Two Pointers / Hashing

Use sorting + two pointers to find triplets that sum to zero.

Two pointers from both ends, greedily track max area.

Use a HashSet to check sequence starts efficiently.


🔤 Strings / Sliding Window / Hashing

Sliding window + HashSet/Map.

Sliding window + two pointers + character frequency count.


📚 Stack

Stack to match open/close brackets.

Monotonic stack pattern.


🔗 Linked List

Iterative or recursive reversal.

Floyd’s Tortoise and Hare.

Merge like merge sort.


🌲 Trees / Binary Trees / BST

BFS using queue.

Post-order DFS to compute depths.

Leverage BST properties in recursion.


🧩 Backtracking

Classic power set generation.

Backtracking with choices and pruning.

DFS with backtracking on grid.


🌐 Graphs / BFS / DFS / Union-Find

DFS or BFS flood-fill.

DFS with hashmap for visited nodes.

Topological sort via DFS or Kahn’s algo.

Union-Find to detect cycle.


🔁 Dynamic Programming

Classic DP or Fibonacci optimization.

DP over choices: rob or skip.

Expand around center or DP table.

Unbounded knapsack DP.

Subset sum DP (1D array can optimize).