auto commit
|
@ -68,7 +68,7 @@ public boolean isNumeric(char[] str) {
|
|||
|
||||
需要保证奇数和奇数,偶数和偶数之间的相对位置不变,这和书本不太一样。
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/7_2001550475133282.png"/> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/d03a2efa-ef19-4c96-97e8-ff61df8061d3.png" width="200px"> </div><br>
|
||||
|
||||
## 解题思路
|
||||
|
||||
|
@ -98,7 +98,7 @@ public void reOrderArray(int[] nums) {
|
|||
|
||||
设链表的长度为 N。设两个指针 P1 和 P2,先让 P1 移动 K 个节点,则还有 N - K 个节点可以移动。此时让 P1 和 P2 同时移动,可以知道当 P1 移动到链表结尾时,P2 移动到 N - K 个节点处,该位置就是倒数第 K 个节点。
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/ea2304ce-268b-4238-9486-4d8f8aea8ca4.png" width="500"/> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/6b504f1f-bf76-4aab-a146-a9c7a58c2029.png" width="500"/> </div><br>
|
||||
|
||||
```java
|
||||
public ListNode FindKthToTail(ListNode head, int k) {
|
||||
|
@ -132,8 +132,7 @@ public ListNode FindKthToTail(ListNode head, int k) {
|
|||
|
||||
在相遇点,slow 要到环的入口点还需要移动 z 个节点,如果让 fast 重新从头开始移动,并且速度变为每次移动一个节点,那么它到环入口点还需要移动 x 个节点。在上面已经推导出 x=z,因此 fast 和 slow 将在环入口点相遇。
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/d5d3b7ae-2712-412e-98f1-633ce6ec5955.png" width="500"/> </div><br>
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/bb7fc182-98c2-4860-8ea3-630e27a5f29f.png" width="500"/> </div><br>
|
||||
|
||||
```java
|
||||
public ListNode EntryNodeOfLoop(ListNode pHead) {
|
||||
|
@ -194,7 +193,7 @@ public ListNode ReverseList(ListNode head) {
|
|||
|
||||
## 题目描述
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/43f2cafa-3568-4a89-a895-4725666b94a6.png" width="500"/> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/c094d2bc-ec75-444b-af77-d369dfb6b3b4.png" width="400"/> </div><br>
|
||||
|
||||
## 解题思路
|
||||
|
||||
|
@ -246,7 +245,7 @@ public ListNode Merge(ListNode list1, ListNode list2) {
|
|||
|
||||
## 题目描述
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/4583e24f-424b-4d50-8a14-2c38a1827d4a.png" width="500"/> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/84a5b15a-86c5-4d8e-9439-d9fd5a4699a1.jpg" width="450"/> </div><br>
|
||||
|
||||
## 解题思路
|
||||
|
||||
|
@ -274,7 +273,7 @@ private boolean isSubtreeWithRoot(TreeNode root1, TreeNode root2) {
|
|||
|
||||
## 题目描述
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/a2d13178-f1ef-4811-a240-1fe95b55b1eb.png" width="300"/> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/0c12221f-729e-4c22-b0ba-0dfc909f8adf.jpg" width="300"/> </div><br>
|
||||
|
||||
## 解题思路
|
||||
|
||||
|
@ -300,7 +299,7 @@ private void swap(TreeNode root) {
|
|||
|
||||
## 题目描述
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/f42443e0-208d-41ea-be44-c7fd97d2e3bf.png" width="300"/> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/0c12221f-729e-4c22-b0ba-0dfc909f8adf.jpg" width="300"/> </div><br>
|
||||
|
||||
## 解题思路
|
||||
|
||||
|
@ -330,7 +329,7 @@ boolean isSymmetrical(TreeNode t1, TreeNode t2) {
|
|||
|
||||
下图的矩阵顺时针打印结果为:1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5, 6, 7, 11, 10
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/8_2001550475451664.png"/> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/48517227-324c-4664-bd26-a2d2cffe2bfe.png" width="200px"> </div><br>
|
||||
|
||||
## 解题思路
|
||||
|
||||
|
|
BIN
docs/pics/0c12221f-729e-4c22-b0ba-0dfc909f8adf.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
docs/pics/48517227-324c-4664-bd26-a2d2cffe2bfe.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
docs/pics/6b504f1f-bf76-4aab-a146-a9c7a58c2029.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
docs/pics/84a5b15a-86c5-4d8e-9439-d9fd5a4699a1.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
docs/pics/bb7fc182-98c2-4860-8ea3-630e27a5f29f.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
docs/pics/c094d2bc-ec75-444b-af77-d369dfb6b3b4.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
docs/pics/d03a2efa-ef19-4c96-97e8-ff61df8061d3.png
Normal file
After Width: | Height: | Size: 7.0 KiB |