Implement Prefix Sums and Kadane

range sums and difference arrays

Challenge 3 of Arrays & StringsBeginner~50 minFree

Master the toolkit behind fast range-sum queries and streaming analytics. You will build a prefix-sum class for O(1) range queries, count subarrays with a target sum, apply batched range updates with a difference array, find the maximum subarray with Kadane's algorithm, and locate a pivot index. These patterns power dashboards, time-series rollups, and interview favorites.

5 steps

  1. 1Range-Sum Queries
  2. 2Subarrays Summing to K
  3. 3Difference Array Updates
  4. 4Kadane's Maximum Subarray
  5. 5Pivot Index
Start step 1