Skip to content

Commit e4edc5c

Browse files
authored
Update 370-range-addition.js
1 parent c7bdfd9 commit e4edc5c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

370-range-addition.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ After applying operation [0,2,-2]:
2626
[-2,0,3,5,3]
2727
2828
*/
29-
3029
/**
3130
* @param {number} length
3231
* @param {number[][]} updates
@@ -35,9 +34,7 @@ After applying operation [0,2,-2]:
3534
const getModifiedArray = function(length, updates) {
3635
const res = new Array(length).fill(0)
3736
for (let update of updates) {
38-
let value = update[2]
39-
let start = update[0]
40-
let end = update[1]
37+
const [start, end, value] = update
4138
res[start] += value
4239
if (end < length - 1) res[end + 1] -= value
4340
}

0 commit comments

Comments
 (0)