Skip to content
LEETFLIX

type

Heap LeetCode problems — visual solutions

Every LeetCode problem tagged Heap — the full catalogue, plus animated visual solutions in Python and Go when a deep-dive exists.

221 problems · 185 animated · 36 locked

Full Heap index

  1. 23Merge k Sorted ListsWatch
  2. 215Kth Largest Element in an ArrayWatch
  3. 218The Skyline ProblemWatch
  4. 239Sliding Window MaximumWatch
  5. 253Meeting Rooms IILocked
  6. 264Ugly Number IIWatch
  7. 272Closest Binary Search Tree Value IILocked
  8. 295Find Median from Data StreamWatch
  9. 332Reconstruct ItineraryWatch
  10. 347Top K Frequent ElementsWatch
  11. 355Design TwitterWatch
  12. 358Rearrange String k Distance ApartLocked
  13. 373Find K Pairs with Smallest SumsWatch
  14. 378Kth Smallest Element in a Sorted MatrixWatch
  15. 407Trapping Rain Water IIWatch
  16. 420Strong Password CheckerWatch
  17. 451Sort Characters By FrequencyWatch
  18. 480Sliding Window MedianWatch
  19. 499The Maze IIILocked
  20. 502IPOWatch
  21. 505The Maze IILocked
  22. 506Relative RanksWatch
  23. 621Task SchedulerWatch
  24. 630Course Schedule IIIWatch
  25. 632Smallest Range Covering Elements from K ListsWatch
  26. 642Design Search Autocomplete SystemLocked
  27. 658Find K Closest ElementsWatch
  28. 659Split Array into Consecutive SubsequencesWatch
  29. 675Cut Off Trees for Golf EventWatch
  30. 683K Empty SlotsLocked
  31. 692Top K Frequent WordsWatch
  32. 703Kth Largest Element in a StreamWatch
  33. 743Network Delay TimeWatch
  34. 759Employee Free TimeLocked
  35. 767Reorganize StringWatch
  36. 778Swim in Rising WaterWatch
  37. 786K-th Smallest Prime FractionWatch
  38. 787Cheapest Flights Within K StopsWatch
  39. 855Exam RoomWatch
  40. 857Minimum Cost to Hire K WorkersWatch
  41. 862Shortest Subarray with Sum at Least KWatch
  42. 871Minimum Number of Refueling StopsWatch
  43. 882Reachable Nodes In Subdivided GraphWatch
  44. 912Sort an ArrayWatch
  45. 973K Closest Points to OriginWatch
  46. 1046Last Stone WeightWatch
  47. 1054Distant BarcodesWatch
  48. 1057Campus BikesLocked
  49. 1086High FiveLocked
  50. 1094Car PoolingWatch
  51. 1102Path With Maximum Minimum ValueLocked
  52. 1135Connecting Cities With Minimum CostLocked
  53. 1167Minimum Cost to Connect SticksLocked
  54. 1168Optimize Water Distribution in a VillageLocked
  55. 1172Dinner Plate StacksWatch
  56. 1183Maximum Number of OnesLocked
  57. 1199Minimum Time to Build BlocksLocked
  58. 1263Minimum Moves to Move a Box to Their Target LocationWatch
  59. 1268Search Suggestions SystemWatch
  60. 1337The K Weakest Rows in a MatrixWatch
  61. 1338Reduce Array Size to The HalfWatch
  62. 1353Maximum Number of Events That Can Be AttendedWatch
  63. 1354Construct Target Array With Multiple SumsWatch
  64. 1368Minimum Cost to Make at Least One Valid Path in a GridWatch
  65. 1383Maximum Performance of a TeamWatch
  66. 1388Pizza With 3n SlicesWatch
  67. 1405Longest Happy StringWatch
  68. 1424Diagonal Traverse IIWatch
  69. 1425Constrained Subsequence SumWatch
  70. 1438Longest Continuous Subarray With Absolute Diff Less Than or Equal to LimitWatch
  71. 1439Find the Kth Smallest Sum of a Matrix With Sorted RowsWatch
  72. 1464Maximum Product of Two Elements in an ArrayWatch
  73. 1488Avoid Flood in The CityWatch
  74. 1499Max Value of EquationWatch
  75. 1500Design a File Sharing SystemLocked
  76. 1514Path with Maximum ProbabilityWatch
  77. 1606Find Servers That Handled Most Number of RequestsWatch
  78. 1631Path With Minimum EffortWatch
  79. 1642Furthest Building You Can ReachWatch
  80. 1648Sell Diminishing-Valued Colored BallsWatch
  81. 1675Minimize Deviation in ArrayWatch
  82. 1686Stone Game VIWatch
  83. 1687Delivering Boxes from Storage to PortsWatch
  84. 1696Jump Game VIWatch
  85. 1705Maximum Number of Eaten ApplesWatch
  86. 1724Checking Existence of Edge Length Limited Paths IILocked
  87. 1738Find Kth Largest XOR Coordinate ValueWatch
  88. 1753Maximum Score From Removing StonesWatch
  89. 1776Car Fleet IIWatch
  90. 1786Number of Restricted Paths From First to Last NodeWatch
  91. 1792Maximum Average Pass RatioWatch
  92. 1801Number of Orders in the BacklogWatch
  93. 1810Minimum Path Cost in a Hidden GridLocked
  94. 1825Finding MK AverageWatch
  95. 1834Single-Threaded CPUWatch
  96. 1845Seat Reservation ManagerWatch
  97. 1851Minimum Interval to Include Each QueryWatch
  98. 1878Get Biggest Three Rhombus Sums in a GridWatch
  99. 1882Process Tasks Using ServersWatch
  100. 1912Design Movie Rental SystemWatch
  101. 1942The Number of the Smallest Unoccupied ChairWatch
  102. 1962Remove Stones to Minimize the TotalWatch
  103. 1985Find the Kth Largest Integer in the ArrayWatch
  104. 2015Average Height of Buildings in Each SegmentLocked
  105. 2034Stock Price Fluctuation Watch
  106. 2054Two Best Non-Overlapping EventsWatch
  107. 2093Minimum Cost to Reach City With DiscountsLocked
  108. 2099Find Subsequence of Length K With the Largest SumWatch
  109. 2102Sequentially Ordinal Rank TrackerWatch
  110. 2146K Highest Ranked Items Within a Price RangeWatch
  111. 2163Minimum Difference in Sums After Removal of ElementsWatch
  112. 2182Construct String With Repeat LimitWatch
  113. 2203Minimum Weighted Subgraph With the Required PathsWatch
  114. 2208Minimum Operations to Halve Array SumWatch
  115. 2231Largest Number After Digit Swaps by ParityWatch
  116. 2233Maximum Product After K IncrementsWatch
  117. 2254Design Video Sharing PlatformLocked
  118. 2263Make Array Non-decreasing or Non-increasingLocked
  119. 2285Maximum Total Importance of RoadsWatch
  120. 2290Minimum Obstacle Removal to Reach CornerWatch
  121. 2333Minimum Sum of Squared DifferenceWatch
  122. 2335Minimum Amount of Time to Fill CupsWatch
  123. 2336Smallest Number in Infinite SetWatch
  124. 2342Max Sum of a Pair With Equal Sum of DigitsWatch
  125. 2343Query Kth Smallest Trimmed NumberWatch
  126. 2344Minimum Deletions to Make Array DivisibleWatch
  127. 2349Design a Number Container SystemWatch
  128. 2353Design a Food Rating SystemWatch
  129. 2357Make Array Zero by Subtracting Equal AmountsWatch
  130. 2386Find the K-Sum of an ArrayWatch
  131. 2398Maximum Number of Robots Within BudgetWatch
  132. 2402Meeting Rooms IIIWatch
  133. 2406Divide Intervals Into Minimum Number of GroupsWatch
  134. 2424Longest Uploaded PrefixWatch
  135. 2454Next Greater Element IVWatch
  136. 2456Most Popular Video CreatorWatch
  137. 2462Total Cost to Hire K WorkersWatch
  138. 2473Minimum Cost to Buy ApplesLocked
  139. 2497Maximum Star Sum of a GraphWatch
  140. 2500Delete Greatest Value in Each RowWatch
  141. 2503Maximum Number of Points From Grid QueriesWatch
  142. 2512Reward Top K StudentsWatch
  143. 2530Maximal Score After Applying K OperationsWatch
  144. 2532Time to Cross a BridgeWatch
  145. 2542Maximum Subsequence ScoreWatch
  146. 2551Put Marbles in BagsWatch
  147. 2558Take Gifts From the Richest PileWatch
  148. 2577Minimum Time to Visit a Cell In a GridWatch
  149. 2593Find Score of an Array After Marking All ElementsWatch
  150. 2599Make the Prefix Sum Non-negativeLocked
  151. 2611Mice and CheeseWatch
  152. 2617Minimum Number of Visited Cells in a GridWatch
  153. 2642Design Graph With Shortest Path CalculatorWatch
  154. 2662Minimum Cost of a Path With Special RoadsWatch
  155. 2679Sum in a MatrixWatch
  156. 2699Modify Graph Edge WeightsWatch
  157. 2714Find Shortest Path with K HopsLocked
  158. 2737Find the Closest Marked NodeLocked
  159. 2762Continuous SubarraysWatch
  160. 2812Find the Safest Path in a GridWatch
  161. 2813Maximum Elegance of a K-Length SubsequenceWatch
  162. 2931Maximum Spending After Buying ItemsWatch
  163. 2940Find Building Where Alice and Bob Can MeetWatch
  164. 2944Minimum Number of Coins for FruitsWatch
  165. 2959Number of Possible Sets of Closing BranchesWatch
  166. 2969Minimum Number of Coins for Fruits IILocked
  167. 2973Find Number of Coins to Place in Tree NodesWatch
  168. 2974Minimum Number GameWatch
  169. 3013Divide an Array Into Subarrays With Minimum Cost IIWatch
  170. 3049Earliest Second to Mark Indices IIWatch
  171. 3066Minimum Operations to Exceed Threshold Value IIWatch
  172. 3080Mark Elements on Array by Performing QueriesWatch
  173. 3081Replace Question Marks in String to Minimize Its ValueWatch
  174. 3092Most Frequent IDsWatch
  175. 3112Minimum Time to Visit Disappearing NodesWatch
  176. 3123Find Edges in Shortest PathsWatch
  177. 3170Lexicographically Minimum String After Removing StarsWatch
  178. 3264Final Array State After K Multiplication Operations IWatch
  179. 3266Final Array State After K Multiplication Operations IIWatch
  180. 3275K-th Nearest Obstacle QueriesWatch
  181. 3286Find a Safe Walk Through a GridWatch
  182. 3296Minimum Number of Seconds to Make Mountain Height ZeroWatch
  183. 3318Find X-Sum of All K-Long Subarrays IWatch
  184. 3321Find X-Sum of All K-Long Subarrays IIWatch
  185. 3341Find Minimum Time to Reach Last Room IWatch
  186. 3342Find Minimum Time to Reach Last Room IIWatch
  187. 3362Zero Array Transformation IIIWatch
  188. 3369Design an Array Statistics Tracker Locked
  189. 3377Digit Operations to Make Two Integers EqualWatch
  190. 3391Design a 3D Binary Matrix with Efficient Layer TrackingLocked
  191. 3408Design Task ManagerWatch
  192. 3422Minimum Operations to Make Subarray Elements EqualLocked
  193. 3462Maximum Sum With at Most K ElementsWatch
  194. 3476Maximize Profit from Task AssignmentLocked
  195. 3478Choose K Elements With Maximum SumWatch
  196. 3505Minimum Operations to Make Elements Within K Subarrays EqualWatch
  197. 3506Find Time Required to Eliminate Bacterial StrainsLocked
  198. 3507Minimum Pair Removal to Sort Array IWatch
  199. 3510Minimum Pair Removal to Sort Array IIWatch
  200. 3572Maximize Y‑Sum by Picking a Triplet of Distinct X‑ValuesWatch
  201. 3594Minimum Time to Transport All IndividualsWatch
  202. 3604Minimum Time to Reach Destination in Directed GraphWatch
  203. 3607Power Grid MaintenanceWatch
  204. 3620Network Recovery PathwaysWatch
  205. 3645Maximum Total from Optimal Activation OrderWatch
  206. 3650Minimum Cost Path with Edge ReversalsWatch
  207. 3691Maximum Total Subarray Value IIWatch
  208. 3711Maximum Transactions Without Negative BalanceLocked
  209. 3763Maximum Total Sum with Threshold ConstraintsLocked
  210. 3767Maximize Points After Choosing K TasksWatch
  211. 3780Maximum Sum of Three Numbers Divisible by ThreeWatch
  212. 3781Maximum Score After Binary SwapsWatch
  213. 3815Design Auction SystemWatch
  214. 3885Design Event ManagerWatch
  215. 3928Minimum Cost to Buy Apples IIWatch
  216. 3935Power Update After K-th Largest Insertion ILocked
  217. 3947Maximum Number of Items From Sale IIWatch
  218. 3962Maximum Subarray Sum After at Most K SwapsWatch
  219. 3970Shortest Path With At Most K Consecutive Identical CharactersWatch
  220. 3977Minimum Time to Reach Target With Limited PowerWatch
  221. 4003Minimum Cost Path with Alternating Directions IIIWatch