Keyword to Algorithm
"Top k"
- Heap: K closest points
"How many ways.."
- DFS: Decode ways
- DP: Robot paths
"Substring"
- Sliding window: Longest substring without repeating characters
"Palindrome"
- two pointers: Valid Palindrome
- DFS: Palindrome Partitioning
- DP: Palindrome Partitioning II
"Tree"
- shortest, level-order
- else: DFS: Max Depth
"Parentheses"
- Stack: Valid Parentheses
"Subarray"
- Sliding window: Maximum subarray sum
- Prefix sum: Subarray sum
- Hashmap: Continuous subarray sum
Max subarray
- Greedy: Kadane's Algorithm
"X Sum"
- Two pointer: Two sum
"Max/longest sequence"
- Dynamic programming, DFS: Longest increasing subsequence
- mono deque: Sliding window maximum
"Minimum/Shortest"
- Dynamic programming, DFS: Minimal path sum
- BFS: Shortest path
"Partition/split ... array/string"
- DFS: Decode ways
"Subsequence"
- Dynamic programming, DFS: Longest increasing subsequence
- Sliding window: Longest increasing subsequence
"Matrix"
- BFS, DFS: Flood fill, Islands
- Dynamic programming: Maximal square
"Jump"
- Greedy/DP: Jump game
"Game"
- Dynamic programming: Divisor game, Stone game