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
Array1,156Hash Table457String425Math316Greedy314Dynamic Programming302Sorting293Depth-First Search205Binary Search182Breadth-First Search163Matrix157Tree156All topics

Medium · With video · 302 results

Jump Game

55.Jump Game

MediumArrayDynamic ProgrammingGreedy41.2% acceptance33 companiesVideo
Triangle

120.Triangle

MediumArrayDynamic Programming59.9% acceptance11 companiesVideo
Paint House

256.Paint House

MediumArrayDynamic Programming64.3% acceptance8 companiesPremium elsewhere, free hereVideo
Paint Fence

276.Paint Fence

MediumDynamic Programming48.3% acceptance4 companiesPremium elsewhere, free hereVideo
Flip Game II

294.Flip Game II

MediumBacktrackingDynamic ProgrammingGame Theory52.2% acceptance2 companiesPremium elsewhere, free hereVideo
Bomb Enemy

361.Bomb Enemy

MediumArrayDynamic ProgrammingMatrix52.8% acceptance2 companiesPremium elsewhere, free hereVideo
Can I Win

464.Can I Win

MediumBit ManipulationBitmaskDynamic Programming31.7% acceptance4 companiesVideo
Showing 1–50 of 302

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.