# Heap (Priority Queue) DSA Problems

> 196 Heap (Priority Queue) coding problems for placements and interviews, sorted easiest first, with hints and company tags. Free practice on InternHack.

Canonical: https://www.internhack.in/learn/dsa/heap-priority-queue
Last updated: 2026-11-28

196 heap (priority queue) problems for coding interviews and campus placements, with hints and company tags. Below are the first 100 of 196: 16 easy, 12 medium and 72 hard. Practise them free on InternHack and track what you have solved.

## Heap (Priority Queue) problems, easiest first

1. [Delete Greatest Value in Each Row](https://www.internhack.in/learn/dsa/problem/delete-greatest-value-in-each-row) (Easy)
2. [Final Array State After K Multiplication Operations I](https://www.internhack.in/learn/dsa/problem/final-array-state-after-k-multiplication-operations-i) (Easy)
3. [Find Subsequence of Length K With the Largest Sum](https://www.internhack.in/learn/dsa/problem/find-subsequence-of-length-k-with-the-largest-sum) (Easy)
4. [Find X-Sum of All K-Long Subarrays I](https://www.internhack.in/learn/dsa/problem/find-x-sum-of-all-k-long-subarrays-i) (Easy)
5. [High Five](https://www.internhack.in/learn/dsa/problem/high-five) (Easy)
6. [Kth Largest Element in a Stream](https://www.internhack.in/learn/dsa/problem/kth-largest-element-in-a-stream) (Easy)
7. [Largest Number After Digit Swaps by Parity](https://www.internhack.in/learn/dsa/problem/largest-number-after-digit-swaps-by-parity) (Easy)
8. [Last Stone Weight](https://www.internhack.in/learn/dsa/problem/last-stone-weight) (Easy)
9. [Make Array Zero by Subtracting Equal Amounts](https://www.internhack.in/learn/dsa/problem/make-array-zero-by-subtracting-equal-amounts) (Easy)
10. [Maximum Product of Two Elements in an Array](https://www.internhack.in/learn/dsa/problem/maximum-product-of-two-elements-in-an-array) (Easy)
11. [Minimum Amount of Time to Fill Cups](https://www.internhack.in/learn/dsa/problem/minimum-amount-of-time-to-fill-cups) (Easy)
12. [Minimum Number Game](https://www.internhack.in/learn/dsa/problem/minimum-number-game) (Easy)
13. [Minimum Pair Removal to Sort Array I](https://www.internhack.in/learn/dsa/problem/minimum-pair-removal-to-sort-array-i) (Easy)
14. [Relative Ranks](https://www.internhack.in/learn/dsa/problem/relative-ranks) (Easy)
15. [Take Gifts From the Richest Pile](https://www.internhack.in/learn/dsa/problem/take-gifts-from-the-richest-pile) (Easy)
16. [The K Weakest Rows in a Matrix](https://www.internhack.in/learn/dsa/problem/the-k-weakest-rows-in-a-matrix) (Easy)
17. [Average Height of Buildings in Each Segment](https://www.internhack.in/learn/dsa/problem/average-height-of-buildings-in-each-segment) (Medium)
18. [Avoid Flood in The City](https://www.internhack.in/learn/dsa/problem/avoid-flood-in-the-city) (Medium)
19. [Campus Bikes](https://www.internhack.in/learn/dsa/problem/campus-bikes) (Medium)
20. [Car Pooling](https://www.internhack.in/learn/dsa/problem/car-pooling) (Medium)
21. [Cheapest Flights Within K Stops](https://www.internhack.in/learn/dsa/problem/cheapest-flights-within-k-stops) (Medium)
22. [Choose K Elements With Maximum Sum](https://www.internhack.in/learn/dsa/problem/choose-k-elements-with-maximum-sum) (Medium)
23. [Connecting Cities With Minimum Cost](https://www.internhack.in/learn/dsa/problem/connecting-cities-with-minimum-cost) (Medium)
24. [Construct String With Repeat Limit](https://www.internhack.in/learn/dsa/problem/construct-string-with-repeat-limit) (Medium)
25. [Continuous Subarrays](https://www.internhack.in/learn/dsa/problem/continuous-subarrays) (Medium)
26. [Design Auction System](https://www.internhack.in/learn/dsa/problem/design-auction-system) (Medium)
27. [Design Task Manager](https://www.internhack.in/learn/dsa/problem/design-task-manager) (Medium)
28. [Design Twitter](https://www.internhack.in/learn/dsa/problem/design-twitter) (Medium)
29. [Car Fleet II](https://www.internhack.in/learn/dsa/problem/car-fleet-ii) (Hard)
30. [Checking Existence of Edge Length Limited Paths II](https://www.internhack.in/learn/dsa/problem/checking-existence-of-edge-length-limited-paths-ii) (Hard)
31. [Closest Binary Search Tree Value II](https://www.internhack.in/learn/dsa/problem/closest-binary-search-tree-value-ii) (Hard)
32. [Constrained Subsequence Sum](https://www.internhack.in/learn/dsa/problem/constrained-subsequence-sum) (Hard)
33. [Construct Target Array With Multiple Sums](https://www.internhack.in/learn/dsa/problem/construct-target-array-with-multiple-sums) (Hard)
34. [Course Schedule III](https://www.internhack.in/learn/dsa/problem/course-schedule-iii) (Hard)
35. [Cut Off Trees for Golf Event](https://www.internhack.in/learn/dsa/problem/cut-off-trees-for-golf-event) (Hard)
36. [Delivering Boxes from Storage to Ports](https://www.internhack.in/learn/dsa/problem/delivering-boxes-from-storage-to-ports) (Hard)
37. [Design an Array Statistics Tracker](https://www.internhack.in/learn/dsa/problem/design-an-array-statistics-tracker) (Hard)
38. [Design Graph With Shortest Path Calculator](https://www.internhack.in/learn/dsa/problem/design-graph-with-shortest-path-calculator) (Hard)
39. [Design Movie Rental System](https://www.internhack.in/learn/dsa/problem/design-movie-rental-system) (Hard)
40. [Design Search Autocomplete System](https://www.internhack.in/learn/dsa/problem/design-search-autocomplete-system) (Hard)
41. [Design Video Sharing Platform](https://www.internhack.in/learn/dsa/problem/design-video-sharing-platform) (Hard)
42. [Dinner Plate Stacks](https://www.internhack.in/learn/dsa/problem/dinner-plate-stacks) (Hard)
43. [Divide an Array Into Subarrays With Minimum Cost II](https://www.internhack.in/learn/dsa/problem/divide-an-array-into-subarrays-with-minimum-cost-ii) (Hard)
44. [Earliest Second to Mark Indices II](https://www.internhack.in/learn/dsa/problem/earliest-second-to-mark-indices-ii) (Hard)
45. [Employee Free Time](https://www.internhack.in/learn/dsa/problem/employee-free-time) (Hard)
46. [Final Array State After K Multiplication Operations II](https://www.internhack.in/learn/dsa/problem/final-array-state-after-k-multiplication-operations-ii) (Hard)
47. [Find Building Where Alice and Bob Can Meet](https://www.internhack.in/learn/dsa/problem/find-building-where-alice-and-bob-can-meet) (Hard)
48. [Find Edges in Shortest Paths](https://www.internhack.in/learn/dsa/problem/find-edges-in-shortest-paths) (Hard)
49. [Find Median from Data Stream](https://www.internhack.in/learn/dsa/problem/find-median-from-data-stream) (Hard)
50. [Find Number of Coins to Place in Tree Nodes](https://www.internhack.in/learn/dsa/problem/find-number-of-coins-to-place-in-tree-nodes) (Hard)
51. [Find Servers That Handled Most Number of Requests](https://www.internhack.in/learn/dsa/problem/find-servers-that-handled-most-number-of-requests) (Hard)
52. [Find Shortest Path with K Hops](https://www.internhack.in/learn/dsa/problem/find-shortest-path-with-k-hops) (Hard)
53. [Find the K-Sum of an Array](https://www.internhack.in/learn/dsa/problem/find-the-k-sum-of-an-array) (Hard)
54. [Find the Kth Smallest Sum of a Matrix With Sorted Rows](https://www.internhack.in/learn/dsa/problem/find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows) (Hard)
55. [Find X-Sum of All K-Long Subarrays II](https://www.internhack.in/learn/dsa/problem/find-x-sum-of-all-k-long-subarrays-ii) (Hard)
56. [Finding MK Average](https://www.internhack.in/learn/dsa/problem/finding-mk-average) (Hard)
57. [IPO](https://www.internhack.in/learn/dsa/problem/ipo) (Hard)
58. [K Empty Slots](https://www.internhack.in/learn/dsa/problem/k-empty-slots) (Hard)
59. [Make Array Non-decreasing or Non-increasing](https://www.internhack.in/learn/dsa/problem/make-array-non-decreasing-or-non-increasing) (Hard)
60. [Max Value of Equation](https://www.internhack.in/learn/dsa/problem/max-value-of-equation) (Hard)
61. [Maximum Number of Ones](https://www.internhack.in/learn/dsa/problem/maximum-number-of-ones) (Hard)
62. [Maximum Number of Points From Grid Queries](https://www.internhack.in/learn/dsa/problem/maximum-number-of-points-from-grid-queries) (Hard)
63. [Maximum Number of Robots Within Budget](https://www.internhack.in/learn/dsa/problem/maximum-number-of-robots-within-budget) (Hard)
64. [Maximum Performance of a Team](https://www.internhack.in/learn/dsa/problem/maximum-performance-of-a-team) (Hard)
65. [Maximum Spending After Buying Items](https://www.internhack.in/learn/dsa/problem/maximum-spending-after-buying-items) (Hard)
66. [Meeting Rooms III](https://www.internhack.in/learn/dsa/problem/meeting-rooms-iii) (Hard)
67. [Merge k Sorted Lists](https://www.internhack.in/learn/dsa/problem/merge-k-sorted-lists) (Hard)
68. [Minimize Deviation in Array](https://www.internhack.in/learn/dsa/problem/minimize-deviation-in-array) (Hard)
69. [Minimum Cost to Hire K Workers](https://www.internhack.in/learn/dsa/problem/minimum-cost-to-hire-k-workers) (Hard)
70. [Minimum Cost to Make at Least One Valid Path in a Grid](https://www.internhack.in/learn/dsa/problem/minimum-cost-to-make-at-least-one-valid-path-in-a-grid) (Hard)
71. [Minimum Deletions to Make Array Divisible](https://www.internhack.in/learn/dsa/problem/minimum-deletions-to-make-array-divisible) (Hard)
72. [Minimum Difference in Sums After Removal of Elements](https://www.internhack.in/learn/dsa/problem/minimum-difference-in-sums-after-removal-of-elements) (Hard)
73. [Minimum Interval to Include Each Query](https://www.internhack.in/learn/dsa/problem/minimum-interval-to-include-each-query) (Hard)
74. [Minimum Moves to Move a Box to Their Target Location](https://www.internhack.in/learn/dsa/problem/minimum-moves-to-move-a-box-to-their-target-location) (Hard)
75. [Minimum Number of Refueling Stops](https://www.internhack.in/learn/dsa/problem/minimum-number-of-refueling-stops) (Hard)
76. [Minimum Number of Visited Cells in a Grid](https://www.internhack.in/learn/dsa/problem/minimum-number-of-visited-cells-in-a-grid) (Hard)
77. [Minimum Obstacle Removal to Reach Corner](https://www.internhack.in/learn/dsa/problem/minimum-obstacle-removal-to-reach-corner) (Hard)
78. [Minimum Pair Removal to Sort Array II](https://www.internhack.in/learn/dsa/problem/minimum-pair-removal-to-sort-array-ii) (Hard)
79. [Minimum Time to Build Blocks](https://www.internhack.in/learn/dsa/problem/minimum-time-to-build-blocks) (Hard)
80. [Minimum Time to Visit a Cell In a Grid](https://www.internhack.in/learn/dsa/problem/minimum-time-to-visit-a-cell-in-a-grid) (Hard)
81. [Minimum Weighted Subgraph With the Required Paths](https://www.internhack.in/learn/dsa/problem/minimum-weighted-subgraph-with-the-required-paths) (Hard)
82. [Modify Graph Edge Weights](https://www.internhack.in/learn/dsa/problem/modify-graph-edge-weights) (Hard)
83. [Number of Possible Sets of Closing Branches](https://www.internhack.in/learn/dsa/problem/number-of-possible-sets-of-closing-branches) (Hard)
84. [Optimize Water Distribution in a Village](https://www.internhack.in/learn/dsa/problem/optimize-water-distribution-in-a-village) (Hard)
85. [Pizza With 3n Slices](https://www.internhack.in/learn/dsa/problem/pizza-with-3n-slices) (Hard)
86. [Put Marbles in Bags](https://www.internhack.in/learn/dsa/problem/put-marbles-in-bags) (Hard)
87. [Reachable Nodes In Subdivided Graph](https://www.internhack.in/learn/dsa/problem/reachable-nodes-in-subdivided-graph) (Hard)
88. [Rearrange String k Distance Apart](https://www.internhack.in/learn/dsa/problem/rearrange-string-k-distance-apart) (Hard)
89. [Reconstruct Itinerary](https://www.internhack.in/learn/dsa/problem/reconstruct-itinerary) (Hard)
90. [Sequentially Ordinal Rank Tracker](https://www.internhack.in/learn/dsa/problem/sequentially-ordinal-rank-tracker) (Hard)
91. [Shortest Subarray with Sum at Least K](https://www.internhack.in/learn/dsa/problem/shortest-subarray-with-sum-at-least-k) (Hard)
92. [Sliding Window Maximum](https://www.internhack.in/learn/dsa/problem/sliding-window-maximum) (Hard)
93. [Sliding Window Median](https://www.internhack.in/learn/dsa/problem/sliding-window-median) (Hard)
94. [Smallest Range Covering Elements from K Lists](https://www.internhack.in/learn/dsa/problem/smallest-range-covering-elements-from-k-lists) (Hard)
95. [Strong Password Checker](https://www.internhack.in/learn/dsa/problem/strong-password-checker) (Hard)
96. [Swim in Rising Water](https://www.internhack.in/learn/dsa/problem/swim-in-rising-water) (Hard)
97. [The Maze III](https://www.internhack.in/learn/dsa/problem/the-maze-iii) (Hard)
98. [The Skyline Problem](https://www.internhack.in/learn/dsa/problem/the-skyline-problem) (Hard)
99. [Time to Cross a Bridge](https://www.internhack.in/learn/dsa/problem/time-to-cross-a-bridge) (Hard)
100. [Trapping Rain Water II](https://www.internhack.in/learn/dsa/problem/trapping-rain-water-ii) (Hard)

## Companies that ask heap (priority queue) problems

- [Google](https://www.internhack.in/learn/dsa/companies/google): 77 of these problems
- [Amazon](https://www.internhack.in/learn/dsa/companies/amazon): 65 of these problems
- [Bloomberg](https://www.internhack.in/learn/dsa/companies/bloomberg): 40 of these problems
- [Meta](https://www.internhack.in/learn/dsa/companies/meta): 40 of these problems
- [Microsoft](https://www.internhack.in/learn/dsa/companies/microsoft): 35 of these problems
- [Uber](https://www.internhack.in/learn/dsa/companies/uber): 17 of these problems
- [Tiktok](https://www.internhack.in/learn/dsa/companies/tiktok): 14 of these problems
- [Apple](https://www.internhack.in/learn/dsa/companies/apple): 13 of these problems
- [Goldman Sachs](https://www.internhack.in/learn/dsa/companies/goldman-sachs): 12 of these problems
- [Salesforce](https://www.internhack.in/learn/dsa/companies/salesforce): 10 of these problems
- [Flipkart](https://www.internhack.in/learn/dsa/companies/flipkart): 10 of these problems
- [DE Shaw](https://www.internhack.in/learn/dsa/companies/de-shaw): 9 of these problems

## Before your interview

Most resumes are filtered by software before a recruiter reads them. [Check your resume ATS score free](https://www.internhack.in/ats-score/try), no signup needed.

## Other DSA topics

- [Array](https://www.internhack.in/learn/dsa/array) (1869)
- [String](https://www.internhack.in/learn/dsa/string) (775)
- [Hash Table](https://www.internhack.in/learn/dsa/hash-table) (708)
- [Math](https://www.internhack.in/learn/dsa/math) (564)
- [Dynamic Programming](https://www.internhack.in/learn/dsa/dynamic-programming) (557)
- [Sorting](https://www.internhack.in/learn/dsa/sorting) (464)
- [Greedy](https://www.internhack.in/learn/dsa/greedy) (407)
- [Depth-First Search](https://www.internhack.in/learn/dsa/depth-first-search) (314)
- [Binary Search](https://www.internhack.in/learn/dsa/binary-search) (298)
- [Matrix](https://www.internhack.in/learn/dsa/matrix) (246)
- [Breadth-First Search](https://www.internhack.in/learn/dsa/breadth-first-search) (245)
- [Bit Manipulation](https://www.internhack.in/learn/dsa/bit-manipulation) (238)
- [Tree](https://www.internhack.in/learn/dsa/tree) (235)
- [Two Pointers](https://www.internhack.in/learn/dsa/two-pointers) (217)
- [Prefix Sum](https://www.internhack.in/learn/dsa/prefix-sum) (204)
- [Database](https://www.internhack.in/learn/dsa/database) (197)
- [Simulation](https://www.internhack.in/learn/dsa/simulation) (177)
- [Counting](https://www.internhack.in/learn/dsa/counting) (174)
- [Binary Tree](https://www.internhack.in/learn/dsa/binary-tree) (169)
- [Stack](https://www.internhack.in/learn/dsa/stack) (167)

## Related

- [Home](https://www.internhack.in/)
- [Learn](https://www.internhack.in/learn)
- [DSA](https://www.internhack.in/learn/dsa)
