1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/构建乘积数组 [gou-jian-cheng-ji-shu-zu-lcof].html

19 lines
608 B
HTML
Raw Normal View History

2022-03-27 20:38:29 +08:00
<p>给定一个数组 <code>A[0,1,…,n-1]</code>,请构建一个数组 <code>B[0,1,…,n-1]</code>,其中 <code>B[i]</code> 的值是数组 <code>A</code> 中除了下标 <code>i</code> 以外的元素的积, 即 <code>B[i]=A[0]×A[1]××A[i-1]×A[i+1]××A[n-1]</code>。不能使用除法。</p>
<p> </p>
<p><strong>示例:</strong></p>
<pre>
<strong>输入:</strong> [1,2,3,4,5]
<strong>输出:</strong> [120,60,40,30,24]</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li>所有元素乘积之和不会溢出 32 位整数</li>
<li><code>a.length <= 100000</code></li>
</ul>