arrays

  • 169. Majority Element
  • 238. Product of Array Except Self
  • 41. First Missing Positive

strings

  • 392. Is Subsequence
  • 151. Reverse Words in a String

bit manipulation

  • 338. Counting Bits
  • 260. Single Number III

hash tables

  • 49. Group Anagrams
  • 128. Longest Consecutive Sequence

two pointers

  • 11. Container With Most Water
  • 15. 3Sum
  • 01. 2Sum
  • 169. Two Sum II
  • 16. 3Sum Smaller
  • 259. 3Sum Closest
  • 42. Trapping Rain Water

prefix sum

  • 325. Subarray Sum Equals K

sliding window - fixed size

  • 438. Find All Anagrams in a String
  • 567. Permutation in String

sliding window - dynamic size

  • 3. Longest Substring Without Repeating Characters
  • 76. Minimum Window Substring

kadane’s algorithm

  • 53. Maximum Subarray

matrix (2d array)

  • 54. Spiral Matrix
  • 48. Rotate Image

linked list

  • 19. Remove Nth Node From End of List
  • 24. Swap Nodes in Pairs
  • 2. Add Two Numbers

linked list (in place reversal)

  • 25. Reverse Nodes in k-Group

fast and slow pointers

  • 142. Linked List Cycle II

stacks

  • 20. Valid Parentheses
  • 155. Min Stack

monotonic stack

  • 84. Largest Rectangle in Histogram

monotonic queue

  • 239. Sliding Window Maximum

quicksort / quickselect

  • 75. Sort Colors
  • 34. Find First and Last Position of Element in Sorted Array
  • 33. Search in Rotated Sorted Array
  • 4. Median of Two Sorted Arrays

backtracking

  • 46. Permutations
  • 78. Subsets

tree traversal (level-order)

  • 102. Binary Tree Level Order Traversal
  • 199. Binary Tree Right Side View

tree traversal (pre-order)

  • 144. Binary Tree Preorder Traversal
  • 437. Path Sum III
  • 297. Serialize and Deserialize Binary Tree

tree traversal (in-order)

  • 94. Binary Tree Inorder Traversal
  • 98. Validate Binary Search Tree
  • 230. Kth Smallest Element in a BST

tree traversal (post-order)

  • 145. Binary Tree Postorder Traversal
  • 236. Lowest Common Ancestor of a Binary Tree
  • 124. Binary Tree Maximum Path Sum

BST / ordered set

  • 729. My Calendar I

tries

  • 1804. Implement Trie (Prefix Tree)
  • 212. Word Search II

two heaps

  • 295. Find Median from Data Stream

top k elements

  • 347. Top K Frequent Elements

intervals

  • 56. Merge Intervals
  • 435. Non-overlapping Intervals

k-way merge

  • 23. Merge k Sorted Lists

data structure design

  • 146. LRU Cache

greedy

  • 45. Jump Game II

depth first search (dfs)

  • 200. Number of Islands
  • 133. Clone Graph
  • 785. Is Graph Bipartite?

breadth first search (bfs)

  • 994. Rotting Oranges
  • 127. Word Ladder

topological sort

  • 210. Course Schedule II

union find

  • 547. Number of Provinces

minimum spanning tree (mst)

  • 1584. Min Cost to Connect All Points

shortest path

  • 787. Cheapest Flights Within K Stops

1-d dynamic programming (dp)

  • 213. House Robber II

knapsack dynamic programming (dp)

  • 416. Partition Equal Subset Sum

unbounded knapsack dp

  • 322. Coin Change

longest increasing subsequence (dp)

  • 300. Longest Increasing Subsequence

2d (grid) DP

  • 64. Minimum Path Sum
  • 329. Longest Increasing Path in a Matrix

string dp

  • 1143. Longest Common Subsequence
  • 139. Word Break

maths / geometry

  • 7. Reverse Integer
  • 149. Max Points on a Line