diff options
Diffstat (limited to 'leetcode/solutions.org')
-rw-r--r-- | leetcode/solutions.org | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/leetcode/solutions.org b/leetcode/solutions.org index 9be16cc..340bc73 100644 --- a/leetcode/solutions.org +++ b/leetcode/solutions.org @@ -188,8 +188,10 @@ vector<int> productexceptself(vector<int> &nums) out[i + 1] = out[i] * nums[i]; int postfix = 1; for (int i = n - 1; i >= 0; --i) + { out[i] *= postfix; - postfix *= nums[i]; + postfix *= nums[i]; + } return out; } #+end_src |