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
Array2,100String848Hash Table764Math642Dynamic Programming606Sorting493Greedy457Binary Search334Depth-First Search318Database302Matrix267Bit Manipulation263All topics

With video · 3,856 results

Jump Game

55.Jump Game

MediumArrayDynamic ProgrammingGreedy41.2% acceptance33 companiesVideo
Sqrt(x)

69.Sqrt(x)

EasyBinary SearchMath42.2% acceptance17 companiesVideo
Subsets

78.Subsets

MediumArrayBacktrackingBit Manipulation82.7% acceptance21 companiesVideo
Gray Code

89.Gray Code

MediumBacktrackingBit ManipulationMath66.2% acceptance5 companiesVideo
Same Tree

100.Same Tree

EasyBinary TreeBreadth-First SearchDepth-First Search68.0% acceptance9 companiesVideo
Showing 51–100 of 3,856

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.