Fix productexceptself
This commit is contained in:
@@ -188,8 +188,10 @@ vector<int> productexceptself(vector<int> &nums)
|
|||||||
out[i + 1] = out[i] * nums[i];
|
out[i + 1] = out[i] * nums[i];
|
||||||
int postfix = 1;
|
int postfix = 1;
|
||||||
for (int i = n - 1; i >= 0; --i)
|
for (int i = n - 1; i >= 0; --i)
|
||||||
|
{
|
||||||
out[i] *= postfix;
|
out[i] *= postfix;
|
||||||
postfix *= nums[i];
|
postfix *= nums[i];
|
||||||
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|||||||
Reference in New Issue
Block a user