<h3><a title="题目描述" href="https://leetcode-cn.com/problems/product-of-array-except-self/">题目描述</a></h3>
![image.png](https://i.loli.net/2020/06/04/UjNmZJ31lxzXW47.png)
<h4>方法一</h4>
<pre class="EnlighterJSRAW" data-enlighter-language="python">class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
left, right,res = [1] * len(nums), [1] * len(nums),[1] * len(nums)
for i in range(1,len(nums)):
left[i] = left[i - 1] * nums[i - 1]
for i in range(len(nums)-2,-1,-1):
right[i] = right[i + 1] * nums[i + 1]
for i in range(len(nums)):
res[i] = left[i] * right[i]
return res
</pre>
<p> </p>
### Note:
- 回溯法/DP ,左乘数组&右乘数组
Leetcode238 除自身以外数组的乘积