1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48: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
2022-03-29 12:43:11 +08:00

19 lines
608 B
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>