From 97f5fcd7d00bb5840bed749a0004610aab34707b Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 17 Jul 2024 20:15:21 +0100 Subject: Fix productexceptself --- leetcode/solutions.org | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 productexceptself(vector &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 -- cgit v1.2.3-13-gbd6f