diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-17 20:15:21 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-17 20:15:21 +0100 |
commit | 97f5fcd7d00bb5840bed749a0004610aab34707b (patch) | |
tree | 359363a0515695602890073525acfe2095cc63de /leetcode/solutions.org | |
parent | f7f106195a5caa905e73bef19119f5e59f4d3f2b (diff) | |
download | algorithms-97f5fcd7d00bb5840bed749a0004610aab34707b.tar.gz algorithms-97f5fcd7d00bb5840bed749a0004610aab34707b.tar.bz2 algorithms-97f5fcd7d00bb5840bed749a0004610aab34707b.zip |
Fix productexceptself
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 |