Skip to main content

All Problems

Prefix Sum

  1. Range Sum Query - Immutable
  2. Contiguous Array
  3. Subarray Sum Equals K

Two Pointers

  1. Two Sum II - Input Array is Sorted
  2. 3 Sum
  3. Container with most water

Sliding Window

  1. Maximum Average Subarray I
  2. Longest Substring without Repeating Characters
  3. Minimum Window Substring

Fast and Slow Pointers

  1. Linked List Cycle
  2. Happy Number
  3. Find the Duplicate Number

Linked List in-place reversal

  1. Reverse Linked List
  2. Reverse Linked List II
  3. Swap Nodes in Pairs

Monotonic Stack

  1. Next Greater Element I
  2. Daily Temperatures
  3. Largest Rectangle in Histogram

Top K. Elements OR min/max Heap

  1. Kth Largest element in an array
  2. Top K Frequent Elements
  3. Find K Pairs with Smallest Sums

Overlapping Intervals

  1. Merge Intervals
  2. Insert Interval
  3. Non-overlapping intervals

Modified Binary Search

  1. Search in Rotated Sorted Array
  2. Find Minimum in Rotated Sorted Array
  3. Search a 2D Matrix II

Binary Tree Traversal

  1. Binary Tree Paths
  2. Kth Smallest Element in a BST
  3. Binary Tree Maximum Path Sum
  4. Binary Tree Level Order Traversal II
  1. Clone Graph
  2. Path Sum II
  3. Course Schedule II
  1. Binary Tree Level Order Traversal
  2. Rotting Oranges
  3. Word Ladder

Matrix Traversal

  1. Flood Fill
  2. Number of Islands
  3. Surrounded Regions

Backtracking

  1. Permutations
  2. Subsets
  3. N-Queens

Dynamic Programming

  1. Climbing Stairs
  2. Coin Change
  3. Longest Increasing Subsequence
  4. Partition Equal Subset Sum
  5. Burst Balloons
  6. Longest Common Subsequence