Skip to content

πŸ’» Detailed Explanations for LeetCode Solutions in Java. Updated Daily.

License

Notifications You must be signed in to change notification settings

cheehwatang/leetcode-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LeetCode Java Solutions


Β Β  Β Β 

Hi πŸ‘‹, I'm Chee Hwa and welcome to LeetCode Solutions in Java.


As I'm new to LeetCode and programming in general, I'm practicing everyday and hope to share my solutions and learnings with you.

  • Exclusively on Java
  • Beginner problems
  • Daily Challenge if within my ability


Latest Solutions


Date Problem Difficulty Solution Topics
September 14th 1775. Equal Sum Arrays With Minimum Number of Operations $\text{\color{Dandelion}Medium}$ Counting Array, Counting, Greedy
September 13th 1814. Count Nice Pairs in an Array $\text{\color{Dandelion}Medium}$ Counting & Hash Table Array, Counting, Hash Table, Math
September 12th 2006. Count Number of Pairs With Absolute Difference K $\text{\color{TealBlue}Easy}$ Hash Table Array, Hash Table
September 11th 2006. Count Number of Pairs With Absolute Difference K $\text{\color{TealBlue}Easy}$ Counting Array, Counting
September 10th 2006. Count Number of Pairs With Absolute Difference K $\text{\color{TealBlue}Easy}$ Brute Force Array


Topics

The problem sets and solutions are grouped into Topics as stated in LeetCode.


Array

# Problem Solution Difficulty Topics Note
1 Two Sum Java $\text{\color{TealBlue}Easy}$ Array, Hash Table
15 3Sum Java $\text{\color{Dandelion}Medium}$ Array, Sorting, Two Pointers
16 3Sum Closest Java $\text{\color{Dandelion}Medium}$ Array, Sorting, Two Pointers
26 Remove Duplicates from Sorted Array Java $\text{\color{TealBlue}Easy}$ Array, Two Pointers
27 Remove Element Java $\text{\color{TealBlue}Easy}$ Array, Two Pointers
36 Valid Sudoku Java without or with Hash Table $\text{\color{Dandelion}Medium}$ Array, Hash Table, Matrix
37 Sudoku Solver Java $\text{\color{Red}Hard}$ Array, Backtracking, Matrix
45 Jump Game II Dynamic Programming (Memoization), Dynamic Programming (Tabulation) or Greedy $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Greedy
46 Permutations Java with Backtracking, Iteration or Recursion $\text{\color{Dandelion}Medium}$ Array, Backtracking
49 Group Anagrams Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting, String
55 Jump Game Java with Dynamic Programming or Greedy $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Greedy
57 Insert Interval Java $\text{\color{Dandelion}Medium}$ Array
73 Set Matrix Zeroes Java with Array, Hash Table or In-Place $\text{\color{Dandelion}Medium}$ Array, Hash Table, Matrix
79 Word Search Java $\text{\color{Dandelion}Medium}$ Array, Backtracking, Matrix
80 Remove Duplicates from Sorted Array II Java $\text{\color{Dandelion}Medium}$ Array, Two Pointers
88 Merge Sorted Array Java with Sorting or Two Pointers $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers
121 Best Time to Buy and Sell Stock Java with or without Dynamic Programming $\text{\color{TealBlue}Easy}$ Array, Dynamic Programming
130 Surrounded Regions Java with Breadth-First Search, Depth-First Search or Union Find $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Depth-First Search, Matrix, Union Find
134 Gas Station Java $\text{\color{Dandelion}Medium}$ Array, Greedy
136 Single Number Java $\text{\color{TealBlue}Easy}$ Array, Bit Manipulation Stream Reduce
152 Maximum Product Subarray Java with Array or Dynamic Programming $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming
167 Two Sum II - Input Array is Sorted Java with Binary Search or Two Pointers $\text{\color{Dandelion}Medium}$ Array, Binary Search, Two Pointers
169 Majority Element Java with Boyer-Moore Majority Voting Algorithm, Counting & Divide and Conquer, Counting & Hash Table or Sorting $\text{\color{TealBlue}Easy}$ Array, Counting, Divide and Conquer, Hash Table, Sorting
200 Number of Islands Java with Breadth-First Search, Depth-First Search or Union Find $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Depth-First Search, Matrix, Union Find
217 Contains Duplicate Java with Hash Map, Hash Set or Sorting $\text{\color{TealBlue}Easy}$ Array, Hash Table, Sorting
219 Contains Duplicate II Java with Hash Map or Sliding Window $\text{\color{TealBlue}Easy}$ Array, Hash Table, Sliding Window
220 Contains Duplicate III Java with Sliding Window & Bucket Sort, Sliding Window & Ordered Set or Sorting $\text{\color{Red}Hard}$ Array, Bucket Sort, Ordered Set, Sliding Window, Sorting
228 Summary Ranges Java $\text{\color{TealBlue}Easy}$ Array
229 Majority Element II Java with Boyer-Moore Majority Voting Algorithm, Counting & Hash Table or Sorting $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Sorting
238 Product of Array Except Self Java $\text{\color{Dandelion}Medium}$ Array, Prefix Sum
274 H-Index Java with Counting Sort and Sorting $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Sorting
275 H-Index II Java $\text{\color{Dandelion}Medium}$ Array, Binary Search
283 Move Zeroes Java $\text{\color{TealBlue}Easy}$ Array, Two Pointers
334 Increasing Triplet Subsequence Java $\text{\color{Dandelion}Medium}$ Array, Greedy
368 Largest Divisible Subset Java $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Math, Sorting
393 UTF-8 Validation Java without or with Bit Manipulation $\text{\color{Dandelion}Medium}$ Array, Bit Manipulation
414 Third Maximum Number Java with Sorting, without Sorting or with Hash Table & Priority Queue $\text{\color{TealBlue}Easy}$ Array, Sorting
448 Find All Numbers Disappeared in an Array Java with or without Hash Table $\text{\color{TealBlue}Easy}$ Array, Hash Table
485 Maximum Consecutive Ones Java $\text{\color{TealBlue}Easy}$ Array
496 Next Greater Element I Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Monotonic Stack, Stack
503 Next Greater Element II Java $\text{\color{Dandelion}Medium}$ Array, Monotonic Stack, Stack
523 Continuous Subarray Sum Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Math, Prefix Sum
560 Subarray Sum Equals K Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Prefix Sum
561 Array Partition Java with Greedy & Counting Sort or Greedy & Sorting $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Greedy, Sorting
609 Find Duplicate File in System Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, String
645 Set Mismatch Java with Bit Manipulation, Hash Table or Sorting $\text{\color{TealBlue}Easy}$ Array, Bit Manipulation, Hash Table, Sorting
713 Subarray Product Less Than K Java $\text{\color{Dandelion}Medium}$ Array, Sliding Window
744 Find Smallest Letter Greater Than Target Java with Linear Search or Binary Search $\text{\color{TealBlue}Easy}$ Array, Binary Search
746 Min Cost Climbing Stairs Java with Dynamic Programming - Tabulation or Memoization $\text{\color{TealBlue}Easy}$ Array, Dynamic Programming
766 Toeplitz Matrix Java $\text{\color{TealBlue}Easy}$ Array, Matrix Follow up: One Row at a Time and One Column at a Time
812 Largest Triangle Area Java $\text{\color{TealBlue}Easy}$ Array, Geometry, Math
835 Image Overlap Java with Bit Manipulation or Hash Table $\text{\color{Dandelion}Medium}$ Array, Matrix
904 Fruit Into Baskets Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sliding Window
905 Sort Array By Parity Java $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers
922 Sort Array By Parity II Java $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers
923 3Sum With Multiplicity Java with Counting Hash Table or Sorting & Two Pointers $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Sorting, Two Pointers
929 Unique Email Addresses Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, String
941 Valid Mountain Array Java $\text{\color{TealBlue}Easy}$ Array
944 Delete Columns to Make Sorted Java $\text{\color{TealBlue}Easy}$ Array, String
948 Bag of Tokens Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Sorting, Two Pointers
953 Verifying an Alien Dictionary Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, String
974 Subarray Sums Divisible by K Java with Counting or Hash Table $\text{\color{Dandelion}Medium}$ Array, Hash Table, Prefix Sum
976 Largest Perimeter Triangle Java $\text{\color{TealBlue}Easy}$ Array, Greedy, Math, Sorting
977 Squares of a Sorted Array Java with Sorting or Two Pointers $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers
985 Sum of Even Numbers After Queries Java $\text{\color{Dandelion}Medium}$ Array, Simulation
989 Add to Array-Form of Integer Java $\text{\color{TealBlue}Easy}$ Array, Math
1019 Next Greater Node In Linked List Java $\text{\color{Dandelion}Medium}$ Array, Linked List, Monotonic Stack, Stack
1037 Valid Boomerang Java $\text{\color{TealBlue}Easy}$ Array, Geometry, Math
1051 Height Checker Java with Counting Sort or Sorting $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Sorting
1089 Duplicate Zeros Java without or with Two Pointers $\text{\color{TealBlue}Easy}$ Array, Two Pointers
1122 Relative Sort Array Java with Counting Sort or Hash Table $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Hash Table, Sorting
1207 Unique Number of Occurrences Java with Counting & Sorting or Hash Table $\text{\color{TealBlue}Easy}$ Array, Hash Table
1232 Check If It Is a Straight Line Java $\text{\color{TealBlue}Easy}$ Array, Geometry, Math
1239 Maximum Length of a Concatenated String with Unique Characters Java with Backtracking or Bit Manipulation $\text{\color{Dandelion}Medium}$ Array, Backtracking, Bit Manipulation, String
1295 Find Numbers with Even Number of Digits Java $\text{\color{TealBlue}Easy}$ Array
1299 Replace Elements with Greatest Element on Right Side Java $\text{\color{TealBlue}Easy}$ Array
1337 The K Weakest Rows in a Matrix Java with Linear Search, Binary Search, Heap (Priority Queue) & Binary Search or Sorting & Binary Search $\text{\color{TealBlue}Easy}$ Array, Binary Search, Heap (Priority Queue), Matrix, Sorting
1346 Check If N and Its Double Exist Java with Binary Search & Sorting, Hash Table or Two Pointers $\text{\color{TealBlue}Easy}$ Array, Binary Search, Hash Table, Sorting, Two Pointers
1351 Count Negative Numbers in a Sorted Matrix Java with Linear Search or Binary Search $\text{\color{TealBlue}Easy}$ Array, Binary Search, Matrix
1470 Shuffle the Array Java $\text{\color{TealBlue}Easy}$ Array
1480 Running Sum of 1D Array Java $\text{\color{TealBlue}Easy}$ Array, Prefix Sum
1497 Check If Array Pairs Are Divisible by k Java with Counting or Hash Table $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table
1534 Count Good Triplets Java $\text{\color{TealBlue}Easy}$ Array, Enumeration
1578 Minimum Time to Make Rope Colorful Java with Dynamic Programming or Greedy $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Greedy, String
1636 Sort Array by Increasing Frequency Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Sorting
1662 Check If Two String Arrays are Equivalent Java with or without Pointers $\text{\color{TealBlue}Easy}$ Array, String
1672 Richest Customer Wealth Java $\text{\color{TealBlue}Easy}$ Array, Matrix
1679 Max Number of K-Sum Pairs Java with Hash Table or Sorting & Two Pointers $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting, Two Pointers
1711 Count Good Meals Java $\text{\color{Dandelion}Medium}$ Array, Hash Table
1732 Find the Highest Altitude Java $\text{\color{TealBlue}Easy}$ Array, Prefix Sum
1775 Equal Sum Arrays With Minimum Number of Operations Java $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy
1814 Count Nice Pairs in an Array Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Math
1833 Maximum Ice Cream Bars Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Sorting
1834 Single-Threaded CPU Java $\text{\color{Dandelion}Medium}$ Array, Heap (Priority Queue), Sorting
1865 Finding Pairs With a Certain Sum Java $\text{\color{Dandelion}Medium}$ Array, Design, Hash Table
1920 Build Array from Permutation Java $\text{\color{TealBlue}Easy}$ Array, Simulation
1926 Nearest Exit from Entrance in Maze Java $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Matrix
1962 Remove Stones to Minimize the Total Java $\text{\color{Dandelion}Medium}$ Array, Heap (Priority Queue)
1979 Find Greatest Common Divisor of Array Java $\text{\color{TealBlue}Easy}$ Array, Math, Number Theory
1995 Count Special Quadruplets Java $\text{\color{TealBlue}Easy}$ Array, Enumeration Solution Using Hash Table
2006 Count Number of Pairs With Absolute Difference K Java with Brute Force, Counting or Hash Table $\text{\color{TealBlue}Easy}$ Array, Counting, Hash Table
2007 Find Original Array From Doubled Array Java with Hash Table, Queue or Counting Array $\text{\color{Dandelion}Medium}$ Array, Greedy, Hash Table, Sorting
2023 Number of Pairs of Strings With Concatenation Equal to Target Java $\text{\color{Dandelion}Medium}$ Array, String
2028 Find Missing Observations Java $\text{\color{Dandelion}Medium}$ Array, Math, Simulation
2131 Longest Palindrome by Concatenating Two Letter Words Java with Counting or Hash Table $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy, Hash Table, String
2133 Check if Every Row and Column Contains All Numbers Java without or with Hash Table $\text{\color{TealBlue}Easy}$ Array, Hash Table, Matrix
2136 Earliest Possible Day of Full Bloom Java $\text{\color{Red}Hard}$ Array, Greedy, Sorting
2176 Count Equal and Divisible Pairs in an Array Java $\text{\color{TealBlue}Easy}$ Array
2244 Minimum Rounds to Complete All Tasks Java $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy, Hash Table
2279 Maximum Bags With Full Capacity of Rocks Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Sorting
2352 Equal Row and Column Pairs Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Matrix, Simulation
2389 Longest Subsequence With Limited Sum Java $\text{\color{TealBlue}Easy}$ Array, Binary Search, Greedy, Prefix Sum, Sorting
2395 Find Subarrays With Equal Sum Java $\text{\color{TealBlue}Easy}$ Array, Hash Table
2399 Check Distances Between Same Letters Java without or with Hash Table $\text{\color{TealBlue}Easy}$ Array, Hash Table, String
2438 Range Product Queries of Powers Java $\text{\color{Dandelion}Medium}$ Array, Bit Manipulation, Prefix Sum
2452 Words Within Two Edits of Dictionary Java $\text{\color{Dandelion}Medium}$ Array, String
2453 Destroy Sequential Targets Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table
2454 Next Greater Element IV Java $\text{\color{Red}Hard}$ Array, Monotonic Stack, Stack

⬆️Back To Top


Backtracking

# Problem Solution Difficulty Topics Note
37 Sudoku Solver Java $\text{\color{Red}Hard}$ Array, Backtracking, Matrix
46 Permutations Java $\text{\color{Dandelion}Medium}$ Array, Backtracking Solution Using Iteration or Recursion
79 Word Search Java $\text{\color{Dandelion}Medium}$ Array, Backtracking, Matrix
113 Path Sum II Java with Backtracking and Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Backtracking, Binary Tree, Depth-First Search, Tree
257 Binary Tree Paths Java with Backtracking and Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Backtracking, Binary Tree, Depth-First Search, String, Tree
797 All Paths From Source to Target Java $\text{\color{Dandelion}Medium}$ Backtracking, Breadth-First Search, Depth-First Search, Graph Solution Using Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive)
967 Numbers With Same Consecutive Differences Java $\text{\color{Dandelion}Medium}$ Backtracking, Breadth-First Search Solution Using Breadth-First Search
1239 Maximum Length of a Concatenated String with Unique Characters Java $\text{\color{Dandelion}Medium}$ Array, Backtracking, Bit Manipulation, String Solution Using Bit Manipulation

⬆️Back To Top


# Problem Solution Difficulty Topics Note
102 Binary Tree Level Order Traversal Java $\text{\color{Dandelion}Medium}$ Binary Search, Breadth-First Search, Tree
103 Binary Tree Zigzag Level Order Traversal Java $\text{\color{Dandelion}Medium}$ Binary Search, Breadth-First Search, Tree
107 Binary Tree Level Order Traversal II Java $\text{\color{Dandelion}Medium}$ Binary Search, Breadth-First Search, Tree
144 Binary Tree Preorder Traversal Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search, Depth-First Search, Stack, Tree
145 Binary Tree Postorder Traversal Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search, Depth-First Search, Stack, Tree
167 Two Sum II - Input Array is Sorted Java $\text{\color{Dandelion}Medium}$ Array, Binary Search, Two Pointers Solution Using Two Pointers
222 Count Complete Tree Nodes Java $\text{\color{Dandelion}Medium}$ Binary Search, Binary Tree, Depth-First Search, Tree
275 H-Index II Java $\text{\color{Dandelion}Medium}$ Array, Binary Search
374 Guess Number Higher or Lower Java $\text{\color{TealBlue}Easy}$ Binary Search, Interactive
744 Find Smallest Letter Greater Than Target Java $\text{\color{TealBlue}Easy}$ Array, Binary Search Solution Using Linear Search
1337 The K Weakest Rows in a Matrix Java with Binary Search, Heap (Priority Queue) & Binary Search or Sorting & Binary Search $\text{\color{TealBlue}Easy}$ Array, Binary Search, Heap (Priority Queue), Matrix, Sorting Solution Using Linear Search
1346 Check If N and Its Double Exist Java with Binary Search & Sorting $\text{\color{TealBlue}Easy}$ Array, Binary Search, Hash Table, Sorting, Two Pointers Solution Using Hash Table or Two Pointers
1351 Count Negative Numbers in a Sorted Matrix Java $\text{\color{TealBlue}Easy}$ Array, Binary Search, Matrix Solution Using Linear Search
2389 Longest Subsequence With Limited Sum Java $\text{\color{TealBlue}Easy}$ Array, Binary Search, Greedy, Prefix Sum, Sorting

⬆️Back To Top


Binary Search Tree

# Problem Solution Difficulty Topics Note
98 Validate Binary Search Tree Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Search Tree, Binary Tree, Depth-First Search, Tree
653 Two Sum IV - Input is a BST Java with Breadth-First Search (with Hash Table), Breadth-First Search (without Hash Table), Depth-First Search (Iterative), Depth-First Search (Recursive), Two Pointers (with Iterative Inorder Traversal) or Two Pointers (with Recursive Inorder Traversal) $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Hash Table, Tree, Two Pointers
783 Minimum Distance Between BST Nodes Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Tree

⬆️Back To Top


Binary Tree

# Problem Solution Difficulty Topics Note
94 Binary Tree Inorder Traversal Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Depth-First Search, Stack, Tree
98 Validate Binary Search Tree Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Search Tree, Binary Tree, Depth-First Search, Tree
100 Same Tree Java with Breadth-First Search or Depth-First Search $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
104 Maximum Depth of Binary Tree Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
110 Balanced Binary Tree Java $\text{\color{TealBlue}Easy}$ Binary Tree, Depth-First Search, Tree
111 Minimum Depth of Binary Tree Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
112 Path Sum Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
113 Path Sum II Java with Backtracking and Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Backtracking, Binary Tree, Depth-First Search, Tree
114 Flatten Binary Tree to Linked List Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Linked List, Stack, Tree
129 Sum Root to Leaf Numbers Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Tree
222 Count Complete Tree Nodes Java $\text{\color{Dandelion}Medium}$ Binary Search, Binary Tree, Depth-First Search, Tree
226 Invert Binary Tree Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
257 Binary Tree Paths Java with Backtracking and Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Backtracking, Binary Tree, Depth-First Search, String, Tree
404 Sum of Left Leaves Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
437 Path Sum III Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Tree
653 Two Sum IV - Input is a BST Java with Breadth-First Search (with Hash Table), Breadth-First Search (without Hash Table), Depth-First Search (Iterative), Depth-First Search (Recursive), Two Pointers (with Iterative Inorder Traversal) or Two Pointers (with Recursive Inorder Traversal) $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Hash Table, Tree, Two Pointers
783 Minimum Distance Between BST Nodes Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Tree
988 Smallest String Starting From Leaf Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, String, Tree
1026 Maximum Difference Between Node and Ancestor Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Tree
1457 Pseudo-Palindromic Paths in a Binary Tree Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Bit Manipulation, Breadth-First Search, Depth-First Search, Tree

⬆️Back To Top


Bit Manipulation

# Problem Solution Difficulty Topics Note
29 Divide Two Integers Java $\text{\color{Dandelion}Medium}$ Bit Manipulation, Math
136 Single Number Java $\text{\color{TealBlue}Easy}$ Array, Bit Manipulation Bonus Solution Using Stream Reduce
371 Sum of Two Integers Java $\text{\color{Dandelion}Medium}$ Bit Manipulation, Math
393 UTF-8 Validation Java $\text{\color{Dandelion}Medium}$ Array, Bit Manipulation Solution without using Bit Manipulation
645 Set Mismatch Java $\text{\color{TealBlue}Easy}$ Array, Bit Manipulation, Hash Table, Sorting Solution Using Hash Table or Sorting
1239 Maximum Length of a Concatenated String with Unique Characters Java $\text{\color{Dandelion}Medium}$ Array, Backtracking, Bit Manipulation, String Solution Using Backtracking
1318 Minimum Flips to Make a OR b Equal to c Java $\text{\color{Dandelion}Medium}$ Bit Manipulation
1342 Number of Steps to Reduce a Number to Zero Java $\text{\color{TealBlue}Easy}$ Bit Manipulation, Math Solution Using Math
1457 Pseudo-Palindromic Paths in a Binary Tree Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Bit Manipulation, Breadth-First Search, Depth-First Search, Tree
1486 XOR Operation in an Array Java $\text{\color{TealBlue}Easy}$ Bit Manipulation, Math
1680 Concatenation of Consecutive Binary Numbers Java $\text{\color{Dandelion}Medium}$ Bit Manipulation, Math, Simulation Solution Using Math
2220 Minimum Bit Flips to Convert Number Java $\text{\color{TealBlue}Easy}$ Bit Manipulation
2438 Range Product Queries of Powers Java $\text{\color{Dandelion}Medium}$ Array, Bit Manipulation, Prefix Sum

⬆️Back To Top


Brainteaser

# Problem Solution Difficulty Topics Note
1033 Moving Stones Until Consecutive Java $\text{\color{Dandelion}Medium}$ Brainteaser, Math

⬆️Back To Top


# Problem Solution Difficulty Topics Note
100 Same Tree Java $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Depth-First Search
102 Binary Tree Level Order Traversal Java $\text{\color{Dandelion}Medium}$ Binary Search, Breadth-First Search, Tree
103 Binary Tree Zigzag Level Order Traversal Java $\text{\color{Dandelion}Medium}$ Binary Search, Breadth-First Search, Tree
104 Maximum Depth of Binary Tree Java $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Depth-First Search (Iterative) or Depth-First Search (Recursive)
107 Binary Tree Level Order Traversal II Java $\text{\color{Dandelion}Medium}$ Binary Search, Breadth-First Search, Tree
111 Minimum Depth of Binary Tree Java $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Depth-First Search (Iterative) or Depth-First Search (Recursive)
112 Path Sum Java $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Depth-First Search (Iterative) or Depth-First Search (Recursive)
130 Surrounded Regions Java $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Depth-First Search, Matrix, Union Find Solution Using Depth-First Search or Union Find
200 Number of Islands Java $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Depth-First Search, Matrix, Union Find Solution Using Depth-First Search or Union Find
226 Invert Binary Tree Java $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Depth-First Search (Iterative) or Depth-First Search (Recursive)
404 Sum of Left Leaves Java $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Depth-First Search (Iterative) or Depth-First Search (Recursive)
429 N-ary Tree Level Order Traversal Java $\text{\color{Dandelion}Medium}$ Breadth-First Search, Tree
559 Maximum Depth of Binary Tree Java $\text{\color{TealBlue}Easy}$ Breadth-First Search, Depth-First Search, Tree Solution Using Depth-First Search (Iterative) or Depth-First Search (Recursive)
653 Two Sum IV - Input is a BST Java with or without Hash Table $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Hash Table, Tree, Two Pointers Solution Using Depth-First Search (Iterative), Depth-First Search (Recursive), Two Pointers (with Iterative Inorder Traversal) or Two Pointers (with Recursive Inorder Traversal)
783 Minimum Distance Between BST Nodes Java $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Depth-First Search (Iterative) or Depth-First Search (Recursive)
797 All Paths From Source to Target Java $\text{\color{Dandelion}Medium}$ Backtracking, Breadth-First Search, Depth-First Search, Graph Solution Using Depth-First Search (Backtracking), Depth-First Search (Iterative) or Depth-First Search (Recursive)
967 Numbers With Same Consecutive Differences Java $\text{\color{Dandelion}Medium}$ Backtracking, Breadth-First Search Solution Using Backtracking
1457 Pseudo-Palindromic Paths in a Binary Tree Java $\text{\color{Dandelion}Medium}$ Binary Tree, Bit Manipulation, Breadth-First Search, Depth-First Search, Tree Solution Using Depth-First Search (Iterative) or Depth-First Search (Recursive)
1926 Nearest Exit from Entrance in Maze Java $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Matrix
1971 Find if Path Exists in Graph Java $\text{\color{TealBlue}Easy}$ Breadth-First Search, Depth-First Search, Graph, Union Find Solution Using Depth-First Search (Iterative), Depth-First Search (Recursive) or Union Find

⬆️Back To Top


Bucket Sort

# Problem Solution Difficulty Topics Note
220 Contains Duplicate III Java with Sliding Window & Bucket Sort $\text{\color{Red}Hard}$ Array, Bucket Sort, Ordered Set, Sliding Window, Sorting Solution Using Sliding Window & Ordered Set or Sorting

⬆️Back To Top


Counting

# Problem Solution Difficulty Topics Note
169 Majority Element Java with Counting & Divide and Conquer or Counting & Hash Table $\text{\color{TealBlue}Easy}$ Array, Counting, Divide and Conquer, Hash Table, Sorting Solution Using Boyer-Moore Majority Voting Algorithm or Sorting
229 Majority Element II Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Sorting Solution Using Boyer-Moore Majority Voting Algorithm or Sorting
383 Ransom Note Java $\text{\color{TealBlue}Easy}$ Counting, Hash Table, String Solution Using Hash Table
923 3Sum With Multiplicity Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Sorting, Two Pointers Solution Using Hash Table or Sorting & Two Pointers
1497 Check If Array Pairs Are Divisible by k Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table Solution Using Hash Table
1603 Design Parking System Java $\text{\color{TealBlue}Easy}$ Counting, Design, Simulation
1704 Determine if String Halves Are Alike Java $\text{\color{TealBlue}Easy}$ Counting, String
1775 Equal Sum Arrays With Minimum Number of Operations Java $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy
1814 Count Nice Pairs in an Array Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Math
2006 Count Number of Pairs With Absolute Difference K Java $\text{\color{TealBlue}Easy}$ Array, Counting, Hash Table Solution Using Brute Force Approach or Hash Table
2131 Longest Palindrome by Concatenating Two Letter Words Java $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy, Hash Table, String Solution Using Hash Table
2244 Minimum Rounds to Complete All Tasks Java $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy, Hash Table
2351 First Letter to Appear Twice Java $\text{\color{TealBlue}Easy}$ Counting, Hash Table, String Solution Using Hash Table
2453 Destroy Sequential Targets Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table

⬆️Back To Top


Counting Sort

# Problem Solution Difficulty Topics Note
274 H-Index Java $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Sorting Solution Using Sorting
561 Array Partition Java $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Greedy, Sorting Solution Using Greedy & Sorting
1051 Height Checker Java $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Sorting Solution Using Sorting
1122 Relative Sort Array Java $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Hash Table, Sorting Solution Using Hash Table

⬆️Back To Top


Data Stream

# Problem Solution Difficulty Topics Note
295 Find Median from Data Stream Java $\text{\color{Red}Hard}$ Data Stream, Design, Heap (Priority Queue), Sorting, Two Pointers

⬆️Back To Top


# Problem Solution Difficulty Topics Note
94 Binary Tree Inorder Traversal Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Depth-First Search, Stack, Tree
98 Validate Binary Search Tree Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Search Tree, Binary Tree, Depth-First Search, Tree
100 Same Tree Java $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Breadth-First Search
104 Maximum Depth of Binary Tree Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Breadth-First Search
110 Balanced Binary Tree Java $\text{\color{TealBlue}Easy}$ Binary Tree, Depth-First Search, Tree
111 Minimum Depth of Binary Tree Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Breadth-First Search
112 Path Sum Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Breadth-First Search
113 Path Sum II Java with Backtracking and Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Backtracking, Binary Tree, Depth-First Search, Tree
114 Flatten Binary Tree to Linked List Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Linked List, Stack, Tree
129 Sum Root to Leaf Numbers Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Tree
130 Surrounded Regions Java $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Depth-First Search, Matrix, Union Find Solution Using Breadth-First Search or Union Find
144 Binary Tree Preorder Traversal Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search, Depth-First Search, Stack, Tree
145 Binary Tree Postorder Traversal Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search, Depth-First Search, Stack, Tree
200 Number of Islands Java $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Depth-First Search, Matrix, Union Find Solution Using Breadth-First Search or Union Find
222 Count Complete Tree Nodes Java $\text{\color{Dandelion}Medium}$ Binary Search, Binary Tree, Depth-First Search, Tree
226 Invert Binary Tree Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Breadth-First Search
257 Binary Tree Paths Java with Backtracking and Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Backtracking, Binary Tree, Depth-First Search, String, Tree
404 Sum of Left Leaves Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Breadth-First Search
437 Path Sum III Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Tree
559 Maximum Depth of Binary Tree Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Breadth-First Search, Depth-First Search, Tree Solution Using Breadth-First Search
653 Two Sum IV - Input is a BST Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Hash Table, Tree, Two Pointers Solution Using Breadth-First Search (with Hash Table), Breadth-First Search (without Hash Table), Two Pointers (with Iterative Inorder Traversal) or Two Pointers (with Recursive Inorder Traversal)
783 Minimum Distance Between BST Nodes Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Tree Solution Using Breadth-First Search
797 All Paths From Source to Target Java with Depth-First Search (Backtracking), Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Backtracking, Breadth-First Search, Depth-First Search, Graph Solution Using Breadth-First Search
988 Smallest String Starting From Leaf Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, String, Tree
1026 Maximum Difference Between Node and Ancestor Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Tree
1457 Pseudo-Palindromic Paths in a Binary Tree Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Bit Manipulation, Breadth-First Search, Depth-First Search, Tree Solution Using Breadth-First Search
1971 Find if Path Exists in Graph Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Breadth-First Search, Depth-First Search, Graph, Union Find Solution Using Breadth-First Search or Union Find
2359 Find Closest Node to Given Two Nodes Java $\text{\color{Dandelion}Medium}$ Depth-First Search, Graph

⬆️Back To Top


Design

# Problem Solution Difficulty Topics Note
225 Implement Stack using Queues Java $\text{\color{TealBlue}Easy}$ Design, Queue, Stack
232 Implement Queue using Stacks Java $\text{\color{TealBlue}Easy}$ Design, Queue, Stack
295 Find Median from Data Stream Java $\text{\color{Red}Hard}$ Data Stream, Design, Heap (Priority Queue), Sorting, Two Pointers
707 Design Linked List Java with Singly Linked List or Doubly Linked List $\text{\color{Dandelion}Medium}$ Design, Linked List
1603 Design Parking System Java $\text{\color{TealBlue}Easy}$ Counting, Design, Simulation
1865 Finding Pairs With a Certain Sum Java $\text{\color{Dandelion}Medium}$ Array, Design, Hash Table

⬆️Back To Top


Divide and Conquer

# Problem Solution Difficulty Topics Note
169 Majority Element Java $\text{\color{TealBlue}Easy}$ Array, Counting, Divide and Conquer, Hash Table, Sorting Solution Using Boyer-Moore Majority Voting Algorithm, Counting & Hash Table or Sorting

⬆️Back To Top


Dynamic Programming

# Problem Solution Difficulty Topics Note
5 Longest Palindromic Substring Java $\text{\color{Dandelion}Medium}$ Dynamic Programming, String Solution Using Two Pointers with Approach 1 or Approach 2
45 Jump Game II Java with Dynamic Programming - Memoization or Tabulation $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Greedy Solution Using Greedy
55 Jump Game Java $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Greedy Solution Using Greedy
70 Climbing Stairs Java with Dynamic Programming - Tabulation or Memoization $\text{\color{TealBlue}Easy}$ Dynamic Programming, Math, Memoization
121 Best Time to Buy and Sell Stock Java $\text{\color{TealBlue}Easy}$ Array, Dynamic Programming Solution without Using Dynamic Programming
152 Maximum Product Subarray Java $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming Solution Using Array
264 Ugly Number II Java $\text{\color{Dandelion}Medium}$ Dynamic Programming, Hash Table, Heap (Priority Queue), Math Solution Using Heap (Priority Queue)
368 Largest Divisible Subset Java $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Math, Sorting
509 Fibonacci Number Java with Dynamic Programming - Tabulation or Memoization $\text{\color{TealBlue}Easy}$ Dynamic Programming, Math, Memoization, Recursion
746 Min Cost Climbing Stairs Java with Dynamic Programming - Tabulation or Memoization $\text{\color{TealBlue}Easy}$ Array, Dynamic Programming
1137 N-th Tribonacci Number Java with Dynamic Programming Iteratively or Recursively (Memoization) $\text{\color{TealBlue}Easy}$ Dynamic Programming, Math, Memoization
1155 Number of Dice Rolls With Target Sum Java with Dynamic Programming using Memoization or Tabulation $\text{\color{Dandelion}Medium}$ Dynamic Programming
1578 Minimum Time to Make Rope Colorful Java $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Greedy, String Solution Using Greedy

⬆️Back To Top


Enumeration

# Problem Solution Difficulty Topics Note
1534 Count Good Triplets Java $\text{\color{TealBlue}Easy}$ Array, Enumeration
1995 Count Special Quadruplets Java $\text{\color{TealBlue}Easy}$ Array, Enumeration Solution Using Hash Table
2240 Number of Ways to Buy Pens and Pencils Java $\text{\color{Dandelion}Medium}$ Enumeration, Math
2437 Number of Valid Clock Times Java $\text{\color{TealBlue}Easy}$ Enumeration, String

⬆️Back To Top


Geometry

# Problem Solution Difficulty Topics Note
223 Rectangle Area Java $\text{\color{Dandelion}Medium}$ Geometry, Math
593 Valid Square Java $\text{\color{Dandelion}Medium}$ Geometry, Math
812 Largest Triangle Area Java $\text{\color{TealBlue}Easy}$ Array, Geometry, Math
836 Rectangle Overlap Java $\text{\color{TealBlue}Easy}$ Geometry, Math
1037 Valid Boomerang Java $\text{\color{TealBlue}Easy}$ Array, Geometry, Math
1232 Check If It Is a Straight Line Java $\text{\color{TealBlue}Easy}$ Array, Geometry, Math

⬆️Back To Top


Graph

# Problem Solution Difficulty Topics Note
797 All Paths From Source to Target Java with Breadth-First Search, Depth-First Search (Backtracking), Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Backtracking, Breadth-First Search, Depth-First Search, Graph
1971 Find if Path Exists in Graph Java with Breadth-First Search, Depth-First Search (Iterative), Depth-First Search (Recursive) or Union Find $\text{\color{TealBlue}Easy}$ Breadth-First Search, Depth-First Search, Graph, Union Find
2359 Find Closest Node to Given Two Nodes Java $\text{\color{Dandelion}Medium}$ Depth-First Search, Graph

⬆️Back To Top


Greedy

# Problem Solution Difficulty Topics Note
45 Jump Game II Java with Greedy $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Greedy Solution Using Dynamic Programming (Memoization) or Dynamic Programming (Tabulation)
55 Jump Game Java with Greedy $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Greedy Solution Using Dynamic Programming
134 Gas Station Java $\text{\color{Dandelion}Medium}$ Array, Greedy
334 Increasing Triplet Subsequence Java $\text{\color{Dandelion}Medium}$ Array, Greedy
561 Array Partition Java with Greedy & Counting Sort or Greedy & Sorting $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Greedy, Sorting
948 Bag of Tokens Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Sorting, Two Pointers
976 Largest Perimeter Triangle Java $\text{\color{TealBlue}Easy}$ Array, Greedy, Math, Sorting
1323 Maximum 69 Number Java with Math or String $\text{\color{TealBlue}Easy}$ Greedy, Math
1328 Break a Palindrome Java $\text{\color{Dandelion}Medium}$ Greedy, String
1578 Minimum Time to Make Rope Colorful Java $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Greedy, String Solution Using Dynamic Programming
1775 Equal Sum Arrays With Minimum Number of Operations Java $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy
1833 Maximum Ice Cream Bars Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Sorting
2007 Find Original Array From Doubled Array Java with Hash Table, Queue or Counting Array $\text{\color{Dandelion}Medium}$ Array, Greedy, Hash Table, Sorting
2131 Longest Palindrome by Concatenating Two Letter Words Java with Counting or Hash Table $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy, Hash Table, String
2136 Earliest Possible Day of Full Bloom Java $\text{\color{Red}Hard}$ Array, Greedy, Sorting
2244 Minimum Rounds to Complete All Tasks Java $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy, Hash Table
2279 Maximum Bags With Full Capacity of Rocks Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Sorting
2389 Longest Subsequence With Limited Sum Java $\text{\color{TealBlue}Easy}$ Array, Binary Search, Greedy, Prefix Sum, Sorting

⬆️Back To Top


Hash Table

# Problem Solution Difficulty Topics Note
1 Two Sum Java $\text{\color{TealBlue}Easy}$ Array, Hash Table
3 Longest Substring Without Repeating Characters Java $\text{\color{Dandelion}Medium}$ Hash Table, Sliding Window, String Solution without Using Hash Table
12 Integer to Roman Java $\text{\color{Dandelion}Medium}$ Hash Table, Math, String Solution without Hash Table
13 Roman to Integer Java $\text{\color{TealBlue}Easy}$ Hash Table, Math, String Solution without Hash Table
36 Valid Sudoku Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Matrix Solution without Hash Table
49 Group Anagrams Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting, String
73 Set Matrix Zeroes Java with Array, Hash Table or In-Place $\text{\color{Dandelion}Medium}$ Array, Hash Table, Matrix
169 Majority Element Java $\text{\color{TealBlue}Easy}$ Array, Counting, Divide and Conquer, Hash Table, Sorting Solution Using Boyer-Moore Majority Voting Algorithm, Counting & Divide and Conquer or Sorting
205 Isomorphic Strings Java $\text{\color{TealBlue}Easy}$ Hash Table, String
217 Contains Duplicate Java with Hash Map or Hash Set $\text{\color{TealBlue}Easy}$ Array, Hash Table, Sorting Solution Using Sorting
219 Contains Duplicate II Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Sliding Window Solution Using Sliding Window
229 Majority Element II Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Sorting Solution Using Boyer-Moore Majority Voting Algorithm or Sorting
264 Ugly Number II Java with Dynamic Programming or Heap (Priority Queue) $\text{\color{Dandelion}Medium}$ Dynamic Programming, Hash Table, Heap (Priority Queue), Math
290 Word Pattern Java $\text{\color{TealBlue}Easy}$ Hash Table, String
383 Ransom Note Java $\text{\color{TealBlue}Easy}$ Counting, Hash Table, String Solution Using Counting Array
438 Find All Anagrams in a String Java $\text{\color{Dandelion}Medium}$ Hash Table, Sliding Window, String
448 Find All Numbers Disappeared in an Array Java $\text{\color{TealBlue}Easy}$ Array, Hash Table Solution without Hash Table
496 Next Greater Element I Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Monotonic Stack, Stack
523 Continuous Subarray Sum Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Math, Prefix Sum
560 Subarray Sum Equals K Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Prefix Sum
567 Permutation in String Java $\text{\color{Dandelion}Medium}$ Hash Table, Sliding Window, String, Two Pointers
609 Find Duplicate File in System Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, String
645 Set Mismatch Java $\text{\color{TealBlue}Easy}$ Array, Bit Manipulation, Hash Table, Sorting Solution Using Bit Manipulation or Sorting
653 Two Sum IV - Input is a BST Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Hash Table, Tree, Two Pointers Solution Using Breadth-First Search (without Hash Table), Two Pointers (with Iterative Inorder Traversal) or Two Pointers (with Recursive Inorder Traversal)
904 Fruit Into Baskets Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sliding Window
923 3Sum With Multiplicity Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Sorting, Two Pointers Solution Using Counting or Sorting & Two Pointers
929 Unique Email Addresses Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, String
953 Verifying an Alien Dictionary Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, String
974 Subarray Sums Divisible by K Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Prefix Sum Solution Using Counting
1122 Relative Sort Array Java $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Hash Table, Sorting Solution Using Counting Sort
1207 Unique Number of Occurrences Java $\text{\color{TealBlue}Easy}$ Array, Hash Table Solution Using Counting & Sorting
1346 Check If N and Its Double Exist Java with Hash Table $\text{\color{TealBlue}Easy}$ Array, Binary Search, Hash Table, Sorting, Two Pointers Solution Using Binary Search & Sorting or Two Pointers
1497 Check If Array Pairs Are Divisible by k Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table Solution Using Counting
1636 Sort Array by Increasing Frequency Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Sorting
1657 Determine if Two Strings Are Close Java with Hash Table & Sorting $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting Solution Using only Sorting
1679 Max Number of K-Sum Pairs Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting, Two Pointers Solution Using Sorting & Two Pointers
1711 Count Good Meals Java $\text{\color{Dandelion}Medium}$ Array, Hash Table
1814 Count Nice Pairs in an Array Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Math
1832 Check if the Sentence is Pangram Java $\text{\color{TealBlue}Easy}$ Hash Table, String Solution Using Bit Manipulation , Counting and Without Hash Table
1865 Finding Pairs With a Certain Sum Java $\text{\color{Dandelion}Medium}$ Array, Design, Hash Table
1935 Maximum Number of Words You Can Type Java $\text{\color{TealBlue}Easy}$ Hash Table, String
2006 Count Number of Pairs With Absolute Difference K Java $\text{\color{TealBlue}Easy}$ Array, Counting, Hash Table Solution Using Brute Force, Counting
2007 Find Original Array From Doubled Array Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Hash Table, Sorting Solution Using Queue or Counting Array
2131 Longest Palindrome by Concatenating Two Letter Words Java $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy, Hash Table, String Solution Using Counting
2133 Check if Every Row and Column Contains All Numbers Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Matrix Solution Without Hash Table
2244 Minimum Rounds to Complete All Tasks Java $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy, Hash Table
2351 First Letter to Appear Twice Java $\text{\color{TealBlue}Easy}$ Counting, Hash Table, String Solution Using Counting
2352 Equal Row and Column Pairs Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Matrix, Simulation
2395 Find Subarrays With Equal Sum Java $\text{\color{TealBlue}Easy}$ Array, Hash Table
2399 Check Distances Between Same Letters Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, String Solution Without Hash Table
2451 Odd String Difference Java $\text{\color{TealBlue}Easy}$ Hash Table, Math, String Solution Without Hash Table
2453 Destroy Sequential Targets Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table

⬆️Back To Top


Heap (Priority Queue)

# Problem Solution Difficulty Topics Note
264 Ugly Number II Java $\text{\color{Dandelion}Medium}$ Dynamic Programming, Hash Table, Heap (Priority Queue), Math Solution Using Dynamic Programming
295 Find Median from Data Stream Java $\text{\color{Red}Hard}$ Data Stream, Design, Heap (Priority Queue), Sorting, Two Pointers
1337 The K Weakest Rows in a Matrix Java with Heap (Priority Queue) & Binary Search $\text{\color{TealBlue}Easy}$ Array, Binary Search, Heap (Priority Queue), Matrix, Sorting Solution Using Linear Search, Binary Search, Sorting & Binary Search
1834 Single-Threaded CPU Java $\text{\color{Dandelion}Medium}$ Array, Heap (Priority Queue), Sorting
1962 Remove Stones to Minimize the Total Java $\text{\color{Dandelion}Medium}$ Array, Heap (Priority Queue)

⬆️Back To Top


Interactive

# Problem Solution Difficulty Topics Note
374 Guess Number Higher or Lower Java $\text{\color{TealBlue}Easy}$ Binary Search, Interactive

⬆️Back To Top


Linked List

# Problem Solution Difficulty Topics Note
19 Remove Nth Node From End of List Java with One Pass or Two Passes $\text{\color{Dandelion}Medium}$ Linked List, Two Pointers
24 Swap Nodes in Pairs Java with Iteration or Recursion $\text{\color{Dandelion}Medium}$ Linked List, Recursion
92 Reverse Linked List II Java $\text{\color{Dandelion}Medium}$ Linked List
114 Flatten Binary Tree to Linked List Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Linked List, Stack, Tree
206 Reverse Linked List Java with Array List, Reverse Nodes Iteratively or Recursively $\text{\color{TealBlue}Easy}$ Linked List, Recursion
707 Design Linked List Java with Singly Linked List or Doubly Linked List $\text{\color{Dandelion}Medium}$ Design, Linked List
876 Middle of the Linked List Java $\text{\color{TealBlue}Easy}$ Linked List, Two Pointers
1019 Next Greater Node In Linked List Java $\text{\color{Dandelion}Medium}$ Array, Linked List, Monotonic Stack, Stack
2095 Delete the Middle Node of a Linked List Java $\text{\color{Dandelion}Medium}$ Linked List, Two Pointers
2130 Maximum Twin Sum of a Linked List Java with Two Pointers or Two Pointers & Stack $\text{\color{Dandelion}Medium}$ Linked List, Stack, Two Pointers

⬆️Back To Top


Math

# Problem Solution Difficulty Topics Note
12 Integer to Roman Java with or without Hash Table $\text{\color{Dandelion}Medium}$ Hash Table, Math, String
13 Roman to Integer Java with or without Hash Table $\text{\color{TealBlue}Easy}$ Hash Table, Math, String
29 Divide Two Integers Java $\text{\color{Dandelion}Medium}$ Bit Manipulation, Math
70 Climbing Stairs Java with Dynamic Programming - Tabulation or Memoization $\text{\color{TealBlue}Easy}$ Dynamic Programming, Math, Memoization
223 Rectangle Area Java $\text{\color{Dandelion}Medium}$ Geometry, Math
263 Ugly Number Java $\text{\color{TealBlue}Easy}$ Math
264 Ugly Number II Java with Dynamic Programming or Heap (Priority Queue) $\text{\color{Dandelion}Medium}$ Dynamic Programming, Hash Table, Heap (Priority Queue), Math
368 Largest Divisible Subset Java $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Math, Sorting
371 Sum of Two Integers Java $\text{\color{Dandelion}Medium}$ Bit Manipulation, Math
412 Fizz Buzz Java $\text{\color{TealBlue}Easy}$ Math, Simulation, String
492 Construct the Rectangle Java $\text{\color{TealBlue}Easy}$ Math
509 Fibonacci Number Java with Dynamic Programming - Tabulation or Memoization $\text{\color{TealBlue}Easy}$ Dynamic Programming, Math, Memoization, Recursion
523 Continuous Subarray Sum Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Math, Prefix Sum
556 Next Greater Element III Java $\text{\color{Dandelion}Medium}$ Math, String, Two Pointers
593 Valid Square Java $\text{\color{Dandelion}Medium}$ Geometry, Math
812 Largest Triangle Area Java $\text{\color{TealBlue}Easy}$ Array, Geometry, Math
836 Rectangle Overlap Java $\text{\color{TealBlue}Easy}$ Geometry, Math
976 Largest Perimeter Triangle Java $\text{\color{TealBlue}Easy}$ Array, Greedy, Math, Sorting
989 Add to Array-Form of Integer Java $\text{\color{TealBlue}Easy}$ Array, Math
1033 Moving Stones Until Consecutive Java $\text{\color{Dandelion}Medium}$ Brainteaser, Math
1037 Valid Boomerang Java $\text{\color{TealBlue}Easy}$ Array, Geometry, Math
1071 Greatest Common Divisor of Strings Java $\text{\color{TealBlue}Easy}$ Math, String
1103 Distribute Candies to People Java $\text{\color{TealBlue}Easy}$ Math, Simulation
1137 N-th Tribonacci Number Java with Dynamic Programming Iteratively or Recursively (Memoization) $\text{\color{TealBlue}Easy}$ Dynamic Programming, Math, Memoization
1154 Day of the Year Java $\text{\color{TealBlue}Easy}$ Math, String
1232 Check If It Is a Straight Line Java $\text{\color{TealBlue}Easy}$ Array, Geometry, Math
1323 Maximum 69 Number Java $\text{\color{TealBlue}Easy}$ Greedy, Math Solution Using String
1342 Number of Steps to Reduce a Number to Zero Java $\text{\color{TealBlue}Easy}$ Bit Manipulation, Math Solution Using Bit Manipulation
1486 XOR Operation in an Array Java $\text{\color{TealBlue}Easy}$ Bit Manipulation, Math
1523 Count Odd Numbers in an Interval Range Java $\text{\color{TealBlue}Easy}$ Math
1680 Concatenation of Consecutive Binary Numbers Java $\text{\color{Dandelion}Medium}$ Bit Manipulation, Math, Simulation Solution Using Bit Manipulation
1814 Count Nice Pairs in an Array Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Math
1979 Find Greatest Common Divisor of Array Java $\text{\color{TealBlue}Easy}$ Array, Math, Number Theory
2028 Find Missing Observations Java $\text{\color{Dandelion}Medium}$ Array, Math, Simulation
2169 Count Operations to Obtain Zero Java $\text{\color{TealBlue}Easy}$ Math, Simulation
2240 Number of Ways to Buy Pens and Pencils Java $\text{\color{Dandelion}Medium}$ Enumeration, Math
2413 Smallest Even Multiple Java $\text{\color{TealBlue}Easy}$ Math, Number Theory
2451 Odd String Difference Java without or with Hash Table $\text{\color{TealBlue}Easy}$ Hash Table, Math, String

⬆️Back To Top


Matrix

# Problem Solution Difficulty Topics Note
36 Valid Sudoku Java without or with Hash Table $\text{\color{Dandelion}Medium}$ Array, Hash Table, Matrix
37 Sudoku Solver Java $\text{\color{Red}Hard}$ Array, Backtracking, Matrix
73 Set Matrix Zeroes Java with Array, Hash Table or In-Place $\text{\color{Dandelion}Medium}$ Array, Hash Table, Matrix
79 Word Search Java $\text{\color{Dandelion}Medium}$ Array, Backtracking, Matrix
130 Surrounded Regions Java with Breadth-First Search, Depth-First Search or Union Find $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Depth-First Search, Matrix, Union Find
200 Number of Islands Java with Breadth-First Search, Depth-First Search or Union Find $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Depth-First Search, Matrix, Union Find
766 Toeplitz Matrix Java $\text{\color{TealBlue}Easy}$ Array, Matrix Follow up: One Row at a Time and One Column at a Time
835 Image Overlap Java with Bit Manipulation or Hash Table $\text{\color{Dandelion}Medium}$ Array, Matrix
1337 The K Weakest Rows in a Matrix Java with Linear Search, Binary Search, Heap (Priority Queue) or Sorting $\text{\color{TealBlue}Easy}$ Array, Binary Search, Heap (Priority Queue), Matrix, Sorting
1351 Count Negative Numbers in a Sorted Matrix Java with Linear Search or Binary Search $\text{\color{TealBlue}Easy}$ Array, Binary Search, Matrix
1672 Richest Customer Wealth Java $\text{\color{TealBlue}Easy}$ Array, Matrix
1926 Nearest Exit from Entrance in Maze Java $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Matrix
2133 Check if Every Row and Column Contains All Numbers Java without or with Hash Table $\text{\color{TealBlue}Easy}$ Array, Hash Table, Matrix
2352 Equal Row and Column Pairs Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Matrix, Simulation

⬆️Back To Top


Memoization

# Problem Solution Difficulty Topics Note
70 Climbing Stairs Java with Dynamic Programming - Tabulation or Memoization $\text{\color{TealBlue}Easy}$ Dynamic Programming, Math, Memoization
509 Fibonacci Number Java with Dynamic Programming - Tabulation or Memoization $\text{\color{TealBlue}Easy}$ Dynamic Programming, Math, Memoization, Recursion
1137 N-th Tribonacci Number Java $\text{\color{TealBlue}Easy}$ Dynamic Programming, Math, Memoization Solution Using Dynamic Programming (Iterative)

⬆️Back To Top


Monotonic Stack

# Problem Solution Difficulty Topics Note
496 Next Greater Element I Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Monotonic Stack, Stack
503 Next Greater Element II Java $\text{\color{Dandelion}Medium}$ Array, Monotonic Stack, Stack
1019 Next Greater Node In Linked List Java $\text{\color{Dandelion}Medium}$ Array, Linked List, Monotonic Stack, Stack
2454 Next Greater Element IV Java $\text{\color{Red}Hard}$ Array, Monotonic Stack, Stack

⬆️Back To Top


Number Theory

# Problem Solution Difficulty Topics Note
1979 Find Greatest Common Divisor of Array Java $\text{\color{TealBlue}Easy}$ Array, Math, Number Theory
2413 Smallest Even Multiple Java $\text{\color{TealBlue}Easy}$ Math, Number Theory

⬆️Back To Top


Ordered Set

# Problem Solution Difficulty Topics Note
220 Contains Duplicate III Java with Sliding Window & Ordered Set $\text{\color{Red}Hard}$ Array, Bucket Sort, Ordered Set, Sliding Window, Sorting Solution Using Sliding Window & Bucket Sort or Sorting

⬆️Back To Top


Prefix Sum

# Problem Solution Difficulty Topics Note
238 Product of Array Except Self Java $\text{\color{Dandelion}Medium}$ Array, Prefix Sum
523 Continuous Subarray Sum Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Math, Prefix Sum
560 Subarray Sum Equals K Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Prefix Sum
974 Subarray Sums Divisible by K Java with Counting or Hash Table $\text{\color{Dandelion}Medium}$ Array, Hash Table, Prefix Sum
1480 Running Sum of 1D Array Java $\text{\color{TealBlue}Easy}$ Array, Prefix Sum
1732 Find the Highest Altitude Java $\text{\color{TealBlue}Easy}$ Array, Prefix Sum
2389 Longest Subsequence With Limited Sum Java $\text{\color{TealBlue}Easy}$ Array, Binary Search, Greedy, Prefix Sum, Sorting
2438 Range Product Queries of Powers Java $\text{\color{Dandelion}Medium}$ Array, Bit Manipulation, Prefix Sum

⬆️Back To Top


Queue

# Problem Solution Difficulty Topics Note
225 Implement Stack using Queues Java $\text{\color{TealBlue}Easy}$ Design, Queue, Stack
232 Implement Queue using Stacks Java $\text{\color{TealBlue}Easy}$ Design, Queue, Stack

⬆️Back To Top


Recursion

# Problem Solution Difficulty Topics Note
24 Swap Nodes in Pairs Java $\text{\color{Dandelion}Medium}$ Linked List, Recursion Solution Using Iteration
206 Reverse Linked List Java $\text{\color{TealBlue}Easy}$ Linked List, Recursion Solution Using Array List or Reverse Nodes Iteratively
509 Fibonacci Number Java with Dynamic Programming - Tabulation or Memoization $\text{\color{TealBlue}Easy}$ Dynamic Programming, Math, Memoization, Recursion

⬆️Back To Top


Simulation

# Problem Solution Difficulty Topics Note
412 Fizz Buzz Java $\text{\color{TealBlue}Easy}$ Math, Simulation, String
985 Sum of Even Numbers After Queries Java $\text{\color{Dandelion}Medium}$ Array, Simulation
1103 Distribute Candies to People Java $\text{\color{TealBlue}Easy}$ Math, Simulation
1603 Design Parking System Java $\text{\color{TealBlue}Easy}$ Counting, Design, Simulation
1680 Concatenation of Consecutive Binary Numbers Java with Bit Manipulation or Math $\text{\color{Dandelion}Medium}$ Bit Manipulation, Math, Simulation
1920 Build Array from Permutation Java $\text{\color{TealBlue}Easy}$ Array, Simulation
2028 Find Missing Observations Java $\text{\color{Dandelion}Medium}$ Array, Math, Simulation
2169 Count Operations to Obtain Zero Java $\text{\color{TealBlue}Easy}$ Math, Simulation
2352 Equal Row and Column Pairs Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Matrix, Simulation

⬆️Back To Top


Sliding Window

# Problem Solution Difficulty Topics Note
3 Longest Substring Without Repeating Characters Java with or without Hash Table $\text{\color{Dandelion}Medium}$ Hash Table, Sliding Window, String
219 Contains Duplicate II Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Sliding Window Solution Using Hash Table
220 Contains Duplicate III Java with Sliding Window & Bucket Sort or Sliding Window & Ordered Set $\text{\color{Red}Hard}$ Array, Bucket Sort, Ordered Set, Sliding Window, Sorting Solution Using Sorting
438 Find All Anagrams in a String Java $\text{\color{Dandelion}Medium}$ Hash Table, Sliding Window, String
567 Permutation in String Java $\text{\color{Dandelion}Medium}$ Hash Table, Sliding Window, String, Two Pointers
713 Subarray Product Less Than K Java $\text{\color{Dandelion}Medium}$ Array, Sliding Window
904 Fruit Into Baskets Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sliding Window

⬆️Back To Top


Sorting

# Problem Solution Difficulty Topics Note
15 3Sum Java $\text{\color{Dandelion}Medium}$ Array, Sorting, Two Pointers
16 3Sum Closest Java $\text{\color{Dandelion}Medium}$ Array, Sorting, Two Pointers
49 Group Anagrams Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting, String
88 Merge Sorted Array Java $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers Solution Using Two Pointers
169 Majority Element Java $\text{\color{TealBlue}Easy}$ Array, Counting, Divide and Conquer, Hash Table, Sorting Solution Using Boyer-Moore Majority Voting Algorithm, Counting & Divide and Conquer or Counting & Hash Table
217 Contains Duplicate Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Sorting Solution Using Hash Map or Hash Set
220 Contains Duplicate III Java $\text{\color{Red}Hard}$ Array, Bucket Sort, Ordered Set, Sliding Window, Sorting Solution Using Sliding Window & Bucket Sort or Sliding Window & Ordered Set
229 Majority Element II Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Sorting Solution Using Boyer-Moore Majority Voting Algorithm or Counting & Hash Table
274 H-Index Java with Counting Sort and Sorting $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Sorting
295 Find Median from Data Stream Java with Heap (Priority Queue) $\text{\color{Red}Hard}$ Data Stream, Design, Heap (Priority Queue), Sorting, Two Pointers Use of Sorting & Two Pointers resulted in TLE (Time Limit Exceed) for large datasets.
414 Third Maximum Number Java $\text{\color{TealBlue}Easy}$ Array, Sorting Solution without Sorting or Using Hash Table & Priority Queue
561 Array Partition Java with Greedy & Counting Sort or Greedy & Sorting $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Greedy, Sorting
645 Set Mismatch Java $\text{\color{TealBlue}Easy}$ Array, Bit Manipulation, Hash Table, Sorting Solution Using Bit Manipulation or Hash Table
905 Sort Array By Parity Java $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers
922 Sort Array By Parity II Java $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers
923 3Sum With Multiplicity Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Sorting, Two Pointers Solution Using Counting Hash Table
948 Bag of Tokens Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Sorting, Two Pointers
976 Largest Perimeter Triangle Java $\text{\color{TealBlue}Easy}$ Array, Greedy, Math, Sorting
977 Squares of a Sorted Array Java $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers Solution Using Two Pointers
1051 Height Checker Java with Counting Sort or Sorting $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Sorting
1122 Relative Sort Array Java $\text{\color{TealBlue}Easy}$ Array, Counting Sort, Hash Table, Sorting Solution Using Hash Table
1337 The K Weakest Rows in a Matrix Java with Sorting & Binary Search $\text{\color{TealBlue}Easy}$ Array, Binary Search, Heap (Priority Queue), Matrix, Sorting Solution Using Linear Search, Binary Search or Heap (Priority Queue) & Binary Search
1346 Check If N and Its Double Exist Java with Binary Search & Sorting $\text{\color{TealBlue}Easy}$ Array, Binary Search, Hash Table, Sorting, Two Pointers Solution Using Hash Table or Two Pointers
1636 Sort Array by Increasing Frequency Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Sorting
1657 Determine if Two Strings Are Close Java with Sorting or Hash Table & Sorting $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting
1679 Max Number of K-Sum Pairs Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting, Two Pointers Solution Using Hash Table
1833 Maximum Ice Cream Bars Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Sorting
1834 Single-Threaded CPU Java $\text{\color{Dandelion}Medium}$ Array, Heap (Priority Queue), Sorting
2007 Find Original Array From Doubled Array Java with Hash Table or Queue $\text{\color{Dandelion}Medium}$ Array, Greedy, Hash Table, Sorting Solution Using Counting Array
2136 Earliest Possible Day of Full Bloom Java $\text{\color{Red}Hard}$ Array, Greedy, Sorting
2279 Maximum Bags With Full Capacity of Rocks Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Sorting
2389 Longest Subsequence With Limited Sum Java $\text{\color{TealBlue}Easy}$ Array, Binary Search, Greedy, Prefix Sum, Sorting

⬆️Back To Top


Stack

# Problem Solution Difficulty Topics Note
94 Binary Tree Inorder Traversal Java $\text{\color{TealBlue}Easy}$ Binary Tree, Depth-First Search, Stack, Tree Solution Using Depth-First Search (Recursive)
114 Flatten Binary Tree to Linked List Java $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Linked List, Stack, Tree Solution Using Depth-First Search (Recursive)
144 Binary Tree Preorder Traversal Java $\text{\color{TealBlue}Easy}$ Binary Search, Depth-First Search, Stack, Tree Solution Using Depth-First Search (Recursive)
145 Binary Tree Postorder Traversal Java $\text{\color{TealBlue}Easy}$ Binary Search, Depth-First Search, Stack, Tree Solution Using Depth-First Search (Recursive)
225 Implement Stack using Queues Java $\text{\color{TealBlue}Easy}$ Design, Queue, Stack
232 Implement Queue using Stacks Java $\text{\color{TealBlue}Easy}$ Design, Queue, Stack
496 Next Greater Element I Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, Monotonic Stack, Stack
503 Next Greater Element II Java $\text{\color{Dandelion}Medium}$ Array, Monotonic Stack, Stack
1019 Next Greater Node In Linked List Java $\text{\color{Dandelion}Medium}$ Array, Linked List, Monotonic Stack, Stack
1047 Remove All Adjacent Duplicates In String Java $\text{\color{TealBlue}Easy}$ Stack, String Solution Using StringBuilder only
1544 Make The String Great Java $\text{\color{TealBlue}Easy}$ Stack, String
2130 Maximum Twin Sum of a Linked List Java with Two Pointers & Stack $\text{\color{Dandelion}Medium}$ Linked List, Stack, Two Pointers Solution Using only Two Pointers
2454 Next Greater Element IV Java $\text{\color{Red}Hard}$ Array, Monotonic Stack, Stack

⬆️Back To Top


String

# Problem Solution Difficulty Topics Note
3 Longest Substring Without Repeating Characters Java with or without Hash Table $\text{\color{Dandelion}Medium}$ Hash Table, Sliding Window, String
5 Longest Palindromic Substring Java with Dynamic Programming, Two Pointers with Approach 1 or Approach 2 $\text{\color{Dandelion}Medium}$ Dynamic Programming, String
6 Zigzag Conversion Java $\text{\color{Dandelion}Medium}$ String
12 Integer to Roman Java with or without Hash Table $\text{\color{Dandelion}Medium}$ Hash Table, Math, String
13 Roman to Integer Java with or without Hash Table $\text{\color{TealBlue}Easy}$ Hash Table, Math, String
38 Count and Say Java with Iterative or Recursive Algorithms $\text{\color{Dandelion}Medium}$ String
49 Group Anagrams Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting, String
151 Reverse Words in a String Java with StringBuilder or Collections Implementations $\text{\color{Dandelion}Medium}$ String, Two Pointers Solution Using Two Pointers
205 Isomorphic Strings Java $\text{\color{TealBlue}Easy}$ Hash Table, String
257 Binary Tree Paths Java with Backtracking and Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Backtracking, Binary Tree, Depth-First Search, String, Tree
290 Word Pattern Java $\text{\color{TealBlue}Easy}$ Hash Table, String
344 Reverse String Java $\text{\color{TealBlue}Easy}$ String, Two Pointers
345 Reverse Vowels of a String Java $\text{\color{TealBlue}Easy}$ String, Two Pointers
368 Largest Divisible Subset Java $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Math, Sorting
383 Ransom Note Java with Counting Array or Hash Table $\text{\color{TealBlue}Easy}$ Counting, Hash Table, String
412 Fizz Buzz Java $\text{\color{TealBlue}Easy}$ Math, Simulation, String
438 Find All Anagrams in a String Java $\text{\color{Dandelion}Medium}$ Hash Table, Sliding Window, String
520 Detect Capital Java $\text{\color{TealBlue}Easy}$ String
541 Reverse String II Java with StringBuilder or Two Pointers $\text{\color{TealBlue}Easy}$ String, Two Pointers
556 Next Greater Element III Java $\text{\color{Dandelion}Medium}$ Math, String, Two Pointers
557 Reverse Words in a String III Java with String Builder or Two Pointers $\text{\color{TealBlue}Easy}$ String, Two Pointers
567 Permutation in String Java $\text{\color{Dandelion}Medium}$ Hash Table, Sliding Window, String, Two Pointers
609 Find Duplicate File in System Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, String
929 Unique Email Addresses Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, String
944 Delete Columns to Make Sorted Java $\text{\color{TealBlue}Easy}$ Array, String
953 Verifying an Alien Dictionary Java $\text{\color{TealBlue}Easy}$ Array, Hash Table, String
988 Smallest String Starting From Leaf Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, String, Tree
1047 Remove All Adjacent Duplicates In String Java $\text{\color{TealBlue}Easy}$ Stack, String Solution Using Stack
1061 Lexicographically Smallest Equivalent String Java $\text{\color{Dandelion}Medium}$ String, Union Find
1071 Greatest Common Divisor of Strings Java $\text{\color{TealBlue}Easy}$ Math, String
1154 Day of the Year Java $\text{\color{TealBlue}Easy}$ Math, String
1239 Maximum Length of a Concatenated String with Unique Characters Java with Backtracking or Bit Manipulation $\text{\color{Dandelion}Medium}$ Array, Backtracking, Bit Manipulation, String
1328 Break a Palindrome Java $\text{\color{Dandelion}Medium}$ Greedy, String
1446 Consecutive Characters Java $\text{\color{TealBlue}Easy}$ String
1544 Make The String Great Java $\text{\color{TealBlue}Easy}$ Stack, String
1578 Minimum Time to Make Rope Colorful Java with Dynamic Programming or Greedy $\text{\color{Dandelion}Medium}$ Array, Dynamic Programming, Greedy, String
1592 Rearrange Spaces Between Words Java $\text{\color{TealBlue}Easy}$ String
1657 Determine if Two Strings Are Close Java with Sorting or Hash Table & Sorting $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting
1662 Check If Two String Arrays are Equivalent Java with or without Pointers $\text{\color{TealBlue}Easy}$ Array, String
1704 Determine if String Halves Are Alike Java $\text{\color{TealBlue}Easy}$ Counting, String
1832 Check if the Sentence is Pangram Java $\text{\color{TealBlue}Easy}$ Hash Table, String Solution Using Bit Manipulation , Counting and Hash Table
1869 Longer Contiguous Segments of Ones than Zeros Java $\text{\color{TealBlue}Easy}$ String
1935 Maximum Number of Words You Can Type Java $\text{\color{TealBlue}Easy}$ Hash Table, String
2023 Number of Pairs of Strings With Concatenation Equal to Target Java $\text{\color{Dandelion}Medium}$ Array, String
2129 Capitalize the Title Java $\text{\color{TealBlue}Easy}$ String
2131 Longest Palindrome by Concatenating Two Letter Words Java with Counting or Hash Table $\text{\color{Dandelion}Medium}$ Array, Counting, Greedy, Hash Table, String
2315 Count Asterisks Java $\text{\color{TealBlue}Easy}$ String
2351 First Letter to Appear Twice Java with Counting or Hash Table $\text{\color{TealBlue}Easy}$ Counting, Hash Table, String
2399 Check Distances Between Same Letters Java without or with Hash Table $\text{\color{TealBlue}Easy}$ Array, Hash Table, String
2437 Number of Valid Clock Times Java $\text{\color{TealBlue}Easy}$ Enumeration, String
2451 Odd String Difference Java without or with Hash Table $\text{\color{TealBlue}Easy}$ Hash Table, Math, String
2452 Words Within Two Edits of Dictionary Java $\text{\color{Dandelion}Medium}$ Array, String

⬆️Back To Top


Tree

# Problem Solution Difficulty Topics Note
94 Binary Tree Inorder Traversal Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Depth-First Search, Stack, Tree
98 Validate Binary Search Tree Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Search Tree, Binary Tree, Depth-First Search, Tree
100 Same Tree Java with Breadth-First Search or Depth-First Search $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
102 Binary Tree Level Order Traversal Java $\text{\color{Dandelion}Medium}$ Binary Search, Breadth-First Search, Tree
103 Binary Tree Zigzag Level Order Traversal Java $\text{\color{Dandelion}Medium}$ Binary Search, Breadth-First Search, Tree
104 Maximum Depth of Binary Tree Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
107 Binary Tree Level Order Traversal II Java $\text{\color{Dandelion}Medium}$ Binary Search, Breadth-First Search, Tree
110 Balanced Binary Tree Java $\text{\color{TealBlue}Easy}$ Binary Tree, Depth-First Search, Tree
111 Minimum Depth of Binary Tree Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
112 Path Sum Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
113 Path Sum II Java with Backtracking and Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Backtracking, Binary Tree, Depth-First Search, Tree
114 Flatten Binary Tree to Linked List Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Linked List, Stack, Tree
129 Sum Root to Leaf Numbers Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Tree
144 Binary Tree Preorder Traversal Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search, Depth-First Search, Stack, Tree
145 Binary Tree Postorder Traversal Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search, Depth-First Search, Stack, Tree
222 Count Complete Tree Nodes Java $\text{\color{Dandelion}Medium}$ Binary Search, Binary Tree, Depth-First Search, Tree
226 Invert Binary Tree Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
257 Binary Tree Paths Java with Backtracking and Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Backtracking, Binary Tree, Depth-First Search, String, Tree
404 Sum of Left Leaves Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Tree, Breadth-First Search, Depth-First Search, Tree
429 N-ary Tree Level Order Traversal Java $\text{\color{Dandelion}Medium}$ Breadth-First Search, Tree
437 Path Sum III Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Tree
559 Maximum Depth of Binary Tree Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Breadth-First Search, Depth-First Search, Tree
653 Two Sum IV - Input is a BST Java with Breadth-First Search (with Hash Table), Breadth-First Search (without Hash Table), Depth-First Search (Iterative), Depth-First Search (Recursive), Two Pointers (with Iterative Inorder Traversal) or Two Pointers (with Recursive Inorder Traversal) $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Hash Table, Tree, Two Pointers
783 Minimum Distance Between BST Nodes Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Tree
988 Smallest String Starting From Leaf Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, String, Tree
1026 Maximum Difference Between Node and Ancestor Java with Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Depth-First Search, Tree
1457 Pseudo-Palindromic Paths in a Binary Tree Java with Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive) $\text{\color{Dandelion}Medium}$ Binary Tree, Bit Manipulation, Breadth-First Search, Depth-First Search, Tree

⬆️Back To Top


Two Pointers

# Problem Solution Difficulty Topics Note
15 3Sum Java $\text{\color{Dandelion}Medium}$ Array, Sorting, Two Pointers
16 3Sum Closest Java $\text{\color{Dandelion}Medium}$ Array, Sorting, Two Pointers
19 Remove Nth Node From End of List Java with One Pass or Two Passes $\text{\color{Dandelion}Medium}$ Linked List, Two Pointers
26 Remove Duplicates from Sorted Array Java $\text{\color{TealBlue}Easy}$ Array, Two Pointers
27 Remove Element Java $\text{\color{TealBlue}Easy}$ Array, Two Pointers
80 Remove Duplicates from Sorted Array II Java $\text{\color{Dandelion}Medium}$ Array, Two Pointers
88 Merge Sorted Array Java $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers Solution Using Sorting
151 Reverse Words in a String Java $\text{\color{Dandelion}Medium}$ String, Two Pointers Solution Using Collections or StringBuilder
167 Two Sum II - Input Array is Sorted Java $\text{\color{Dandelion}Medium}$ Array, Binary Search, Two Pointers Solution Using Binary Search
283 Move Zeroes Java $\text{\color{TealBlue}Easy}$ Array, Two Pointers
295 Find Median from Data Stream Java with Heap (Priority Queue) $\text{\color{Red}Hard}$ Data Stream, Design, Heap (Priority Queue), Sorting, Two Pointers Use of Sorting & Two Pointers resulted in TLE (Time Limit Exceed) for large datasets.
344 Reverse String Java $\text{\color{TealBlue}Easy}$ String, Two Pointers
345 Reverse Vowels of a String Java $\text{\color{TealBlue}Easy}$ String, Two Pointers
541 Reverse String II Java $\text{\color{TealBlue}Easy}$ String, Two Pointers Solution Using StringBuilder
556 Next Greater Element III Java $\text{\color{Dandelion}Medium}$ Math, String, Two Pointers
557 Reverse Words in a String III Java $\text{\color{TealBlue}Easy}$ String, Two Pointers Solution Using String Builder
567 Permutation in String Java $\text{\color{Dandelion}Medium}$ Hash Table, Sliding Window, String, Two Pointers
653 Two Sum IV - Input is a BST Java with Two Pointers (with Iterative Inorder Traversal) or Two Pointers (with Recursive Inorder Traversal) $\text{\color{TealBlue}Easy}$ Binary Search Tree, Binary Tree, Breadth-First Search, Depth-First Search, Hash Table, Tree, Two Pointers Solution Using Breadth-First Search (with Hash Table), Breadth-First Search (without Hash Table), Depth-First Search (Iterative) or Depth-First Search (Recursive)
876 Middle of the Linked List Java $\text{\color{TealBlue}Easy}$ Linked List, Two Pointers
905 Sort Array By Parity Java $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers
922 Sort Array By Parity II Java $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers
923 3Sum With Multiplicity Java $\text{\color{Dandelion}Medium}$ Array, Counting, Hash Table, Sorting, Two Pointers Solution Using Counting Hash Table
948 Bag of Tokens Java $\text{\color{Dandelion}Medium}$ Array, Greedy, Sorting, Two Pointers
977 Squares of a Sorted Array Java $\text{\color{TealBlue}Easy}$ Array, Sorting, Two Pointers Solution Using Sorting
1089 Duplicate Zeros Java $\text{\color{TealBlue}Easy}$ Array, Two Pointers Solution Without Two Pointers
1346 Check If N and Its Double Exist Java $\text{\color{TealBlue}Easy}$ Array, Binary Search, Hash Table, Sorting, Two Pointers Solution Using Binary Search & Sorting or Hash Table
1679 Max Number of K-Sum Pairs Java $\text{\color{Dandelion}Medium}$ Array, Hash Table, Sorting, Two Pointers Solution Using Hash Table
2095 Delete the Middle Node of a Linked List Java $\text{\color{Dandelion}Medium}$ Linked List, Two Pointers
2130 Maximum Twin Sum of a Linked List Java with Two Pointers or Two Pointers & Stack $\text{\color{Dandelion}Medium}$ Linked List, Stack, Two Pointers

⬆️Back To Top


Union Find

# Problem Solution Difficulty Topics Note
130 Surrounded Regions Java $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Depth-First Search, Matrix, Union Find Solution Using Breadth-First Search or Depth-First Search
200 Number of Islands Java $\text{\color{Dandelion}Medium}$ Array, Breadth-First Search, Depth-First Search, Matrix, Union Find Solution Using Breadth-First Search or Depth-First Search
1061 Lexicographically Smallest Equivalent String Java $\text{\color{Dandelion}Medium}$ String, Union Find
1971 Find if Path Exists in Graph Java $\text{\color{TealBlue}Easy}$ Breadth-First Search, Depth-First Search, Graph, Union Find Solution Using Breadth-First Search, Depth-First Search (Iterative) or Depth-First Search (Recursive)

⬆️Back To Top