Heap (Priority Queue) DSA Problems

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 (Easy)
  2. Final Array State After K Multiplication Operations I (Easy)
  3. Find Subsequence of Length K With the Largest Sum (Easy)
  4. Find X-Sum of All K-Long Subarrays I (Easy)
  5. High Five (Easy)
  6. Kth Largest Element in a Stream (Easy)
  7. Largest Number After Digit Swaps by Parity (Easy)
  8. Last Stone Weight (Easy)
  9. Make Array Zero by Subtracting Equal Amounts (Easy)
  10. Maximum Product of Two Elements in an Array (Easy)
  11. Minimum Amount of Time to Fill Cups (Easy)
  12. Minimum Number Game (Easy)
  13. Minimum Pair Removal to Sort Array I (Easy)
  14. Relative Ranks (Easy)
  15. Take Gifts From the Richest Pile (Easy)
  16. The K Weakest Rows in a Matrix (Easy)
  17. Average Height of Buildings in Each Segment (Medium)
  18. Avoid Flood in The City (Medium)
  19. Campus Bikes (Medium)
  20. Car Pooling (Medium)
  21. Cheapest Flights Within K Stops (Medium)
  22. Choose K Elements With Maximum Sum (Medium)
  23. Connecting Cities With Minimum Cost (Medium)
  24. Construct String With Repeat Limit (Medium)
  25. Continuous Subarrays (Medium)
  26. Design Auction System (Medium)
  27. Design Task Manager (Medium)
  28. Design Twitter (Medium)
  29. Car Fleet II (Hard)
  30. Checking Existence of Edge Length Limited Paths II (Hard)
  31. Closest Binary Search Tree Value II (Hard)
  32. Constrained Subsequence Sum (Hard)
  33. Construct Target Array With Multiple Sums (Hard)
  34. Course Schedule III (Hard)
  35. Cut Off Trees for Golf Event (Hard)
  36. Delivering Boxes from Storage to Ports (Hard)
  37. Design an Array Statistics Tracker (Hard)
  38. Design Graph With Shortest Path Calculator (Hard)
  39. Design Movie Rental System (Hard)
  40. Design Search Autocomplete System (Hard)
  41. Design Video Sharing Platform (Hard)
  42. Dinner Plate Stacks (Hard)
  43. Divide an Array Into Subarrays With Minimum Cost II (Hard)
  44. Earliest Second to Mark Indices II (Hard)
  45. Employee Free Time (Hard)
  46. Final Array State After K Multiplication Operations II (Hard)
  47. Find Building Where Alice and Bob Can Meet (Hard)
  48. Find Edges in Shortest Paths (Hard)
  49. Find Median from Data Stream (Hard)
  50. Find Number of Coins to Place in Tree Nodes (Hard)
  51. Find Servers That Handled Most Number of Requests (Hard)
  52. Find Shortest Path with K Hops (Hard)
  53. Find the K-Sum of an Array (Hard)
  54. Find the Kth Smallest Sum of a Matrix With Sorted Rows (Hard)
  55. Find X-Sum of All K-Long Subarrays II (Hard)
  56. Finding MK Average (Hard)
  57. IPO (Hard)
  58. K Empty Slots (Hard)
  59. Make Array Non-decreasing or Non-increasing (Hard)
  60. Max Value of Equation (Hard)
  61. Maximum Number of Ones (Hard)
  62. Maximum Number of Points From Grid Queries (Hard)
  63. Maximum Number of Robots Within Budget (Hard)
  64. Maximum Performance of a Team (Hard)
  65. Maximum Spending After Buying Items (Hard)
  66. Meeting Rooms III (Hard)
  67. Merge k Sorted Lists (Hard)
  68. Minimize Deviation in Array (Hard)
  69. Minimum Cost to Hire K Workers (Hard)
  70. Minimum Cost to Make at Least One Valid Path in a Grid (Hard)
  71. Minimum Deletions to Make Array Divisible (Hard)
  72. Minimum Difference in Sums After Removal of Elements (Hard)
  73. Minimum Interval to Include Each Query (Hard)
  74. Minimum Moves to Move a Box to Their Target Location (Hard)
  75. Minimum Number of Refueling Stops (Hard)
  76. Minimum Number of Visited Cells in a Grid (Hard)
  77. Minimum Obstacle Removal to Reach Corner (Hard)
  78. Minimum Pair Removal to Sort Array II (Hard)
  79. Minimum Time to Build Blocks (Hard)
  80. Minimum Time to Visit a Cell In a Grid (Hard)
  81. Minimum Weighted Subgraph With the Required Paths (Hard)
  82. Modify Graph Edge Weights (Hard)
  83. Number of Possible Sets of Closing Branches (Hard)
  84. Optimize Water Distribution in a Village (Hard)
  85. Pizza With 3n Slices (Hard)
  86. Put Marbles in Bags (Hard)
  87. Reachable Nodes In Subdivided Graph (Hard)
  88. Rearrange String k Distance Apart (Hard)
  89. Reconstruct Itinerary (Hard)
  90. Sequentially Ordinal Rank Tracker (Hard)
  91. Shortest Subarray with Sum at Least K (Hard)
  92. Sliding Window Maximum (Hard)
  93. Sliding Window Median (Hard)
  94. Smallest Range Covering Elements from K Lists (Hard)
  95. Strong Password Checker (Hard)
  96. Swim in Rising Water (Hard)
  97. The Maze III (Hard)
  98. The Skyline Problem (Hard)
  99. Time to Cross a Bridge (Hard)
  100. Trapping Rain Water II (Hard)

Companies that ask heap (priority queue) problems

Before your interview

Most resumes are filtered by software before a recruiter reads them. Check your resume ATS score free, no signup needed.

Other DSA topics