mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-10-31 11:05:36 +00:00
Update 66. 构建乘积数组.md
补充解题思路小节中关于左右乘积拆分与双向遍历计算方法的文字说明。
This commit is contained in:
+2
-1
@@ -10,9 +10,10 @@
|
||||
|
||||
<div align="center"> <img src="pics/offer-product-array.png" width="560px"/> </div><br>
|
||||
|
||||
|
||||
## 解题思路
|
||||
|
||||
B[i] 等于 A[i] 左边所有元素的乘积乘以右边所有元素的乘积。第一遍从左往右,让 B[i] 等于左边的乘积;第二遍从右往左,用 product 累乘右边的元素,再乘到 B[i] 上。两遍都是 O(N),不需要除法。
|
||||
|
||||
```java
|
||||
public int[] statisticalResult(int[] arrayA) {
|
||||
int n = arrayA.length;
|
||||
|
||||
Reference in New Issue
Block a user