You are viewing a single comment's thread. Return to all comments →
Filling of vector also can be done in the following way:
a[i].reserve(k); // make room for k elements for (int j=0;j<k;j++) { cin >> a[i][j]; // and reading them }
That reserve() was exectly what I was lacking. Thanks!
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Variable Sized Arrays
You are viewing a single comment's thread. Return to all comments →
Filling of vector also can be done in the following way:
That reserve() was exectly what I was lacking. Thanks!