Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ceae48b

Browse files
Merge pull request neetcode-gh#2990 from pontusdacke/patch-1
Solve 0303-range-sum-query-immutable
2 parents 72e0327 + 0af1ff3 commit ceae48b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
public class NumArray {
2+
private int[] nums;
3+
public NumArray(int[] nums) {
4+
this.nums = nums;
5+
}
6+
7+
public int SumRange(int left, int right) {
8+
int sum = 0;
9+
for (int i = left; i <= right; i++)
10+
{
11+
sum += this.nums[i];
12+
}
13+
return sum;
14+
}
15+
}

0 commit comments

Comments
 (0)