i was trying to solve this problem, and i did resolve it but there’s a thing that i don’t understand.

why this work:

```
#include <bits/stdc++.h>
using namespace std;
struct Fenwick{
vector<int> arr;
int n;
int last;
void assign(int N){
n=N+1;
arr.resize(N+1,0);
for(int i=1,i<N+1;i++){
arr[i] = i & -i;
}
last = N;
}
};
int main() {
int T = 10;
Fenwick fen;
for(int i=0;i<T;i++){
int N = i+1;
fen.assign(N);
}
}
```

and this one doesn’t:

```
#include <bits/stdc++.h>
using namespace std;
struct Fenwick{
vector<int> arr;
int n;
int last;
Fenwick(int N) : n(N+1){
arr.resize(N+1,0);
for(int i=1,i<N+1;i++){
arr[i] = i & -i;
}
last = N;
}
};
int main() {
int T=10;
for(int i=0;i<T;i++){
int N = i+1;
Fenwick fen(N);
}
}
```

when i say that “it works” i mean that it doesn’t crash, this is only a small part of the code but it’s the only difference between the two codes that i wrote for the problem.