Java ยท DSA ยท LeetCode

LeetCode Problem Sets

191 Problems across 22 categories

Curated, interview-focused problems organised by topic. Each category maps to a core DSA concept. Pick a category, solve the problems in order, and cross-reference the concept page for theory.

Arrays, Strings & Hashing
11 problems
Arrays & Hashing โ†’
โ–ธ Preview problems
  • E#1 Two Sum
  • E#217 Contains Duplicate
  • E#242 Valid Anagram
  • M#49 Group Anagrams
  • M#238 Product of Array Except Self
  • M#347 Top K Frequent Elements
  • M#128 Longest Consecutive Sequence
  • M#36 Valid Sudoku
  • M#271 Encode and Decode Strings
  • M#3 Longest Substring Without Repeating Characters
  • M#189 Rotate Array
6 problems
HashMap โ†’
โ–ธ Preview problems
  • E#1 Two Sum
  • M#49 Group Anagrams
  • M#347 Top K Frequent Elements
  • M#560 Subarray Sum Equals K
  • M#128 Longest Consecutive Sequence
  • M#146 LRU Cache
6 problems
HashSet โ†’
โ–ธ Preview problems
  • E#217 Contains Duplicate
  • E#349 Intersection of Two Arrays
  • E#202 Happy Number
  • M#128 Longest Consecutive Sequence
  • M#127 Word Ladder
  • M#36 Valid Sudoku
9 problems
Two Pointers โ†’
โ–ธ Preview problems
  • E#125 Valid Palindrome
  • E#283 Move Zeroes
  • E#344 Reverse String
  • E#977 Squares of a Sorted Array
  • M#142 Linked List Cycle II
  • M#167 Two Sum II
  • M#11 Container With Most Water
  • M#15 3Sum
  • H#42 Trapping Rain Water
11 problems
Sliding Window โ†’
โ–ธ Preview problems
  • E#121 Best Time to Buy and Sell Stock
  • E#643 Maximum Average Subarray I
  • M#3 Longest Substring Without Repeating Characters
  • M#209 Minimum Size Subarray Sum
  • M#424 Longest Repeating Character Replacement
  • M#438 Find All Anagrams in a String
  • M#567 Permutation in String
  • M#904 Fruit Into Baskets
  • M#1004 Max Consecutive Ones III
  • H#76 Minimum Window Substring
  • H#239 Sliding Window Maximum
9 problems
Stack โ†’
โ–ธ Preview problems
  • E#20 Valid Parentheses
  • M#155 Min Stack
  • M#150 Evaluate Reverse Polish Notation
  • M#22 Generate Parentheses
  • M#394 Decode String
  • M#739 Daily Temperatures
  • M#853 Car Fleet
  • H#84 Largest Rectangle in Histogram
  • M#227 Basic Calculator II
11 problems
Binary Search โ†’
โ–ธ Preview problems
  • E#704 Binary Search
  • E#35 Search Insert Position
  • M#34 Find First and Last Position
  • M#33 Search in Rotated Sorted Array
  • M#153 Find Minimum in Rotated Sorted Array
  • M#162 Find Peak Element
  • M#74 Search a 2D Matrix
  • M#875 Koko Eating Bananas
  • M#1011 Capacity To Ship Packages Within D Days
  • M#981 Time Based Key-Value Store
  • H#4 Median of Two Sorted Arrays
Data Structures
10 problems
Linked List โ†’
โ–ธ Preview problems
  • E#206 Reverse Linked List
  • E#21 Merge Two Sorted Lists
  • E#141 Linked List Cycle
  • M#142 Linked List Cycle II
  • M#143 Reorder List
  • M#19 Remove Nth Node From End of List
  • M#2 Add Two Numbers
  • M#138 Copy List with Random Pointer
  • M#287 Find the Duplicate Number
  • H#23 Merge k Sorted Lists
6 problems
Queue โ†’
โ–ธ Preview problems
  • M#102 Binary Tree Level Order Traversal
  • M#200 Number of Islands
  • M#994 Rotting Oranges
  • M#622 Design Circular Queue
  • M#621 Task Scheduler
  • H#239 Sliding Window Maximum
13 problems
Trees โ†’
โ–ธ Preview problems
  • E#226 Invert Binary Tree
  • E#104 Maximum Depth of Binary Tree
  • E#101 Symmetric Tree
  • E#100 Same Tree
  • E#572 Subtree of Another Tree
  • E#94 Binary Tree Inorder Traversal
  • M#98 Validate Binary Search Tree
  • M#102 Binary Tree Level Order Traversal
  • M#105 Construct from Preorder and Inorder
  • M#236 Lowest Common Ancestor
  • M#230 Kth Smallest Element in a BST
  • M#235 Lowest Common Ancestor of a BST
  • H#124 Binary Tree Maximum Path Sum
6 problems
BST โ†’
โ–ธ Preview problems
  • M#98 Validate Binary Search Tree
  • E#700 Search in a Binary Search Tree
  • M#701 Insert into a Binary Search Tree
  • M#450 Delete Node in a BST
  • M#230 Kth Smallest Element in a BST
  • M#235 Lowest Common Ancestor of a BST
10 problems
Heap / Priority Queue โ†’
โ–ธ Preview problems
  • E#703 Kth Largest Element in a Stream
  • E#1046 Last Stone Weight
  • M#215 Kth Largest Element in an Array
  • M#347 Top K Frequent Elements
  • M#973 K Closest Points to Origin
  • M#355 Design Twitter
  • M#621 Task Scheduler
  • M#743 Network Delay Time
  • H#23 Merge k Sorted Lists
  • H#295 Find Median from Data Stream
6 problems
Trie โ†’
โ–ธ Preview problems
  • M#208 Implement Trie (Prefix Tree)
  • M#211 Design Add and Search Words
  • H#212 Word Search II
  • M#421 Maximum XOR of Two Numbers
  • M#648 Replace Words
  • H#642 Design Search Autocomplete System
12 problems
Graphs โ†’
โ–ธ Preview problems
  • M#200 Number of Islands
  • M#994 Rotting Oranges
  • M#542 01 Matrix
  • M#133 Clone Graph
  • M#695 Max Area of Island
  • M#417 Pacific Atlantic Water Flow
  • M#207 Course Schedule
  • M#210 Course Schedule II
  • M#323 Number of Connected Components
  • M#684 Redundant Connection
  • M#743 Network Delay Time
  • H#127 Word Ladder
6 problems
BFS โ†’
โ–ธ Preview problems
  • M#200 Number of Islands
  • M#994 Rotting Oranges
  • M#542 01 Matrix
  • M#1091 Shortest Path in Binary Matrix
  • H#127 Word Ladder
  • H#773 Sliding Puzzle
6 problems
DFS โ†’
โ–ธ Preview problems
  • M#200 Number of Islands
  • M#207 Course Schedule
  • M#210 Course Schedule II
  • M#133 Clone Graph
  • M#417 Pacific Atlantic Water Flow
  • M#797 All Paths From Source to Target
Algorithms
9 problems
Backtracking โ†’
โ–ธ Preview problems
  • M#78 Subsets
  • M#90 Subsets II
  • M#39 Combination Sum
  • M#40 Combination Sum II
  • M#46 Permutations
  • M#17 Letter Combinations of a Phone Number
  • M#79 Word Search
  • M#131 Palindrome Partitioning
  • H#51 N-Queens
9 problems
Greedy โ†’
โ–ธ Preview problems
  • M#55 Jump Game
  • M#45 Jump Game II
  • M#53 Maximum Subarray
  • M#134 Gas Station
  • H#135 Candy
  • M#678 Valid Parenthesis String
  • M#763 Partition Labels
  • M#846 Hand of Straights
  • M#1899 Merge Triplets to Form Target
8 problems
Intervals โ†’
โ–ธ Preview problems
  • M#56 Merge Intervals
  • M#57 Insert Interval
  • M#435 Non-overlapping Intervals
  • E#252 Meeting Rooms
  • M#253 Meeting Rooms II
  • M#986 Interval List Intersections
  • M#1288 Remove Covered Intervals
  • H#2402 Meeting Rooms III
9 problems
DP โ€” 1D โ†’
โ–ธ Preview problems
  • E#70 Climbing Stairs
  • M#198 House Robber
  • M#213 House Robber II
  • M#91 Decode Ways
  • M#322 Coin Change
  • M#152 Maximum Product Subarray
  • M#139 Word Break
  • M#300 Longest Increasing Subsequence
  • M#647 Palindromic Substrings
9 problems
DP โ€” 2D / Advanced โ†’
โ–ธ Preview problems
  • M#62 Unique Paths
  • M#5 Longest Palindromic Substring
  • M#1143 Longest Common Subsequence
  • M#494 Target Sum
  • M#518 Coin Change II
  • M#309 Best Time to Buy and Sell Stock with Cooldown
  • M#97 Interleaving String
  • H#72 Edit Distance
  • H#10 Regular Expression Matching
9 problems
Math & Bit Manipulation โ†’
โ–ธ Preview problems
  • E#136 Single Number
  • E#191 Number of 1 Bits
  • E#190 Reverse Bits
  • E#268 Missing Number
  • E#338 Counting Bits
  • M#7 Reverse Integer
  • M#48 Rotate Image
  • M#73 Set Matrix Zeroes
  • M#371 Sum of Two Integers
How to use this:
  1. Start: Arrays & Hashing โ†’ branch into HashMap and HashSet
  2. Core techniques: Two Pointers โ†’ Sliding Window โ†’ Stack โ†’ Binary Search
  3. Data structures: Linked List โ†’ Queue โ†’ Trees โ†’ BST โ†’ Heap โ†’ Trie
  4. Graphs: Graphs (umbrella) โ†’ split into BFS and DFS
  5. Algorithms: Backtracking โ†’ Greedy โ†’ Intervals โ†’ DP โ†’ Math

Each problem links back to the concept page for theory.