Skip to content
New issue

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

A problem about 315. Count of Smaller Numbers After Self #229

Open
guuzaa opened this issue Oct 5, 2020 · 1 comment
Open

A problem about 315. Count of Smaller Numbers After Self #229

guuzaa opened this issue Oct 5, 2020 · 1 comment

Comments

@guuzaa
Copy link

guuzaa commented Oct 5, 2020

Hi, there.

In the Binary Index Tree implementation, the length of the tree should be one greater than the length of the original array (nums) . However, your code is the same .

// @ 63-64 line
vector <int> f(sorted.size());
fenwick = f;

I think this will lead to some memory overflow issues. So, I modifies the size of f to sorted.size() + 1. It works in leetcode.

@Shanayshah44
Copy link

Yes Binary Index Tree is always one greater than the size of the array

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

No branches or pull requests

2 participants