Practice · 4 problems
Prefix Sum
0 of 4 solved on this device
- 156Find Pivot IndexGiven an array `nums`, return the leftmost index where the sum of everything strictly to its left equals the sum of everything strictly to its right. Return -1 if no such index exists.Easy
- 157Range Sum Query - ImmutableGiven an integer array `nums`, handle many queries asking for the sum of the elements between indices left and right inclusive. Implement the NumArray class with sumRange(left, right).Easy
- 158Range Sum Query 2D - ImmutableGiven a 2D matrix, handle queries for the sum of the rectangle defined by its upper left and lower right corners. Implement NumMatrix with sumRegion(row1, col1, row2, col2).Medium
- 159Continuous Subarray SumGiven an integer array `nums` and an integer `k`, return true if there is a contiguous subarray of length AT LEAST TWO whose sum is a multiple of k.Medium