Whats the difference?

vector<vector> v
vector v[n]
they both are 2d matrix

vector< vector< int > > V(N);

That is the declaration of an object V of type vector< vector< int > > , i.e. “vector of int-vectors”, initialized to hold N default-initialized objects…

…i.e., a vector holding N objects of vector< int > – which are, in turn, empty (because “empty” is what default-initialized vectors are).

vector v[N] (which would not even compile). It is also not the same as vector<int> v[N] – that would be an array of N different vector<int> objects.

refer this
https://stackoverflow.com/questions/35478657/what-is-difference-between-vectorint-vn-and-vector-int-v-n#:~:text=vector%20>%20V(N)%3B,default-initialized%20objects…&text=The%20std%3A%3Avector%20(%20std,which%20is%20dynamic%20in%20size.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.