# Prefix Sum DSA Problems

> 204 Prefix Sum 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/prefix-sum
Last updated: 2026-11-28

204 prefix sum problems for coding interviews and campus placements, with hints and company tags. Below are the first 100 of 204: 18 easy, 30 medium and 52 hard. Practise them free on InternHack and track what you have solved.

## Prefix Sum problems, easiest first

1. [Ant on the Boundary](https://www.internhack.in/learn/dsa/problem/ant-on-the-boundary) (Easy)
2. [Check if All the Integers in a Range Are Covered](https://www.internhack.in/learn/dsa/problem/check-if-all-the-integers-in-a-range-are-covered) (Easy)
3. [Count Partitions with Even Sum Difference](https://www.internhack.in/learn/dsa/problem/count-partitions-with-even-sum-difference) (Easy)
4. [Find Pivot Index](https://www.internhack.in/learn/dsa/problem/find-pivot-index) (Easy)
5. [Find the Highest Altitude](https://www.internhack.in/learn/dsa/problem/find-the-highest-altitude) (Easy)
6. [Find the Middle Index in Array](https://www.internhack.in/learn/dsa/problem/find-the-middle-index-in-array) (Easy)
7. [Find the Pivot Integer](https://www.internhack.in/learn/dsa/problem/find-the-pivot-integer) (Easy)
8. [Left and Right Sum Differences](https://www.internhack.in/learn/dsa/problem/left-and-right-sum-differences) (Easy)
9. [Longest Subsequence With Limited Sum](https://www.internhack.in/learn/dsa/problem/longest-subsequence-with-limited-sum) (Easy)
10. [Make Array Elements Equal to Zero](https://www.internhack.in/learn/dsa/problem/make-array-elements-equal-to-zero) (Easy)
11. [Maximum Population Year](https://www.internhack.in/learn/dsa/problem/maximum-population-year) (Easy)
12. [Maximum Score After Splitting a String](https://www.internhack.in/learn/dsa/problem/maximum-score-after-splitting-a-string) (Easy)
13. [Minimum Positive Sum Subarray](https://www.internhack.in/learn/dsa/problem/minimum-positive-sum-subarray) (Easy)
14. [Minimum Value to Get Positive Step by Step Sum](https://www.internhack.in/learn/dsa/problem/minimum-value-to-get-positive-step-by-step-sum) (Easy)
15. [Points That Intersect With Cars](https://www.internhack.in/learn/dsa/problem/points-that-intersect-with-cars) (Easy)
16. [Range Sum Query - Immutable](https://www.internhack.in/learn/dsa/problem/range-sum-query-immutable) (Easy)
17. [Running Sum of 1d Array](https://www.internhack.in/learn/dsa/problem/running-sum-of-1d-array) (Easy)
18. [Sum of All Odd Length Subarrays](https://www.internhack.in/learn/dsa/problem/sum-of-all-odd-length-subarrays) (Easy)
19. [Apply Operations to Make All Array Elements Equal to Zero](https://www.internhack.in/learn/dsa/problem/apply-operations-to-make-all-array-elements-equal-to-zero) (Medium)
20. [Average Height of Buildings in Each Segment](https://www.internhack.in/learn/dsa/problem/average-height-of-buildings-in-each-segment) (Medium)
21. [Best Time to Buy and Sell Stock using Strategy](https://www.internhack.in/learn/dsa/problem/best-time-to-buy-and-sell-stock-using-strategy) (Medium)
22. [Binary Subarrays With Sum](https://www.internhack.in/learn/dsa/problem/binary-subarrays-with-sum) (Medium)
23. [Bitwise OR of All Subsequence Sums](https://www.internhack.in/learn/dsa/problem/bitwise-or-of-all-subsequence-sums) (Medium)
24. [Brightest Position on Street](https://www.internhack.in/learn/dsa/problem/brightest-position-on-street) (Medium)
25. [Can Make Palindrome from Substring](https://www.internhack.in/learn/dsa/problem/can-make-palindrome-from-substring) (Medium)
26. [Can You Eat Your Favorite Candy on Your Favorite Day?](https://www.internhack.in/learn/dsa/problem/can-you-eat-your-favorite-candy-on-your-favorite-day) (Medium)
27. [Car Pooling](https://www.internhack.in/learn/dsa/problem/car-pooling) (Medium)
28. [Change Minimum Characters to Satisfy One of Three Conditions](https://www.internhack.in/learn/dsa/problem/change-minimum-characters-to-satisfy-one-of-three-conditions) (Medium)
29. [Concatenate Non-Zero Digits and Multiply by Sum II](https://www.internhack.in/learn/dsa/problem/concatenate-non-zero-digits-and-multiply-by-sum-ii) (Medium)
30. [Construct Product Matrix](https://www.internhack.in/learn/dsa/problem/construct-product-matrix) (Medium)
31. [Contiguous Array](https://www.internhack.in/learn/dsa/problem/contiguous-array) (Medium)
32. [Continuous Subarray Sum](https://www.internhack.in/learn/dsa/problem/continuous-subarray-sum) (Medium)
33. [Corporate Flight Bookings](https://www.internhack.in/learn/dsa/problem/corporate-flight-bookings) (Medium)
34. [Count Beautiful Substrings I](https://www.internhack.in/learn/dsa/problem/count-beautiful-substrings-i) (Medium)
35. [Count Number of Nice Subarrays](https://www.internhack.in/learn/dsa/problem/count-number-of-nice-subarrays) (Medium)
36. [Count of Interesting Subarrays](https://www.internhack.in/learn/dsa/problem/count-of-interesting-subarrays) (Medium)
37. [Count Partitions With Max-Min Difference at Most K](https://www.internhack.in/learn/dsa/problem/count-partitions-with-max-min-difference-at-most-k) (Medium)
38. [Count Positions on Street With Required Brightness](https://www.internhack.in/learn/dsa/problem/count-positions-on-street-with-required-brightness) (Medium)
39. [Count Submatrices With Equal Frequency of X and Y](https://www.internhack.in/learn/dsa/problem/count-submatrices-with-equal-frequency-of-x-and-y) (Medium)
40. [Count Submatrices with Top-Left Element and Sum Less Than k](https://www.internhack.in/learn/dsa/problem/count-submatrices-with-top-left-element-and-sum-less-than-k) (Medium)
41. [Count the Hidden Sequences](https://www.internhack.in/learn/dsa/problem/count-the-hidden-sequences) (Medium)
42. [Count the Number of Houses at a Certain Distance I](https://www.internhack.in/learn/dsa/problem/count-the-number-of-houses-at-a-certain-distance-i) (Medium)
43. [Count Triplets That Can Form Two Arrays of Equal XOR](https://www.internhack.in/learn/dsa/problem/count-triplets-that-can-form-two-arrays-of-equal-xor) (Medium)
44. [Count Vowel Strings in Ranges](https://www.internhack.in/learn/dsa/problem/count-vowel-strings-in-ranges) (Medium)
45. [Describe the Painting](https://www.internhack.in/learn/dsa/problem/describe-the-painting) (Medium)
46. [Design Exam Scores Tracker](https://www.internhack.in/learn/dsa/problem/design-exam-scores-tracker) (Medium)
47. [Divide Intervals Into Minimum Number of Groups](https://www.internhack.in/learn/dsa/problem/divide-intervals-into-minimum-number-of-groups) (Medium)
48. [Find All Good Indices](https://www.internhack.in/learn/dsa/problem/find-all-good-indices) (Medium)
49. [Apply Operations to Maximize Frequency Score](https://www.internhack.in/learn/dsa/problem/apply-operations-to-maximize-frequency-score) (Hard)
50. [Build Array Where You Can Find The Maximum Exactly K Comparisons](https://www.internhack.in/learn/dsa/problem/build-array-where-you-can-find-the-maximum-exactly-k-comparisons) (Hard)
51. [Count Beautiful Substrings II](https://www.internhack.in/learn/dsa/problem/count-beautiful-substrings-ii) (Hard)
52. [Count Increasing Quadruplets](https://www.internhack.in/learn/dsa/problem/count-increasing-quadruplets) (Hard)
53. [Count Routes to Climb a Rectangular Grid](https://www.internhack.in/learn/dsa/problem/count-routes-to-climb-a-rectangular-grid) (Hard)
54. [Count Subarrays With Median K](https://www.internhack.in/learn/dsa/problem/count-subarrays-with-median-k) (Hard)
55. [Count Subarrays With Score Less Than K](https://www.internhack.in/learn/dsa/problem/count-subarrays-with-score-less-than-k) (Hard)
56. [Count the Number of Houses at a Certain Distance II](https://www.internhack.in/learn/dsa/problem/count-the-number-of-houses-at-a-certain-distance-ii) (Hard)
57. [Delivering Boxes from Storage to Ports](https://www.internhack.in/learn/dsa/problem/delivering-boxes-from-storage-to-ports) (Hard)
58. [Find All Possible Stable Binary Arrays II](https://www.internhack.in/learn/dsa/problem/find-all-possible-stable-binary-arrays-ii) (Hard)
59. [Find the Count of Monotonic Pairs I](https://www.internhack.in/learn/dsa/problem/find-the-count-of-monotonic-pairs-i) (Hard)
60. [Find the Count of Monotonic Pairs II](https://www.internhack.in/learn/dsa/problem/find-the-count-of-monotonic-pairs-ii) (Hard)
61. [Find the Original Typed String II](https://www.internhack.in/learn/dsa/problem/find-the-original-typed-string-ii) (Hard)
62. [Longest Balanced Subarray II](https://www.internhack.in/learn/dsa/problem/longest-balanced-subarray-ii) (Hard)
63. [Longest Special Path II](https://www.internhack.in/learn/dsa/problem/longest-special-path-ii) (Hard)
64. [Max Sum of Rectangle No Larger Than K](https://www.internhack.in/learn/dsa/problem/max-sum-of-rectangle-no-larger-than-k) (Hard)
65. [Maximize Subarrays After Removing One Conflicting Pair](https://www.internhack.in/learn/dsa/problem/maximize-subarrays-after-removing-one-conflicting-pair) (Hard)
66. [Maximize the Beauty of the Garden](https://www.internhack.in/learn/dsa/problem/maximize-the-beauty-of-the-garden) (Hard)
67. [Maximize the Minimum Powered City](https://www.internhack.in/learn/dsa/problem/maximize-the-minimum-powered-city) (Hard)
68. [Maximum Average Subarray II](https://www.internhack.in/learn/dsa/problem/maximum-average-subarray-ii) (Hard)
69. [Maximum Difference Between Even and Odd Frequency II](https://www.internhack.in/learn/dsa/problem/maximum-difference-between-even-and-odd-frequency-ii) (Hard)
70. [Maximum Frequency of an Element After Performing Operations II](https://www.internhack.in/learn/dsa/problem/maximum-frequency-of-an-element-after-performing-operations-ii) (Hard)
71. [Maximum Fruits Harvested After at Most K Steps](https://www.internhack.in/learn/dsa/problem/maximum-fruits-harvested-after-at-most-k-steps) (Hard)
72. [Maximum Number of Robots Within Budget](https://www.internhack.in/learn/dsa/problem/maximum-number-of-robots-within-budget) (Hard)
73. [Maximum Number of Ways to Partition an Array](https://www.internhack.in/learn/dsa/problem/maximum-number-of-ways-to-partition-an-array) (Hard)
74. [Maximum Score From Grid Operations](https://www.internhack.in/learn/dsa/problem/maximum-score-from-grid-operations) (Hard)
75. [Maximum Segment Sum After Removals](https://www.internhack.in/learn/dsa/problem/maximum-segment-sum-after-removals) (Hard)
76. [Maximum Strength of K Disjoint Subarrays](https://www.internhack.in/learn/dsa/problem/maximum-strength-of-k-disjoint-subarrays) (Hard)
77. [Maximum Sum of 3 Non-Overlapping Subarrays](https://www.internhack.in/learn/dsa/problem/maximum-sum-of-3-non-overlapping-subarrays) (Hard)
78. [Maximum Total Beauty of the Gardens](https://www.internhack.in/learn/dsa/problem/maximum-total-beauty-of-the-gardens) (Hard)
79. [Maximum Value of K Coins From Piles](https://www.internhack.in/learn/dsa/problem/maximum-value-of-k-coins-from-piles) (Hard)
80. [Merge Operations for Minimum Travel Time](https://www.internhack.in/learn/dsa/problem/merge-operations-for-minimum-travel-time) (Hard)
81. [Minimum Adjacent Swaps for K Consecutive Ones](https://www.internhack.in/learn/dsa/problem/minimum-adjacent-swaps-for-k-consecutive-ones) (Hard)
82. [Minimum Cost to Make Array Equal](https://www.internhack.in/learn/dsa/problem/minimum-cost-to-make-array-equal) (Hard)
83. [Minimum Cost to Merge Stones](https://www.internhack.in/learn/dsa/problem/minimum-cost-to-merge-stones) (Hard)
84. [Minimum Moves to Pick K Ones](https://www.internhack.in/learn/dsa/problem/minimum-moves-to-pick-k-ones) (Hard)
85. [Minimum Number of K Consecutive Bit Flips](https://www.internhack.in/learn/dsa/problem/minimum-number-of-k-consecutive-bit-flips) (Hard)
86. [Minimum Space Wasted From Packaging](https://www.internhack.in/learn/dsa/problem/minimum-space-wasted-from-packaging) (Hard)
87. [Minimum White Tiles After Covering With Carpets](https://www.internhack.in/learn/dsa/problem/minimum-white-tiles-after-covering-with-carpets) (Hard)
88. [My Calendar III](https://www.internhack.in/learn/dsa/problem/my-calendar-iii) (Hard)
89. [Number of Beautiful Partitions](https://www.internhack.in/learn/dsa/problem/number-of-beautiful-partitions) (Hard)
90. [Number of Flowers in Full Bloom](https://www.internhack.in/learn/dsa/problem/number-of-flowers-in-full-bloom) (Hard)
91. [Number of Submatrices That Sum to Target](https://www.internhack.in/learn/dsa/problem/number-of-submatrices-that-sum-to-target) (Hard)
92. [Number of Ways of Cutting a Pizza](https://www.internhack.in/learn/dsa/problem/number-of-ways-of-cutting-a-pizza) (Hard)
93. [Shortest Subarray with Sum at Least K](https://www.internhack.in/learn/dsa/problem/shortest-subarray-with-sum-at-least-k) (Hard)
94. [Sorted GCD Pair Queries](https://www.internhack.in/learn/dsa/problem/sorted-gcd-pair-queries) (Hard)
95. [Split Array Largest Sum](https://www.internhack.in/learn/dsa/problem/split-array-largest-sum) (Hard)
96. [Split Array with Equal Sum](https://www.internhack.in/learn/dsa/problem/split-array-with-equal-sum) (Hard)
97. [Stamping the Grid](https://www.internhack.in/learn/dsa/problem/stamping-the-grid) (Hard)
98. [Stone Game VIII](https://www.internhack.in/learn/dsa/problem/stone-game-viii) (Hard)
99. [Sum of Total Strength of Wizards](https://www.internhack.in/learn/dsa/problem/sum-of-total-strength-of-wizards) (Hard)
100. [Threshold Majority Queries](https://www.internhack.in/learn/dsa/problem/threshold-majority-queries) (Hard)

## Companies that ask prefix sum problems

- [Google](https://www.internhack.in/learn/dsa/companies/google): 65 of these problems
- [Amazon](https://www.internhack.in/learn/dsa/companies/amazon): 57 of these problems
- [Microsoft](https://www.internhack.in/learn/dsa/companies/microsoft): 33 of these problems
- [Meta](https://www.internhack.in/learn/dsa/companies/meta): 31 of these problems
- [Bloomberg](https://www.internhack.in/learn/dsa/companies/bloomberg): 29 of these problems
- [Uber](https://www.internhack.in/learn/dsa/companies/uber): 8 of these problems
- [Adobe](https://www.internhack.in/learn/dsa/companies/adobe): 7 of these problems
- [Goldman Sachs](https://www.internhack.in/learn/dsa/companies/goldman-sachs): 7 of these problems
- [Oracle](https://www.internhack.in/learn/dsa/companies/oracle): 7 of these problems
- [Infosys](https://www.internhack.in/learn/dsa/companies/infosys): 6 of these problems
- [Tiktok](https://www.internhack.in/learn/dsa/companies/tiktok): 6 of these problems
- [Accenture](https://www.internhack.in/learn/dsa/companies/accenture): 5 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)
- [Database](https://www.internhack.in/learn/dsa/database) (197)
- [Heap (Priority Queue)](https://www.internhack.in/learn/dsa/heap-priority-queue) (196)
- [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)
