307. Range Sum Query - Mutable
Difficulty: Medium
Given an integer array nums, find the sum of the elements between indices _i_ and _j_ (_i_ ≤ _j_), inclusive.
The update(i, val) function modifies nums by updating the element at index _i_ to val.
Example:
1 | Given nums = [1, 3, 5] |
Note:
- The array is only modifiable by the update function.
- You may assume the number of calls to update and sumRange function is distributed evenly.
Solution
一个基本考察BIT的题目 https://blog.csdn.net/Yaokai_AssultMaster/article/details/79492190
Language: Java
1 | public class NumArray { |