Skip to main content

Solutions & Explanations

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

4,030 Solutions961 Easy2102 Medium967 Hard
#1101Medium

The Earliest Moment When Everyone Become Friends

ArraySortingUnion Find

Acceptance: 66.0%

#1102Medium

Path With Maximum Minimum Value

ArrayBinary SearchBreadth-First Search+4

Acceptance: 54.6%

#1103Easy

Distribute Candies to People

MathSimulation

Acceptance: 67.5%

#1104Medium

Path In Zigzag Labelled Binary Tree

Binary TreeMathTree

Acceptance: 75.9%

#1105Medium

Filling Bookcase Shelves

ArrayDynamic Programming

Acceptance: 68.7%

#1106Hard

Parsing A Boolean Expression

RecursionStackString

Acceptance: 69.8%

#1107Medium

New Users Daily Count

Database

Acceptance: 44.7%

#1108Easy

Defanging an IP Address

String

Acceptance: 90.0%

#1109Medium

Corporate Flight Bookings

ArrayPrefix Sum

Acceptance: 68.7%

#1110Medium

Delete Nodes And Return Forest

ArrayBinary TreeDepth-First Search+2

Acceptance: 72.4%

#1111Medium

Maximum Nesting Depth of Two Valid Parentheses Strings

StackString

Acceptance: 72.1%

#1112Medium

Highest Grade For Each Student

Database

Acceptance: 70.8%

#1113Easy

Reported Posts

Database

Acceptance: 65.0%

#1114Easy

Print in Order

Concurrency

Acceptance: 70.3%

#1115Medium

Print FooBar Alternately

Concurrency

Acceptance: 67.7%

#1116Medium

Print Zero Even Odd

Concurrency

Acceptance: 62.0%

#1117Medium

Building H2O

Concurrency

Acceptance: 57.1%

#1118Easy

Number of Days in a Month

Math

Acceptance: 59.4%

#1119Easy

Remove Vowels from a String

String

Acceptance: 91.2%

#1120Medium

Maximum Average Subtree

Binary TreeDepth-First SearchTree

Acceptance: 66.7%

#1121Hard

Divide Array Into Increasing Sequences

ArrayCounting

Acceptance: 65.4%

#1122Easy

Relative Sort Array

ArrayCounting SortHash Table+1

Acceptance: 75.4%

#1123Medium

Lowest Common Ancestor of Deepest Leaves

Binary TreeBreadth-First SearchDepth-First Search+2

Acceptance: 79.5%

#1124Medium

Longest Well-Performing Interval

ArrayHash TableMonotonic Stack+2

Acceptance: 37.9%

#1125Hard

Smallest Sufficient Team

ArrayBit ManipulationBitmask+1

Acceptance: 55.5%

#1126Medium

Active Businesses

Database

Acceptance: 65.8%

#1127Hard

User Purchase Platform

Database

Acceptance: 46.9%

#1128Easy

Number of Equivalent Domino Pairs

ArrayCountingHash Table

Acceptance: 60.7%

#1129Medium

Shortest Path with Alternating Colors

Breadth-First SearchGraph

Acceptance: 47.8%

#1130Medium

Minimum Cost Tree From Leaf Values

ArrayDynamic ProgrammingGreedy+2

Acceptance: 67.7%

#1131Medium

Maximum of Absolute Value Expression

ArrayMath

Acceptance: 48.4%

#1132Medium

Reported Posts II

Database

Acceptance: 32.3%

#1133Easy

Largest Unique Number

ArrayHash TableSorting

Acceptance: 71.3%

#1134Easy

Armstrong Number

Math

Acceptance: 77.8%

#1135Medium

Connecting Cities With Minimum Cost

GraphHeap (Priority Queue)Minimum Spanning Tree+1

Acceptance: 63.5%

#1136Medium

Parallel Courses

GraphTopological Sort

Acceptance: 62.1%

#1137Easy

N-th Tribonacci Number

Dynamic ProgrammingMathMemoization

Acceptance: 63.2%

#1138Medium

Alphabet Board Path

Hash TableString

Acceptance: 51.5%

#1139Medium

Largest 1-Bordered Square

ArrayDynamic ProgrammingMatrix

Acceptance: 52.1%

#1140Medium

Stone Game II

ArrayDynamic ProgrammingGame Theory+2

Acceptance: 75.8%

#1141Easy

User Activity for the Past 30 Days I

Database

Acceptance: 49.2%

#1142Easy

User Activity for the Past 30 Days II

Database

Acceptance: 35.7%

#1143Medium

Longest Common Subsequence

Dynamic ProgrammingString

Acceptance: 59.6%

#1144Medium

Decrease Elements To Make Array Zigzag

ArrayGreedy

Acceptance: 49.7%

#1145Medium

Binary Tree Coloring Game

Binary TreeDepth-First SearchTree

Acceptance: 52.9%

#1146Medium

Snapshot Array

ArrayBinary SearchDesign+1

Acceptance: 36.8%

#1147Hard

Longest Chunked Palindrome Decomposition

Dynamic ProgrammingGreedyHash Function+3

Acceptance: 58.6%

#1148Easy

Article Views I

Database

Acceptance: 76.8%

#1149Medium

Article Views II

Database

Acceptance: 47.1%

#1150Easy

Check If a Number Is Majority Element in a Sorted Array

ArrayBinary Search

Acceptance: 59.9%

Page 23 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