From 34083b33592c1cef3658bedfb8d3bb748225962e Mon Sep 17 00:00:00 2001 From: CyC2018 <1029579233@qq.com> Date: Thu, 10 Jan 2019 12:48:44 +0800 Subject: [PATCH] auto commit --- docs/notes/Leetcode 题解.md | 2 +- .../pics/gh_a68199af85d6_258_20_282_29.jpg | Bin 0 -> 31744 bytes docs/notes/剑指 offer 题解.md | 6 +++++- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 docs/notes/pics/gh_a68199af85d6_258_20_282_29.jpg diff --git a/docs/notes/Leetcode 题解.md b/docs/notes/Leetcode 题解.md index 7ee1a2b7..23dfbefc 100644 --- a/docs/notes/Leetcode 题解.md +++ b/docs/notes/Leetcode 题解.md @@ -4243,7 +4243,7 @@ public boolean isPalindrome(ListNode head) { slow = slow.next; fast = fast.next.next; } - if (fast != null) slow = slow.next; // 链表节点个数为奇数,让 slow 指向下一个节点 + if (fast != null) slow = slow.next; // 偶数节点,让 slow 指向下一个节点 cut(head, slow); // 切成两个链表 return isEqual(head, reverse(slow)); } diff --git a/docs/notes/pics/gh_a68199af85d6_258_20_282_29.jpg b/docs/notes/pics/gh_a68199af85d6_258_20_282_29.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3c09c1c40a3f25373140507a7fe017b35c113934 GIT binary patch literal 31744 zcmeIb30RE#|2KXoWGSJNgt0^j9YQD#4w4Ro5TZenO3g{ysJXL?=#X@*V@pUz+E8X% zR1{??ZEC8KNK-Q{)6{Iw`*Y8<;QXK8xAS{`*Y*6b>+wB(IoB~Y_kDjp@6Y@F+D2X^ zufPVcSZ1{hQ&GV%75E<}FU5YxRD1P8|G=-_@K2w9efsq7-DiNBTHk)^1Ju8sYS|A2w;7vcwFy;M|H zd-YaD?;8Gg0Q`5X_mDnA$Ie*PS8L67wQ(NWGY_7<(Qo|Xm{gs$@Aw8LJN6#xKVX>d zaJ>-|CK^tfJZ0AGIi_>x&HsJL(q)#*tyb8qTff0}vqJQ$h-IMKaP!yPe^?7^jTW^i;T>ym#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oGvbA5tsbMwF(UmR|JO^X#5@TAZMm6uThx z3bW+1#UC}^j^Fhh$B^vluOay1A=u9FzMn*oru%SvUMC|fC`HtCI;ntOT(w{qu9czJ*J#$^y1%XsCz%X-{V8lrUwhlD zDOIeCHd^3{pTHQpWRbS4`vMqf!@Nx}J(pM
+ # 2. 实现 Singleton [单例模式](设计模式.md) @@ -1853,7 +1857,7 @@ private void backtracking(char[] chars, boolean[] hasUsed, StringBuilder s) { 多数投票问题,可以利用 Boyer-Moore Majority Vote Algorithm 来解决这个问题,使得时间复杂度为 O(N)。 -使用 cnt 来统计一个元素出现的次数,cnt 初始为 0。算法依次遍历数组中的数字,遍历到一个元素时,若 cnt 为 0,则令统计元素为遍历到的该元素,并置 cnt 为 1。若 cnt 不为 0,且当遍历到的元素和统计元素相等时,令 cnt++,否则令 cnt--。如果前面查找了 i 个元素,且 cnt == 0,说明前 i 个元素没有 majority,或者有 majority,但是出现的次数少于 i / 2 ,因为如果多于 i / 2 的话 cnt 就一定不会为 0 。此时剩下的 n - i 个元素中,majority 的数目依然多于 (n - i) / 2,因此继续查找就能找出 majority。 +使用 cnt 来统计一个元素出现的次数,当遍历到的元素和统计元素相等时,令 cnt++,否则令 cnt--。如果前面查找了 i 个元素,且 cnt == 0,说明前 i 个元素没有 majority,或者有 majority,但是出现的次数少于 i / 2 ,因为如果多于 i / 2 的话 cnt 就一定不会为 0 。此时剩下的 n - i 个元素中,majority 的数目依然多于 (n - i) / 2,因此继续查找就能找出 majority。 ```java public int MoreThanHalfNum_Solution(int[] nums) {