Skip to content

Commit a3a7e1b

Browse files
committed
修改了notes
1 parent 2a953c8 commit a3a7e1b

17 files changed

+305
-414
lines changed

code/offer/.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/offer/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/offer/.idea/workspace.xml

Lines changed: 244 additions & 330 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/offer/src/Chap7/LastSameInBST.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ public class LastSameInBST {
77
private class Node {
88
private Node left, right;
99
private int val;
10-
1110
public Node(int val) {
1211
this.val = val;
1312
}

notes/剑指offer面试题 52--两个链表的第一个公共结点.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ public class FirstPublicNode {
138138

139139
```java
140140
public ListNode FindFirstCommonNode(ListNode pHead1, ListNode pHead2) {
141-
ListNode p1 = pHead1;
142-
ListNode p2 = pHead2;
143-
while (p1 != p2) {
144-
p1 = (p1 == null ? pHead2 : p1.next);
145-
p2 = (p2 == null ? pHead1 : p2.next);
146-
}
147-
return p1;
141+
ListNode p1 = pHead1;
142+
ListNode p2 = pHead2;
143+
while (p1 != p2) {
144+
p1 = (p1 == null ? pHead2 : p1.next);
145+
p2 = (p2 == null ? pHead1 : p2.next);
146+
}
147+
return p1;
148148
}
149149
```
150150

notes/剑指offer面试题10--斐波那契数列.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ public class Fibonacci {
3535

3636
```java
3737
public int fib2(int n) {
38-
if (n <= 0) {
39-
return 0;
40-
}
38+
if (n <= 0) {
39+
return 0;
40+
}
4141

42-
if (n == 1) {
43-
return 1;
44-
}
42+
if (n == 1) {
43+
return 1;
44+
}
4545

46-
return fib2(n-1) +fib(n-2);
46+
return fib2(n-1) +fib(n-2);
4747
}
4848
```
4949

notes/剑指offer面试题14--剪绳子.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ public static int maxProductAfterCutting2(int length) {
9595

9696
by @sunhaiyu
9797

98-
2017.12.19
98+
2017.12.19

notes/剑指offer面试题15--二进制中1的个数.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
99
```java
1010
public int numberOf1_2(int n) {
11-
int count = 0;
12-
13-
while (n != 0) {
14-
if ((n & 1) == 1) {
15-
count++;
16-
}
17-
n = n >> 1;
18-
}
19-
return count;
11+
int count = 0;
12+
13+
while (n != 0) {
14+
if ((n & 1) == 1) {
15+
count++;
16+
}
17+
n = n >> 1;
18+
}
19+
return count;
2020
}
2121
```
2222

notes/剑指offer面试题21--调整数组的顺序使奇数位于偶数前面.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public class ReOrderArray {
8383
// 右到左找出第一个奇数
8484
while (pBegin < pEnd && !p.test(array[pEnd]))
8585
pEnd--;
86-
// 交换两个奇数和偶数,奇数被换到了前面,偶数换到了后面
86+
// 交换两个奇数和偶数,奇数被换到了前面,偶数换到了后面
8787
if (pBegin < pEnd) {
8888
int temp = array[pBegin];
8989
array[pBegin] = array[pEnd];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 剑指offer面试题28--对称的二叉树
1+
# 剑指offer面试题27--对称的二叉树
22

33
> ```
44
> 请实现一个函数,用来判断一颗二叉树是不是对称的。注意,如果一个二叉树同此二叉树的镜像是同样的,定义其为对称的。

0 commit comments

Comments
 (0)