MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / NumArray

Method NumArray

Java/Range-Sum-Query-Mutable.java:18–24  ·  view source on GitHub ↗
(int[] nums)

Source from the content-addressed store, hash-verified

16 int n;
17
18 public NumArray(int[] nums) {
19 if (nums.length > 0) {
20 n = nums.length;
21 tree = new int[n * 2];
22 buildTree(nums);
23 }
24 }
25
26 // build the segment tree and store it in array of size 2 * nums[] length
27 // so the nums[] values are stores at leaves of the segment tree.

Callers

nothing calls this directly

Calls 1

buildTreeMethod · 0.95

Tested by

no test coverage detected