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