Skip to main content

Solutions & Explanations

Browse 4,029+ detailed solutions with multiple approaches, code in Python, Java, C++ and more.

4,029 Solutions961 Easy2102 Medium966 Hard
#401Easy

Binary Watch

BacktrackingBit Manipulation

Acceptance: 65.9%

#402Medium

Remove K Digits

GreedyMonotonic StackStack+1

Acceptance: 37.7%

#403Hard

Frog Jump

ArrayDynamic Programming

Acceptance: 47.2%

#404Easy

Sum of Left Leaves

Binary TreeBreadth-First SearchDepth-First Search+1

Acceptance: 63.1%

#405Easy

Convert a Number to Hexadecimal

Bit ManipulationMath

Acceptance: 54.8%

#406Medium

Queue Reconstruction by Height

ArrayBinary Indexed TreeSegment Tree+1

Acceptance: 74.6%

#407Hard

Trapping Rain Water II

ArrayBreadth-First SearchHeap (Priority Queue)+1

Acceptance: 64.0%

#408Easy

Valid Word Abbreviation

StringTwo Pointers

Acceptance: 37.0%

#409Easy

Longest Palindrome

GreedyHash TableString

Acceptance: 55.9%

#410Hard

Split Array Largest Sum

ArrayBinary SearchDynamic Programming+2

Acceptance: 61.2%

#411Hard

Minimum Unique Word Abbreviation

ArrayBacktrackingBit Manipulation+1

Acceptance: 40.5%

#412Easy

Fizz Buzz

MathSimulationString

Acceptance: 75.9%

#413Medium

Arithmetic Slices

ArrayDynamic ProgrammingSliding Window

Acceptance: 65.0%

#414Easy

Third Maximum Number

ArraySorting

Acceptance: 40.3%

#415Easy

Add Strings

MathSimulationString

Acceptance: 52.1%

#416Medium

Partition Equal Subset Sum

ArrayDynamic Programming

Acceptance: 49.9%

#417Medium

Pacific Atlantic Water Flow

ArrayBreadth-First SearchDepth-First Search+1

Acceptance: 61.3%

#418Medium

Sentence Screen Fitting

ArrayDynamic ProgrammingString

Acceptance: 36.3%

#419Medium

Battleships in a Board

ArrayDepth-First SearchMatrix

Acceptance: 77.4%

#420Hard

Strong Password Checker

GreedyHeap (Priority Queue)String

Acceptance: 16.1%

#421Medium

Maximum XOR of Two Numbers in an Array

ArrayBit ManipulationHash Table+1

Acceptance: 53.8%

#422Easy

Valid Word Square

ArrayMatrix

Acceptance: 42.9%

#423Medium

Reconstruct Original Digits from English

Hash TableMathString

Acceptance: 52.8%

#424Medium

Longest Repeating Character Replacement

Hash TableSliding WindowString

Acceptance: 60.4%

#425Hard

Word Squares

ArrayBacktrackingString+1

Acceptance: 54.7%

#426Medium

Convert Binary Search Tree to Sorted Doubly Linked List

Binary Search TreeBinary TreeDepth-First Search+4

Acceptance: 65.2%

#427Medium

Construct Quad Tree

ArrayDivide and ConquerMatrix+1

Acceptance: 78.2%

#428Hard

Serialize and Deserialize N-ary Tree

Breadth-First SearchDepth-First SearchString+1

Acceptance: 68.7%

#429Medium

N-ary Tree Level Order Traversal

Breadth-First SearchTree

Acceptance: 71.6%

#430Medium

Flatten a Multilevel Doubly Linked List

Depth-First SearchDoubly-Linked ListLinked List

Acceptance: 63.3%

#431Hard

Encode N-ary Tree to Binary Tree

Binary TreeBreadth-First SearchDepth-First Search+2

Acceptance: 80.6%

#432Hard

All O`one Data Structure

DesignDoubly-Linked ListHash Table+1

Acceptance: 44.2%

#433Medium

Minimum Genetic Mutation

Breadth-First SearchHash TableString

Acceptance: 57.1%

#434Easy

Number of Segments in a String

String

Acceptance: 37.6%

#435Medium

Non-overlapping Intervals

ArrayDynamic ProgrammingGreedy+1

Acceptance: 57.5%

#436Medium

Find Right Interval

ArrayBinary SearchSorting

Acceptance: 56.1%

#437Medium

Path Sum III

Binary TreeDepth-First SearchTree

Acceptance: 46.6%

#438Medium

Find All Anagrams in a String

Hash TableSliding WindowString

Acceptance: 54.1%

#439Medium

Ternary Expression Parser

RecursionStackString

Acceptance: 62.6%

#440Hard

K-th Smallest in Lexicographical Order

Trie

Acceptance: 46.2%

#441Easy

Arranging Coins

Binary SearchMath

Acceptance: 48.1%

#442Medium

Find All Duplicates in an Array

ArrayHash Table

Acceptance: 76.8%

#443Medium

String Compression

StringTwo Pointers

Acceptance: 60.3%

#444Medium

Sequence Reconstruction

ArrayGraphTopological Sort

Acceptance: 31.2%

#445Medium

Add Two Numbers II

Linked ListMathStack

Acceptance: 63.1%

#446Hard

Arithmetic Slices II - Subsequence

ArrayDynamic Programming

Acceptance: 55.1%

#447Medium

Number of Boomerangs

ArrayHash TableMath

Acceptance: 58.0%

#448Easy

Find All Numbers Disappeared in an Array

ArrayHash Table

Acceptance: 64.4%

#449Medium

Serialize and Deserialize BST

Binary Search TreeBinary TreeBreadth-First Search+4

Acceptance: 59.5%

#450Medium

Delete Node in a BST

Binary Search TreeBinary TreeTree

Acceptance: 55.1%

Page 9 of 81

Master DSA with Step-by-Step Solutions

Each solution article on FleetCode breaks down the problem into multiple approaches, from brute force to optimal, with detailed explanations and code in Python, Java, C++ and more. Understanding why an approach works - not just copying code - is what separates candidates who clear interviews from those who don't.

How to Use These Solutions

  • Try the problem first: Spend at least 20 minutes before reading the solution
  • Read all approaches: Start from brute force to understand the problem fully, then study the optimized solution
  • Understand the complexity: Pay attention to time and space analysis for each approach
  • Code it yourself: After understanding the approach, close the solution and implement from memory
  • Revisit after a week: Spaced repetition helps retain problem-solving patterns