2 ms·
You're right, I completely forgot what it meant... The loop I wrote was basically equivalent to : for (int i = 0; i < nums.size(); ++i) { nums[nums[i]] =
by tsimionescu 4y ago
You're right, I completely forgot what it meant... The loop I wrote was basically equivalent to :
for (int i = 0; i < nums.size(); ++i) {
nums[nums[i]] = rng();
}
Which happens not to go out of bounds simply because nums[i] is initially 0 for every i in the range - so it sets nums[0] to a different random number 1000 times.