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
- 23Merge k Sorted ListsWatch
- 215Kth Largest Element in an ArrayWatch
- 218The Skyline ProblemWatch
- 239Sliding Window MaximumWatch
- 253Meeting Rooms IILocked
- 264Ugly Number IIWatch
- 272Closest Binary Search Tree Value IILocked
- 295Find Median from Data StreamWatch
- 332Reconstruct ItineraryWatch
- 347Top K Frequent ElementsWatch
- 355Design TwitterWatch
- 358Rearrange String k Distance ApartLocked
- 373Find K Pairs with Smallest SumsWatch
- 378Kth Smallest Element in a Sorted MatrixWatch
- 407Trapping Rain Water IIWatch
- 420Strong Password CheckerWatch
- 451Sort Characters By FrequencyWatch
- 480Sliding Window MedianWatch
- 499The Maze IIILocked
- 502IPOWatch
- 505The Maze IILocked
- 506Relative RanksWatch
- 621Task SchedulerWatch
- 630Course Schedule IIIWatch
- 632Smallest Range Covering Elements from K ListsWatch
- 642Design Search Autocomplete SystemLocked
- 658Find K Closest ElementsWatch
- 659Split Array into Consecutive SubsequencesWatch
- 675Cut Off Trees for Golf EventWatch
- 683K Empty SlotsLocked
- 692Top K Frequent WordsWatch
- 703Kth Largest Element in a StreamWatch
- 743Network Delay TimeWatch
- 759Employee Free TimeLocked
- 767Reorganize StringWatch
- 778Swim in Rising WaterWatch
- 786K-th Smallest Prime FractionWatch
- 787Cheapest Flights Within K StopsWatch
- 855Exam RoomWatch
- 857Minimum Cost to Hire K WorkersWatch
- 862Shortest Subarray with Sum at Least KWatch
- 871Minimum Number of Refueling StopsWatch
- 882Reachable Nodes In Subdivided GraphWatch
- 912Sort an ArrayWatch
- 973K Closest Points to OriginWatch
- 1046Last Stone WeightWatch
- 1054Distant BarcodesWatch
- 1057Campus BikesLocked
- 1086High FiveLocked
- 1094Car PoolingWatch
- 1102Path With Maximum Minimum ValueLocked
- 1135Connecting Cities With Minimum CostLocked
- 1167Minimum Cost to Connect SticksLocked
- 1168Optimize Water Distribution in a VillageLocked
- 1172Dinner Plate StacksWatch
- 1183Maximum Number of OnesLocked
- 1199Minimum Time to Build BlocksLocked
- 1263Minimum Moves to Move a Box to Their Target LocationWatch
- 1268Search Suggestions SystemWatch
- 1337The K Weakest Rows in a MatrixWatch
- 1338Reduce Array Size to The HalfWatch
- 1353Maximum Number of Events That Can Be AttendedWatch
- 1354Construct Target Array With Multiple SumsWatch
- 1368Minimum Cost to Make at Least One Valid Path in a GridWatch
- 1383Maximum Performance of a TeamWatch
- 1388Pizza With 3n SlicesWatch
- 1405Longest Happy StringWatch
- 1424Diagonal Traverse IIWatch
- 1425Constrained Subsequence SumWatch
- 1438Longest Continuous Subarray With Absolute Diff Less Than or Equal to LimitWatch
- 1439Find the Kth Smallest Sum of a Matrix With Sorted RowsWatch
- 1464Maximum Product of Two Elements in an ArrayWatch
- 1488Avoid Flood in The CityWatch
- 1499Max Value of EquationWatch
- 1500Design a File Sharing SystemLocked
- 1514Path with Maximum ProbabilityWatch
- 1606Find Servers That Handled Most Number of RequestsWatch
- 1631Path With Minimum EffortWatch
- 1642Furthest Building You Can ReachWatch
- 1648Sell Diminishing-Valued Colored BallsWatch
- 1675Minimize Deviation in ArrayWatch
- 1686Stone Game VIWatch
- 1687Delivering Boxes from Storage to PortsWatch
- 1696Jump Game VIWatch
- 1705Maximum Number of Eaten ApplesWatch
- 1724Checking Existence of Edge Length Limited Paths IILocked
- 1738Find Kth Largest XOR Coordinate ValueWatch
- 1753Maximum Score From Removing StonesWatch
- 1776Car Fleet IIWatch
- 1786Number of Restricted Paths From First to Last NodeWatch
- 1792Maximum Average Pass RatioWatch
- 1801Number of Orders in the BacklogWatch
- 1810Minimum Path Cost in a Hidden GridLocked
- 1825Finding MK AverageWatch
- 1834Single-Threaded CPUWatch
- 1845Seat Reservation ManagerWatch
- 1851Minimum Interval to Include Each QueryWatch
- 1878Get Biggest Three Rhombus Sums in a GridWatch
- 1882Process Tasks Using ServersWatch
- 1912Design Movie Rental SystemWatch
- 1942The Number of the Smallest Unoccupied ChairWatch
- 1962Remove Stones to Minimize the TotalWatch
- 1985Find the Kth Largest Integer in the ArrayWatch
- 2015Average Height of Buildings in Each SegmentLocked
- 2034Stock Price Fluctuation Watch
- 2054Two Best Non-Overlapping EventsWatch
- 2093Minimum Cost to Reach City With DiscountsLocked
- 2099Find Subsequence of Length K With the Largest SumWatch
- 2102Sequentially Ordinal Rank TrackerWatch
- 2146K Highest Ranked Items Within a Price RangeWatch
- 2163Minimum Difference in Sums After Removal of ElementsWatch
- 2182Construct String With Repeat LimitWatch
- 2203Minimum Weighted Subgraph With the Required PathsWatch
- 2208Minimum Operations to Halve Array SumWatch
- 2231Largest Number After Digit Swaps by ParityWatch
- 2233Maximum Product After K IncrementsWatch
- 2254Design Video Sharing PlatformLocked
- 2263Make Array Non-decreasing or Non-increasingLocked
- 2285Maximum Total Importance of RoadsWatch
- 2290Minimum Obstacle Removal to Reach CornerWatch
- 2333Minimum Sum of Squared DifferenceWatch
- 2335Minimum Amount of Time to Fill CupsWatch
- 2336Smallest Number in Infinite SetWatch
- 2342Max Sum of a Pair With Equal Sum of DigitsWatch
- 2343Query Kth Smallest Trimmed NumberWatch
- 2344Minimum Deletions to Make Array DivisibleWatch
- 2349Design a Number Container SystemWatch
- 2353Design a Food Rating SystemWatch
- 2357Make Array Zero by Subtracting Equal AmountsWatch
- 2386Find the K-Sum of an ArrayWatch
- 2398Maximum Number of Robots Within BudgetWatch
- 2402Meeting Rooms IIIWatch
- 2406Divide Intervals Into Minimum Number of GroupsWatch
- 2424Longest Uploaded PrefixWatch
- 2454Next Greater Element IVWatch
- 2456Most Popular Video CreatorWatch
- 2462Total Cost to Hire K WorkersWatch
- 2473Minimum Cost to Buy ApplesLocked
- 2497Maximum Star Sum of a GraphWatch
- 2500Delete Greatest Value in Each RowWatch
- 2503Maximum Number of Points From Grid QueriesWatch
- 2512Reward Top K StudentsWatch
- 2530Maximal Score After Applying K OperationsWatch
- 2532Time to Cross a BridgeWatch
- 2542Maximum Subsequence ScoreWatch
- 2551Put Marbles in BagsWatch
- 2558Take Gifts From the Richest PileWatch
- 2577Minimum Time to Visit a Cell In a GridWatch
- 2593Find Score of an Array After Marking All ElementsWatch
- 2599Make the Prefix Sum Non-negativeLocked
- 2611Mice and CheeseWatch
- 2617Minimum Number of Visited Cells in a GridWatch
- 2642Design Graph With Shortest Path CalculatorWatch
- 2662Minimum Cost of a Path With Special RoadsWatch
- 2679Sum in a MatrixWatch
- 2699Modify Graph Edge WeightsWatch
- 2714Find Shortest Path with K HopsLocked
- 2737Find the Closest Marked NodeLocked
- 2762Continuous SubarraysWatch
- 2812Find the Safest Path in a GridWatch
- 2813Maximum Elegance of a K-Length SubsequenceWatch
- 2931Maximum Spending After Buying ItemsWatch
- 2940Find Building Where Alice and Bob Can MeetWatch
- 2944Minimum Number of Coins for FruitsWatch
- 2959Number of Possible Sets of Closing BranchesWatch
- 2969Minimum Number of Coins for Fruits IILocked
- 2973Find Number of Coins to Place in Tree NodesWatch
- 2974Minimum Number GameWatch
- 3013Divide an Array Into Subarrays With Minimum Cost IIWatch
- 3049Earliest Second to Mark Indices IIWatch
- 3066Minimum Operations to Exceed Threshold Value IIWatch
- 3080Mark Elements on Array by Performing QueriesWatch
- 3081Replace Question Marks in String to Minimize Its ValueWatch
- 3092Most Frequent IDsWatch
- 3112Minimum Time to Visit Disappearing NodesWatch
- 3123Find Edges in Shortest PathsWatch
- 3170Lexicographically Minimum String After Removing StarsWatch
- 3264Final Array State After K Multiplication Operations IWatch
- 3266Final Array State After K Multiplication Operations IIWatch
- 3275K-th Nearest Obstacle QueriesWatch
- 3286Find a Safe Walk Through a GridWatch
- 3296Minimum Number of Seconds to Make Mountain Height ZeroWatch
- 3318Find X-Sum of All K-Long Subarrays IWatch
- 3321Find X-Sum of All K-Long Subarrays IIWatch
- 3341Find Minimum Time to Reach Last Room IWatch
- 3342Find Minimum Time to Reach Last Room IIWatch
- 3362Zero Array Transformation IIIWatch
- 3369Design an Array Statistics Tracker Locked
- 3377Digit Operations to Make Two Integers EqualWatch
- 3391Design a 3D Binary Matrix with Efficient Layer TrackingLocked
- 3408Design Task ManagerWatch
- 3422Minimum Operations to Make Subarray Elements EqualLocked
- 3462Maximum Sum With at Most K ElementsWatch
- 3476Maximize Profit from Task AssignmentLocked
- 3478Choose K Elements With Maximum SumWatch
- 3505Minimum Operations to Make Elements Within K Subarrays EqualWatch
- 3506Find Time Required to Eliminate Bacterial StrainsLocked
- 3507Minimum Pair Removal to Sort Array IWatch
- 3510Minimum Pair Removal to Sort Array IIWatch
- 3572Maximize Y‑Sum by Picking a Triplet of Distinct X‑ValuesWatch
- 3594Minimum Time to Transport All IndividualsWatch
- 3604Minimum Time to Reach Destination in Directed GraphWatch
- 3607Power Grid MaintenanceWatch
- 3620Network Recovery PathwaysWatch
- 3645Maximum Total from Optimal Activation OrderWatch
- 3650Minimum Cost Path with Edge ReversalsWatch
- 3691Maximum Total Subarray Value IIWatch
- 3711Maximum Transactions Without Negative BalanceLocked
- 3763Maximum Total Sum with Threshold ConstraintsLocked
- 3767Maximize Points After Choosing K TasksWatch
- 3780Maximum Sum of Three Numbers Divisible by ThreeWatch
- 3781Maximum Score After Binary SwapsWatch
- 3815Design Auction SystemWatch
- 3885Design Event ManagerWatch
- 3928Minimum Cost to Buy Apples IIWatch
- 3935Power Update After K-th Largest Insertion ILocked
- 3947Maximum Number of Items From Sale IIWatch
- 3962Maximum Subarray Sum After at Most K SwapsWatch
- 3970Shortest Path With At Most K Consecutive Identical CharactersWatch
- 3977Minimum Time to Reach Target With Limited PowerWatch
- 4003Minimum Cost Path with Alternating Directions IIIWatch