auto commit
This commit is contained in:
parent
d6b4a9a012
commit
480ce3db3c
|
@ -381,6 +381,8 @@ public TreeLinkNode GetNext(TreeLinkNode pNode) {
|
|||
|
||||
in 栈用来处理入栈(push)操作,out 栈用来处理出栈(pop)操作。一个元素进入 in 栈之后,出栈的顺序被反转。当元素要出栈时,需要先进入 out 栈,此时元素出栈顺序再一次被反转,因此出栈顺序就和最开始入栈顺序是相同的,此时先进入的元素先退出,这就是队列的顺序。
|
||||
|
||||
<div align="center"> <img src="../pics//dd9f6026-a514-475b-a707-a2f442e046b2.png"/> </div><br>
|
||||
|
||||
```java
|
||||
Stack<Integer> in = new Stack<Integer>();
|
||||
Stack<Integer> out = new Stack<Integer>();
|
||||
|
@ -980,7 +982,7 @@ public ListNode FindKthToTail(ListNode head, int k) {
|
|||
|
||||
在相遇点,slow 要到环的入口点还需要移动 z 个节点,如果让 fast 重新从头开始移动,并且速度变为每次移动一个节点,那么它到环入口点还需要移动 x 个节点。在上面已经推导出 x=z,因此 fast 和 slow 将在环入口点相遇。
|
||||
|
||||
<div align="center"> <img src="../pics//e7d7dc0d-fc22-4f95-8768-b8a216168792.jpg"/> </div><br>
|
||||
<div align="center"> <img src="../pics//71363383-2d06-4c63-8b72-c01c2186707d.png"/> </div><br>
|
||||
|
||||
```java
|
||||
public ListNode EntryNodeOfLoop(ListNode pHead) {
|
||||
|
@ -1154,9 +1156,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="../pics//8615d9f7-bd1d-4240-8bb4-02b941d54a6f.png"/> </div><br>
|
||||
|
||||
<div align="center"> <img src="../pics//6afa9796-af1a-4495-9f02-63349ab68a19.png"/> </div><br>
|
||||
<div align="center"> <img src="../pics//0f373947-c68f-45b4-a59e-086154745ac5.png"/> </div><br>
|
||||
|
||||
## 解题思路
|
||||
|
||||
|
|
BIN
pics/0f373947-c68f-45b4-a59e-086154745ac5.png
Normal file
BIN
pics/0f373947-c68f-45b4-a59e-086154745ac5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
pics/71363383-2d06-4c63-8b72-c01c2186707d.png
Normal file
BIN
pics/71363383-2d06-4c63-8b72-c01c2186707d.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
pics/dd9f6026-a514-475b-a707-a2f442e046b2.png
Normal file
BIN
pics/dd9f6026-a514-475b-a707-a2f442e046b2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.0 KiB |
Loading…
Reference in New Issue
Block a user