Repository files navigation
https://leetcode.com/
Prefix sum
Use case: Query sum of elements in a subarray
303, 525, 560
Two pointers
Use case: palindrom
11, 15, 167
Sliding Window
Use case: subarray, substring
3, 76, 643
Fast and Slow Pointers
Use case: if a linked list contains cycle?, middle of the linked list
141, 202, 287
Linked list in-place reversal
Use case: Reverse a linked list, rearrange the list
Use three points (prev, curr, next)
24, 92, 206
Monotonic Stack
Use case: Next greater/next smaller item in the array
84, 496, 739
Top k elements
Use case: K largest/smallest/most frequent
Using min/max heap
215, 347, 373
Overlapping Intervals
Use case: merging interval, interval intersection, insert interval, find minimum meeting rooms
56, 57, 435
Modified Binary Search
Binary Tree Traversal
DFS
BFS
Matrix Traversal
Backtracking
DP
70, 300, 312, 322, 416, 1143
Also referenced Sahil Gaba's linkedin post as follows:
BFS and DFS:
Dynamic Programming:
Backtracking:
Sliding Window:
Top k Elements:
You can’t perform that action at this time.