Skip to content

Commit 5f18b8d

Browse files
committed
Update index.ts
1 parent e352187 commit 5f18b8d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

range-sum-query-mutable/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export function build(
2828
}
2929
const mid = Math.floor((start + end) / 2);
3030
pushdown(node);
31+
if (!node.left || !node.right) {
32+
throw Error("node.left and node.right empty");
33+
}
3134
if (node.left) build(node.left, start, mid, nums);
3235
if (node.right) build(node.right, mid + 1, end, nums);
3336
pushup(node);

0 commit comments

Comments
 (0)