Problem explanations
Approach walkthroughs, complexity, common mistakes, and Python or C++ code. Source and license details accompany each reference.
836 explanations
Graphs
- 01 MatrixMedium
- Accounts MergeMedium
- All Paths from Source Lead to DestinationMedium
- Array NestingMedium
- As Far from Land as PossibleMedium
- Battleships in a BoardMedium
- Binary Tree Level Order Traversal IIMedium
- Binary Tree Longest Consecutive SequenceMedium
- Binary Tree Longest Consecutive Sequence IIMedium
- Binary Tree PathsEasy
- Binary Tree Postorder TraversalEasy
- Binary Tree Preorder TraversalEasy
- Binary Tree Vertical Order TraversalMedium
- Boundary of Binary TreeMedium
- Brace ExpansionMedium
- Build a Matrix With ConditionsHard
- Bus RoutesHard
- Check Completeness of a Binary TreeMedium
- Clone GraphMedium
- Clone N-ary TreeMedium
- Closest Binary Search Tree ValueEasy
- Construct String from Binary TreeMedium
- Convert BST to Greater TreeMedium
- Count Servers that CommunicateMedium
- Count Sub IslandsMedium
- Count Univalue SubtreesMedium
- Course ScheduleMedium
- Course Schedule IIMedium
- Course Schedule IVMedium
- Delete Leaves With a Given ValueMedium
- Detonate the Maximum BombsMedium
- Diameter of N-Ary TreeMedium
- Distribute Coins in Binary TreeMedium
- Encode N-ary Tree to Binary TreeHard
- Evaluate Boolean Binary TreeEasy
- Evaluate DivisionMedium
- Even Odd TreeMedium
- Find All People With SecretHard
- Find Bottom Left Tree ValueMedium
- Find Closest Node to Given Two NodesMedium
- Find Duplicate SubtreesMedium
- Find Eventual Safe StatesMedium
- Find Largest Value in Each Tree RowMedium
- Find Leaves of Binary TreeMedium
- Find Root of N-Ary TreeMedium
- Find the CelebrityMedium
- Find the Town JudgeEasy
- Flatten Binary Tree to Linked ListMedium
- Flatten Nested List IteratorMedium
- Flip Equivalent Binary TreesMedium
- Flood FillEasy
- Freedom TrailHard
- Graph Valid TreeMedium
- Greatest Common Divisor TraversalHard
- House Robber IIIMedium
- Inorder Successor in BSTMedium
- Is Graph Bipartite?Medium
- Island PerimeterEasy
- Kill ProcessMedium
- Largest BST SubtreeMedium
- Largest Color Value in a Directed GraphHard
- Leaf-Similar TreesEasy
- Lowest Common Ancestor of a Binary TreeMedium
- Max Area of IslandMedium
- Maximum Average SubtreeMedium
- Maximum Width of Binary TreeMedium
- Merge Two Binary TreesEasy
- MinesweeperMedium
- Minimum Depth of Binary TreeEasy
- Minimum Distance Between BST NodesEasy
- Minimum Fuel Cost to Report to the CapitalMedium
- Minimum Genetic MutationMedium
- Minimum Height TreesMedium
- Minimum Knight MovesMedium
- Minimum Number of Vertices to Reach All NodesMedium
- Minimum Score of a Path Between Two CitiesMedium
- Minimum Time to Collect All Apples in a TreeMedium
- Most Frequent Subtree SumMedium
- N-ary Tree Level Order TraversalMedium
- N-ary Tree Postorder TraversalEasy
- Number of Closed IslandsMedium
- Number of Connected Components in an Undirected GraphMedium
- Number of Distinct IslandsMedium
- Number of EnclavesMedium
- Number of Good PathsHard
- Number of IslandsMedium
- Number of Islands IIHard
- Number of ProvincesMedium
- Open the LockMedium
- Operations on TreeMedium
- Pacific Atlantic Water FlowMedium
- Parallel CoursesMedium
- Parallel Courses IIIHard
- Path Sum IIMedium
- Path Sum IIIMedium
- Pseudo-Palindromic Paths in a Binary TreeMedium
- Range Sum of BSTEasy
- Recover Binary Search TreeMedium
- Redundant ConnectionMedium
- Reorder Routes to Make All Paths Lead to the City ZeroMedium
- Rotting OrangesMedium
- Serialize and Deserialize N-ary TreeHard
- Shortest BridgeMedium
- Shortest Distance from All BuildingsHard
- Shortest Path in Binary MatrixMedium
- Shortest Path with Alternating ColorsMedium
- Smallest String Starting From LeafMedium
- Snakes and LaddersMedium
- Sort Items by Groups Respecting DependenciesHard
- Sum of Left LeavesEasy
- Sum Root to Leaf NumbersMedium
- Surrounded RegionsMedium
- The MazeMedium
- Time Needed to Inform All EmployeesMedium
- Trim a Binary Search TreeMedium
- Two Sum BSTsMedium
- Two Sum IV - Input is a BSTEasy
- Validate Binary Tree NodesMedium
- Walls and GatesMedium
- Water and Jug ProblemMedium
- Web CrawlerMedium
- Word LadderHard
Stack
- 132 PatternMedium
- Add Two Numbers IIMedium
- Asteroid CollisionMedium
- Baseball GameEasy
- Basic Calculator IIMedium
- Basic Calculator IIIHard
- Binary Search Tree IteratorMedium
- Buildings With an Ocean ViewMedium
- Car FleetMedium
- Crawler Log FolderEasy
- Daily TemperaturesMedium
- Decode StringMedium
- Design Browser HistoryMedium
- Evaluate Reverse Polish NotationMedium
- Find PermutationMedium
- Generate ParenthesesMedium
- Implement Queue using StacksEasy
- Implement Stack using QueuesEasy
- Largest Rectangle in HistogramHard
- Make The String GreatEasy
- Max StackHard
- Maximum Frequency StackHard
- Maximum Nesting Depth of the ParenthesesEasy
- Maximum Subarray Min-ProductMedium
- Min StackMedium
- Minimum Number of Increments on Subarrays to Form a Target ArrayHard
- Minimum Remove to Make Valid ParenthesesMedium
- Next Greater Element IEasy
- Next Greater Element IIMedium
- Number of Students Unable to Eat LunchEasy
- Number of Visible People in a QueueHard
- Online Stock SpanMedium
- Remove All Adjacent Duplicates in String IIMedium
- Remove Duplicate LettersMedium
- Remove K DigitsMedium
- Remove Nodes From Linked ListMedium
- Removing Stars From a StringMedium
- Simplify PathMedium
- Sum of Subarray MinimumsMedium
- Ternary Expression ParserMedium
- Valid ParenthesesEasy
- Validate Stack SequencesMedium
- Verify Preorder Sequence in Binary Search TreeMedium
- Verify Preorder Serialization of a Binary TreeMedium
Two Pointers
- 3SumMedium
- 3Sum ClosestMedium
- 3Sum SmallerMedium
- 4SumMedium
- Append Characters to String to Make SubsequenceMedium
- Assign CookiesEasy
- Backspace String CompareEasy
- Bag of TokensMedium
- Boats to Save PeopleMedium
- Candy CrushMedium
- Compare Version NumbersMedium
- Container With Most WaterMedium
- Find First Palindromic String in the ArrayEasy
- HeatersMedium
- Intersection of Two ArraysEasy
- Intersection of Two Arrays IIEasy
- Intersection of Two Linked ListsEasy
- Interval List IntersectionsMedium
- Is SubsequenceEasy
- K-diff Pairs in an ArrayMedium
- Linked List Cycle IIMedium
- Longest String ChainMedium
- Longest Word in Dictionary through DeletingMedium
- Lowest Common Ancestor of a Binary Tree IIIMedium
- Maximum Number of Removable CharactersMedium
- Maximum Score of a Good SubarrayHard
- Maximum Twin Sum of a Linked ListMedium
- Merge Sorted ArrayEasy
- Merge Strings AlternatelyEasy
- Middle of the Linked ListEasy
- Minimum Length of String After Deleting Similar EndsMedium
- Minimum Number of Swaps to Make the String BalancedMedium
- Move ZeroesEasy
- Next Greater Element IIIMedium
- Next PermutationMedium
- Number of Subsequences That Satisfy the Given Sum ConditionMedium
- One Edit DistanceMedium
- Palindrome Linked ListEasy
- Partition ListMedium
- Print Immutable Linked List in ReverseMedium
- Push DominoesMedium
- Rearrange Array Elements by SignMedium
- Remove Duplicates from Sorted ArrayEasy
- Remove Duplicates from Sorted Array IIMedium
- Remove Duplicates from Sorted List IIMedium
- Reverse StringEasy
- Reverse String IIEasy
- Reverse Vowels of a StringEasy
- Reverse Words in a StringMedium
- Reverse Words in a String IIMedium
- Reverse Words in a String IIIEasy
- Rotate ArrayMedium
- Rotating the BoxMedium
- Shortest Unsorted Continuous SubarrayMedium
- Shortest Way to Form StringMedium
- Sort Array By ParityEasy
- Sort ListMedium
- Sort Transformed ArrayMedium
- Squares of a Sorted ArrayEasy
- String CompressionMedium
- Successful Pairs of Spells and PotionsMedium
- Swapping Nodes in a Linked ListMedium
- Trapping Rain WaterHard
- Two Sum II - Input Array Is SortedMedium
- Valid PalindromeEasy
- Valid Palindrome IIEasy
- Valid Triangle NumberMedium
- Valid Word AbbreviationEasy
1-D Dynamic Programming
- 4 Keys KeyboardMedium
- All Possible Full Binary TreesMedium
- Arithmetic Slices II - SubsequenceHard
- Best Team With No ConflictsMedium
- Bomb EnemyMedium
- Champagne TowerMedium
- Check if There is a Valid Partition For The ArrayMedium
- Cherry PickupHard
- Cherry Pickup IIHard
- Climbing StairsEasy
- Coin ChangeMedium
- Combination Sum IVMedium
- Concatenated WordsHard
- Count All Valid Pickup and Delivery OptionsHard
- Count Vowels PermutationHard
- Count Ways To Build Good StringsMedium
- Decode WaysMedium
- Delete and EarnMedium
- Delete Operation for Two StringsMedium
- Different Ways to Add ParenthesesMedium
- Fibonacci NumberEasy
- Flip String to Monotone IncreasingMedium
- Guess Number Higher or Lower IIMedium
- Handshakes That Don't CrossHard
- House RobberMedium
- House Robber IIMedium
- Integer BreakMedium
- K Inverse Pairs ArrayHard
- Knight DialerMedium
- Largest Divisible SubsetMedium
- Last Stone Weight IIMedium
- Longest Ideal SubsequenceMedium
- Longest Increasing SubsequenceMedium
- Longest Increasing Subsequence IIHard
- Longest Palindromic SubstringMedium
- Maximum Alternating Subsequence SumMedium
- Maximum Number of Points with CostMedium
- Maximum Product SubarrayMedium
- Maximum Value of K Coins From PilesHard
- Min Cost Climbing StairsEasy
- Minimum Cost For TicketsMedium
- Minimum Cost to Cut a StickHard
- Minimum Difficulty of a Job ScheduleHard
- Minimum Falling Path SumMedium
- Minimum Falling Path Sum IIHard
- Minimum Number of Days to Eat N OrangesHard
- Minimum One Bit Operations to Make Integers ZeroHard
- N-th Tribonacci NumberEasy
- Number of Dice Rolls With Target SumMedium
- Number of Longest Increasing SubsequenceMedium
- Number of Music PlaylistsHard
- Number of Sub-arrays With Odd SumMedium
- Number of Ways to Divide a Long CorridorHard
- Number of Ways to Form a Target String Given a DictionaryHard
- Number of Ways to Rearrange Sticks With K Sticks VisibleHard
- Number of Ways to Stay in the Same Place After Some StepsHard
- Optimal DivisionMedium
- Out of Boundary PathsMedium
- Paint FenceMedium
- Paint HouseMedium
- Paint House IIHard
- Painting the WallsHard
- Palindromic SubstringsMedium
- Partition Array for Maximum SumMedium
- Partition Equal Subset SumMedium
- Pascal's Triangle IIEasy
- Perfect SquaresMedium
- Predict the WinnerMedium
- Profitable SchemesHard
- Rotate FunctionMedium
- Shortest Common Supersequence Hard
- Solving Questions With BrainpowerMedium
- Split Array With Same AverageHard
- Stone GameMedium
- Stone Game IIMedium
- Stone Game IIIHard
- String Compression IIHard
- Student Attendance Record IIHard
- Super Ugly NumberMedium
- TriangleMedium
- Uncrossed LinesMedium
- Unique Substrings in Wraparound StringMedium
- Word BreakMedium
Arrays & Hashing
- 4Sum IIMedium
- Analyze User Website Visit PatternMedium
- Average Waiting TimeMedium
- Best Time to Buy and Sell Stock IIMedium
- Brick WallMedium
- Bulls and CowsMedium
- Check if Array Is Sorted and RotatedEasy
- Check if Move is LegalMedium
- Check If Two String Arrays are EquivalentEasy
- Circular SentenceEasy
- Concatenation of ArrayEasy
- Construct Quad TreeMedium
- Contains DuplicateEasy
- Contiguous ArrayMedium
- Convert an Array Into a 2D Array With ConditionsMedium
- Count and SayMedium
- Count Vowel Strings in RangesMedium
- Counting ElementsEasy
- Counting Words With a Given PrefixEasy
- Custom Sort StringMedium
- Design A LeaderboardMedium
- Design Compressed String IteratorEasy
- Design Parking SystemEasy
- Design Snake GameMedium
- Design Tic-Tac-ToeMedium
- Design Underground SystemMedium
- Destination CityEasy
- Diagonal TraverseMedium
- Encode and Decode StringsMedium
- Encode and Decode TinyURLMedium
- Find All Duplicates in an ArrayMedium
- Find All Numbers Disappeared in an ArrayEasy
- Find Anagram MappingsEasy
- Find Common CharactersEasy
- Find Lucky Integer in an ArrayEasy
- Find Pivot IndexEasy
- Find the Difference of Two ArraysEasy
- Find the Index of the First Occurrence in a StringEasy
- Find Words That Can Be Formed by CharactersEasy
- First Missing PositiveHard
- First Unique Character in a StringEasy
- First Unique NumberMedium
- Game of LifeMedium
- Grid GameMedium
- Group AnagramsMedium
- Group Shifted StringsMedium
- H-IndexMedium
- Height CheckerEasy
- Image SmootherEasy
- Isomorphic StringsEasy
- Kth Distinct String in an ArrayEasy
- Largest 3-Same-Digit Number in StringEasy
- Largest Local Values in a MatrixEasy
- Largest NumberMedium
- Largest Substring Between Two Equal CharactersEasy
- Largest Unique NumberEasy
- Length of Last WordEasy
- Lonely Pixel IMedium
- Longest Common PrefixEasy
- Longest Consecutive SequenceMedium
- Longest Strictly Increasing or Strictly Decreasing SubarrayEasy
- Majority ElementEasy
- Majority Element IIMedium
- Make Sum Divisible by PMedium
- Matrix Diagonal SumEasy
- Max Consecutive OnesEasy
- Maximum Ascending Subarray SumEasy
- Maximum Difference Between Even and Odd Frequency IEasy
- Maximum Number of BalloonsEasy
- Maximum Product Difference Between Two PairsEasy
- Maximum Score After Splitting a StringEasy
- Maximum Size Subarray Sum Equals kMedium
- Minimum Changes To Make Alternating Binary StringEasy
- Minimum Index of a Valid SplitMedium
- Minimum Number of Operations to Move All Balls to Each BoxMedium
- Minimum Penalty for a ShopMedium
- Missing RangesEasy
- Monotonic ArrayEasy
- Moving Average from Data StreamEasy
- Non-decreasing ArrayMedium
- Number of Senior CitizensEasy
- Number of Submatrices That Sum to TargetHard
- Number of Ways to Split ArrayMedium
- Pascal's TriangleEasy
- Path CrossingEasy
- Product of Array Except SelfMedium
- Queue Reconstruction by HeightMedium
- Range AdditionMedium
- Range Sum Query - ImmutableEasy
- Range Sum Query - MutableMedium
- Range Sum Query 2D - ImmutableMedium
- Ransom NoteEasy
- Redistribute Characters to Make All Strings EqualEasy
- Relative Sort ArrayEasy
- Remove Covered IntervalsMedium
- Remove ElementEasy
- Remove IntervalMedium
- Repeated DNA SequencesMedium
- Repeated Substring PatternEasy
- Replace Elements with Greatest Element on Right SideEasy
- Reveal Cards In Increasing OrderMedium
- Score of a StringEasy
- Sentence SimilarityEasy
- Sequential DigitsMedium
- Shift 2D GridEasy
- Shifting Letters IIMedium
- Single-Row KeyboardEasy
- Sort Array by Increasing FrequencyEasy
- Sort ColorsMedium
- Sort the Jumbled NumbersMedium
- Sort the PeopleEasy
- Sparse Matrix MultiplicationMedium
- Special Array IEasy
- String Matching in an ArrayEasy
- String to Integer (atoi)Medium
- Strobogrammatic Number IIMedium
- Subarray Sum Equals KMedium
- Subarray Sums Divisible by KMedium
- Summary RangesEasy
- Text JustificationHard
- Third Maximum NumberEasy
- Time Needed to Buy TicketsEasy
- Top K Frequent ElementsMedium
- Transpose MatrixEasy
- Two SumEasy
- Uncommon Words from Two SentencesEasy
- Unique Email AddressesEasy
- Valid AnagramEasy
- Valid SudokuMedium
- Valid Word SquareEasy
- Verifying an Alien DictionaryEasy
- Widest Vertical Area Between Two Points Containing No PointsEasy
- Word PatternEasy
- Word SubsetsMedium
- Zigzag IteratorMedium
Bit Manipulation
- Add BinaryEasy
- Add to Array-Form of IntegerEasy
- Bitwise AND of Numbers RangeMedium
- Check If a String Contains All Binary Codes of Size KMedium
- Count the Number of Consistent StringsEasy
- Count Triplets That Can Form Two Arrays of Equal XORMedium
- Counting BitsEasy
- Divide Array Into Equal PairsEasy
- Find the DifferenceEasy
- Hamming DistanceEasy
- K-th Symbol in GrammarMedium
- Maximum Product of Word LengthsMedium
- Minimum Array EndMedium
- Missing NumberEasy
- Naming a CompanyHard
- Number ComplementEasy
- Number of 1 BitsEasy
- Palindrome PermutationEasy
- Power of FourEasy
- Power of TwoEasy
- Reverse BitsEasy
- Reverse IntegerMedium
- Set MismatchEasy
- Shuffle the ArrayEasy
- Single NumberEasy
- Single Number IIMedium
- Single Number IIIMedium
- Sum of Two IntegersMedium
- Total Hamming DistanceMedium
- Unique Length-3 Palindromic SubsequencesMedium
- UTF-8 ValidationMedium
Tries
- Add Bold Tag in StringMedium
- Count Prefix and Suffix Pairs IEasy
- Design Add and Search Words Data StructureMedium
- Design Search Autocomplete SystemHard
- Extra Characters in a StringMedium
- Implement Trie (Prefix Tree)Medium
- K-th Smallest in Lexicographical OrderHard
- Lexicographical NumbersMedium
- Prefix and Suffix SearchHard
- Remove Sub-Folders from the FilesystemMedium
- Search Suggestions SystemMedium
- Word Break IIHard
- Word Search IIHard
Math & Geometry
- Add DigitsEasy
- Add StringsEasy
- Armstrong NumberEasy
- Bulb SwitcherMedium
- Calculate Money in Leetcode BankEasy
- Complex Number MultiplicationMedium
- Confusing NumberEasy
- Continuous Subarray SumMedium
- Count Number of Bad PairsMedium
- Count Odd Numbers in an Interval RangeEasy
- Count of Matches in TournamentEasy
- Count PrimesMedium
- Count Substrings with Only One Distinct LetterEasy
- Detect SquaresMedium
- Distribute Candies Among Children IIMedium
- Excel Sheet Column NumberEasy
- Excel Sheet Column TitleEasy
- Factorial Trailing ZeroesMedium
- Find Missing and Repeated ValuesEasy
- Find Missing ObservationsMedium
- Fizz BuzzEasy
- Fraction to Recurring DecimalMedium
- Greatest Common Divisor of StringsEasy
- Guess the Majority in a Hidden ArrayMedium
- Happy NumberEasy
- Insert Delete GetRandom O(1)Medium
- Integer to RomanMedium
- Max Points on a LineHard
- Minimum Moves to Equal Array ElementsMedium
- Minimum Moves to Equal Array Elements IIMedium
- Minimum Time DifferenceMedium
- Missing Number In Arithmetic ProgressionEasy
- Multiply StringsMedium
- Number of BoomerangsMedium
- Number of Good PairsEasy
- Number of Laser Beams in a BankMedium
- Number of Pairs of Interchangeable RectanglesMedium
- Number of Zero-Filled SubarraysMedium
- Palindrome NumberEasy
- Perform String ShiftsEasy
- Plus OneEasy
- Pow(x, n)Medium
- Power of ThreeEasy
- Rectangle AreaMedium
- Robot Bounded In CircleMedium
- Roman to IntegerEasy
- Rotate ImageMedium
- Set Matrix ZeroesMedium
- Sign of the Product of an ArrayEasy
- Spiral MatrixMedium
- Spiral Matrix IIMedium
- Sum of Absolute Differences in a Sorted ArrayMedium
- Ugly NumberEasy
- Valid SquareMedium
- Zigzag ConversionMedium
Linked List
- Add Two NumbersMedium
- Convert Sorted List to Binary Search TreeMedium
- Copy List with Random PointerMedium
- Delete N Nodes After M Nodes of a Linked ListEasy
- Delete Node in a Linked ListMedium
- Design Circular QueueMedium
- Design HashMapEasy
- Design HashSetEasy
- Design Linked ListMedium
- Find the Duplicate NumberMedium
- Insert Greatest Common Divisors in Linked ListMedium
- Insert into a Sorted Circular Linked ListMedium
- Insertion Sort ListMedium
- LFU CacheHard
- Linked List CycleEasy
- LRU CacheMedium
- Merge In Between Linked ListsMedium
- Merge k Sorted ListsHard
- Merge Two Sorted ListsEasy
- Odd Even Linked ListMedium
- Plus One Linked ListMedium
- Remove Duplicates from Sorted ListEasy
- Remove Linked List ElementsEasy
- Remove Nth Node From End of ListMedium
- Reorder ListMedium
- Reverse Linked ListEasy
- Reverse Linked List IIMedium
- Reverse Nodes in k-GroupHard
- Rotate ListMedium
- Split Linked List in PartsMedium
- Swap Nodes in PairsMedium
Advanced Graphs
- Alien DictionaryHard
- Cheapest Flights Within K StopsMedium
- Find Critical and Pseudo-Critical Edges in Minimum Spanning TreeHard
- Min Cost to Connect All PointsMedium
- Network Delay TimeMedium
- Path with Maximum ProbabilityMedium
- Path With Minimum EffortMedium
- Reconstruct ItineraryHard
- Remove Max Number of Edges to Keep Graph Fully TraversableHard
- Swim in Rising WaterHard
Sliding Window
- Arithmetic SlicesMedium
- Best Time to Buy and Sell StockEasy
- Binary Subarrays With SumMedium
- Contains Duplicate IIEasy
- Count Subarrays Where Max Element Appears at Least K TimesMedium
- Find All Anagrams in a StringMedium
- Find K Closest ElementsMedium
- Find K-Length Substrings With No Repeated CharactersMedium
- Frequency of the Most Frequent ElementMedium
- Fruit Into BasketsMedium
- Get Equal Substrings Within BudgetMedium
- Grumpy Bookstore OwnerMedium
- Jump Game VIIMedium
- Length of Longest Subarray With at Most K FrequencyMedium
- Longest Repeating Character ReplacementMedium
- Longest Substring with At Least K Repeating CharactersMedium
- Longest Substring with At Most K Distinct CharactersMedium
- Longest Substring with At Most Two Distinct CharactersMedium
- Longest Substring Without Repeating CharactersMedium
- Max Consecutive Ones IIMedium
- Max Consecutive Ones IIIMedium
- Maximum Average Subarray IEasy
- Maximum Number of Vowels in a Substring of Given LengthMedium
- Maximum Points You Can Obtain from CardsMedium
- Minimum Difference Between Highest and Lowest of K ScoresEasy
- Minimum Number of Flips to Make the Binary String AlternatingMedium
- Minimum Number of Operations to Make Array ContinuousHard
- Minimum Operations to Reduce X to ZeroMedium
- Minimum Recolors to Get K Consecutive Black BlocksEasy
- Minimum Size Subarray SumMedium
- Minimum Window SubstringHard
- New 21 GameMedium
- Number of Sub-arrays of Size K and Average Greater than or Equal to ThresholdMedium
- Permutation in StringMedium
- Sliding Window MaximumHard
- Subarray Product Less Than KMedium
- Subarrays with K Different IntegersHard
Binary Search
- Arranging CoinsEasy
- Binary SearchEasy
- Capacity To Ship Packages Within D DaysMedium
- Check If a Number Is Majority Element in a Sorted ArrayEasy
- Count Complete Tree NodesEasy
- Design Hit CounterMedium
- Divide ChocolateHard
- Find First and Last Position of Element in Sorted ArrayMedium
- Find in Mountain ArrayHard
- Find Minimum in Rotated Sorted ArrayMedium
- Find Peak ElementMedium
- Find Right IntervalMedium
- Find Smallest Common Element in All RowsMedium
- Find the Index of the Large IntegerMedium
- Find the Longest Valid Obstacle Course at Each PositionHard
- First Bad VersionEasy
- Guess Number Higher or LowerEasy
- H-Index IIMedium
- Koko Eating BananasMedium
- Kth Smallest Product of Two Sorted ArraysHard
- Maximum Average Subarray IIHard
- Maximum Profit in Job SchedulingHard
- Median of Two Sorted ArraysHard
- Minimize Maximum of ArrayMedium
- Minimize the Maximum Difference of PairsMedium
- Missing Element in Sorted ArrayMedium
- My Calendar IMedium
- Number of Flowers in Full BloomHard
- Populating Next Right Pointers in Each NodeMedium
- Random Pick with WeightMedium
- Russian Doll EnvelopesHard
- Search a 2D MatrixMedium
- Search a 2D Matrix IIMedium
- Search in Rotated Sorted ArrayMedium
- Search in Rotated Sorted Array IIMedium
- Search Insert PositionEasy
- Single Element in a Sorted ArrayMedium
- Special Array With X Elements Greater Than or Equal XEasy
- Split Array Largest SumHard
- Sqrt(x)Easy
- Time Based Key-Value StoreMedium
- Valid Perfect SquareEasy
Greedy
- Array With Elements Not Equal to Average of NeighborsMedium
- Buy Two ChocolatesEasy
- Can Place FlowersEasy
- CandyHard
- Divide Array Into Arrays With Max DifferenceMedium
- Dota2 SenateMedium
- Eliminate Maximum Number of MonstersMedium
- Find Polygon With the Largest PerimeterMedium
- Find the Maximum Sum of Node ValuesHard
- Gas StationMedium
- Hand of StraightsMedium
- Increasing Triplet SubsequenceMedium
- Integer ReplacementMedium
- Jump GameMedium
- Jump Game IIMedium
- Largest Odd Number in StringEasy
- Largest Submatrix With RearrangementsMedium
- Least Number of Unique Integers after K RemovalsMedium
- Lemonade ChangeEasy
- Longest PalindromeEasy
- Longest Turbulent SubarrayMedium
- Maximum Distance in ArraysMedium
- Maximum Element After Decreasing and RearrangingMedium
- Maximum Frequency After Subarray OperationMedium
- Maximum Length of Pair ChainMedium
- Maximum Odd Binary NumberEasy
- Maximum SubarrayMedium
- Maximum Sum Circular SubarrayMedium
- Merge Triplets to Form Target TripletMedium
- Minimum Deletions to Make Character Frequencies UniqueMedium
- Minimum Number of Arrows to Burst BalloonsMedium
- Minimum Number of Moves to Seat EveryoneEasy
- Minimum Number of Operations to Make Array EmptyMedium
- Minimum Time to Make Rope ColorfulMedium
- Optimal Partition of StringMedium
- Partition LabelsMedium
- Remove Colored Pieces if Both Neighbors are the Same ColorMedium
- Score After Flipping MatrixMedium
- Two City SchedulingMedium
- Valid Parenthesis StringMedium
- Wiggle SortMedium
- Wiggle SubsequenceMedium
Trees
- Balanced Binary TreeEasy
- Binary Tree Inorder TraversalEasy
- Binary Tree Level Order TraversalMedium
- Binary Tree Maximum Path SumHard
- Binary Tree Right Side ViewMedium
- Binary Tree Zigzag Level Order TraversalMedium
- Construct Binary Tree from Inorder and Postorder TraversalMedium
- Construct Binary Tree from Preorder and Inorder TraversalMedium
- Convert Sorted Array to Binary Search TreeEasy
- Count Good Nodes in Binary TreeMedium
- Delete Node in a BSTMedium
- Diameter of Binary TreeEasy
- Insert into a Binary Search TreeMedium
- Invert Binary TreeEasy
- Kth Smallest Element in a BSTMedium
- Lowest Common Ancestor of a Binary Search TreeMedium
- Maximum Depth of Binary TreeEasy
- Path SumEasy
- Same TreeEasy
- Search in a Binary Search TreeEasy
- Serialize and Deserialize Binary TreeHard
- Subtree of Another TreeEasy
- Symmetric TreeEasy
- Unique Binary Search TreesMedium
- Unique Binary Search Trees IIMedium
- Validate Binary Search TreeMedium
Backtracking
- Beautiful ArrangementMedium
- Combination SumMedium
- Combination Sum IIMedium
- Combination Sum IIIMedium
- CombinationsMedium
- Count Numbers with Unique DigitsMedium
- Factor CombinationsMedium
- Find Unique Binary StringMedium
- Gray CodeMedium
- Letter Combinations of a Phone NumberMedium
- Matchsticks to SquareMedium
- Maximize Score After N OperationsHard
- Maximum Length of a Concatenated String with Unique CharactersMedium
- Maximum Product of the Length of Two Palindromic SubsequencesMedium
- Maximum Score Words Formed by LettersHard
- N-QueensHard
- N-Queens IIHard
- Non-decreasing SubsequencesMedium
- Palindrome PartitioningMedium
- Partition to K Equal Sum SubsetsMedium
- Path with Maximum GoldMedium
- PermutationsMedium
- Permutations IIMedium
- Restore IP AddressesMedium
- Splitting a String Into Descending Consecutive ValuesMedium
- Stickers to Spell WordHard
- SubsetsMedium
- Subsets IIMedium
- Sum of All Subset XOR TotalsEasy
- The Number of Beautiful SubsetsMedium
- Word SearchMedium
2-D Dynamic Programming
- Best Time to Buy and Sell Stock with CooldownMedium
- Burst BalloonsHard
- Coin Change IIMedium
- Distinct SubsequencesHard
- Edit DistanceHard
- Interleaving StringMedium
- Longest Common SubsequenceMedium
- Longest Increasing Path in a MatrixHard
- Longest Palindromic SubsequenceMedium
- Maximal SquareMedium
- Minimum Path SumMedium
- Ones and ZeroesMedium
- Regular Expression MatchingHard
- Target SumMedium
- Unique PathsMedium
- Unique Paths IIMedium
Heap / Priority Queue
- Campus BikesMedium
- Car PoolingMedium
- Closest Binary Search Tree Value IIHard
- Constrained Subsequence SumHard
- Design a Food Rating SystemMedium
- Design TwitterMedium
- Final Array State After K Multiplication Operations IEasy
- Find K Pairs with Smallest SumsMedium
- Find Median from Data StreamHard
- Find the Kth Largest Integer in the ArrayMedium
- Find the Safest Path in a GridMedium
- Furthest Building You Can ReachMedium
- High FiveEasy
- IPOHard
- K Closest Points to OriginMedium
- Kth Largest Element in a StreamEasy
- Kth Largest Element in an ArrayMedium
- Kth Smallest Element in a Sorted MatrixMedium
- Last Stone WeightEasy
- Longest Continuous Subarray With Absolute Diff Less Than or Equal to LimitMedium
- Longest Happy StringMedium
- Maximize Y‑Sum by Picking a Triplet of Distinct X‑ValuesMedium
- Maximum Number of OnesHard
- Maximum Performance of a TeamHard
- Maximum Subsequence ScoreMedium
- Meeting Rooms IIIHard
- Minimize Deviation in ArrayHard
- Minimum Cost to Connect SticksMedium
- Minimum Cost to Hire K WorkersHard
- Process Tasks Using ServersMedium
- Put Marbles in BagsHard
- Rearrange String k Distance ApartHard
- Reorganize StringMedium
- Seat Reservation ManagerMedium
- Single-Threaded CPUMedium
- Sliding Window MedianHard
- Sort an ArrayMedium
- Sort Characters By FrequencyMedium
- Take Gifts From the Richest PileEasy
- Task SchedulerMedium
- The Maze IIMedium
- The Maze IIIHard
- Ugly Number IIMedium