From 81cef9e578ef5b2f6c8951d22630723e430c2429 Mon Sep 17 00:00:00 2001 From: CyC2018 Date: Wed, 28 Oct 2026 13:45:07 +0800 Subject: [PATCH] =?UTF-8?q?Update=2066.=20=E6=9E=84=E5=BB=BA=E4=B9=98?= =?UTF-8?q?=E7=A7=AF=E6=95=B0=E7=BB=84.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 题目链接改为力扣中的对应题目,题目描述和代码按该题的接口调整。 --- notes/66. 构建乘积数组.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/notes/66. 构建乘积数组.md b/notes/66. 构建乘积数组.md index c1d94a08..1cdf8de5 100644 --- a/notes/66. 构建乘积数组.md +++ b/notes/66. 构建乘积数组.md @@ -2,7 +2,7 @@ ## 题目链接 -[NowCoder](https://www.nowcoder.com/practice/94a4d381a68b47b7a8bed86f2975db46?tpId=13&tqId=11204&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github) +[Leetcode](https://leetcode.cn/problems/gou-jian-cheng-ji-shu-zu-lcof/) ## 题目描述 @@ -14,12 +14,12 @@ ## 解题思路 ```java -public int[] multiply(int[] A) { - int n = A.length; +public int[] statisticalResult(int[] arrayA) { + int n = arrayA.length; int[] B = new int[n]; - for (int i = 0, product = 1; i < n; product *= A[i], i++) /* 从左往右累乘 */ + for (int i = 0, product = 1; i < n; product *= arrayA[i], i++) /* 从左往右累乘 */ B[i] = product; - for (int i = n - 1, product = 1; i >= 0; product *= A[i], i--) /* 从右往左累乘 */ + for (int i = n - 1, product = 1; i >= 0; product *= arrayA[i], i--) /* 从右往左累乘 */ B[i] *= product; return B; }