We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/wisdompeak/LeetCode/blob/master/Template/SegmentTree/range_sum.cpp#L33 In the PushDown method of RangeSum temlpate, the code just simply copy the parent's info to childrens', which is wrong.
PushDown
I test it by the following code
int main(){ SegTreeNode* root = new SegTreeNode(0, 10, 0); root->updateRange(5, 10, 20); assert(root->queryRange(6,6) == 20); // where the template gives us 40 }
We could fix this by introducing lazy_val as the member variable.
lazy_val
The text was updated successfully, but these errors were encountered:
谢谢提醒。简单修正了一下,欢迎测试。
Sorry, something went wrong.
No branches or pull requests
https://github.com/wisdompeak/LeetCode/blob/master/Template/SegmentTree/range_sum.cpp#L33
In the
PushDown
method of RangeSum temlpate, the code just simply copy the parent's info to childrens', which is wrong.I test it by the following code
We could fix this by introducing
lazy_val
as the member variable.The text was updated successfully, but these errors were encountered: