From 699e13d5b4fae1dd73be00065b33c0b4565e5dba Mon Sep 17 00:00:00 2001 From: Alexander <90351792+Sanya239@users.noreply.github.com> Date: Tue, 3 Mar 2026 16:23:08 +0300 Subject: [PATCH] Update segment-trees.md --- content/english/hpc/data-structures/segment-trees.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/english/hpc/data-structures/segment-trees.md b/content/english/hpc/data-structures/segment-trees.md index 9ad14608..776e42f9 100644 --- a/content/english/hpc/data-structures/segment-trees.md +++ b/content/english/hpc/data-structures/segment-trees.md @@ -148,7 +148,7 @@ To calculate the sum on a segment, we can check if the query covers the current ```c++ int sum(int lq, int rq) { - if (rb <= lq && rb <= rq) // if we're fully inside the query, return the sum + if (lb >= lq && rb <= rq) // if we're fully inside the query, return the sum return s; if (rq <= lb || lq >= rb) // if we don't intersect with the query, return zero return 0;