mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-04 16:12:47 +08:00
Update solution 1104
This commit is contained in:
16
README.md
16
README.md
@ -127,15 +127,15 @@
|
||||
| | Easy | Medium | Hard | Total |
|
||||
|:--------:|:--------:|:--------:|:--------:|:--------:|
|
||||
|Optimizing|33|37|27|97|
|
||||
|Accepted|**284**|**406**|**120**|**810**|
|
||||
|Accepted|**284**|**407**|**120**|**811**|
|
||||
|Total|506|1035|415|1956|
|
||||
|Perfection Rate|88.4%|90.9%|77.5%|88.0%|
|
||||
|Completion Rate|56.1%|39.2%|28.9%|41.4%|
|
||||
|Completion Rate|56.1%|39.3%|28.9%|41.5%|
|
||||
|------------|----------------------------|----------------------------|----------------------------|----------------------------|
|
||||
|
||||
## 二. 目录
|
||||
|
||||
以下已经收录了 713 道题的题解,还有 11 道题在尝试优化到 beats 100%
|
||||
以下已经收录了 714 道题的题解,还有 11 道题在尝试优化到 beats 100%
|
||||
|
||||
| No. | Title | Solution | Acceptance | Difficulty | Frequency |
|
||||
|:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:|
|
||||
@ -244,7 +244,7 @@
|
||||
|0103|Binary Tree Zigzag Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal)|51.4%|Medium||
|
||||
|0104|Maximum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0104.Maximum-Depth-of-Binary-Tree)|69.4%|Easy||
|
||||
|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal)|54.4%|Medium||
|
||||
|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal)|51.6%|Medium||
|
||||
|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal)|51.7%|Medium||
|
||||
|0107|Binary Tree Level Order Traversal II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0107.Binary-Tree-Level-Order-Traversal-II)|56.5%|Medium||
|
||||
|0108|Convert Sorted Array to Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0108.Convert-Sorted-Array-to-Binary-Search-Tree)|63.1%|Easy||
|
||||
|0109|Convert Sorted List to Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0109.Convert-Sorted-List-to-Binary-Search-Tree)|53.0%|Medium||
|
||||
@ -1242,7 +1242,7 @@
|
||||
|1101|The Earliest Moment When Everyone Become Friends||67.9%|Medium||
|
||||
|1102|Path With Maximum Minimum Value||51.4%|Medium||
|
||||
|1103|Distribute Candies to People||63.4%|Easy||
|
||||
|1104|Path In Zigzag Labelled Binary Tree||73.8%|Medium||
|
||||
|1104|Path In Zigzag Labelled Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1104.Path-In-Zigzag-Labelled-Binary-Tree)|73.8%|Medium||
|
||||
|1105|Filling Bookcase Shelves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1105.Filling-Bookcase-Shelves)|57.7%|Medium||
|
||||
|1106|Parsing A Boolean Expression||59.7%|Hard||
|
||||
|1107|New Users Daily Count||46.0%|Medium||
|
||||
@ -1406,7 +1406,7 @@
|
||||
|1265|Print Immutable Linked List in Reverse||94.1%|Medium||
|
||||
|1266|Minimum Time Visiting All Points|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1266.Minimum-Time-Visiting-All-Points)|79.2%|Easy||
|
||||
|1267|Count Servers that Communicate||57.9%|Medium||
|
||||
|1268|Search Suggestions System|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1268.Search-Suggestions-System)|65.6%|Medium||
|
||||
|1268|Search Suggestions System|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1268.Search-Suggestions-System)|65.5%|Medium||
|
||||
|1269|Number of Ways to Stay in the Same Place After Some Steps||43.3%|Hard||
|
||||
|1270|All People Report to the Given Manager||88.3%|Medium||
|
||||
|1271|Hexspeak||56.0%|Easy||
|
||||
@ -1900,7 +1900,7 @@
|
||||
|1759|Count Number of Homogenous Substrings||44.0%|Medium||
|
||||
|1760|Minimum Limit of Balls in a Bag||54.5%|Medium||
|
||||
|1761|Minimum Degree of a Connected Trio in a Graph||39.5%|Hard||
|
||||
|1762|Buildings With an Ocean View||81.4%|Medium||
|
||||
|1762|Buildings With an Ocean View||81.3%|Medium||
|
||||
|1763|Longest Nice Substring||61.5%|Easy||
|
||||
|1764|Form Array by Concatenating Subarrays of Another Array||53.1%|Medium||
|
||||
|1765|Map of Highest Peak||57.6%|Medium||
|
||||
@ -1948,7 +1948,7 @@
|
||||
|1807|Evaluate the Bracket Pairs of a String||66.5%|Medium||
|
||||
|1808|Maximize Number of Nice Divisors||28.5%|Hard||
|
||||
|1809|Ad-Free Sessions||62.1%|Easy||
|
||||
|1810|Minimum Path Cost in a Hidden Grid||54.0%|Medium||
|
||||
|1810|Minimum Path Cost in a Hidden Grid||54.1%|Medium||
|
||||
|1811|Find Interview Candidates||66.5%|Medium||
|
||||
|1812|Determine Color of a Chessboard Square||77.0%|Easy||
|
||||
|1813|Sentence Similarity III||31.6%|Medium||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# [1104. Path In Zigzag Labelled Binary Tree](https://leetcode-cn.com/problems/path-in-zigzag-labelled-binary-tree/)
|
||||
# [1104. Path In Zigzag Labelled Binary Tree](https://leetcode.com/problems/path-in-zigzag-labelled-binary-tree/)
|
||||
|
||||
|
||||
## 题目
|
||||
@ -7,41 +7,86 @@ In an infinite binary tree where every node has two children, the nodes are labe
|
||||
|
||||
In the odd numbered rows (ie., the first, third, fifth,...), the labelling is left to right, while in the even numbered rows (second, fourth, sixth,...), the labelling is right to left.
|
||||
|
||||

|
||||
|
||||
Given the label of a node in this tree, return the labels in the path from the root of the tree to the node with that label.
|
||||

|
||||
|
||||
Given the `label` of a node in this tree, return the labels in the path from the root of the tree to the node with that `label`.
|
||||
|
||||
**Example 1:**
|
||||
|
||||
Input: label = 14
|
||||
Output: [1,3,4,14]
|
||||
```
|
||||
Input: label = 14
|
||||
Output: [1,3,4,14]
|
||||
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
Input: label = 26
|
||||
Output: [1,2,6,10,26]
|
||||
```
|
||||
Input: label = 26
|
||||
Output: [1,2,6,10,26]
|
||||
|
||||
```
|
||||
|
||||
**Constraints:**
|
||||
|
||||
1. `1 <= label <= 10^6`
|
||||
- `1 <= label <= 10^6`
|
||||
|
||||
## 题目大意
|
||||
|
||||
在一棵无限的二叉树上,每个节点都有两个子节点,树中的节点 逐行 依次按 “之” 字形进行标记。
|
||||
|
||||
如下图所示,在奇数行(即,第一行、第三行、第五行……)中,按从左到右的顺序进行标记;
|
||||
|
||||
而偶数行(即,第二行、第四行、第六行……)中,按从右到左的顺序进行标记。
|
||||
|
||||

|
||||
在一棵无限的二叉树上,每个节点都有两个子节点,树中的节点 逐行 依次按 “之” 字形进行标记。如下图所示,在奇数行(即,第一行、第三行、第五行……)中,按从左到右的顺序进行标记;而偶数行(即,第二行、第四行、第六行……)中,按从右到左的顺序进行标记。
|
||||
|
||||
给你树上某一个节点的标号 label,请你返回从根节点到该标号为 label 节点的路径,该路径是由途经的节点标号所组成的。
|
||||
|
||||
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 计算出label所在的level和index
|
||||
- 根据index和level计算出父节点的index和value
|
||||
- level减一,循环计算出对应的父节点直到根节点
|
||||
- 计算出 label 所在的 level 和 index。
|
||||
- 根据 index 和 level 计算出父节点的 index 和 value。
|
||||
- level 减一,循环计算出对应的父节点直到根节点。
|
||||
|
||||
## 代码
|
||||
|
||||
```go
|
||||
package leetcode
|
||||
|
||||
func pathInZigZagTree(label int) []int {
|
||||
level := getLevel(label)
|
||||
ans := []int{label}
|
||||
curIndex := label - (1 << level)
|
||||
parent := 0
|
||||
for level >= 1 {
|
||||
parent, curIndex = getParent(curIndex, level)
|
||||
ans = append(ans, parent)
|
||||
level--
|
||||
}
|
||||
ans = reverse(ans)
|
||||
return ans
|
||||
}
|
||||
|
||||
func getLevel(label int) int {
|
||||
level := 0
|
||||
nums := 0
|
||||
for {
|
||||
nums += 1 << level
|
||||
if nums >= label {
|
||||
return level
|
||||
}
|
||||
level++
|
||||
}
|
||||
}
|
||||
|
||||
func getParent(index int, level int) (parent int, parentIndex int) {
|
||||
parentIndex = 1<<(level-1) - 1 + (index/2)*(-1)
|
||||
parent = 1<<(level-1) + parentIndex
|
||||
return
|
||||
}
|
||||
|
||||
func reverse(nums []int) []int {
|
||||
left, right := 0, len(nums)-1
|
||||
for left < right {
|
||||
nums[left], nums[right] = nums[right], nums[left]
|
||||
left++
|
||||
right--
|
||||
}
|
||||
return nums
|
||||
}
|
||||
```
|
@ -101,5 +101,5 @@ func sampleStats(count []int) []float64 {
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1000~1099/1091.Shortest-Path-in-Binary-Matrix/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1100~1199/1105.Filling-Bookcase-Shelves/">下一页➡️</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1100~1199/1104.Path-In-Zigzag-Labelled-Binary-Tree/">下一页➡️</a></p>
|
||||
</div>
|
||||
|
@ -0,0 +1,99 @@
|
||||
# [1104. Path In Zigzag Labelled Binary Tree](https://leetcode.com/problems/path-in-zigzag-labelled-binary-tree/)
|
||||
|
||||
|
||||
## 题目
|
||||
|
||||
In an infinite binary tree where every node has two children, the nodes are labelled in row order.
|
||||
|
||||
In the odd numbered rows (ie., the first, third, fifth,...), the labelling is left to right, while in the even numbered rows (second, fourth, sixth,...), the labelling is right to left.
|
||||
|
||||

|
||||
|
||||
Given the `label` of a node in this tree, return the labels in the path from the root of the tree to the node with that `label`.
|
||||
|
||||
**Example 1:**
|
||||
|
||||
```
|
||||
Input: label = 14
|
||||
Output: [1,3,4,14]
|
||||
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```
|
||||
Input: label = 26
|
||||
Output: [1,2,6,10,26]
|
||||
|
||||
```
|
||||
|
||||
**Constraints:**
|
||||
|
||||
- `1 <= label <= 10^6`
|
||||
|
||||
## 题目大意
|
||||
|
||||
在一棵无限的二叉树上,每个节点都有两个子节点,树中的节点 逐行 依次按 “之” 字形进行标记。如下图所示,在奇数行(即,第一行、第三行、第五行……)中,按从左到右的顺序进行标记;而偶数行(即,第二行、第四行、第六行……)中,按从右到左的顺序进行标记。
|
||||
|
||||
给你树上某一个节点的标号 label,请你返回从根节点到该标号为 label 节点的路径,该路径是由途经的节点标号所组成的。
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 计算出 label 所在的 level 和 index。
|
||||
- 根据 index 和 level 计算出父节点的 index 和 value。
|
||||
- level 减一,循环计算出对应的父节点直到根节点。
|
||||
|
||||
## 代码
|
||||
|
||||
```go
|
||||
package leetcode
|
||||
|
||||
func pathInZigZagTree(label int) []int {
|
||||
level := getLevel(label)
|
||||
ans := []int{label}
|
||||
curIndex := label - (1 << level)
|
||||
parent := 0
|
||||
for level >= 1 {
|
||||
parent, curIndex = getParent(curIndex, level)
|
||||
ans = append(ans, parent)
|
||||
level--
|
||||
}
|
||||
ans = reverse(ans)
|
||||
return ans
|
||||
}
|
||||
|
||||
func getLevel(label int) int {
|
||||
level := 0
|
||||
nums := 0
|
||||
for {
|
||||
nums += 1 << level
|
||||
if nums >= label {
|
||||
return level
|
||||
}
|
||||
level++
|
||||
}
|
||||
}
|
||||
|
||||
func getParent(index int, level int) (parent int, parentIndex int) {
|
||||
parentIndex = 1<<(level-1) - 1 + (index/2)*(-1)
|
||||
parent = 1<<(level-1) + parentIndex
|
||||
return
|
||||
}
|
||||
|
||||
func reverse(nums []int) []int {
|
||||
left, right := 0, len(nums)-1
|
||||
for left < right {
|
||||
nums[left], nums[right] = nums[right], nums[left]
|
||||
left++
|
||||
right--
|
||||
}
|
||||
return nums
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1000~1099/1093.Statistics-from-a-Large-Sample/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1100~1199/1105.Filling-Bookcase-Shelves/">下一页➡️</a></p>
|
||||
</div>
|
@ -70,6 +70,6 @@ func minHeightShelves(books [][]int, shelfWidth int) int {
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1000~1099/1093.Statistics-from-a-Large-Sample/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1100~1199/1104.Path-In-Zigzag-Labelled-Binary-Tree/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1100~1199/1108.Defanging-an-IP-Address/">下一页➡️</a></p>
|
||||
</div>
|
||||
|
@ -52,7 +52,7 @@ weight: 1
|
||||
|0088|Merge Sorted Array|[Go]({{< relref "/ChapterFour/0001~0099/0088.Merge-Sorted-Array.md" >}})|Easy| O(n)| O(1)|❤️|41.5%|
|
||||
|0090|Subsets II|[Go]({{< relref "/ChapterFour/0001~0099/0090.Subsets-II.md" >}})|Medium| O(n^2)| O(n)|❤️|50.7%|
|
||||
|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0100~0199/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||54.4%|
|
||||
|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0100~0199/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||51.6%|
|
||||
|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0100~0199/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||51.7%|
|
||||
|0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0100~0199/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy||||63.1%|
|
||||
|0118|Pascal's Triangle|[Go]({{< relref "/ChapterFour/0100~0199/0118.Pascals-Triangle.md" >}})|Easy||||58.2%|
|
||||
|0119|Pascal's Triangle II|[Go]({{< relref "/ChapterFour/0100~0199/0119.Pascals-Triangle-II.md" >}})|Easy||||53.8%|
|
||||
@ -283,7 +283,7 @@ weight: 1
|
||||
|1049|Last Stone Weight II|[Go]({{< relref "/ChapterFour/1000~1099/1049.Last-Stone-Weight-II.md" >}})|Medium||||48.2%|
|
||||
|1051|Height Checker|[Go]({{< relref "/ChapterFour/1000~1099/1051.Height-Checker.md" >}})|Easy||||73.3%|
|
||||
|1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1000~1099/1052.Grumpy-Bookstore-Owner.md" >}})|Medium||||56.1%|
|
||||
|1054|Distant Barcodes|[Go]({{< relref "/ChapterFour/1000~1099/1054.Distant-Barcodes.md" >}})|Medium||||44.7%|
|
||||
|1054|Distant Barcodes|[Go]({{< relref "/ChapterFour/1000~1099/1054.Distant-Barcodes.md" >}})|Medium||||44.8%|
|
||||
|1073|Adding Two Negabinary Numbers|[Go]({{< relref "/ChapterFour/1000~1099/1073.Adding-Two-Negabinary-Numbers.md" >}})|Medium||||34.9%|
|
||||
|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1000~1099/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||65.5%|
|
||||
|1089|Duplicate Zeros|[Go]({{< relref "/ChapterFour/1000~1099/1089.Duplicate-Zeros.md" >}})|Easy||||51.4%|
|
||||
|
@ -21,7 +21,7 @@ weight: 13
|
||||
|0073|Set Matrix Zeroes|[Go]({{< relref "/ChapterFour/0001~0099/0073.Set-Matrix-Zeroes.md" >}})|Medium||||45.5%|
|
||||
|0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0001~0099/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|37.0%|
|
||||
|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0100~0199/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||54.4%|
|
||||
|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0100~0199/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||51.6%|
|
||||
|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0100~0199/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||51.7%|
|
||||
|0126|Word Ladder II|[Go]({{< relref "/ChapterFour/0100~0199/0126.Word-Ladder-II.md" >}})|Hard||||25.2%|
|
||||
|0127|Word Ladder|[Go]({{< relref "/ChapterFour/0100~0199/0127.Word-Ladder.md" >}})|Hard||||33.1%|
|
||||
|0128|Longest Consecutive Sequence|[Go]({{< relref "/ChapterFour/0100~0199/0128.Longest-Consecutive-Sequence.md" >}})|Medium||||47.6%|
|
||||
@ -121,7 +121,7 @@ weight: 13
|
||||
|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0900~0999/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n) |❤️|51.9%|
|
||||
|1002|Find Common Characters|[Go]({{< relref "/ChapterFour/1000~1099/1002.Find-Common-Characters.md" >}})|Easy||||68.8%|
|
||||
|1048|Longest String Chain|[Go]({{< relref "/ChapterFour/1000~1099/1048.Longest-String-Chain.md" >}})|Medium||||56.4%|
|
||||
|1054|Distant Barcodes|[Go]({{< relref "/ChapterFour/1000~1099/1054.Distant-Barcodes.md" >}})|Medium||||44.7%|
|
||||
|1054|Distant Barcodes|[Go]({{< relref "/ChapterFour/1000~1099/1054.Distant-Barcodes.md" >}})|Medium||||44.8%|
|
||||
|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1000~1099/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||65.5%|
|
||||
|1122|Relative Sort Array|[Go]({{< relref "/ChapterFour/1100~1199/1122.Relative-Sort-Array.md" >}})|Easy||||67.9%|
|
||||
|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1100~1199/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||68.7%|
|
||||
|
@ -106,6 +106,7 @@ weight: 12
|
||||
|1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1000~1099/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium||||54.8%|
|
||||
|1073|Adding Two Negabinary Numbers|[Go]({{< relref "/ChapterFour/1000~1099/1073.Adding-Two-Negabinary-Numbers.md" >}})|Medium||||34.9%|
|
||||
|1093|Statistics from a Large Sample|[Go]({{< relref "/ChapterFour/1000~1099/1093.Statistics-from-a-Large-Sample.md" >}})|Medium||||47.2%|
|
||||
|1104|Path In Zigzag Labelled Binary Tree|[Go]({{< relref "/ChapterFour/1100~1199/1104.Path-In-Zigzag-Labelled-Binary-Tree.md" >}})|Medium||||73.8%|
|
||||
|1137|N-th Tribonacci Number|[Go]({{< relref "/ChapterFour/1100~1199/1137.N-th-Tribonacci-Number.md" >}})|Easy||||56.2%|
|
||||
|1154|Day of the Year|[Go]({{< relref "/ChapterFour/1100~1199/1154.Day-of-the-Year.md" >}})|Easy||||50.0%|
|
||||
|1175|Prime Arrangements|[Go]({{< relref "/ChapterFour/1100~1199/1175.Prime-Arrangements.md" >}})|Easy||||51.8%|
|
||||
|
@ -87,7 +87,7 @@ weight: 14
|
||||
|1030|Matrix Cells in Distance Order|[Go]({{< relref "/ChapterFour/1000~1099/1030.Matrix-Cells-in-Distance-Order.md" >}})|Easy| O(n^2)| O(1) ||68.6%|
|
||||
|1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1000~1099/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium||||54.8%|
|
||||
|1051|Height Checker|[Go]({{< relref "/ChapterFour/1000~1099/1051.Height-Checker.md" >}})|Easy||||73.3%|
|
||||
|1054|Distant Barcodes|[Go]({{< relref "/ChapterFour/1000~1099/1054.Distant-Barcodes.md" >}})|Medium| O(n log n)| O(log n) |❤️|44.7%|
|
||||
|1054|Distant Barcodes|[Go]({{< relref "/ChapterFour/1000~1099/1054.Distant-Barcodes.md" >}})|Medium| O(n log n)| O(log n) |❤️|44.8%|
|
||||
|1122|Relative Sort Array|[Go]({{< relref "/ChapterFour/1100~1199/1122.Relative-Sort-Array.md" >}})|Easy||||67.9%|
|
||||
|1170|Compare Strings by Frequency of the Smallest Character|[Go]({{< relref "/ChapterFour/1100~1199/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md" >}})|Medium||||60.6%|
|
||||
|1200|Minimum Absolute Difference|[Go]({{< relref "/ChapterFour/1200~1299/1200.Minimum-Absolute-Difference.md" >}})|Easy||||67.3%|
|
||||
|
@ -20,7 +20,7 @@ weight: 6
|
||||
|0103|Binary Tree Zigzag Level Order Traversal|[Go]({{< relref "/ChapterFour/0100~0199/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})|Medium| O(n)| O(n)||51.4%|
|
||||
|0104|Maximum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0100~0199/0104.Maximum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||69.4%|
|
||||
|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0100~0199/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||54.4%|
|
||||
|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0100~0199/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||51.6%|
|
||||
|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0100~0199/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||51.7%|
|
||||
|0107|Binary Tree Level Order Traversal II|[Go]({{< relref "/ChapterFour/0100~0199/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})|Medium| O(n)| O(1)||56.5%|
|
||||
|0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0100~0199/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||63.1%|
|
||||
|0109|Convert Sorted List to Binary Search Tree|[Go]({{< relref "/ChapterFour/0100~0199/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})|Medium||||53.0%|
|
||||
@ -77,6 +77,7 @@ weight: 6
|
||||
|1026|Maximum Difference Between Node and Ancestor|[Go]({{< relref "/ChapterFour/1000~1099/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}})|Medium||||70.3%|
|
||||
|1028|Recover a Tree From Preorder Traversal|[Go]({{< relref "/ChapterFour/1000~1099/1028.Recover-a-Tree-From-Preorder-Traversal.md" >}})|Hard||||71.4%|
|
||||
|1038|Binary Search Tree to Greater Sum Tree|[Go]({{< relref "/ChapterFour/1000~1099/1038.Binary-Search-Tree-to-Greater-Sum-Tree.md" >}})|Medium||||83.4%|
|
||||
|1104|Path In Zigzag Labelled Binary Tree|[Go]({{< relref "/ChapterFour/1100~1199/1104.Path-In-Zigzag-Labelled-Binary-Tree.md" >}})|Medium||||73.8%|
|
||||
|1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1100~1199/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||68.3%|
|
||||
|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1100~1199/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||68.7%|
|
||||
|1145|Binary Tree Coloring Game|[Go]({{< relref "/ChapterFour/1100~1199/1145.Binary-Tree-Coloring-Game.md" >}})|Medium||||51.1%|
|
||||
|
Reference in New Issue
Block a user