diff --git a/docs/notes/剑指 Offer 题解 - 30~39.md b/docs/notes/剑指 Offer 题解 - 30~39.md index cd64d546..fdd0b24f 100644 --- a/docs/notes/剑指 Offer 题解 - 30~39.md +++ b/docs/notes/剑指 Offer 题解 - 30~39.md @@ -87,7 +87,7 @@ public boolean IsPopOrder(int[] pushSequence, int[] popSequence) { 例如,以下二叉树层次遍历的结果为:1,2,3,4,5,6,7 -

+

## 解题思路 @@ -195,7 +195,7 @@ public ArrayList> Print(TreeNode pRoot) { 例如,下图是后序遍历序列 1,3,2 所对应的二叉搜索树。 -

+

## 解题思路 @@ -230,7 +230,7 @@ private boolean verify(int[] sequence, int first, int last) { 下图的二叉树有两条和为 22 的路径:10, 5, 7 和 10, 12 -

+

## 解题思路 @@ -277,21 +277,21 @@ public class RandomListNode { } ``` -

+

## 解题思路 第一步,在每个节点的后面插入复制的节点。 -

+

第二步,对复制节点的 random 链接进行赋值。 -

+

第三步,拆分。 -

+

```java public RandomListNode Clone(RandomListNode pHead) { @@ -333,7 +333,7 @@ public RandomListNode Clone(RandomListNode pHead) { 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向。 -

+

## 解题思路 diff --git a/docs/notes/剑指 Offer 题解 - 60~68.md b/docs/notes/剑指 Offer 题解 - 60~68.md index 602ae124..e53fc552 100644 --- a/docs/notes/剑指 Offer 题解 - 60~68.md +++ b/docs/notes/剑指 Offer 题解 - 60~68.md @@ -285,12 +285,12 @@ public int StrToInt(String str) { ### 二叉查找树 -

- [Leetcode : 235. Lowest Common Ancestor of a Binary Search Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/description/) 二叉查找树中,两个节点 p, q 的公共祖先 root 满足 root.val >= p.val && root.val <= q.val。 +

+ ```java public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if (root == null) @@ -305,12 +305,12 @@ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { ### 普通二叉树 -

- [Leetcode : 236. Lowest Common Ancestor of a Binary Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/description/) 在左右子树中查找是否存在 p 或者 q,如果 p 和 q 分别在两个子树中,那么就说明根节点就是最低公共祖先。 +

+ ```java public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if (root == null || root == p || root == q) diff --git a/docs/pics/047faac4-a368-4565-8331-2b66253080d3.jpg b/docs/pics/047faac4-a368-4565-8331-2b66253080d3.jpg new file mode 100644 index 00000000..1eaf6d4c Binary files /dev/null and b/docs/pics/047faac4-a368-4565-8331-2b66253080d3.jpg differ diff --git a/docs/pics/05a08f2e-9914-4a77-92ef-aebeaecf4f66.jpg b/docs/pics/05a08f2e-9914-4a77-92ef-aebeaecf4f66.jpg new file mode 100644 index 00000000..cef9109a Binary files /dev/null and b/docs/pics/05a08f2e-9914-4a77-92ef-aebeaecf4f66.jpg differ diff --git a/docs/pics/13454fa1-23a8-4578-9663-2b13a6af564a.jpg b/docs/pics/13454fa1-23a8-4578-9663-2b13a6af564a.jpg new file mode 100644 index 00000000..1bd9c224 Binary files /dev/null and b/docs/pics/13454fa1-23a8-4578-9663-2b13a6af564a.jpg differ diff --git a/docs/pics/66a01953-5303-43b1-8646-0c77b825e980.png b/docs/pics/66a01953-5303-43b1-8646-0c77b825e980.png new file mode 100644 index 00000000..9777b994 Binary files /dev/null and b/docs/pics/66a01953-5303-43b1-8646-0c77b825e980.png differ diff --git a/docs/pics/cafbfeb8-7dfe-4c0a-a3c9-750eeb824068.png b/docs/pics/cafbfeb8-7dfe-4c0a-a3c9-750eeb824068.png new file mode 100644 index 00000000..7fb2297e Binary files /dev/null and b/docs/pics/cafbfeb8-7dfe-4c0a-a3c9-750eeb824068.png differ diff --git a/docs/pics/d27c99f0-7881-4f2d-9675-c75cbdee3acd.jpg b/docs/pics/d27c99f0-7881-4f2d-9675-c75cbdee3acd.jpg new file mode 100644 index 00000000..73cd9c6c Binary files /dev/null and b/docs/pics/d27c99f0-7881-4f2d-9675-c75cbdee3acd.jpg differ diff --git a/docs/pics/d5e838cf-d8a2-49af-90df-1b2a714ee676.jpg b/docs/pics/d5e838cf-d8a2-49af-90df-1b2a714ee676.jpg new file mode 100644 index 00000000..3192a118 Binary files /dev/null and b/docs/pics/d5e838cf-d8a2-49af-90df-1b2a714ee676.jpg differ diff --git a/docs/pics/dfd5d3f8-673c-486b-8ecf-d2082107b67b.png b/docs/pics/dfd5d3f8-673c-486b-8ecf-d2082107b67b.png new file mode 100644 index 00000000..fd0c5816 Binary files /dev/null and b/docs/pics/dfd5d3f8-673c-486b-8ecf-d2082107b67b.png differ diff --git a/docs/pics/e151b5df-5390-4365-b66e-b130cd253c12.png b/docs/pics/e151b5df-5390-4365-b66e-b130cd253c12.png new file mode 100644 index 00000000..c3107464 Binary files /dev/null and b/docs/pics/e151b5df-5390-4365-b66e-b130cd253c12.png differ diff --git a/docs/pics/ed77b0e6-38d9-4a34-844f-724f3ffa2c12.jpg b/docs/pics/ed77b0e6-38d9-4a34-844f-724f3ffa2c12.jpg new file mode 100644 index 00000000..b1123b86 Binary files /dev/null and b/docs/pics/ed77b0e6-38d9-4a34-844f-724f3ffa2c12.jpg differ