We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f2b5a10 commit 6d0e4b4Copy full SHA for 6d0e4b4
product-of-array-except-self/daiyongg-kim.py
@@ -0,0 +1,20 @@
1
+class Solution:
2
+ def productExceptSelf(self, nums: List[int]) -> List[int]:
3
+
4
+ size = len(nums)
5
6
+ #initialize array as 1
7
+ result = [1] * size
8
9
+ left_pass = 1
10
11
+ for i in range(size):A
12
+ result[i] *= left_pass
13
+ left_pass *= nums[i]
14
15
+ right_pass = 1
16
+ for i in range(size-1, -1, -1):
17
+ result[i] *= right_pass
18
+ right_pass *= nums[i]
19
20
+ return result
0 commit comments