Talentd
FleetCode
Make and follow sheets.Sign in

Solutions, explained

Every approach from brute force to the best one, with code in Python, Java, C++ and more.

Has video
Breadth-First SearchArray2,120String854Hash Table774Math650Dynamic Programming613Sorting495Greedy462Binary Search335Depth-First Search321Database307Matrix267Bit Manipulation264All topics

252 results

Same Tree

100.Same Tree

EasyBinary TreeBreadth-First SearchDepth-First Search68.0% acceptance9 companiesVideo
Path Sum

112.Path Sum

EasyBinary TreeBreadth-First SearchDepth-First Search55.8% acceptance9 companiesVideo
Zuma Game

488.Zuma Game

HardBreadth-First SearchDynamic ProgrammingMemoization29.4% acceptance7 companiesVideo
The Maze

490.The Maze

MediumArrayBreadth-First SearchDepth-First Search60.4% acceptance13 companiesPremium elsewhere, free hereVideo
The Maze III

499.The Maze III

HardArrayBreadth-First SearchDepth-First Search52.3% acceptance1 companyPremium elsewhere, free hereVideo
The Maze II

505.The Maze II

MediumArrayBreadth-First SearchDepth-First Search55.0% acceptance5 companiesPremium elsewhere, free hereVideo
Showing 1–50 of 252

How to use these solutions

Each solution breaks the problem into approaches, usually from brute force to the best one, and explains why each works. Code comes in Python, Java, C++ and other languages. Knowing why an approach works matters more in an interview than remembering the code.

  • Try the problem first. Give it at least 20 minutes before you open the solution.
  • Read every approach. The brute force shows you the problem; the faster ones show the pattern.
  • Check the complexity. Note the time and space of each approach and what makes the difference.
  • Write it yourself. Close the solution and code it from memory in the editor.
  • Come back in a week. Solving it again later is what makes the pattern stick.