Skip to content

Commit 4dfbc49

Browse files
authored
Update Product of Array Except Self - Leetcode 238.py
1 parent d29cd55 commit 4dfbc49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Product of Array Except Self - Leetcode 238/Product of Array Except Self - Leetcode 238.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ def productExceptSelf(self, nums: List[int]) -> List[int]:
55
ans = [0] * n
66

77
for i in range(n):
8-
multiplier = 1
8+
prod = 1
99
for j in range(n):
1010
if i != j:
11-
multiplier *= nums[j]
12-
ans[i] = multiplier
11+
prod *= nums[j]
12+
ans[i] = prod
1313

1414
return ans
1515
# Time: O(n^2)

0 commit comments

Comments
 (0)