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

Skip to content

Conversation

@Sosuke23
Copy link

@Sosuke23 Sosuke23 commented Nov 9, 2025

i think it is better to make coding language consistent.

b[idx] += x
idx += idx & -idx
```cpp
void add(std::vector<int> b, int idx, int x) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not pass the entire vector, just the reference.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


We can find arbitrary range sums by computing the prefix sums for $l-1$ and $r$ and taking the difference of them again.

```python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we actually keep both Python and C++?

Copy link
Author

@Sosuke23 Sosuke23 Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want it for the whole fenwick module or just this one?

@Sosuke23 Sosuke23 requested a review from kostca November 11, 2025 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants