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
#564Hard

Find the Closest Palindrome

MathString

Acceptance: 31.6%

#568Hard

Maximum Vacation Days

ArrayDynamic ProgrammingMatrix

Acceptance: 46.7%

#569Hard

Median Employee Salary

Database

Acceptance: 65.9%

#571Hard

Find Median Given Frequency of Numbers

Database

Acceptance: 42.4%

#579Hard

Find Cumulative Salary of an Employee

Database

Acceptance: 47.8%

#587Hard

Erect the Fence

ArrayGeometryMath

Acceptance: 53.4%

#588Hard

Design In-Memory File System

DesignHash TableSorting+2

Acceptance: 48.0%

#591Hard

Tag Validator

StackString

Acceptance: 41.7%

#600Hard

Non-negative Integers without Consecutive Ones

Dynamic Programming

Acceptance: 43.1%

#601Hard

Human Traffic of Stadium

Database

Acceptance: 49.1%

#615Hard

Average Salary: Departments VS Company

Database

Acceptance: 56.2%

#618Hard

Students Report By Geography

Database

Acceptance: 63.5%

#629Hard

K Inverse Pairs Array

Dynamic Programming

Acceptance: 49.2%

#630Hard

Course Schedule III

ArrayGreedyHeap (Priority Queue)+1

Acceptance: 42.1%

#631Hard

Design Excel Sum Formula

ArrayDesignGraph+2

Acceptance: 39.9%

#632Hard

Smallest Range Covering Elements from K Lists

ArrayGreedyHash Table+3

Acceptance: 70.3%

#639Hard

Decode Ways II

Dynamic ProgrammingString

Acceptance: 31.8%

#642Hard

Design Search Autocomplete System

Data StreamDepth-First SearchDesign+4

Acceptance: 49.9%

#644Hard

Maximum Average Subarray II

ArrayBinary SearchPrefix Sum

Acceptance: 37.7%

#656Hard

Coin Path

ArrayDynamic Programming

Acceptance: 34.2%

#660Hard

Remove 9

Math

Acceptance: 57.3%

#664Hard

Strange Printer

Dynamic ProgrammingString

Acceptance: 61.0%

#668Hard

Kth Smallest Number in Multiplication Table

Binary SearchMath

Acceptance: 55.1%

#675Hard

Cut Off Trees for Golf Event

ArrayBreadth-First SearchHeap (Priority Queue)+1

Acceptance: 36.8%

#679Hard

24 Game

ArrayBacktrackingMath

Acceptance: 59.4%

#683Hard

K Empty Slots

ArrayBinary Indexed TreeHeap (Priority Queue)+5

Acceptance: 38.0%

#685Hard

Redundant Connection II

Breadth-First SearchDepth-First SearchGraph+1

Acceptance: 36.6%

#689Hard

Maximum Sum of 3 Non-Overlapping Subarrays

ArrayDynamic Programming

Acceptance: 59.8%

#691Hard

Stickers to Spell Word

ArrayBacktrackingBit Manipulation+3

Acceptance: 50.7%

#699Hard

Falling Squares

ArrayOrdered SetSegment Tree

Acceptance: 48.3%

#710Hard

Random Pick with Blacklist

ArrayBinary SearchHash Table+3

Acceptance: 35.4%

#711Hard

Number of Distinct Islands II

Breadth-First SearchDepth-First SearchHash Function+2

Acceptance: 55.3%

#715Hard

Range Module

DesignOrdered SetSegment Tree

Acceptance: 45.4%

#716Hard

Max Stack

DesignDoubly-Linked ListLinked List+2

Acceptance: 45.9%

#719Hard

Find K-th Smallest Pair Distance

ArrayBinary SearchSorting+1

Acceptance: 46.4%

#726Hard

Number of Atoms

Hash TableSortingStack+1

Acceptance: 65.1%

#727Hard

Minimum Window Subsequence

Dynamic ProgrammingSliding WindowString

Acceptance: 43.5%

#730Hard

Count Different Palindromic Subsequences

Dynamic ProgrammingString

Acceptance: 48.2%

#732Hard

My Calendar III

Binary SearchDesignOrdered Set+2

Acceptance: 71.9%

#736Hard

Parse Lisp Expression

Hash TableRecursionStack+1

Acceptance: 53.5%

#741Hard

Cherry Pickup

ArrayDynamic ProgrammingMatrix

Acceptance: 40.4%

#745Hard

Prefix and Suffix Search

ArrayDesignHash Table+2

Acceptance: 41.2%

#749Hard

Contain Virus

ArrayBreadth-First SearchDepth-First Search+2

Acceptance: 55.9%

#753Hard

Cracking the Safe

Depth-First SearchEulerian CircuitGraph

Acceptance: 58.5%

#757Hard

Set Intersection Size At Least Two

ArrayGreedySorting

Acceptance: 58.0%

#759Hard

Employee Free Time

ArrayHeap (Priority Queue)Sorting

Acceptance: 72.9%

#761Hard

Special Binary String

RecursionString

Acceptance: 79.4%

#765Hard

Couples Holding Hands

Breadth-First SearchDepth-First SearchGraph+2

Acceptance: 59.8%

#768Hard

Max Chunks To Make Sorted II

ArrayGreedyMonotonic Stack+2

Acceptance: 54.7%

#770Hard

Basic Calculator IV

Hash TableMathRecursion+2

Acceptance: 49.8%

Page 3 of 20

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