Sulba
000 / 100

Algorithms · Coding interview prep

Algorithms,visualised.

150 problems, each with a clear explanation, a step-by-step animation and solutions in 6 languages.

Contains Duplicate · O(n) time18 patterns6 languages
Problems
150
Patterns
18
Languages
6
0/150

Your progress

Open any problem to begin, and mark it understood when the idea clicks.

Easy0/28
Medium0/101
Hard0/21

18 · Patterns

Patterns

Each pattern is one idea that cracks a family of problems. Learn the idea once; use it everywhere it applies.

  1. 01Arrays & HashingTrade memory for time: a hash map answers “have I seen this?” in one step instead of a search.9 problems
  2. 02Two PointersTwo indices walking toward each other (or together) through ordered data, each step ruling out a whole row of possibilities.5 problems
  3. 03Sliding WindowA stretch of the array that grows at one end and shrinks at the other, so every contiguous stretch is considered without starting over.6 problems
  4. 04StackLast in, first out: keep the things still waiting to be matched or resolved, and deal with the newest first.7 problems
  5. 05Binary SearchHalve the possibilities with every question: whenever the answer lies on one side of a line you can test, log n steps find it.7 problems
  6. 06Linked ListNodes that know only the next one: every trick is about which arrows to redirect, in what order, without losing the rest of the chain.11 problems
  7. 07TreesA tree is a node and two smaller trees. Solve it for one node, trust the same function on the children, and the whole tree is solved.15 problems
  8. 08TriesStore words letter by letter down a tree, so every word sharing a beginning shares the path — and a prefix is found in as many steps as it has letters.3 problems
  9. 09Heap / Priority QueueA heap always knows its smallest (or largest) item, and adding or removing one costs only log n — the tool for “the best k” and “what comes next”.7 problems
  10. 10BacktrackingBuild an answer one choice at a time; when a choice leads nowhere, undo it and try the next. Every answer is a path through a tree of choices.9 problems
  11. 11GraphsThings joined to things — cells on a map, courses by their prerequisites, words by one letter. Depth-first goes deep along one path; breadth-first spreads out one ring at a time.13 problems
  12. 12Advanced GraphsWeighted edges and ordering constraints: shortest paths with Dijkstra and Bellman–Ford, the cheapest network with Prim, and a route that uses every edge once.6 problems
  13. 131-D Dynamic ProgrammingWhen the answer for n is built from answers for smaller n, compute each one once and keep it. A row of remembered answers, filled in order.12 problems
  14. 142-D Dynamic ProgrammingTwo things change at once — a position in each of two strings, a row and a column, an index and an amount — so the remembered answers form a table.11 problems
  15. 15GreedyMake the choice that looks best right now and never revisit it — correct only when you can argue no later step would ever want it undone.8 problems
  16. 16IntervalsStretches of a line, from a start to an end. Sort them by one end, and overlaps become a question about neighbours.6 problems
  17. 17Math & GeometryA little arithmetic or a picture of the grid turns a fiddly simulation into a few lines: rotations as flips, powers by squaring, digits by place value.8 problems
  18. 18Bit ManipulationNumbers are rows of 0s and 1s, and a handful of operations — AND, OR, XOR, shifts — work on every bit at once.7 problems

150 · All problems

All problems

Filter by pattern, difficulty or where you are with it.

  1. 1Contains DuplicateArrays & HashingEasyNot started
  2. 2Valid AnagramArrays & HashingEasyNot started
  3. 3Two SumArrays & HashingEasyNot started
  4. 4Group AnagramsArrays & HashingMediumNot started
  5. 5Top K Frequent ElementsArrays & HashingMediumNot started
  6. 6Product of Array Except SelfArrays & HashingMediumNot started
  7. 7Valid SudokuArrays & HashingMediumNot started
  8. 8Encode and Decode StringsArrays & HashingMediumNot started
  9. 9Longest Consecutive SequenceArrays & HashingMediumNot started
  10. 10Valid PalindromeTwo PointersEasyNot started
  11. 11Two Sum II – Input Array Is SortedTwo PointersMediumNot started
  12. 123SumTwo PointersMediumNot started
  13. 13Container With Most WaterTwo PointersMediumNot started
  14. 14Trapping Rain WaterTwo PointersHardNot started
  15. 15Best Time to Buy and Sell StockSliding WindowEasyNot started
  16. 16Longest Substring Without Repeating CharactersSliding WindowMediumNot started
  17. 17Longest Repeating Character ReplacementSliding WindowMediumNot started
  18. 18Permutation in StringSliding WindowMediumNot started
  19. 19Minimum Window SubstringSliding WindowHardNot started
  20. 20Sliding Window MaximumSliding WindowHardNot started
  21. 21Valid ParenthesesStackEasyNot started
  22. 22Min StackStackMediumNot started
  23. 23Evaluate Reverse Polish NotationStackMediumNot started
  24. 24Generate ParenthesesStackMediumNot started
  25. 25Daily TemperaturesStackMediumNot started
  26. 26Car FleetStackMediumNot started
  27. 27Largest Rectangle in HistogramStackHardNot started
  28. 28Binary SearchBinary SearchEasyNot started
  29. 29Search a 2D MatrixBinary SearchMediumNot started
  30. 30Koko Eating BananasBinary SearchMediumNot started
  31. 31Find Minimum in Rotated Sorted ArrayBinary SearchMediumNot started
  32. 32Search in Rotated Sorted ArrayBinary SearchMediumNot started
  33. 33Time Based Key-Value StoreBinary SearchMediumNot started
  34. 34Median of Two Sorted ArraysBinary SearchHardNot started
  35. 35Reverse Linked ListLinked ListEasyNot started
  36. 36Merge Two Sorted ListsLinked ListEasyNot started
  37. 37Reorder ListLinked ListMediumNot started
  38. 38Remove Nth Node From End of ListLinked ListMediumNot started
  39. 39Copy List with Random PointerLinked ListMediumNot started
  40. 40Add Two NumbersLinked ListMediumNot started
  41. 41Linked List CycleLinked ListEasyNot started
  42. 42Find the Duplicate NumberLinked ListMediumNot started
  43. 43LRU CacheLinked ListMediumNot started
  44. 44Merge k Sorted ListsLinked ListHardNot started
  45. 45Reverse Nodes in k-GroupLinked ListHardNot started
  46. 46Invert Binary TreeTreesEasyNot started
  47. 47Maximum Depth of Binary TreeTreesEasyNot started
  48. 48Diameter of Binary TreeTreesEasyNot started
  49. 49Balanced Binary TreeTreesEasyNot started
  50. 50Same TreeTreesEasyNot started
  51. 51Subtree of Another TreeTreesEasyNot started
  52. 52Lowest Common Ancestor of a Binary Search TreeTreesMediumNot started
  53. 53Binary Tree Level Order TraversalTreesMediumNot started
  54. 54Binary Tree Right Side ViewTreesMediumNot started
  55. 55Count Good Nodes in Binary TreeTreesMediumNot started
  56. 56Validate Binary Search TreeTreesMediumNot started
  57. 57Kth Smallest Element in a BSTTreesMediumNot started
  58. 58Construct Binary Tree from Preorder and Inorder TraversalTreesMediumNot started
  59. 59Binary Tree Maximum Path SumTreesHardNot started
  60. 60Serialize and Deserialize Binary TreeTreesHardNot started
  61. 61Implement Trie (Prefix Tree)TriesMediumNot started
  62. 62Design Add and Search Words Data StructureTriesMediumNot started
  63. 63Word Search IITriesHardNot started
  64. 64Kth Largest Element in a StreamHeap / Priority QueueEasyNot started
  65. 65Last Stone WeightHeap / Priority QueueEasyNot started
  66. 66K Closest Points to OriginHeap / Priority QueueMediumNot started
  67. 67Kth Largest Element in an ArrayHeap / Priority QueueMediumNot started
  68. 68Task SchedulerHeap / Priority QueueMediumNot started
  69. 69Design TwitterHeap / Priority QueueMediumNot started
  70. 70Find Median from Data StreamHeap / Priority QueueHardNot started
  71. 71SubsetsBacktrackingMediumNot started
  72. 72Combination SumBacktrackingMediumNot started
  73. 73PermutationsBacktrackingMediumNot started
  74. 74Subsets IIBacktrackingMediumNot started
  75. 75Combination Sum IIBacktrackingMediumNot started
  76. 76Word SearchBacktrackingMediumNot started
  77. 77Palindrome PartitioningBacktrackingMediumNot started
  78. 78Letter Combinations of a Phone NumberBacktrackingMediumNot started
  79. 79N-QueensBacktrackingHardNot started
  80. 80Number of IslandsGraphsMediumNot started
  81. 81Clone GraphGraphsMediumNot started
  82. 82Max Area of IslandGraphsMediumNot started
  83. 83Pacific Atlantic Water FlowGraphsMediumNot started
  84. 84Surrounded RegionsGraphsMediumNot started
  85. 85Rotting OrangesGraphsMediumNot started
  86. 86Walls and GatesGraphsMediumNot started
  87. 87Course ScheduleGraphsMediumNot started
  88. 88Course Schedule IIGraphsMediumNot started
  89. 89Redundant ConnectionGraphsMediumNot started
  90. 90Number of Connected Components in an Undirected GraphGraphsMediumNot started
  91. 91Graph Valid TreeGraphsMediumNot started
  92. 92Word LadderGraphsHardNot started
  93. 93Reconstruct ItineraryAdvanced GraphsHardNot started
  94. 94Min Cost to Connect All PointsAdvanced GraphsMediumNot started
  95. 95Network Delay TimeAdvanced GraphsMediumNot started
  96. 96Swim in Rising WaterAdvanced GraphsHardNot started
  97. 97Alien DictionaryAdvanced GraphsHardNot started
  98. 98Cheapest Flights Within K StopsAdvanced GraphsMediumNot started
  99. 99Climbing Stairs1-D Dynamic ProgrammingEasyNot started
  100. 100Min Cost Climbing Stairs1-D Dynamic ProgrammingEasyNot started
  101. 101House Robber1-D Dynamic ProgrammingMediumNot started
  102. 102House Robber II1-D Dynamic ProgrammingMediumNot started
  103. 103Longest Palindromic Substring1-D Dynamic ProgrammingMediumNot started
  104. 104Palindromic Substrings1-D Dynamic ProgrammingMediumNot started
  105. 105Decode Ways1-D Dynamic ProgrammingMediumNot started
  106. 106Coin Change1-D Dynamic ProgrammingMediumNot started
  107. 107Maximum Product Subarray1-D Dynamic ProgrammingMediumNot started
  108. 108Word Break1-D Dynamic ProgrammingMediumNot started
  109. 109Longest Increasing Subsequence1-D Dynamic ProgrammingMediumNot started
  110. 110Partition Equal Subset Sum1-D Dynamic ProgrammingMediumNot started
  111. 111Unique Paths2-D Dynamic ProgrammingMediumNot started
  112. 112Longest Common Subsequence2-D Dynamic ProgrammingMediumNot started
  113. 113Best Time to Buy and Sell Stock with Cooldown2-D Dynamic ProgrammingMediumNot started
  114. 114Coin Change II2-D Dynamic ProgrammingMediumNot started
  115. 115Target Sum2-D Dynamic ProgrammingMediumNot started
  116. 116Interleaving String2-D Dynamic ProgrammingMediumNot started
  117. 117Longest Increasing Path in a Matrix2-D Dynamic ProgrammingHardNot started
  118. 118Distinct Subsequences2-D Dynamic ProgrammingHardNot started
  119. 119Edit Distance2-D Dynamic ProgrammingMediumNot started
  120. 120Burst Balloons2-D Dynamic ProgrammingHardNot started
  121. 121Regular Expression Matching2-D Dynamic ProgrammingHardNot started
  122. 122Maximum SubarrayGreedyMediumNot started
  123. 123Jump GameGreedyMediumNot started
  124. 124Jump Game IIGreedyMediumNot started
  125. 125Gas StationGreedyMediumNot started
  126. 126Hand of StraightsGreedyMediumNot started
  127. 127Merge Triplets to Form Target TripletGreedyMediumNot started
  128. 128Partition LabelsGreedyMediumNot started
  129. 129Valid Parenthesis StringGreedyMediumNot started
  130. 130Insert IntervalIntervalsMediumNot started
  131. 131Merge IntervalsIntervalsMediumNot started
  132. 132Non-overlapping IntervalsIntervalsMediumNot started
  133. 133Meeting RoomsIntervalsEasyNot started
  134. 134Meeting Rooms IIIntervalsMediumNot started
  135. 135Minimum Interval to Include Each QueryIntervalsHardNot started
  136. 136Rotate ImageMath & GeometryMediumNot started
  137. 137Spiral MatrixMath & GeometryMediumNot started
  138. 138Set Matrix ZeroesMath & GeometryMediumNot started
  139. 139Happy NumberMath & GeometryEasyNot started
  140. 140Plus OneMath & GeometryEasyNot started
  141. 141Pow(x, n)Math & GeometryMediumNot started
  142. 142Multiply StringsMath & GeometryMediumNot started
  143. 143Detect SquaresMath & GeometryMediumNot started
  144. 144Single NumberBit ManipulationEasyNot started
  145. 145Number of 1 BitsBit ManipulationEasyNot started
  146. 146Counting BitsBit ManipulationEasyNot started
  147. 147Reverse BitsBit ManipulationEasyNot started
  148. 148Missing NumberBit ManipulationEasyNot started
  149. 149Sum of Two IntegersBit ManipulationMediumNot started
  150. 150Reverse IntegerBit ManipulationMediumNot started
Showing 150 of 150