Skip to content

Commit 2a953c8

Browse files
committed
修改了面试题18的错误代码
1 parent 0ea72d2 commit 2a953c8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

notes/剑指offer面试题18——删除链表的结点.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public ListNode deleteDuplication(ListNode pHead) {
188188
}
189189
}
190190
// 这里不能返回pHead,因为pHead也可能被删除了
191-
return pre.next;
191+
return first.next;
192192
}
193193
```
194194

notes/剑指offer面试题66--构建乘积数组.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
根据这些关系计算出C[i]和D[i],最后求得`B[i] = C[i] * D[i]`即可。
2020

21-
![https://www.cnblogs.com/wxdjss](http://obvjfxxhr.bkt.clouddn.com/947994-20160430170929925-1177273395.png)
21+
![](http://picmeup.oss-cn-hangzhou.aliyuncs.com/coding/Snipaste_2018-10-20_21-55-32.png)
2222

2323
如上图,表中每一行的第一个数就是其后每个数字连乘,没有被乘上的数字A[i]就用1表示了,反正乘积不变。显然C[0] = 1,我们可以用`C[i] = C[i -1]*A[i -1]`计算出对角线左边的三角中各个A[i]的值;显然D[n -1] = 1,再`D[i] = D[i + 1]*A[i + 1]`计算对角线右边的三角中各个A[i]的值,然后将两者相乘就能得到B[i]
2424

0 commit comments

Comments
 (0)