Skip to content

Latest commit

 

History

History
71 lines (29 loc) · 957 Bytes

File metadata and controls

71 lines (29 loc) · 957 Bytes

中文文档

Description

Given an integer array nums, find the sum of the elements between indices i and j (ij), inclusive.

The update(i, val) function modifies nums by updating the element at index i to val.

Example:

Given nums = [1, 3, 5]



sumRange(0, 2) -> 9

update(1, 2)

sumRange(0, 2) -> 8

Note:

    <li>The array is only modifiable by the <i>update</i> function.</li>
    
    <li>You may assume the number of calls to <i>update</i> and <i>sumRange</i> function is distributed evenly.</li>
    

Solutions

Python3

Java

...