Skip to content
{ }
SolveLogs
Home
Problems
Patterns
Learn
Blog
About
⌕
☀
☾
All problems
Search, filter by difficulty or pattern, and sort. Deep-linkable.
⌕
All
Easy
Medium
Hard
All patterns
Arrays & Hashing
Two Pointers
Sliding Window
Stack
Binary Search
Linked List
Intervals
Matrix
Dynamic Programming
Recursion & Backtracking
Binary Trees
Strings
Greedy
Heaps
Graphs
Trie
Bit Manipulation
Maths
Newest
By number
By difficulty
A–Z
GFG 0/1 Knapsack — Medium
#542 01 Matrix — Medium
#15 3Sum — Medium
#18 4Sum — Medium
#721 Accounts Merge — Medium
#67 Add Binary — Easy
#2 Add Two Numbers — Medium
GFG Aggressive Cows — Medium
#863 All Nodes Distance K in Binary Tree — Medium
GFG Pre + Post + Inorder in One Traversal — Easy
GFG Allocate Minimum Pages — Medium
#455 Assign Cookies — Easy
#735 Asteroid Collision — Medium
#637 Average of Levels in Binary Tree — Easy
#110 Balanced Binary Tree — Medium
#682 Baseball Game — Easy
#224 Basic Calculator — Hard
#227 Basic Calculator II — Medium
GFG Bellman–Ford Algorithm — Medium
#309 Best Time to Buy and Sell Stock with Cooldown — Medium
#714 Best Time to Buy and Sell Stock with Transaction Fee — Medium
#123 Best Time to Buy and Sell Stock III — Hard
#188 Best Time to Buy and Sell Stock IV — Hard
#121 Best Time to Buy and Sell Stock — Easy
#122 Best Time to Buy and Sell Stock II — Medium
GFG BFS of Graph — Easy
#704 Binary Search — Easy
#173 BST Iterator — Hard
#930 Binary Subarrays With Sum — Medium
#94 Binary Tree Inorder Traversal — Easy
#102 Binary Tree Level Order Traversal — Medium
#107 Binary Tree Level Order Traversal II — Medium
#124 Binary Tree Maximum Path Sum — Hard
#257 Binary Tree Paths — Medium
#145 Binary Tree Postorder Traversal — Easy
#144 Binary Tree Preorder Traversal — Easy
#199 Binary Tree Right Side View — Medium
#563 Binary Tree Tilt — Easy
#103 Zigzag Level Order Traversal — Medium
#201 Bitwise AND of Numbers Range — Medium
#881 Boats to Save People — Medium
GFG Bottom View of Binary Tree — Medium
#545 Boundary of Binary Tree — Hard
#312 Burst Balloons — Hard
#605 Can Place Flowers — Easy
#135 Candy — Hard
#1011 Capacity to Ship Packages Within D Days — Medium
#853 Car Fleet — Medium
GFG Ceil in BST — Easy
#787 Cheapest Flights Within K Stops — Medium
#70 Climbing Stairs — Easy
#133 Clone Graph — Medium
#322 Coin Change (Minimum Coins) — Medium
#518 Coin Change II — Medium
#39 Combination Sum — Medium
#40 Combination Sum II — Medium
#216 Combination Sum III — Medium
#377 Combination Sum IV — Medium
#77 Combinations — Medium
#165 Compare Version Numbers — Medium
#1008 Construct BST from Preorder Traversal — Medium
#106 Construct BT from Postorder and Inorder — Medium
#105 Construct BT from Preorder and Inorder — Medium
GFG Construct BST from Given Keys (Preorder) — Easy
#11 Container With Most Water — Medium
#217 Contains Duplicate — Easy
#219 Contains Duplicate II — Easy
#108 Convert Sorted Array to Binary Search Tree — Easy
#109 Convert Sorted List to BST — Medium
#138 Copy List with Random Pointer — Medium
#38 Count and Say — Medium
#222 Count Complete Tree Nodes — Medium
#1448 Count Good Nodes in Binary Tree — Medium
GFG Count Inversions — Hard
#1248 Count Number of Nice Subarrays — Medium
#315 Count of Smaller Numbers After Self — Hard
#204 Count Primes — Medium
GFG Count Subarrays with XOR K — Hard
#338 Counting Bits — Easy
#207 Course Schedule — Medium
#210 Course Schedule II — Medium
#1462 Course Schedule IV — Medium
#739 Daily Temperatures — Medium
#394 Decode String — Medium
#91 Decode Ways — Medium
#450 Delete Node in a BST — Medium
#237 Delete Node in a Linked List — Medium
#583 Delete Operation for Two Strings — Medium
#2095 Delete the Middle Node of a Linked List — Medium
#211 Design Add and Search Words Data Structure — Medium
#706 Design HashMap — Easy
#355 Design Twitter — Medium
GFG Detect Cycle in Directed Graph (BFS) — Medium
GFG Detect Cycle in Directed Graph (DFS) — Medium
GFG Detect Cycle in Undirected Graph (BFS) — Medium
GFG Detect Cycle in Undirected Graph (DFS) — Medium
#1657 Determine if Two Strings Are Close — Medium
GFG DFS of Graph — Easy
#498 Diagonal Traverse — Medium
#543 Diameter of Binary Tree — Easy
GFG Dijkstra's Algorithm — Medium
#115 Distinct Subsequences — Hard
#29 Divide Two Integers — Medium
#790 Domino and Tromino Tiling — Medium
#649 Dota2 Senate — Medium
#72 Edit Distance — Hard
#2352 Equal Row and Column Pairs — Medium
#399 Evaluate Division — Medium
#150 Evaluate Reverse Polish Notation — Medium
#171 Excel Sheet Column Number — Easy
#168 Excel Sheet Column Title — Easy
#172 Factorial Trailing Zeroes — Medium
#509 Fibonacci Number — Easy
#438 Find All Anagrams in a String — Medium
#442 Find All Duplicates in an Array — Medium
#448 Find All Numbers Disappeared in an Array — Easy
#513 Find Bottom Left Tree Value — Medium
#2239 Find Closest Number to Zero — Easy
#34 Find First and Last Position of Element in Sorted Array — Medium
#1971 Find if Path Exists in Graph — Easy
#373 Find K Pairs with Smallest Sums — Medium
#719 Find K-th Smallest Pair Distance — Hard
#295 Find Median from Data Stream — Hard
#153 Find Minimum in Rotated Sorted Array — Medium
#154 Find Minimum in Rotated Sorted Array II — Hard
GFG Find Missing and Repeating Number — Hard
#162 Find Peak Element — Medium
#724 Find Pivot Index — Easy
#277 Find the Celebrity — Medium
#287 Find the Duplicate Number — Medium
#1732 Find the Highest Altitude — Easy
#28 KMP Algorithm / LPS Array — Medium
#278 First Bad Version — Easy
#41 First Missing Positive — Hard
#387 First Unique Character in a String — Easy
#430 Flatten a Multilevel Doubly Linked List — Hard
#114 Flatten Binary Tree to Linked List — Medium
#733 Flood Fill — Easy
GFG Floor in BST — Easy
GFG Floyd–Warshall Algorithm — Medium
#166 Fraction to Recurring Decimal — Medium
GFG Fractional Knapsack — Medium
#904 Fruit Into Baskets — Medium
#289 Game of Life — Medium
#134 Gas Station — Medium
#22 Generate Parentheses — Medium
#89 Gray Code — Medium
#1071 Greatest Common Divisor of Strings — Easy
#49 Group Anagrams — Medium
#275 H-Index II — Medium
#202 Happy Number — Easy
#198 House Robber — Medium
#213 House Robber II — Medium
GFG Implement Max Heap — Medium
GFG Implement Queue using Arrays — Easy
#232 Implement Queue using Stack — Medium
GFG Implement Stack using Arrays — Easy
#225 Implement Stack using Queue — Medium
#28 Find the Index of the First Occurrence in a String — Easy
#208 Implement Trie (Prefix Tree) — Medium
#334 Increasing Triplet Subsequence — Medium
GFG Infix to Postfix Conversion — Medium
#285 Inorder Successor in BST — Medium
#380 Insert Delete GetRandom O(1) — Medium
#57 Insert Interval — Medium
#147 Insertion Sort List — Medium
#343 Integer Break — Medium
#12 Integer to Roman — Medium
#97 Interleaving String — Medium
#160 Intersection of Two Linked Lists — Medium
#986 Interval List Intersections — Medium
#226 Invert Binary Tree — Easy
#785 Is Graph Bipartite? — Medium
#392 Is Subsequence — Easy
#463 Island Perimeter — Easy
#205 Isomorphic Strings — Easy
#771 Jewels and Stones — Easy
GFG Job Sequencing Problem — Hard
#55 Jump Game — Medium
#45 Jump Game II — Medium
#973 K Closest Points to Origin — Medium
#841 Keys and Rooms — Medium
#1431 Kids With the Greatest Number of Candies — Easy
#875 Koko Eating Bananas — Medium
GFG Kth Element of Two Sorted Arrays — Hard
#703 Kth Largest in Stream — Medium
#215 Kth Largest Element in an Array — Medium
GFG Kth Smallest and Largest in BST — Medium
#230 Kth Smallest Element in BST — Medium
#378 Kth Smallest Element in a Sorted Matrix — Medium
#368 Largest Divisible Subset — Medium
#84 Largest Rectangle in Histogram — Hard
#1046 Last Stone Weight — Easy
#1049 Last Stone Weight II — Medium
GFG Leaders in an Array — Easy
#872 Leaf-Similar Trees — Easy
#860 Lemonade Change — Easy
#58 Length of Last Word — Easy
#17 Letter Combinations of a Phone Number — Medium
#460 LFU Cache — Hard
#141 Linked List Cycle — Easy
#142 Linked List Cycle II — Medium
#1027 Longest Arithmetic Subsequence — Medium
#14 Longest Common Prefix — Easy
#1143 Longest Common Subsequence — Medium
#128 Longest Consecutive Sequence — Medium
#329 Longest Increasing Path in a Matrix — Hard
#300 Longest Increasing Subsequence — Medium
#516 Longest Palindromic Subsequence — Medium
#5 Longest Palindromic Substring — Medium
#424 Longest Repeating Character Replacement — Medium
GFG Longest Subarray with Sum K — Medium
#340 Longest Substring with At Most K Distinct Characters — Medium
#3 Longest Substring Without Repeating Characters — Medium
#32 Longest Valid Parentheses — Hard
#720 Longest Word in Dictionary — Medium
GFG Longest Word with All Prefixes — Medium
#1372 Longest ZigZag Path in a Binary Tree — Medium
#235 Lowest Common Ancestor of BST — Easy
#236 Lowest Common Ancestor of Binary Tree — Medium
#146 LRU Cache — Medium
GFG M-Coloring Problem — Medium
#169 Majority Element — Medium
#229 Majority Element II — Medium
#677 Map Sum Pairs — Medium
GFG Matrix Chain Multiplication — Hard
GFG Matrix Median — Medium
#695 Max Area of Island — Medium
#485 Max Consecutive Ones — Easy
#1004 Max Consecutive Ones III — Medium
#1679 Max Number of K-Sum Pairs — Medium
GFG Maximum of Minimums for Every Window Size — Medium
#149 Max Points on a Line — Hard
#85 Maximal Rectangle — Hard
#221 Maximal Square — Medium
#643 Maximum Average Subarray I — Easy
#104 Maximum Depth of Binary Tree — Easy
#1161 Maximum Level Sum of a Binary Tree — Medium
#1456 Maximum Number of Vowels in a Substring — Medium
#1423 Maximum Points You Can Obtain from Cards — Medium
#152 Maximum Product Subarray — Hard
#1235 Maximum Profit in Job Scheduling — Hard
#53 Maximum Subarray — Medium
#1373 Maximum Sum BST in Binary Tree — Hard
GFG Maximum Sum Combination — Medium
GFG Maximum Sum Increasing Subsequence — Medium
#2130 Maximum Twin Sum of a Linked List — Medium
#662 Maximum Width of Binary Tree — Medium
#421 Maximum XOR of Two Numbers in an Array — Hard
#1707 Maximum XOR With an Element From Array — Hard
#4 Median of Two Sorted Arrays — Hard
#56 Merge Intervals — Medium
#23 Merge K Sorted Lists — Hard
#88 Merge Sorted Array — Medium
#1768 Merge Strings Alternately — Easy
#617 Merge Two Binary Trees — Easy
#21 Merge Two Sorted Lists — Easy
#876 Middle of the Linked List — Easy
#746 Min Cost Climbing Stairs — Easy
#1584 Min Cost to Connect All Points — Medium
#155 Min Stack — Medium
#530 Minimum Absolute Difference in BST — Easy
#452 Minimum Number of Arrows to Burst Balloons — Medium
#2220 Minimum Bit Flips to Convert Number — Easy
#857 Minimum Cost to Hire K Workers — Hard
#111 Minimum Depth of Binary Tree — Easy
#931 Minimum Falling Path Sum — Medium
#433 Minimum Genetic Mutation — Medium
#1312 Minimum Insertions to Make String Palindrome — Hard
#1851 Minimum Interval to Include Each Query — Hard
#1482 Minimum Number of Days to Make m Bouquets — Medium
GFG Minimum Number of Platforms — Medium
#64 Minimum Path Sum — Medium
#1249 Minimum Remove to Make Valid Parentheses — Medium
#209 Minimum Size Subarray Sum — Medium
#76 Minimum Window Substring — Hard
#268 Missing Number — Easy
GFG Morris Inorder Traversal — Hard
GFG Morris Preorder Traversal — Hard
#283 Move Zeroes — Easy
GFG MST — Kruskal's Algorithm — Medium
GFG MST — Prim's Algorithm — Medium
#43 Multiply Strings — Medium
GFG N Meetings in One Room — Medium
#51 N-Queens — Hard
#1926 Nearest Exit from Entrance in Maze — Medium
#743 Network Delay Time — Medium
GFG Next Greater Element — Medium
#503 Next Greater Element II — Medium
#31 Next Permutation — Medium
GFG Next Smaller Element — Medium
#435 Non-overlapping Intervals — Medium
GFG N-th Root of an Integer — Medium
#191 Number of 1 Bits — Easy
#323 Number of Connected Components in an Undirected Graph — Medium
GFG Number of Distinct Substrings — Hard
#1020 Number of Enclaves — Medium
#200 Number of Islands — Medium
#547 Number of Provinces — Medium
#328 Odd Even Linked List — Medium
#474 Ones and Zeroes — Medium
#901 Online Stock Span — Medium
#752 Open the Lock — Medium
#417 Pacific Atlantic Water Flow — Medium
#234 Palindrome Linked List — Medium
#9 Palindrome Number — Easy
#131 Palindrome Partitioning — Medium
#132 Palindrome Partitioning II — Hard
#647 Palindromic Substrings — Medium
#416 Partition Equal Subset Sum — Medium
#763 Partition Labels — Medium
#86 Partition List — Medium
#118 Pascal's Triangle — Easy
#112 Path Sum — Easy
#113 Path Sum II — Medium
#437 Path Sum III — Medium
#1631 Path With Minimum Effort — Medium
#279 Perfect Squares — Medium
#567 Permutation in String — Medium
#60 Permutation Sequence — Hard
#46 Permutations — Medium
#47 Permutations II — Medium
#66 Plus One — Easy
#116 Populating Next Right Pointers — Medium
#886 Possible Bipartition — Medium
#342 Power of Four — Easy
#326 Power of Three — Easy
#231 Power of Two — Easy
#50 Pow(x, n) — Medium
GFG Print All Divisors of a Number — Easy
#238 Product of Array Except Self — Medium
GFG Rabin-Karp Algorithm — Medium
#304 Range Sum Query 2D - Immutable — Medium
#383 Ransom Note — Easy
GFG Rat in a Maze — Medium
#2149 Rearrange Array Elements by Sign — Medium
#332 Reconstruct Itinerary — Hard
#684 Redundant Connection — Medium
#10 Regular Expression Matching — Hard
#506 Relative Ranks — Easy
#1047 Remove All Adjacent Duplicates In String — Easy
#316 Remove Duplicate Letters — Medium
#26 Remove Duplicates from Sorted Array — Easy
#80 Remove Duplicates from Sorted Array II — Medium
#83 Remove Duplicates from Sorted List — Easy
#82 Remove Duplicates from Sorted List II — Medium
#402 Remove K Digits — Medium
#203 Remove Linked List Elements — Easy
#19 Remove Nth Node From End of List — Medium
#2390 Removing Stars From a String — Medium
#143 Reorder List — Medium
#1466 Reorder Routes to Make All Paths Lead to City Zero — Medium
#767 Reorganize String — Medium
#187 Repeated DNA Sequences — Medium
#459 Repeated Substring Pattern — Easy
#648 Replace Words — Medium
#93 Restore IP Addresses — Medium
#190 Reverse Bits — Easy
#7 Reverse Integer — Medium
#206 Reverse Linked List — Easy
#25 Reverse Nodes in k-Group — Hard
#493 Reverse Pairs — Hard
#344 Reverse String — Easy
#345 Reverse Vowels of a String — Easy
#151 Reverse Words in a String — Medium
GFG Rod Cutting Problem — Medium
#13 Roman to Integer — Easy
#189 Rotate Array — Medium
#48 Rotate Image — Medium
#61 Rotate List — Medium
#994 Rotten Oranges — Medium
#1480 Running Sum of 1D Array — Easy
#100 Same Tree — Easy
#990 Satisfiability of Equality Equations — Medium
#240 Search a 2D Matrix II — Medium
#74 Search a 2D Matrix — Medium
#700 Search in a BST — Easy
#33 Search in Rotated Sorted Array — Medium
#81 Search in Rotated Sorted Array II — Medium
#35 Search Insert Position — Easy
#297 Serialize and Deserialize Binary Tree — Hard
#73 Set Matrix Zeroes — Medium
GFG Shortest Job First — Easy
#1091 Shortest Path in Binary Matrix — Medium
GFG Sieve of Eratosthenes — Medium
#71 Simplify Path — Medium
#540 Single Element in a Sorted Array — Medium
#136 Single Number — Easy
#137 Single Number II — Medium
#260 Single Number III — Medium
#239 Sliding Window Maximum — Hard
#909 Snakes and Ladders — Medium
GFG Sort a Stack — Medium
#451 Sort Characters By Frequency — Medium
#75 Sort Colors — Medium
#148 Sort List — Medium
#54 Spiral Matrix — Medium
#59 Spiral Matrix II — Medium
#410 Split Array Largest Sum — Hard
#69 Sqrt(x) — Easy
#977 Squares of a Sorted Array — Easy
#443 String Compression — Medium
#8 String to Integer (atoi) — Medium
GFG Strongly Connected Components (Kosaraju) — Hard
#560 Subarray Sum Equals K — Medium
#992 Subarrays with K Different Integers — Hard
GFG Subset Sum Equals Target — Medium
GFG Subset Sums — Medium
#78 Subsets (Power Set) — Easy
#90 Subsets II — Medium
#1358 Number of Substrings Containing All Three Characters — Medium
#572 Subtree of Another Tree — Easy
#2300 Successful Pairs of Spells and Potions — Medium
#37 Sudoku Solver — Hard
#404 Sum of Left Leaves — Easy
#907 Sum of Subarray Minimums — Medium
#2104 Sum of Subarray Ranges — Medium
#371 Sum of Two Integers — Medium
#129 Sum Root to Leaf Numbers — Medium
#228 Summary Ranges — Easy
#887 Super Egg Drop — Hard
#130 Surrounded Regions — Medium
#24 Swap Nodes in Pairs — Medium
#778 Swim in Rising Water — Hard
#101 Symmetric Tree — Easy
#494 Target Sum — Medium
#621 Task Scheduler — Medium
#68 Text Justification — Hard
#16 3Sum Closest — Medium
#347 Top K Frequent Elements — Medium
#692 Top K Frequent Words — Medium
GFG Top View of Binary Tree — Medium
GFG Topological Sort (DFS) — Medium
GFG Topological Sort (Kahn's BFS) — Medium
#477 Total Hamming Distance — Medium
#42 Trapping Rain Water — Hard
#120 Triangle — Medium
#1 Two Sum — Easy
#167 Two Sum II - Input Array Is Sorted — Medium
#653 Two Sum IV — Input is BST — Easy
#263 Ugly Number — Easy
#264 Ugly Number II — Medium
#1035 Uncrossed Lines — Medium
#96 Unique Binary Search Trees — Medium
#1207 Unique Number of Occurrences — Easy
#62 Unique Paths — Medium
#63 Unique Paths II — Medium
#242 Valid Anagram — Easy
#125 Valid Palindrome — Easy
#680 Valid Palindrome II — Easy
#20 Valid Parentheses — Easy
#678 Valid Parenthesis String — Medium
#367 Valid Perfect Square — Easy
#36 Valid Sudoku — Medium
#98 Validate Binary Search Tree — Medium
#987 Vertical Order Traversal — Medium
#44 Wildcard Matching — Hard
#139 Word Break — Medium
#140 Word Break II — Hard
#127 Word Ladder — Hard
#290 Word Pattern — Easy
#79 Word Search — Medium
#212 Word Search II — Hard
GFG XOR of Numbers in a Given Range — Easy
GFG Z Function — Medium
#6 Zigzag Conversion — Medium