From e02e370d4ed8d6a03205261edca6affda77a3467 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 6 Sep 2020 08:39:12 +0800 Subject: [PATCH 01/82] micro fix --- README.md | 2 +- .../content/ChapterFour/pytool/CutContent.py | 24 +++++++++++++++++++ website/content/ChapterTwo/Segment_Tree.md | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 website/content/ChapterFour/pytool/CutContent.py diff --git a/README.md b/README.md index 13d25d82..cd9c3e5f 100644 --- a/README.md +++ b/README.md @@ -2119,7 +2119,7 @@ Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Sliding_ ![](./topic/Segment_Tree.png) -- 线段数的经典数组实现写法。将合并两个节点 pushUp 逻辑抽象出来了,可以实现任意操作(常见的操作有:加法,取 max,min 等等)。第 218 题,第 303 题,第 307 题,第 699 题。 +- 线段树的经典数组实现写法。将合并两个节点 pushUp 逻辑抽象出来了,可以实现任意操作(常见的操作有:加法,取 max,min 等等)。第 218 题,第 303 题,第 307 题,第 699 题。 - 计数线段树的经典写法。第 315 题,第 327 题,第 493 题。 - 线段树的树的实现写法。第 715 题,第 732 题。 - 区间懒惰更新。第 218 题,第 699 题。 diff --git a/website/content/ChapterFour/pytool/CutContent.py b/website/content/ChapterFour/pytool/CutContent.py new file mode 100644 index 00000000..28dbc720 --- /dev/null +++ b/website/content/ChapterFour/pytool/CutContent.py @@ -0,0 +1,24 @@ +import os +import re +import glob + +# file_name = 'Array.md' +reg = "## 题目大意" + +current_working_dir = os.getcwd() +# print(f"current_working_dir: {current_working_dir}") + +dir_names = glob.glob("*.md") +dir_names.sort() +print(len(dir_names)) + +for file_name in dir_names: + # print(file_name) + with open(file_name, "r") as myfile: + codeContent = myfile.read() + findIndex = codeContent.find(reg) + # print(findIndex) + content = codeContent[findIndex:] + with open(file_name, "w") as myfile: + myfile.write(content) +print("Finished") \ No newline at end of file diff --git a/website/content/ChapterTwo/Segment_Tree.md b/website/content/ChapterTwo/Segment_Tree.md index d083d921..fb0c06b9 100644 --- a/website/content/ChapterTwo/Segment_Tree.md +++ b/website/content/ChapterTwo/Segment_Tree.md @@ -7,7 +7,7 @@ type: docs ![](https://img.halfrost.com/Leetcode/Segment_Tree.png) -- 线段数的经典数组实现写法。将合并两个节点 pushUp 逻辑抽象出来了,可以实现任意操作(常见的操作有:加法,取 max,min 等等)。第 218 题,第 303 题,第 307 题,第 699 题。 +- 线段树的经典数组实现写法。将合并两个节点 pushUp 逻辑抽象出来了,可以实现任意操作(常见的操作有:加法,取 max,min 等等)。第 218 题,第 303 题,第 307 题,第 699 题。 - 计数线段树的经典写法。第 315 题,第 327 题,第 493 题。 - 线段树的树的实现写法。第 715 题,第 732 题。 - 区间懒惰更新。第 218 题,第 699 题。 From 0e424f710571fa697f83f84f6952311015a417e9 Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 9 Sep 2020 20:51:49 +0800 Subject: [PATCH 02/82] Due to problem 925 test case change, so solution should modify --- .../925. Long Pressed Name.go | 24 ++++++++-------- .../925. Long Pressed Name_test.go | 15 ++++++++++ leetcode/0925.Long-Pressed-Name/README.md | 4 +-- .../ChapterFour/0925.Long-Pressed-Name.md | 28 +++++++++---------- 4 files changed, 41 insertions(+), 30 deletions(-) diff --git a/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name.go b/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name.go index 69b27ea5..8c28a2bf 100644 --- a/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name.go +++ b/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name.go @@ -7,20 +7,18 @@ func isLongPressedName(name string, typed string) bool { if (len(name) == 0 && len(typed) != 0) || (len(name) != 0 && len(typed) == 0) { return false } - - j := 0 - for i := 0; i < len(name); i++ { - if j < len(typed) && name[i] == typed[j] { + i, j := 0, 0 + for i < len(name) && j < len(typed) { + if name[i] != typed[j] { + return false + } + for i < len(name) && j < len(typed) && name[i] == typed[j] { + i++ + j++ + } + for j < len(typed) && typed[j] == typed[j-1] { j++ - continue - } else { - if i > 0 && j < len(typed) && name[i-1] == typed[j] { - j++ - i-- - } else { - return false - } } } - return true + return i == len(name) && j == len(typed) } diff --git a/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name_test.go b/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name_test.go index f374c797..d2ae6662 100644 --- a/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name_test.go +++ b/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name_test.go @@ -32,6 +32,21 @@ func Test_Problem925(t *testing.T) { ans925{true}, }, + { + para925{"alex", "alexxr"}, + ans925{false}, + }, + + { + para925{"alex", "alexxxxr"}, + ans925{false}, + }, + + { + para925{"alex", "alexxxxx"}, + ans925{true}, + }, + { para925{"saeed", "ssaaedd"}, ans925{false}, diff --git a/leetcode/0925.Long-Pressed-Name/README.md b/leetcode/0925.Long-Pressed-Name/README.md index 95dfbaf5..1b588feb 100644 --- a/leetcode/0925.Long-Pressed-Name/README.md +++ b/leetcode/0925.Long-Pressed-Name/README.md @@ -53,8 +53,8 @@ Note: ## 解题思路 -这一题也可以借助滑动窗口的思想。2 个字符串一起比较,如果遇到有相同的字符串,窗口继续往后滑动。直到遇到了第一个不同的字符,如果遇到两个字符串不相等的情况,可以直接返回 false。具体实现见代码。 - +- 这一题也可以借助滑动窗口的思想。2 个字符串一起比较,如果遇到有相同的字符串,窗口继续往后滑动。直到遇到了第一个不同的字符,如果遇到两个字符串不相等的情况,可以直接返回 false。具体实现见代码。 +- 这一题的测试用例修改过一次,需要注意我这里写的第二组测试用例,当 name 结束以后,如果 typed 还有多余的不同的字符,这种情况要输出 false 的。具体见 test 文件里面的第二组,第三组,第四组测试用例。 diff --git a/website/content/ChapterFour/0925.Long-Pressed-Name.md b/website/content/ChapterFour/0925.Long-Pressed-Name.md index 4483d591..fb33cbd9 100644 --- a/website/content/ChapterFour/0925.Long-Pressed-Name.md +++ b/website/content/ChapterFour/0925.Long-Pressed-Name.md @@ -61,8 +61,8 @@ Explanation: It's not necessary to long press any character. ## 解题思路 -这一题也可以借助滑动窗口的思想。2 个字符串一起比较,如果遇到有相同的字符串,窗口继续往后滑动。直到遇到了第一个不同的字符,如果遇到两个字符串不相等的情况,可以直接返回 false。具体实现见代码。 - +- 这一题也可以借助滑动窗口的思想。2 个字符串一起比较,如果遇到有相同的字符串,窗口继续往后滑动。直到遇到了第一个不同的字符,如果遇到两个字符串不相等的情况,可以直接返回 false。具体实现见代码。 +- 这一题的测试用例修改过一次,需要注意我这里写的第二组测试用例,当 name 结束以后,如果 typed 还有多余的不同的字符,这种情况要输出 false 的。具体见 test 文件里面的第二组,第三组,第四组测试用例。 @@ -88,22 +88,20 @@ func isLongPressedName(name string, typed string) bool { if (len(name) == 0 && len(typed) != 0) || (len(name) != 0 && len(typed) == 0) { return false } - - j := 0 - for i := 0; i < len(name); i++ { - if j < len(typed) && name[i] == typed[j] { + i, j := 0, 0 + for i < len(name) && j < len(typed) { + if name[i] != typed[j] { + return false + } + for i < len(name) && j < len(typed) && name[i] == typed[j] { + i++ + j++ + } + for j < len(typed) && typed[j] == typed[j-1] { j++ - continue - } else { - if i > 0 && j < len(typed) && name[i-1] == typed[j] { - j++ - i-- - } else { - return false - } } } - return true + return i == len(name) && j == len(typed) } ``` \ No newline at end of file From 2461c246fbd90f8a1a65d62ccd27d7d61bd42db0 Mon Sep 17 00:00:00 2001 From: YDZ Date: Thu, 10 Sep 2020 17:09:30 +0800 Subject: [PATCH 03/82] Add QR code --- website/config.toml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/website/config.toml b/website/config.toml index 271cbc46..4bed3f6f 100644 --- a/website/config.toml +++ b/website/config.toml @@ -46,14 +46,18 @@ disablePathToLower = true name = "Github" url = "https://github.com/halfrost" weight = 20 +[[menu.before]] + name = "微信公众号" + url = "https://img.halfrost.com/wechat-qr-code.png" + weight = 30 [[menu.before]] name = "Twitter" url = "https://twitter.com/halffrost" - weight = 30 + weight = 40 [[menu.before]] name = "Weibo" url = "https://weibo.com/halfrost" - weight = 40 + weight = 50 #[[menu.after]] # name = "Github" # url = "https://github.com/alex-shpak/hugo-book" From ec09c8d37b7f9db7cdc123fd02a5b9403f8e3228 Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 15 Sep 2020 20:10:20 +0800 Subject: [PATCH 04/82] Problem 113 add solutions --- ...inary Tree Zigzag Level Order Traversal.go | 24 ++++++++++++++++++ ...inary-Tree-Zigzag-Level-Order-Traversal.md | 25 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal/103. Binary Tree Zigzag Level Order Traversal.go b/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal/103. Binary Tree Zigzag Level Order Traversal.go index 30e3d452..dc8f398d 100644 --- a/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal/103. Binary Tree Zigzag Level Order Traversal.go +++ b/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal/103. Binary Tree Zigzag Level Order Traversal.go @@ -16,6 +16,7 @@ type TreeNode = structures.TreeNode * } */ +// 解法一 func zigzagLevelOrder(root *TreeNode) [][]int { if root == nil { return [][]int{} @@ -57,3 +58,26 @@ func zigzagLevelOrder(root *TreeNode) [][]int { } return res } + +// 解法二 递归 +func zigzagLevelOrder0(root *TreeNode) [][]int { + var res [][]int + search(root, 0, &res) + return res +} + +func search(root *TreeNode, depth int, res *[][]int) { + if root == nil { + return + } + for len(*res) < depth+1 { + *res = append(*res, []int{}) + } + if depth%2 == 0 { + (*res)[depth] = append((*res)[depth], root.Val) + } else { + (*res)[depth] = append([]int{root.Val}, (*res)[depth]...) + } + search(root.Left, depth+1, res) + search(root.Right, depth+1, res) +} diff --git a/website/content/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md b/website/content/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md index 6cac4bca..1f2db14f 100644 --- a/website/content/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md +++ b/website/content/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md @@ -56,6 +56,8 @@ package leetcode * Right *TreeNode * } */ + +// 解法一 func zigzagLevelOrder(root *TreeNode) [][]int { if root == nil { return [][]int{} @@ -98,4 +100,27 @@ func zigzagLevelOrder(root *TreeNode) [][]int { return res } +// 解法二 递归 +func zigzagLevelOrder0(root *TreeNode) [][]int { + var res [][]int + search(root, 0, &res) + return res +} + +func search(root *TreeNode, depth int, res *[][]int) { + if root == nil { + return + } + for len(*res) < depth+1 { + *res = append(*res, []int{}) + } + if depth%2 == 0 { + (*res)[depth] = append((*res)[depth], root.Val) + } else { + (*res)[depth] = append([]int{root.Val}, (*res)[depth]...) + } + search(root.Left, depth+1, res) + search(root.Right, depth+1, res) +} + ``` \ No newline at end of file From 8ab50ac930cf17efe9169eddb543f441cca64528 Mon Sep 17 00:00:00 2001 From: janetyu <931242644@qq.com> Date: Wed, 16 Sep 2020 23:46:08 +0800 Subject: [PATCH 05/82] =?UTF-8?q?leetcode82=20=E6=8F=90=E4=BE=9B=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E7=9A=84=E8=A7=A3=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .... Remove Duplicates from Sorted List II.go | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II.go b/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II.go index 1fd71973..2a235332 100644 --- a/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II.go +++ b/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II.go @@ -91,3 +91,66 @@ func deleteDuplicates(head *ListNode) *ListNode { } return head } + +// 双循环简单解法 O(n*m) +func deleteDuplicates3(head *ListNode) *ListNode { + if head == nil { + return head + } + + nilNode := &ListNode{Val: 0, Next: head} + head = nilNode + + lastVal := 0 + for head.Next != nil && head.Next.Next != nil { + if head.Next.Val == head.Next.Next.Val { + lastVal = head.Next.Val + for head.Next != nil && lastVal == head.Next.Val { + head.Next = head.Next.Next + } + } else { + head = head.Next + } + } + return nilNode.Next +} + +// 双指针+删除标志位,单循环解法 O(n) +func deleteDuplicates4(head *ListNode) *ListNode { + if head == nil || head.Next == nil { + return head + } + + nilNode := &ListNode{Val: 0, Next: head} + // 上次遍历有删除操作的标志位 + lastIsDel := false + // 虚拟空结点 + head = nilNode + // 前后指针用于判断 + pre, back := head.Next, head.Next.Next + // 每次只删除前面的一个重复的元素,留一个用于下次遍历判重 + // pre, back 指针的更新位置和值比较重要和巧妙 + for head.Next != nil && head.Next.Next != nil { + if pre.Val != back.Val && lastIsDel { + head.Next = head.Next.Next + pre, back = head.Next, head.Next.Next + lastIsDel = false + continue + } + + if pre.Val == back.Val { + head.Next = head.Next.Next + pre, back = head.Next, head.Next.Next + lastIsDel = true + } else { + head = head.Next + pre, back = head.Next, head.Next.Next + lastIsDel = false + } + } + // 处理 [1,1] 这种删除还剩一个的情况 + if lastIsDel && head.Next != nil { + head.Next = nil + } + return nilNode.Next +} From f56f6889bc54a8b15857fedecb1bf123b283f424 Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 18 Sep 2020 12:15:02 +0800 Subject: [PATCH 06/82] Due to problem 1300 test case change, so solution should modify --- .... Sum of Mutated Array Closest to Target.go | 9 +++++++++ ... of Mutated Array Closest to Target_test.go | 6 ++++++ .../README.md | 18 ++++++++++++++++++ ...0.Sum-of-Mutated-Array-Closest-to-Target.md | 18 ++++++++++++++++++ 4 files changed, 51 insertions(+) diff --git a/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target.go b/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target.go index f008a556..9bd5f6d5 100644 --- a/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target.go +++ b/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target.go @@ -10,6 +10,15 @@ func findBestValue(arr []int, target int) int { high = mid } } + if high == 100000 { + res := 0 + for _, num := range arr { + if res < num { + res = num + } + } + return res + } // 比较阈值线分别定在 left - 1 和 left 的时候与 target 的接近程度 sum1, sum2 := calculateSum(arr, low-1), calculateSum(arr, low) if target-sum1 <= sum2-target { diff --git a/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target_test.go b/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target_test.go index 9fca7e54..da66fbba 100644 --- a/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target_test.go +++ b/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target_test.go @@ -37,6 +37,12 @@ func Test_Problem1300(t *testing.T) { ans1300{5}, }, + // new case + { + para1300{[]int{2, 3, 5}, 11}, + ans1300{5}, + }, + { para1300{[]int{60864, 25176, 27249, 21296, 20204}, 56803}, ans1300{11361}, diff --git a/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/README.md b/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/README.md index dcee2bcd..15c7d5d7 100644 --- a/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/README.md +++ b/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/README.md @@ -57,6 +57,7 @@ Output: 11361 ## 代码 ```go + func findBestValue(arr []int, target int) int { low, high := 0, 100000 for low < high { @@ -67,6 +68,15 @@ func findBestValue(arr []int, target int) int { high = mid } } + if high == 100000 { + res := 0 + for _, num := range arr { + if res < num { + res = num + } + } + return res + } // 比较阈值线分别定在 left - 1 和 left 的时候与 target 的接近程度 sum1, sum2 := calculateSum(arr, low-1), calculateSum(arr, low) if target-sum1 <= sum2-target { @@ -82,4 +92,12 @@ func calculateSum(arr []int, mid int) int { } return sum } + +func min(a int, b int) int { + if a > b { + return b + } + return a +} + ``` \ No newline at end of file diff --git a/website/content/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md b/website/content/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md index dcee2bcd..15c7d5d7 100644 --- a/website/content/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md +++ b/website/content/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md @@ -57,6 +57,7 @@ Output: 11361 ## 代码 ```go + func findBestValue(arr []int, target int) int { low, high := 0, 100000 for low < high { @@ -67,6 +68,15 @@ func findBestValue(arr []int, target int) int { high = mid } } + if high == 100000 { + res := 0 + for _, num := range arr { + if res < num { + res = num + } + } + return res + } // 比较阈值线分别定在 left - 1 和 left 的时候与 target 的接近程度 sum1, sum2 := calculateSum(arr, low-1), calculateSum(arr, low) if target-sum1 <= sum2-target { @@ -82,4 +92,12 @@ func calculateSum(arr []int, mid int) int { } return sum } + +func min(a int, b int) int { + if a > b { + return b + } + return a +} + ``` \ No newline at end of file From fb9da5f88521d7cee6f7bb45aaadc29726e919cc Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 20 Sep 2020 10:44:47 +0800 Subject: [PATCH 07/82] micro fix --- leetcode/0127.Word-Ladder/README.md | 2 +- website/content/ChapterFour/0127.Word-Ladder.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/leetcode/0127.Word-Ladder/README.md b/leetcode/0127.Word-Ladder/README.md index 9a207836..6575eab2 100755 --- a/leetcode/0127.Word-Ladder/README.md +++ b/leetcode/0127.Word-Ladder/README.md @@ -60,6 +60,6 @@ Given two words (*beginWord* and *endWord*), and a dictionary's word list, fin - 这一题要求输出从 `beginWord` 变换到 `endWord` 最短变换次数。可以用 BFS,从 `beginWord` 开始变换,把该单词的每个字母都用 `'a'~'z'` 变换一次,生成的数组到 `wordList` 中查找,这里用 Map 来记录查找。找得到就入队列,找不到就输出 0 。入队以后按照 BFS 的算法依次遍历完,当所有单词都 `len(queue)<=0` 出队以后,整个程序结束。 - 这一题题目中虽然说了要求找到一条最短的路径,但是实际上最短的路径的寻找方法已经告诉你了: - 1. 每次只变换一个字母 + 1. 每次只变换一个字母 2. 每次变换都必须在 `wordList` 中 所以不需要单独考虑何种方式是最短的。 diff --git a/website/content/ChapterFour/0127.Word-Ladder.md b/website/content/ChapterFour/0127.Word-Ladder.md index 475aed66..cf67f6d1 100755 --- a/website/content/ChapterFour/0127.Word-Ladder.md +++ b/website/content/ChapterFour/0127.Word-Ladder.md @@ -60,7 +60,7 @@ Given two words (*beginWord* and *endWord*), and a dictionary's word list, fin - 这一题要求输出从 `beginWord` 变换到 `endWord` 最短变换次数。可以用 BFS,从 `beginWord` 开始变换,把该单词的每个字母都用 `'a'~'z'` 变换一次,生成的数组到 `wordList` 中查找,这里用 Map 来记录查找。找得到就入队列,找不到就输出 0 。入队以后按照 BFS 的算法依次遍历完,当所有单词都 `len(queue)<=0` 出队以后,整个程序结束。 - 这一题题目中虽然说了要求找到一条最短的路径,但是实际上最短的路径的寻找方法已经告诉你了: - 1. 每次只变换一个字母 + 1. 每次只变换一个字母 2. 每次变换都必须在 `wordList` 中 所以不需要单独考虑何种方式是最短的。 From e2a31f2a920b6520c006f57606e96e4c3de3867a Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 20 Sep 2020 16:04:49 +0800 Subject: [PATCH 08/82] Add word count --- README.md | 1 + .../content/ChapterFour/pytool/WordCount.py | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 website/content/ChapterFour/pytool/WordCount.py diff --git a/README.md b/README.md index cd9c3e5f..43d134a4 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@

GitHub All Releases + diff --git a/website/content/ChapterFour/pytool/WordCount.py b/website/content/ChapterFour/pytool/WordCount.py new file mode 100644 index 00000000..3bae213e --- /dev/null +++ b/website/content/ChapterFour/pytool/WordCount.py @@ -0,0 +1,29 @@ +from collections import defaultdict +import glob +import os + + +def str_count2(str): + count_zh = count_dg = 0 + for s in str: + # 中文字符范围 + if '\u4e00' <= s <= '\u9fff': + count_zh += 1 + if s.isdigit(): + count_dg += 1 + # print(count_zh + count_dg) + return count_zh + count_dg + +current_working_dir = os.getcwd() +# print(f"current_working_dir: {current_working_dir}") + +dir_names = glob.glob("*.md") +dir_names.sort() + +word_count = 0 +for file_name in dir_names: + with open(file_name, "r") as myfile: + codeContent = myfile.read() + print("当前读取文件: {}, 字数统计: {}".format(file_name, str_count2(codeContent))) + word_count += str_count2(codeContent) +print(word_count) \ No newline at end of file From 5830c8dbfcb271a32ee5081843a8570950c2849d Mon Sep 17 00:00:00 2001 From: YDZ Date: Mon, 21 Sep 2020 00:37:45 +0800 Subject: [PATCH 09/82] Badge add link --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 43d134a4..233969f6 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@

GitHub All Releases - - - + + + Support Go version From 44f8b5b8a6e209b19b4e7fd326848a6e14c33919 Mon Sep 17 00:00:00 2001 From: Harry Leonardo Date: Thu, 24 Sep 2020 00:23:54 +0700 Subject: [PATCH 10/82] [ADD] 1480 & 1512 --- .../1480.Running-Sum-of-1d-Array.go | 19 ++++++ .../1480.Running-Sum-of-1d-Array_test.go | 52 ++++++++++++++++ .../1480.Running-Sum-of-1d-Array/README.md | 59 +++++++++++++++++++ .../1512.Number-of-Good-Pairs.go | 14 +++++ .../1512.Number-of-Good-Pairs_test.go | 52 ++++++++++++++++ leetcode/1512.Number-of-Good-Pairs/README.md | 57 ++++++++++++++++++ 6 files changed, 253 insertions(+) create mode 100644 leetcode/1480.Running-Sum-of-1d-Array/1480.Running-Sum-of-1d-Array.go create mode 100644 leetcode/1480.Running-Sum-of-1d-Array/1480.Running-Sum-of-1d-Array_test.go create mode 100644 leetcode/1480.Running-Sum-of-1d-Array/README.md create mode 100644 leetcode/1512.Number-of-Good-Pairs/1512.Number-of-Good-Pairs.go create mode 100644 leetcode/1512.Number-of-Good-Pairs/1512.Number-of-Good-Pairs_test.go create mode 100644 leetcode/1512.Number-of-Good-Pairs/README.md diff --git a/leetcode/1480.Running-Sum-of-1d-Array/1480.Running-Sum-of-1d-Array.go b/leetcode/1480.Running-Sum-of-1d-Array/1480.Running-Sum-of-1d-Array.go new file mode 100644 index 00000000..4a5f1a74 --- /dev/null +++ b/leetcode/1480.Running-Sum-of-1d-Array/1480.Running-Sum-of-1d-Array.go @@ -0,0 +1,19 @@ +package leetcode + +func runningSum(nums []int) []int { + result := []int{} + counter := 0 + + for x := 0; x < len(nums); x++ { + for y := 0; y < x; y++ { + counter += nums[y] + } + + val := counter + nums[x] + result = append(result, val) + + counter = 0 + } + + return result +} diff --git a/leetcode/1480.Running-Sum-of-1d-Array/1480.Running-Sum-of-1d-Array_test.go b/leetcode/1480.Running-Sum-of-1d-Array/1480.Running-Sum-of-1d-Array_test.go new file mode 100644 index 00000000..da95eea8 --- /dev/null +++ b/leetcode/1480.Running-Sum-of-1d-Array/1480.Running-Sum-of-1d-Array_test.go @@ -0,0 +1,52 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1480 struct { + para1480 + ans1480 +} + +// para 是参数 +// one 代表第一个参数 +type para1480 struct { + nums []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1480 struct { + one []int +} + +func Test_Problem1480(t *testing.T) { + + qs := []question1480{ + + { + para1480{[]int{1, 2, 3, 4}}, + ans1480{[]int{1, 2, 6, 10}}, + }, + + { + para1480{[]int{1, 1, 1, 1, 1}}, + ans1480{[]int{1, 2, 3, 4, 5}}, + }, + + { + para1480{[]int{3, 1, 2, 10, 1}}, + ans1480{[]int{3, 4, 6, 16, 17}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1480------------------------\n") + + for _, q := range qs { + _, p := q.ans1480, q.para1480 + fmt.Printf("【input】:%v 【output】:%v \n", p, runningSum(p.nums)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1480.Running-Sum-of-1d-Array/README.md b/leetcode/1480.Running-Sum-of-1d-Array/README.md new file mode 100644 index 00000000..3ed3e0ac --- /dev/null +++ b/leetcode/1480.Running-Sum-of-1d-Array/README.md @@ -0,0 +1,59 @@ +# [1480. Running Sum of 1d Array](https://leetcode.com/problems/running-sum-of-1d-array/) + +## 题目 + +Given an array `nums`. We define a running sum of an array as `runningSum[i] = sum(nums[0]…nums[i])`. + +Return the running sum of `nums`. + +**Example 1**: + +``` +Input: nums = [1,2,3,4] +Output: [1,3,6,10] +Explanation: Running sum is obtained as follows: [1, 1+2, 1+2+3, 1+2+3+4]. + +``` + +**Example 2**: + +``` +Input: nums = [1,1,1,1,1] +Output: [1,2,3,4,5] +Explanation: Running sum is obtained as follows: [1, 1+1, 1+1+1, 1+1+1+1, 1+1+1+1+1]. + +``` + +**Example 3**: + +``` +Input: nums = [3,1,2,10,1] +Output: [3,4,6,16,17] + +``` + +**Constraints**: + +- `1 <= nums.length <= 1000` +- `-10^6 <= nums[i] <= 10^6` + +```go +func runningSum(nums []int) []int { + result := []int{} + counter := 0 + + for x := 0; x < len(nums); x++ { + for y := 0; y < x; y++ { + counter += nums[y] + } + + val := counter + nums[x] + result = append(result, val) + + counter = 0 + } + + return result +} + +``` \ No newline at end of file diff --git a/leetcode/1512.Number-of-Good-Pairs/1512.Number-of-Good-Pairs.go b/leetcode/1512.Number-of-Good-Pairs/1512.Number-of-Good-Pairs.go new file mode 100644 index 00000000..a56f52d6 --- /dev/null +++ b/leetcode/1512.Number-of-Good-Pairs/1512.Number-of-Good-Pairs.go @@ -0,0 +1,14 @@ +package leetcode + +func numIdenticalPairs(nums []int) int { + total := 0 + for x := 0; x < len(nums); x++ { + for y := x + 1; y < len(nums); y++ { + if nums[x] == nums[y] { + total++ + } + } + } + + return total +} diff --git a/leetcode/1512.Number-of-Good-Pairs/1512.Number-of-Good-Pairs_test.go b/leetcode/1512.Number-of-Good-Pairs/1512.Number-of-Good-Pairs_test.go new file mode 100644 index 00000000..3fc12218 --- /dev/null +++ b/leetcode/1512.Number-of-Good-Pairs/1512.Number-of-Good-Pairs_test.go @@ -0,0 +1,52 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1512 struct { + para1512 + ans1512 +} + +// para 是参数 +// one 代表第一个参数 +type para1512 struct { + nums []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1512 struct { + one int +} + +func Test_Problem1512(t *testing.T) { + + qs := []question1512{ + + { + para1512{[]int{1, 2, 3, 1, 1, 3}}, + ans1512{4}, + }, + + { + para1512{[]int{1, 1, 1, 1}}, + ans1512{6}, + }, + + { + para1512{[]int{1, 2, 3}}, + ans1512{0}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1512------------------------\n") + + for _, q := range qs { + _, p := q.ans1512, q.para1512 + fmt.Printf("【input】:%v 【output】:%v \n", p, numIdenticalPairs(p.nums)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1512.Number-of-Good-Pairs/README.md b/leetcode/1512.Number-of-Good-Pairs/README.md new file mode 100644 index 00000000..28a5fd0c --- /dev/null +++ b/leetcode/1512.Number-of-Good-Pairs/README.md @@ -0,0 +1,57 @@ +# [1512. Number of Good Pairs](https://leetcode.com/problems/number-of-good-pairs/) + +## 题目 + +Given an array of integers `nums`. + +A pair `(i,j)` is called good if `nums[i] == nums[j]` and `i < j`. + +Return the number of good pairs. + +**Example 1**: + +``` +Input: nums = [1,2,3,1,1,3] +Output: 4 +Explanation: There are 4 good pairs (0,3), (0,4), (3,4), (2,5) 0-indexed. + +``` + +**Example 2**: + +``` +Input: nums = [1,1,1,1] +Output: 6 +Explanation: Each pair in the array are good. + +``` + +**Example 3**: + +``` +Input: nums = [1,2,3] +Output: 0 + +``` + +**Constraints**: + +- `1 <= nums.length <= 1000` +- `1 <= nums[i] <= 100` + +```go +func numIdenticalPairs(nums []int) int { + total := 0 + for x := 0; x < len(nums); x++ { + for y := x + 1; y < len(nums); y++ { + if nums[x] == nums[y] { + total++ + } + } + } + + return total +} + + +``` \ No newline at end of file From 3e7996d3712999a23f6bab26d60a491854e76349 Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 30 Sep 2020 10:47:46 +0800 Subject: [PATCH 11/82] Fix go report card --- .../0109.Convert-Sorted-List-to-Binary-Search-Tree/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/leetcode/0109.Convert-Sorted-List-to-Binary-Search-Tree/README.md b/leetcode/0109.Convert-Sorted-List-to-Binary-Search-Tree/README.md index 0c0c91ae..692a49ca 100644 --- a/leetcode/0109.Convert-Sorted-List-to-Binary-Search-Tree/README.md +++ b/leetcode/0109.Convert-Sorted-List-to-Binary-Search-Tree/README.md @@ -27,4 +27,5 @@ One possible answer is: [0,-3,9,-10,null,5], which represents the following heig ## 解题思路 -思路比较简单,依次把链表的中间点作为根结点,类似二分的思想,递归排列所有结点即可。 \ No newline at end of file +思路比较简单,依次把链表的中间点作为根结点,类似二分的思想,递归排列所有结点即可。 + From deb2aa1dc1ad3438a5c31e086ebd6cc9b4a2b4a5 Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 30 Sep 2020 14:13:02 +0800 Subject: [PATCH 12/82] Change problem 1079 image --- leetcode/1079.Letter-Tile-Possibilities/README.md | 2 +- website/content/ChapterFour/1079.Letter-Tile-Possibilities.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/leetcode/1079.Letter-Tile-Possibilities/README.md b/leetcode/1079.Letter-Tile-Possibilities/README.md index e8e12a5e..4f789c73 100755 --- a/leetcode/1079.Letter-Tile-Possibilities/README.md +++ b/leetcode/1079.Letter-Tile-Possibilities/README.md @@ -33,4 +33,4 @@ You have a set of `tiles`, where each tile has one letter `tiles[i]` printed - 题目要求输出所有非空字母序列的数目。这一题是排列和组合的结合题目。组合是可以选择一个字母,二个字母,…… n 个字母。每个组合内是排列问题。比如选择 2 个字母,字母之间相互排序不同是影响最终结果的,不同的排列顺序是不同的解。 - 这道题目由于不需要输出所有解,所以解法可以优化,例如我们在递归计算解的时候,不需要真的遍历原字符串,只需要累加一些字母的频次就可以。当然如果要输出所有解,就需要真实遍历原字符串了(见解法二)。简单的做法是每次递归按照频次累加。因为每次增加一个字母一定是 26 个大写字母中的一个。这里需要注意的是,增加的只能是 26 个字母里面还能取出“机会”的字母,例如递归到到第 3 轮了,A 用完了,这个时候只能取频次还不为 0 的字母拼上去。 -![](https://pic.cdn.lizenghai.com/uploads/2019/06/15604249050330956_414598-48d6698970379275.png?x-oss-process=style%2Ffull) \ No newline at end of file +![](https://img.halfrost.com/Leetcode/leetcode_1079_0.png) diff --git a/website/content/ChapterFour/1079.Letter-Tile-Possibilities.md b/website/content/ChapterFour/1079.Letter-Tile-Possibilities.md index 41a7ecfa..6f035a14 100755 --- a/website/content/ChapterFour/1079.Letter-Tile-Possibilities.md +++ b/website/content/ChapterFour/1079.Letter-Tile-Possibilities.md @@ -33,7 +33,8 @@ You have a set of `tiles`, where each tile has one letter `tiles[i]` printed - 题目要求输出所有非空字母序列的数目。这一题是排列和组合的结合题目。组合是可以选择一个字母,二个字母,…… n 个字母。每个组合内是排列问题。比如选择 2 个字母,字母之间相互排序不同是影响最终结果的,不同的排列顺序是不同的解。 - 这道题目由于不需要输出所有解,所以解法可以优化,例如我们在递归计算解的时候,不需要真的遍历原字符串,只需要累加一些字母的频次就可以。当然如果要输出所有解,就需要真实遍历原字符串了(见解法二)。简单的做法是每次递归按照频次累加。因为每次增加一个字母一定是 26 个大写字母中的一个。这里需要注意的是,增加的只能是 26 个字母里面还能取出“机会”的字母,例如递归到到第 3 轮了,A 用完了,这个时候只能取频次还不为 0 的字母拼上去。 -![](https://pic.cdn.lizenghai.com/uploads/2019/06/15604249050330956_414598-48d6698970379275.png?x-oss-process=style%2Ffull) +![](https://img.halfrost.com/Leetcode/leetcode_1079_0.png) + ## 代码 From 2af7be37910b6181e7220414d82915020f0c4d9d Mon Sep 17 00:00:00 2001 From: YDZ Date: Thu, 1 Oct 2020 09:27:18 +0800 Subject: [PATCH 13/82] Fix problem 82 gofmt --- .... Remove Duplicates from Sorted List II.go | 102 ++++++++--------- ...2.Remove-Duplicates-from-Sorted-List-II.md | 103 +++++++++--------- 2 files changed, 103 insertions(+), 102 deletions(-) diff --git a/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II.go b/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II.go index 2a235332..aa08a6ce 100644 --- a/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II.go +++ b/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II.go @@ -94,63 +94,63 @@ func deleteDuplicates(head *ListNode) *ListNode { // 双循环简单解法 O(n*m) func deleteDuplicates3(head *ListNode) *ListNode { - if head == nil { - return head - } + if head == nil { + return head + } - nilNode := &ListNode{Val: 0, Next: head} - head = nilNode + nilNode := &ListNode{Val: 0, Next: head} + head = nilNode - lastVal := 0 - for head.Next != nil && head.Next.Next != nil { - if head.Next.Val == head.Next.Next.Val { - lastVal = head.Next.Val - for head.Next != nil && lastVal == head.Next.Val { - head.Next = head.Next.Next - } - } else { - head = head.Next - } - } - return nilNode.Next + lastVal := 0 + for head.Next != nil && head.Next.Next != nil { + if head.Next.Val == head.Next.Next.Val { + lastVal = head.Next.Val + for head.Next != nil && lastVal == head.Next.Val { + head.Next = head.Next.Next + } + } else { + head = head.Next + } + } + return nilNode.Next } // 双指针+删除标志位,单循环解法 O(n) func deleteDuplicates4(head *ListNode) *ListNode { - if head == nil || head.Next == nil { - return head - } + if head == nil || head.Next == nil { + return head + } - nilNode := &ListNode{Val: 0, Next: head} - // 上次遍历有删除操作的标志位 - lastIsDel := false - // 虚拟空结点 - head = nilNode - // 前后指针用于判断 - pre, back := head.Next, head.Next.Next - // 每次只删除前面的一个重复的元素,留一个用于下次遍历判重 - // pre, back 指针的更新位置和值比较重要和巧妙 - for head.Next != nil && head.Next.Next != nil { - if pre.Val != back.Val && lastIsDel { - head.Next = head.Next.Next - pre, back = head.Next, head.Next.Next - lastIsDel = false - continue - } + nilNode := &ListNode{Val: 0, Next: head} + // 上次遍历有删除操作的标志位 + lastIsDel := false + // 虚拟空结点 + head = nilNode + // 前后指针用于判断 + pre, back := head.Next, head.Next.Next + // 每次只删除前面的一个重复的元素,留一个用于下次遍历判重 + // pre, back 指针的更新位置和值比较重要和巧妙 + for head.Next != nil && head.Next.Next != nil { + if pre.Val != back.Val && lastIsDel { + head.Next = head.Next.Next + pre, back = head.Next, head.Next.Next + lastIsDel = false + continue + } - if pre.Val == back.Val { - head.Next = head.Next.Next - pre, back = head.Next, head.Next.Next - lastIsDel = true - } else { - head = head.Next - pre, back = head.Next, head.Next.Next - lastIsDel = false - } - } - // 处理 [1,1] 这种删除还剩一个的情况 - if lastIsDel && head.Next != nil { - head.Next = nil - } - return nilNode.Next + if pre.Val == back.Val { + head.Next = head.Next.Next + pre, back = head.Next, head.Next.Next + lastIsDel = true + } else { + head = head.Next + pre, back = head.Next, head.Next.Next + lastIsDel = false + } + } + // 处理 [1,1] 这种删除还剩一个的情况 + if lastIsDel && head.Next != nil { + head.Next = nil + } + return nilNode.Next } diff --git a/website/content/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md b/website/content/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md index 4fc6a768..1a4f119e 100644 --- a/website/content/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md +++ b/website/content/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md @@ -126,65 +126,66 @@ func deleteDuplicates(head *ListNode) *ListNode { // 解法三 双循环简单解法 O(n*m) func deleteDuplicates3(head *ListNode) *ListNode { - if head == nil { - return head - } + if head == nil { + return head + } - nilNode := &ListNode{Val: 0, Next: head} - head = nilNode + nilNode := &ListNode{Val: 0, Next: head} + head = nilNode - lastVal := 0 - for head.Next != nil && head.Next.Next != nil { - if head.Next.Val == head.Next.Next.Val { - lastVal = head.Next.Val - for head.Next != nil && lastVal == head.Next.Val { - head.Next = head.Next.Next - } - } else { - head = head.Next - } - } - return nilNode.Next + lastVal := 0 + for head.Next != nil && head.Next.Next != nil { + if head.Next.Val == head.Next.Next.Val { + lastVal = head.Next.Val + for head.Next != nil && lastVal == head.Next.Val { + head.Next = head.Next.Next + } + } else { + head = head.Next + } + } + return nilNode.Next } // 解法四 双指针+删除标志位,单循环解法 O(n) func deleteDuplicates4(head *ListNode) *ListNode { - if head == nil || head.Next == nil { - return head - } + if head == nil || head.Next == nil { + return head + } - nilNode := &ListNode{Val: 0, Next: head} - // 上次遍历有删除操作的标志位 - lastIsDel := false - // 虚拟空结点 - head = nilNode - // 前后指针用于判断 - pre, back := head.Next, head.Next.Next - // 每次只删除前面的一个重复的元素,留一个用于下次遍历判重 - // pre, back 指针的更新位置和值比较重要和巧妙 - for head.Next != nil && head.Next.Next != nil { - if pre.Val != back.Val && lastIsDel { - head.Next = head.Next.Next - pre, back = head.Next, head.Next.Next - lastIsDel = false - continue - } + nilNode := &ListNode{Val: 0, Next: head} + // 上次遍历有删除操作的标志位 + lastIsDel := false + // 虚拟空结点 + head = nilNode + // 前后指针用于判断 + pre, back := head.Next, head.Next.Next + // 每次只删除前面的一个重复的元素,留一个用于下次遍历判重 + // pre, back 指针的更新位置和值比较重要和巧妙 + for head.Next != nil && head.Next.Next != nil { + if pre.Val != back.Val && lastIsDel { + head.Next = head.Next.Next + pre, back = head.Next, head.Next.Next + lastIsDel = false + continue + } - if pre.Val == back.Val { - head.Next = head.Next.Next - pre, back = head.Next, head.Next.Next - lastIsDel = true - } else { - head = head.Next - pre, back = head.Next, head.Next.Next - lastIsDel = false - } - } - // 处理 [1,1] 这种删除还剩一个的情况 - if lastIsDel && head.Next != nil { - head.Next = nil - } - return nilNode.Next + if pre.Val == back.Val { + head.Next = head.Next.Next + pre, back = head.Next, head.Next.Next + lastIsDel = true + } else { + head = head.Next + pre, back = head.Next, head.Next.Next + lastIsDel = false + } + } + // 处理 [1,1] 这种删除还剩一个的情况 + if lastIsDel && head.Next != nil { + head.Next = nil + } + return nilNode.Next } + ``` \ No newline at end of file From 80a641546a52f7ac70a7bf1da58ffe3dcb816d30 Mon Sep 17 00:00:00 2001 From: YDZ Date: Thu, 1 Oct 2020 09:42:46 +0800 Subject: [PATCH 14/82] Fix goreportcard --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 233969f6..5fc694e5 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ - + Support Go version From aa8d1801def0c6a10e23c2262ebfdd6499c7be43 Mon Sep 17 00:00:00 2001 From: YDZ Date: Thu, 1 Oct 2020 09:46:23 +0800 Subject: [PATCH 15/82] Display goreportcard --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5fc694e5..233969f6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ - + Support Go version From c39c65dfcee806a16e51a7a0b25f651c57227752 Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 2 Oct 2020 02:18:31 +0800 Subject: [PATCH 16/82] Hidden goreportcard --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 233969f6..a8c82858 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ - + Support Go version From e6a965f76762f6d03cb5701bb0b8dde624075d11 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sat, 3 Oct 2020 01:31:59 +0800 Subject: [PATCH 17/82] Refresh goreportcard --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8c82858..233969f6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ - + Support Go version From e85635e6f945cad53e27aa286cfd5185ee363172 Mon Sep 17 00:00:00 2001 From: Aman Dwivedi <57112545+born69confused@users.noreply.github.com> Date: Sun, 4 Oct 2020 15:38:27 +0530 Subject: [PATCH 18/82] 785.Is Graph Bipartite? Adding a new solution, Leetcode Q.785 solution in Go lang using Depth First Search, faster than 100 % ( 20ms ) with a memory usage of 12 MB. --- leetcode/785.Is Graph Bipartite? | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 leetcode/785.Is Graph Bipartite? diff --git a/leetcode/785.Is Graph Bipartite? b/leetcode/785.Is Graph Bipartite? new file mode 100644 index 00000000..aadc2330 --- /dev/null +++ b/leetcode/785.Is Graph Bipartite? @@ -0,0 +1,44 @@ +func isBipartite(graph [][]int) bool { + colors := make([]int,len(graph)) + + + for i := range colors { + colors[i] = -1 + } + + + for i := range graph { + if !dfs(i, graph, colors, -1) { + fmt.Println(colors) + return false + } + } + + fmt.Println(colors) + return true + +} + +func dfs(n int, graph [][]int, colors []int, parentCol int) bool { + if colors[n] == -1 { + if parentCol == 1 { + colors[n] = 0 + } else { + colors[n] = 1 + } + } else if colors[n] == parentCol { + fmt.Println(n) + return false + } else if colors[n] != parentCol { + return true + } + + + for _, c := range graph[n] { + if !dfs(c, graph, colors, colors[n]) { + fmt.Println(c) + return false + } + } + return true +} From 59380b26edb0c056a260bded54fe5a6ceeddb399 Mon Sep 17 00:00:00 2001 From: tejasdobariya7 <69356942+tejasdobariya7@users.noreply.github.com> Date: Mon, 5 Oct 2020 22:54:53 +0530 Subject: [PATCH 19/82] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 233969f6..89063916 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # LeetCode in Go -[LeetCode Online Judge](https://leetcode.com/) is a website containing many **algorithm questions**. Most of them are real interview questions of **Google, Facebook, LinkedIn, Apple**, etc. This repo shows my solutions in Go with the code style strictly follows the [Google Golang Style Guide](https://github.com/golang/go/wiki/CodeReviewComments). Please feel free to reference and **STAR** to support this repo, thank you! +[LeetCode Online Judge](https://leetcode.com/) is a website containing many **algorithm questions**. Most of them are real interview questions of **Google, Facebook, LinkedIn, Apple**, etc. and it always help to sharp our algorithm Skills .This repo shows my solutions in Go with the code style strictly follows the [Google Golang Style Guide](https://github.com/golang/go/wiki/CodeReviewComments). Please feel free to reference and **STAR** to support this repo, thank you!

From f88b33b0478fb22436ccd1eb896dc8c80d3321f0 Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 6 Oct 2020 10:53:15 +0800 Subject: [PATCH 20/82] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89063916..5388fc4e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # LeetCode in Go -[LeetCode Online Judge](https://leetcode.com/) is a website containing many **algorithm questions**. Most of them are real interview questions of **Google, Facebook, LinkedIn, Apple**, etc. and it always help to sharp our algorithm Skills .This repo shows my solutions in Go with the code style strictly follows the [Google Golang Style Guide](https://github.com/golang/go/wiki/CodeReviewComments). Please feel free to reference and **STAR** to support this repo, thank you! +[LeetCode Online Judge](https://leetcode.com/) is a website containing many **algorithm questions**. Most of them are real interview questions of **Google, Facebook, LinkedIn, Apple**, etc. and it always help to sharp our algorithm Skills. Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. This repo shows my solutions in Go with the code style strictly follows the [Google Golang Style Guide](https://github.com/golang/go/wiki/CodeReviewComments). Please feel free to reference and **STAR** to support this repo, thank you!

From 7ccb69a920d71bab5137287befd8feeef502bef3 Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 6 Oct 2020 13:26:32 +0800 Subject: [PATCH 21/82] Add solution 0785 --- .../785. Is Graph Bipartite.go | 35 +++++++ .../785. Is Graph Bipartite_test.go | 52 ++++++++++ leetcode/0785.Is-Graph-Bipartite/README.md | 98 +++++++++++++++++++ leetcode/785.Is Graph Bipartite? | 44 --------- .../ChapterFour/0785.Is-Graph-Bipartite.md | 98 +++++++++++++++++++ website/content/menu/index.md | 1 + 6 files changed, 284 insertions(+), 44 deletions(-) create mode 100644 leetcode/0785.Is-Graph-Bipartite/785. Is Graph Bipartite.go create mode 100644 leetcode/0785.Is-Graph-Bipartite/785. Is Graph Bipartite_test.go create mode 100644 leetcode/0785.Is-Graph-Bipartite/README.md delete mode 100644 leetcode/785.Is Graph Bipartite? create mode 100644 website/content/ChapterFour/0785.Is-Graph-Bipartite.md diff --git a/leetcode/0785.Is-Graph-Bipartite/785. Is Graph Bipartite.go b/leetcode/0785.Is-Graph-Bipartite/785. Is Graph Bipartite.go new file mode 100644 index 00000000..e0b6089a --- /dev/null +++ b/leetcode/0785.Is-Graph-Bipartite/785. Is Graph Bipartite.go @@ -0,0 +1,35 @@ +package leetcode + +// DFS 染色,1 是红色,0 是绿色,-1 是未染色 +func isBipartite(graph [][]int) bool { + colors := make([]int, len(graph)) + for i := range colors { + colors[i] = -1 + } + for i := range graph { + if !dfs(i, graph, colors, -1) { + return false + } + } + return true +} + +func dfs(n int, graph [][]int, colors []int, parentCol int) bool { + if colors[n] == -1 { + if parentCol == 1 { + colors[n] = 0 + } else { + colors[n] = 1 + } + } else if colors[n] == parentCol { + return false + } else if colors[n] != parentCol { + return true + } + for _, c := range graph[n] { + if !dfs(c, graph, colors, colors[n]) { + return false + } + } + return true +} diff --git a/leetcode/0785.Is-Graph-Bipartite/785. Is Graph Bipartite_test.go b/leetcode/0785.Is-Graph-Bipartite/785. Is Graph Bipartite_test.go new file mode 100644 index 00000000..862eaf59 --- /dev/null +++ b/leetcode/0785.Is-Graph-Bipartite/785. Is Graph Bipartite_test.go @@ -0,0 +1,52 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question785 struct { + para785 + ans785 +} + +// para 是参数 +// one 代表第一个参数 +type para785 struct { + graph [][]int +} + +// ans 是答案 +// one 代表第一个答案 +type ans785 struct { + one bool +} + +func Test_Problem785(t *testing.T) { + + qs := []question785{ + + { + para785{[][]int{{1, 3}, {0, 2}, {1, 3}, {0, 2}}}, + ans785{true}, + }, + + { + para785{[][]int{{1, 2, 3}, {0, 2}, {0, 1, 3}, {0, 2}}}, + ans785{false}, + }, + + { + para785{[][]int{{1, 2, 3}, {0, 2, 3}, {0, 1, 3}, {0, 1, 2}}}, + ans785{false}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 785------------------------\n") + + for _, q := range qs { + _, p := q.ans785, q.para785 + fmt.Printf("【input】:%v 【output】:%v\n", p, isBipartite(p.graph)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/0785.Is-Graph-Bipartite/README.md b/leetcode/0785.Is-Graph-Bipartite/README.md new file mode 100644 index 00000000..a5eb6679 --- /dev/null +++ b/leetcode/0785.Is-Graph-Bipartite/README.md @@ -0,0 +1,98 @@ +# [785. Is Graph Bipartite?](https://leetcode.com/problems/is-graph-bipartite/) + + +## 题目 + +Given an undirected `graph`, return `true` if and only if it is bipartite. + +Recall that a graph is *bipartite* if we can split it's set of nodes into two independent subsets A and B such that every edge in the graph has one node in A and another node in B. + +The graph is given in the following form: `graph[i]` is a list of indexes `j` for which the edge between nodes `i` and `j` exists. Each node is an integer between `0` and `graph.length - 1`. There are no self edges or parallel edges: `graph[i]` does not contain `i`, and it doesn't contain any element twice. + + + Example 1:Input: [[1,3], [0,2], [1,3], [0,2]] + Output: true + Explanation: + The graph looks like this: + 0----1 + | | + | | + 3----2 + We can divide the vertices into two groups: {0, 2} and {1, 3}. + + + Example 2:Input: [[1,2,3], [0,2], [0,1,3], [0,2]] + Output: false + Explanation: + The graph looks like this: + 0----1 + | \ | + | \ | + 3----2 + We cannot find a way to divide the set of nodes into two independent subsets. + + +**Note:** + +- `graph` will have length in range `[1, 100]`. +- `graph[i]` will contain integers in range `[0, graph.length - 1]`. +- `graph[i]` will not contain `i` or duplicate values. +- The graph is undirected: if any element `j` is in `graph[i]`, then `i` will be in `graph[j]`. + +## 题目大意 + +给定一个无向图 graph,当这个图为二分图时返回 true。 + +graph 将会以邻接表方式给出,graph[i] 表示图中与节点i相连的所有节点。每个节点都是一个在 0 到 graph.length-1 之间的整数。这图中没有自环和平行边: graph[i] 中不存在 i,并且 graph[i] 中没有重复的值。 + +注意: + +- graph 的长度范围为 [1, 100]。 +- graph[i] 中的元素的范围为 [0, graph.length - 1]。 +- graph[i] 不会包含 i 或者有重复的值。 +- 图是无向的: 如果 j 在 graph[i] 里边, 那么 i 也会在 graph[j] 里边。 + +## 解题思路 + +- 判断一个无向图是否是二分图。二分图的定义:如果我们能将一个图的节点集合分割成两个独立的子集 A 和 B,并使图中的每一条边的两个节点一个来自 A 集合,一个来自 B 集合,我们就将这个图称为二分图。 +- 这一题可以用 BFS、DFS、并查集来解答。这里是 DFS 实现。任选一个节点开始,把它染成红色,然后对整个图 DFS 遍历,把与它相连的节点并且未被染色的,都染成绿色。颜色不同的节点代表不同的集合。这时候还可能遇到第 2 种情况,与它相连的节点已经有颜色了,并且这个颜色和前一个节点的颜色相同,这就说明了该无向图不是二分图。可以直接 return false。如此遍历到所有节点都染色了,如果能染色成功,说明该无向图是二分图,返回 true。 + +## 代码 + +```go +package leetcode + +// DFS 染色,1 是红色,0 是绿色,-1 是未染色 +func isBipartite(graph [][]int) bool { + colors := make([]int, len(graph)) + for i := range colors { + colors[i] = -1 + } + for i := range graph { + if !dfs(i, graph, colors, -1) { + return false + } + } + return true +} + +func dfs(n int, graph [][]int, colors []int, parentCol int) bool { + if colors[n] == -1 { + if parentCol == 1 { + colors[n] = 0 + } else { + colors[n] = 1 + } + } else if colors[n] == parentCol { + return false + } else if colors[n] != parentCol { + return true + } + for _, c := range graph[n] { + if !dfs(c, graph, colors, colors[n]) { + return false + } + } + return true +} +``` \ No newline at end of file diff --git a/leetcode/785.Is Graph Bipartite? b/leetcode/785.Is Graph Bipartite? deleted file mode 100644 index aadc2330..00000000 --- a/leetcode/785.Is Graph Bipartite? +++ /dev/null @@ -1,44 +0,0 @@ -func isBipartite(graph [][]int) bool { - colors := make([]int,len(graph)) - - - for i := range colors { - colors[i] = -1 - } - - - for i := range graph { - if !dfs(i, graph, colors, -1) { - fmt.Println(colors) - return false - } - } - - fmt.Println(colors) - return true - -} - -func dfs(n int, graph [][]int, colors []int, parentCol int) bool { - if colors[n] == -1 { - if parentCol == 1 { - colors[n] = 0 - } else { - colors[n] = 1 - } - } else if colors[n] == parentCol { - fmt.Println(n) - return false - } else if colors[n] != parentCol { - return true - } - - - for _, c := range graph[n] { - if !dfs(c, graph, colors, colors[n]) { - fmt.Println(c) - return false - } - } - return true -} diff --git a/website/content/ChapterFour/0785.Is-Graph-Bipartite.md b/website/content/ChapterFour/0785.Is-Graph-Bipartite.md new file mode 100644 index 00000000..a5eb6679 --- /dev/null +++ b/website/content/ChapterFour/0785.Is-Graph-Bipartite.md @@ -0,0 +1,98 @@ +# [785. Is Graph Bipartite?](https://leetcode.com/problems/is-graph-bipartite/) + + +## 题目 + +Given an undirected `graph`, return `true` if and only if it is bipartite. + +Recall that a graph is *bipartite* if we can split it's set of nodes into two independent subsets A and B such that every edge in the graph has one node in A and another node in B. + +The graph is given in the following form: `graph[i]` is a list of indexes `j` for which the edge between nodes `i` and `j` exists. Each node is an integer between `0` and `graph.length - 1`. There are no self edges or parallel edges: `graph[i]` does not contain `i`, and it doesn't contain any element twice. + + + Example 1:Input: [[1,3], [0,2], [1,3], [0,2]] + Output: true + Explanation: + The graph looks like this: + 0----1 + | | + | | + 3----2 + We can divide the vertices into two groups: {0, 2} and {1, 3}. + + + Example 2:Input: [[1,2,3], [0,2], [0,1,3], [0,2]] + Output: false + Explanation: + The graph looks like this: + 0----1 + | \ | + | \ | + 3----2 + We cannot find a way to divide the set of nodes into two independent subsets. + + +**Note:** + +- `graph` will have length in range `[1, 100]`. +- `graph[i]` will contain integers in range `[0, graph.length - 1]`. +- `graph[i]` will not contain `i` or duplicate values. +- The graph is undirected: if any element `j` is in `graph[i]`, then `i` will be in `graph[j]`. + +## 题目大意 + +给定一个无向图 graph,当这个图为二分图时返回 true。 + +graph 将会以邻接表方式给出,graph[i] 表示图中与节点i相连的所有节点。每个节点都是一个在 0 到 graph.length-1 之间的整数。这图中没有自环和平行边: graph[i] 中不存在 i,并且 graph[i] 中没有重复的值。 + +注意: + +- graph 的长度范围为 [1, 100]。 +- graph[i] 中的元素的范围为 [0, graph.length - 1]。 +- graph[i] 不会包含 i 或者有重复的值。 +- 图是无向的: 如果 j 在 graph[i] 里边, 那么 i 也会在 graph[j] 里边。 + +## 解题思路 + +- 判断一个无向图是否是二分图。二分图的定义:如果我们能将一个图的节点集合分割成两个独立的子集 A 和 B,并使图中的每一条边的两个节点一个来自 A 集合,一个来自 B 集合,我们就将这个图称为二分图。 +- 这一题可以用 BFS、DFS、并查集来解答。这里是 DFS 实现。任选一个节点开始,把它染成红色,然后对整个图 DFS 遍历,把与它相连的节点并且未被染色的,都染成绿色。颜色不同的节点代表不同的集合。这时候还可能遇到第 2 种情况,与它相连的节点已经有颜色了,并且这个颜色和前一个节点的颜色相同,这就说明了该无向图不是二分图。可以直接 return false。如此遍历到所有节点都染色了,如果能染色成功,说明该无向图是二分图,返回 true。 + +## 代码 + +```go +package leetcode + +// DFS 染色,1 是红色,0 是绿色,-1 是未染色 +func isBipartite(graph [][]int) bool { + colors := make([]int, len(graph)) + for i := range colors { + colors[i] = -1 + } + for i := range graph { + if !dfs(i, graph, colors, -1) { + return false + } + } + return true +} + +func dfs(n int, graph [][]int, colors []int, parentCol int) bool { + if colors[n] == -1 { + if parentCol == 1 { + colors[n] = 0 + } else { + colors[n] = 1 + } + } else if colors[n] == parentCol { + return false + } else if colors[n] != parentCol { + return true + } + for _, c := range graph[n] { + if !dfs(c, graph, colors, colors[n]) { + return false + } + } + return true +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 43832d46..abd00fce 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -379,6 +379,7 @@ headless: true - [0778.Swim-in-Rising-Water]({{< relref "/ChapterFour/0778.Swim-in-Rising-Water.md" >}}) - [0781.Rabbits-in-Forest]({{< relref "/ChapterFour/0781.Rabbits-in-Forest.md" >}}) - [0784.Letter-Case-Permutation]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}}) + - [0785.Is-Graph-Bipartite]({{< relref "/ChapterFour/0785.Is-Graph-Bipartite.md" >}}) - [0786.K-th-Smallest-Prime-Fraction]({{< relref "/ChapterFour/0786.K-th-Smallest-Prime-Fraction.md" >}}) - [0793.Preimage-Size-of-Factorial-Zeroes-Function]({{< relref "/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md" >}}) - [0802.Find-Eventual-Safe-States]({{< relref "/ChapterFour/0802.Find-Eventual-Safe-States.md" >}}) From 6d2472da5f20753602615607674b5d90bca88c6e Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 18 Oct 2020 15:38:31 +0800 Subject: [PATCH 22/82] micro fix --- website/themes/book/layouts/partials/docs/footer.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/themes/book/layouts/partials/docs/footer.html b/website/themes/book/layouts/partials/docs/footer.html index 048e2bba..afffc249 100644 --- a/website/themes/book/layouts/partials/docs/footer.html +++ b/website/themes/book/layouts/partials/docs/footer.html @@ -22,6 +22,6 @@ {{ end }} {{ partial "docs/gitalk.html" . }} -本站总访问量: -您是本站第 位访问者 +本站总访问量:  次 +您是本站第  位访问者 From f3888ff449bc29bc04ad53485529bffc20192ad3 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 8 Nov 2020 11:58:53 +0800 Subject: [PATCH 23/82] Add weekly-contest-214 --- .vscode/settings.json | 1 + .../5561. Get Maximum in Generated Array.go | 21 +++++++ ...61. Get Maximum in Generated Array_test.go | 62 +++++++++++++++++++ ...ns to Make Character Frequencies Unique.go | 24 +++++++ ... Make Character Frequencies Unique_test.go | 62 +++++++++++++++++++ .... Sell Diminishing-Valued Colored Balls.go | 54 ++++++++++++++++ ...l Diminishing-Valued Colored Balls_test.go | 58 +++++++++++++++++ 7 files changed, 282 insertions(+) create mode 100644 leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array.go create mode 100644 leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array_test.go create mode 100644 leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique.go create mode 100644 leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique_test.go create mode 100644 leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls.go create mode 100644 leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls_test.go diff --git a/.vscode/settings.json b/.vscode/settings.json index 93139647..eb946948 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,6 +3,7 @@ "go.formatFlags": [ "-s" ], + "go.autocompleteUnimportedPackages": true, "[go]": { "editor.insertSpaces": false, "editor.formatOnSave": true, diff --git a/leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array.go b/leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array.go new file mode 100644 index 00000000..246a1e1f --- /dev/null +++ b/leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array.go @@ -0,0 +1,21 @@ +package leetcode + +func getMaximumGenerated(n int) int { + if n == 0 { + return 0 + } + nums, max := make([]int, n+1), 0 + nums[0], nums[1] = 0, 1 + for i := 0; i <= n; i++ { + if nums[i] > max { + max = nums[i] + } + if 2*i >= 2 && 2*i <= n { + nums[2*i] = nums[i] + } + if 2*i+1 >= 2 && 2*i+1 <= n { + nums[2*i+1] = nums[i] + nums[i+1] + } + } + return max +} diff --git a/leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array_test.go b/leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array_test.go new file mode 100644 index 00000000..8af6a6fc --- /dev/null +++ b/leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array_test.go @@ -0,0 +1,62 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question5561 struct { + para5561 + ans5561 +} + +// para 是参数 +// one 代表第一个参数 +type para5561 struct { + n int +} + +// ans 是答案 +// one 代表第一个答案 +type ans5561 struct { + one int +} + +func Test_Problem5561(t *testing.T) { + + qs := []question5561{ + + { + para5561{7}, + ans5561{3}, + }, + + { + para5561{2}, + ans5561{1}, + }, + + { + para5561{3}, + ans5561{2}, + }, + + { + para5561{0}, + ans5561{0}, + }, + + { + para5561{1}, + ans5561{1}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 5561------------------------\n") + + for _, q := range qs { + _, p := q.ans5561, q.para5561 + fmt.Printf("【input】:%v 【output】:%v \n", p, getMaximumGenerated(p.n)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique.go b/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique.go new file mode 100644 index 00000000..39249854 --- /dev/null +++ b/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique.go @@ -0,0 +1,24 @@ +package leetcode + +import ( + "fmt" + "sort" +) + +func minDeletions(s string) int { + frequency, res := make([]int, 26), 0 + for i := 0; i < len(s); i++ { + frequency[s[i]-'a']++ + } + sort.Sort(sort.Reverse(sort.IntSlice(frequency))) + fmt.Printf("%v\n", frequency) + for i := 1; i <= 25; i++ { + if frequency[i] == frequency[i-1] && frequency[i] != 0 { + res++ + frequency[i]-- + sort.Sort(sort.Reverse(sort.IntSlice(frequency))) + i-- + } + } + return res +} diff --git a/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique_test.go b/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique_test.go new file mode 100644 index 00000000..1a3b33d3 --- /dev/null +++ b/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique_test.go @@ -0,0 +1,62 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question5562 struct { + para5562 + ans5562 +} + +// para 是参数 +// one 代表第一个参数 +type para5562 struct { + s string +} + +// ans 是答案 +// one 代表第一个答案 +type ans5562 struct { + one int +} + +func Test_Problem5562(t *testing.T) { + + qs := []question5562{ + + { + para5562{"aab"}, + ans5562{0}, + }, + + { + para5562{"aaabbbcc"}, + ans5562{2}, + }, + + { + para5562{"ceabaacb"}, + ans5562{2}, + }, + + { + para5562{""}, + ans5562{0}, + }, + + { + para5562{"abcabc"}, + ans5562{3}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 5562------------------------\n") + + for _, q := range qs { + _, p := q.ans5562, q.para5562 + fmt.Printf("【input】:%v 【output】:%v \n", p, minDeletions(p.s)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls.go b/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls.go new file mode 100644 index 00000000..88103a63 --- /dev/null +++ b/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls.go @@ -0,0 +1,54 @@ +package leetcode + +import ( + "container/heap" +) + +func maxProfit(inventory []int, orders int) int { + res, mod := 0, 1000000007 + q := PriorityQueue{} + for i := 0; i < len(inventory); i++ { + heap.Push(&q, &Item{count: inventory[i]}) + } + for ; orders > 0; orders-- { + item := heap.Pop(&q).(*Item) + res = (res + item.count) % mod + heap.Push(&q, &Item{count: item.count - 1}) + } + return res +} + +// Item define +type Item struct { + count int +} + +// A PriorityQueue implements heap.Interface and holds Items. +type PriorityQueue []*Item + +func (pq PriorityQueue) Len() int { + return len(pq) +} + +func (pq PriorityQueue) Less(i, j int) bool { + // 注意:因为golang中的heap是按最小堆组织的,所以count越大,Less()越小,越靠近堆顶. + return pq[i].count > pq[j].count +} + +func (pq PriorityQueue) Swap(i, j int) { + pq[i], pq[j] = pq[j], pq[i] +} + +// Push define +func (pq *PriorityQueue) Push(x interface{}) { + item := x.(*Item) + *pq = append(*pq, item) +} + +// Pop define +func (pq *PriorityQueue) Pop() interface{} { + n := len(*pq) + item := (*pq)[n-1] + *pq = (*pq)[:n-1] + return item +} diff --git a/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls_test.go b/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls_test.go new file mode 100644 index 00000000..9d48c4b3 --- /dev/null +++ b/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls_test.go @@ -0,0 +1,58 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question5563 struct { + para5563 + ans5563 +} + +// para 是参数 +// one 代表第一个参数 +type para5563 struct { + inventory []int + orders int +} + +// ans 是答案 +// one 代表第一个答案 +type ans5563 struct { + one int +} + +func Test_Problem5563(t *testing.T) { + + qs := []question5563{ + + { + para5563{[]int{2, 5}, 4}, + ans5563{14}, + }, + + { + para5563{[]int{3, 5}, 6}, + ans5563{19}, + }, + + { + para5563{[]int{2, 8, 4, 10, 6}, 20}, + ans5563{110}, + }, + + { + para5563{[]int{1000000000}, 1000000000}, + ans5563{21}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 5563------------------------\n") + + for _, q := range qs { + _, p := q.ans5563, q.para5563 + fmt.Printf("【input】:%v 【output】:%v \n", p, maxProfit(p.inventory, p.orders)) + } + fmt.Printf("\n\n\n") +} From ea38a912024bfe7f5a0f21ed32b908b4bcee599f Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 10 Nov 2020 07:39:47 +0800 Subject: [PATCH 24/82] Add weekly-contest-214 solution --- .../1646. Get Maximum in Generated Array.go} | 0 ...46. Get Maximum in Generated Array_test.go | 62 ++++++ .../README.md | 96 +++++++++ ...s to Make Character Frequencies Unique.go} | 2 - ... Make Character Frequencies Unique_test.go | 62 ++++++ .../README.md | 89 +++++++++ ... Sell Diminishing-Valued Colored Balls.go} | 48 +++++ ...l Diminishing-Valued Colored Balls_test.go | 63 ++++++ .../README.md | 131 ++++++++++++ ...reate Sorted Array through Instructions.go | 106 ++++++++++ ... Sorted Array through Instructions_test.go | 52 +++++ .../README.md | 189 ++++++++++++++++++ ...61. Get Maximum in Generated Array_test.go | 62 ------ ... Make Character Frequencies Unique_test.go | 62 ------ ...l Diminishing-Valued Colored Balls_test.go | 58 ------ .../1646.Get-Maximum-in-Generated-Array.md | 96 +++++++++ ...ns-to-Make-Character-Frequencies-Unique.md | 89 +++++++++ ...8.Sell-Diminishing-Valued-Colored-Balls.md | 131 ++++++++++++ ...reate-Sorted-Array-through-Instructions.md | 189 ++++++++++++++++++ website/content/menu/index.md | 4 + 20 files changed, 1407 insertions(+), 184 deletions(-) rename leetcode/{5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array.go => 1646.Get-Maximum-in-Generated-Array/1646. Get Maximum in Generated Array.go} (100%) create mode 100644 leetcode/1646.Get-Maximum-in-Generated-Array/1646. Get Maximum in Generated Array_test.go create mode 100644 leetcode/1646.Get-Maximum-in-Generated-Array/README.md rename leetcode/{5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique.go => 1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/1647. Minimum Deletions to Make Character Frequencies Unique.go} (91%) create mode 100644 leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/1647. Minimum Deletions to Make Character Frequencies Unique_test.go create mode 100644 leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/README.md rename leetcode/{5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls.go => 1648.Sell-Diminishing-Valued-Colored-Balls/1648. Sell Diminishing-Valued Colored Balls.go} (50%) create mode 100644 leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/1648. Sell Diminishing-Valued Colored Balls_test.go create mode 100644 leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/README.md create mode 100644 leetcode/1649.Create-Sorted-Array-through-Instructions/1649. Create Sorted Array through Instructions.go create mode 100644 leetcode/1649.Create-Sorted-Array-through-Instructions/1649. Create Sorted Array through Instructions_test.go create mode 100644 leetcode/1649.Create-Sorted-Array-through-Instructions/README.md delete mode 100644 leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array_test.go delete mode 100644 leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique_test.go delete mode 100644 leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls_test.go create mode 100644 website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md create mode 100644 website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md create mode 100644 website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md create mode 100644 website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md diff --git a/leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array.go b/leetcode/1646.Get-Maximum-in-Generated-Array/1646. Get Maximum in Generated Array.go similarity index 100% rename from leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array.go rename to leetcode/1646.Get-Maximum-in-Generated-Array/1646. Get Maximum in Generated Array.go diff --git a/leetcode/1646.Get-Maximum-in-Generated-Array/1646. Get Maximum in Generated Array_test.go b/leetcode/1646.Get-Maximum-in-Generated-Array/1646. Get Maximum in Generated Array_test.go new file mode 100644 index 00000000..38472190 --- /dev/null +++ b/leetcode/1646.Get-Maximum-in-Generated-Array/1646. Get Maximum in Generated Array_test.go @@ -0,0 +1,62 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1646 struct { + para1646 + ans1646 +} + +// para 是参数 +// one 代表第一个参数 +type para1646 struct { + n int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1646 struct { + one int +} + +func Test_Problem1646(t *testing.T) { + + qs := []question1646{ + + { + para1646{7}, + ans1646{3}, + }, + + { + para1646{2}, + ans1646{1}, + }, + + { + para1646{3}, + ans1646{2}, + }, + + { + para1646{0}, + ans1646{0}, + }, + + { + para1646{1}, + ans1646{1}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1646------------------------\n") + + for _, q := range qs { + _, p := q.ans1646, q.para1646 + fmt.Printf("【input】:%v 【output】:%v \n", p, getMaximumGenerated(p.n)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1646.Get-Maximum-in-Generated-Array/README.md b/leetcode/1646.Get-Maximum-in-Generated-Array/README.md new file mode 100644 index 00000000..a703bba7 --- /dev/null +++ b/leetcode/1646.Get-Maximum-in-Generated-Array/README.md @@ -0,0 +1,96 @@ +# [1646. Get Maximum in Generated Array](https://leetcode.com/problems/get-maximum-in-generated-array/) + + +## 题目 + +You are given an integer `n`. An array `nums` of length `n + 1` is generated in the following way: + +- `nums[0] = 0` +- `nums[1] = 1` +- `nums[2 * i] = nums[i]` when `2 <= 2 * i <= n` +- `nums[2 * i + 1] = nums[i] + nums[i + 1]` when `2 <= 2 * i + 1 <= n` + +Return *****the **maximum** integer in the array* `nums`. + +**Example 1:** + +``` +Input: n = 7 +Output: 3 +Explanation: According to the given rules: + nums[0] = 0 + nums[1] = 1 + nums[(1 * 2) = 2] = nums[1] = 1 + nums[(1 * 2) + 1 = 3] = nums[1] + nums[2] = 1 + 1 = 2 + nums[(2 * 2) = 4] = nums[2] = 1 + nums[(2 * 2) + 1 = 5] = nums[2] + nums[3] = 1 + 2 = 3 + nums[(3 * 2) = 6] = nums[3] = 2 + nums[(3 * 2) + 1 = 7] = nums[3] + nums[4] = 2 + 1 = 3 +Hence, nums = [0,1,1,2,1,3,2,3], and the maximum is 3. + +``` + +**Example 2:** + +``` +Input: n = 2 +Output: 1 +Explanation: According to the given rules, the maximum between nums[0], nums[1], and nums[2] is 1. + +``` + +**Example 3:** + +``` +Input: n = 3 +Output: 2 +Explanation: According to the given rules, the maximum between nums[0], nums[1], nums[2], and nums[3] is 2. + +``` + +**Constraints:** + +- `0 <= n <= 100` + +## 题目大意 + +给你一个整数 n 。按下述规则生成一个长度为 n + 1 的数组 nums : + +- nums[0] = 0 +- nums[1] = 1 +- 当 2 <= 2 * i <= n 时,nums[2 * i] = nums[i] +- 当 2 <= 2 * i + 1 <= n 时,nums[2 * i + 1] = nums[i] + nums[i + 1] + +返回生成数组 nums 中的 最大值。 + +## 解题思路 + +- 给出一个 n + 1 的数组,并按照生成规则生成这个数组,求出这个数组中的最大值。 +- 简单题,按照题意生成数组,边生成边记录和更新最大值即可。 +- 注意边界条件,当 n 为 0 的时候,数组里面只有一个元素 0 。 + +## 代码 + +```go +package leetcode + +func getMaximumGenerated(n int) int { + if n == 0 { + return 0 + } + nums, max := make([]int, n+1), 0 + nums[0], nums[1] = 0, 1 + for i := 0; i <= n; i++ { + if nums[i] > max { + max = nums[i] + } + if 2*i >= 2 && 2*i <= n { + nums[2*i] = nums[i] + } + if 2*i+1 >= 2 && 2*i+1 <= n { + nums[2*i+1] = nums[i] + nums[i+1] + } + } + return max +} +``` \ No newline at end of file diff --git a/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique.go b/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/1647. Minimum Deletions to Make Character Frequencies Unique.go similarity index 91% rename from leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique.go rename to leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/1647. Minimum Deletions to Make Character Frequencies Unique.go index 39249854..30219660 100644 --- a/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique.go +++ b/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/1647. Minimum Deletions to Make Character Frequencies Unique.go @@ -1,7 +1,6 @@ package leetcode import ( - "fmt" "sort" ) @@ -11,7 +10,6 @@ func minDeletions(s string) int { frequency[s[i]-'a']++ } sort.Sort(sort.Reverse(sort.IntSlice(frequency))) - fmt.Printf("%v\n", frequency) for i := 1; i <= 25; i++ { if frequency[i] == frequency[i-1] && frequency[i] != 0 { res++ diff --git a/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/1647. Minimum Deletions to Make Character Frequencies Unique_test.go b/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/1647. Minimum Deletions to Make Character Frequencies Unique_test.go new file mode 100644 index 00000000..3bdc2735 --- /dev/null +++ b/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/1647. Minimum Deletions to Make Character Frequencies Unique_test.go @@ -0,0 +1,62 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1647 struct { + para1647 + ans1647 +} + +// para 是参数 +// one 代表第一个参数 +type para1647 struct { + s string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1647 struct { + one int +} + +func Test_Problem1647(t *testing.T) { + + qs := []question1647{ + + { + para1647{"aab"}, + ans1647{0}, + }, + + { + para1647{"aaabbbcc"}, + ans1647{2}, + }, + + { + para1647{"ceabaacb"}, + ans1647{2}, + }, + + { + para1647{""}, + ans1647{0}, + }, + + { + para1647{"abcabc"}, + ans1647{3}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1647------------------------\n") + + for _, q := range qs { + _, p := q.ans1647, q.para1647 + fmt.Printf("【input】:%v 【output】:%v \n", p, minDeletions(p.s)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/README.md b/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/README.md new file mode 100644 index 00000000..e6b2fff8 --- /dev/null +++ b/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique/README.md @@ -0,0 +1,89 @@ +# [1647. Minimum Deletions to Make Character Frequencies Unique](https://leetcode.com/problems/minimum-deletions-to-make-character-frequencies-unique/) + + +## 题目 + +A string `s` is called **good** if there are no two different characters in `s` that have the same **frequency**. + +Given a string `s`, return *the **minimum** number of characters you need to delete to make* `s` ***good**.* + +The **frequency** of a character in a string is the number of times it appears in the string. For example, in the string `"aab"`, the **frequency** of `'a'` is `2`, while the **frequency** of `'b'` is `1`. + +**Example 1:** + +``` +Input: s = "aab" +Output: 0 +Explanation: s is already good. + +``` + +**Example 2:** + +``` +Input: s = "aaabbbcc" +Output: 2 +Explanation: You can delete two 'b's resulting in the good string "aaabcc". +Another way it to delete one 'b' and one 'c' resulting in the good string "aaabbc". +``` + +**Example 3:** + +``` +Input: s = "ceabaacb" +Output: 2 +Explanation: You can delete both 'c's resulting in the good string "eabaab". +Note that we only care about characters that are still in the string at the end (i.e. frequency of 0 is ignored). + +``` + +**Constraints:** + +- `1 <= s.length <= 105` +- `s` contains only lowercase English letters. + +## 题目大意 + +如果字符串 s 中 不存在 两个不同字符 频次 相同的情况,就称 s 是 优质字符串 。 + +给你一个字符串 s,返回使 s 成为优质字符串需要删除的最小字符数。 + +字符串中字符的 频次 是该字符在字符串中的出现次数。例如,在字符串 "aab" 中,'a' 的频次是 2,而 'b' 的频次是 1 。 + +**提示:** + +- `1 <= s.length <= 105` +- `s` 仅含小写英文字母 + +## 解题思路 + +- 给出一个字符串 s,要求输出使 s 变成“优质字符串”需要删除的最小字符数。“优质字符串”的定义是:字符串 s 中不存在频次相同的两个不同字符。 +- 首先将 26 个字母在字符串中的频次分别统计出来,然后把频次从大到小排列,从频次大的开始,依次调整:例如,假设前一个和后一个频次相等,就把前一个字符删除一个,频次减一,再次排序,如果频次还相等,继续调整,如果频次不同了,游标往后移,继续调整后面的频次。直到所有的频次都不同了,就可以输出最终结果了。 +- 这里需要注意频次为 0 的情况,即字母都被删光了。频次为 0 以后,就不需要再比较了。 + +## 代码 + +```go +package leetcode + +import ( + "sort" +) + +func minDeletions(s string) int { + frequency, res := make([]int, 26), 0 + for i := 0; i < len(s); i++ { + frequency[s[i]-'a']++ + } + sort.Sort(sort.Reverse(sort.IntSlice(frequency))) + for i := 1; i <= 25; i++ { + if frequency[i] == frequency[i-1] && frequency[i] != 0 { + res++ + frequency[i]-- + sort.Sort(sort.Reverse(sort.IntSlice(frequency))) + i-- + } + } + return res +} +``` \ No newline at end of file diff --git a/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls.go b/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/1648. Sell Diminishing-Valued Colored Balls.go similarity index 50% rename from leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls.go rename to leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/1648. Sell Diminishing-Valued Colored Balls.go index 88103a63..677a3699 100644 --- a/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls.go +++ b/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/1648. Sell Diminishing-Valued Colored Balls.go @@ -4,7 +4,55 @@ import ( "container/heap" ) +// 解法一 贪心 + 二分搜索 func maxProfit(inventory []int, orders int) int { + maxItem, thresholdValue, count, res, mod := 0, -1, 0, 0, 1000000007 + for i := 0; i < len(inventory); i++ { + if inventory[i] > maxItem { + maxItem = inventory[i] + } + } + low, high := 0, maxItem + for low <= high { + mid := low + ((high - low) >> 1) + for i := 0; i < len(inventory); i++ { + count += max(inventory[i]-mid, 0) + } + if count <= orders { + thresholdValue = mid + high = mid - 1 + } else { + low = mid + 1 + } + count = 0 + } + count = 0 + for i := 0; i < len(inventory); i++ { + count += max(inventory[i]-thresholdValue, 0) + } + count = orders - count + for i := 0; i < len(inventory); i++ { + if inventory[i] >= thresholdValue { + if count > 0 { + res += (thresholdValue + inventory[i]) * (inventory[i] - thresholdValue + 1) / 2 + count-- + } else { + res += (thresholdValue + 1 + inventory[i]) * (inventory[i] - thresholdValue) / 2 + } + } + } + return res % mod +} + +func max(a int, b int) int { + if a > b { + return a + } + return b +} + +// 解法二 优先队列,超时! +func maxProfit_(inventory []int, orders int) int { res, mod := 0, 1000000007 q := PriorityQueue{} for i := 0; i < len(inventory); i++ { diff --git a/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/1648. Sell Diminishing-Valued Colored Balls_test.go b/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/1648. Sell Diminishing-Valued Colored Balls_test.go new file mode 100644 index 00000000..b81ce0e6 --- /dev/null +++ b/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/1648. Sell Diminishing-Valued Colored Balls_test.go @@ -0,0 +1,63 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1648 struct { + para1648 + ans1648 +} + +// para 是参数 +// one 代表第一个参数 +type para1648 struct { + inventory []int + orders int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1648 struct { + one int +} + +func Test_Problem1648(t *testing.T) { + + qs := []question1648{ + + { + para1648{[]int{2, 3, 3, 4, 5}, 4}, + ans1648{16}, + }, + + { + para1648{[]int{2, 5}, 4}, + ans1648{14}, + }, + + { + para1648{[]int{3, 5}, 6}, + ans1648{19}, + }, + + { + para1648{[]int{2, 8, 4, 10, 6}, 20}, + ans1648{110}, + }, + + { + para1648{[]int{1000000000}, 1000000000}, + ans1648{21}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1648------------------------\n") + + for _, q := range qs { + _, p := q.ans1648, q.para1648 + fmt.Printf("【input】:%v 【output】:%v \n", p, maxProfit(p.inventory, p.orders)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/README.md b/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/README.md new file mode 100644 index 00000000..bddd91b3 --- /dev/null +++ b/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls/README.md @@ -0,0 +1,131 @@ +# [1648. Sell Diminishing-Valued Colored Balls](https://leetcode.com/problems/sell-diminishing-valued-colored-balls/) + + +## 题目 + +You have an `inventory` of different colored balls, and there is a customer that wants `orders` balls of **any** color. + +The customer weirdly values the colored balls. Each colored ball's value is the number of balls **of that color** you currently have in your `inventory`. For example, if you own `6` yellow balls, the customer would pay `6` for the first yellow ball. After the transaction, there are only `5` yellow balls left, so the next yellow ball is then valued at `5` (i.e., the value of the balls decreases as you sell more to the customer). + +You are given an integer array, `inventory`, where `inventory[i]` represents the number of balls of the `ith` color that you initially own. You are also given an integer `orders`, which represents the total number of balls that the customer wants. You can sell the balls **in any order**. + +Return *the **maximum** total value that you can attain after selling* `orders` *colored balls*. As the answer may be too large, return it **modulo** `109 + 7`. + +**Example 1:** + +![https://assets.leetcode.com/uploads/2020/11/05/jj.gif](https://assets.leetcode.com/uploads/2020/11/05/jj.gif) + +``` +Input: inventory = [2,5], orders = 4 +Output: 14 +Explanation: Sell the 1st color 1 time (2) and the 2nd color 3 times (5 + 4 + 3). +The maximum total value is 2 + 5 + 4 + 3 = 14. + +``` + +**Example 2:** + +``` +Input: inventory = [3,5], orders = 6 +Output: 19 +Explanation: Sell the 1st color 2 times (3 + 2) and the 2nd color 4 times (5 + 4 + 3 + 2). +The maximum total value is 3 + 2 + 5 + 4 + 3 + 2 = 19. +``` + +**Example 3:** + +``` +Input: inventory = [2,8,4,10,6], orders = 20 +Output: 110 +``` + +**Example 4:** + +``` +Input: inventory = [1000000000], orders = 1000000000 +Output: 21 +Explanation: Sell the 1st color 1000000000 times for a total value of 500000000500000000. 500000000500000000 modulo 109 + 7 = 21. +``` + +**Constraints:** + +- `1 <= inventory.length <= 10^5` +- `1 <= inventory[i] <= 10^9` +- `1 <= orders <= min(sum(inventory[i]), 10^9)` + +## 题目大意 + +你有一些球的库存 inventory ,里面包含着不同颜色的球。一个顾客想要 任意颜色 总数为 orders 的球。这位顾客有一种特殊的方式衡量球的价值:每个球的价值是目前剩下的 同色球 的数目。比方说还剩下 6 个黄球,那么顾客买第一个黄球的时候该黄球的价值为 6 。这笔交易以后,只剩下 5 个黄球了,所以下一个黄球的价值为 5 (也就是球的价值随着顾客购买同色球是递减的) + +给你整数数组 inventory ,其中 inventory[i] 表示第 i 种颜色球一开始的数目。同时给你整数 orders ,表示顾客总共想买的球数目。你可以按照 任意顺序 卖球。请你返回卖了 orders 个球以后 最大 总价值之和。由于答案可能会很大,请你返回答案对 109 + 7 取余数 的结果。 + +提示: + +- 1 <= inventory.length <= 10^5 +- 1 <= inventory[i] <= 10^9 +- 1 <= orders <= min(sum(inventory[i]), 10^9) + +## 解题思路 + +- 给出一个 `inventory` 数组和 `orders` 次操作,要求输出数组中前 `orders` 大个元素累加和。需要注意的是,每累加一个元素 `inventory[i]`,这个元素都会减一,下次再累加的时候,需要选取更新以后的数组的最大值。 +- 拿到这个题目以后很容易想到优先队列,建立大根堆以后,`pop` 出当前最大值 `maxItem`,累加,以后把 `maxItem` 减一再 `push` 回去。循环执行 `orders` 次以后即是最终结果。题目是这个意思,但是我们不能这么写代码,因为题目条件里面给出了 `orders` 的数据大小。orders 最大为 10^9。按照优先队列的这个方法一定会超时,时间复杂度为 O(orders⋅logn)。那就换一个思路。优先队列这个思路中,重复操作了 `orders` 次,其实在这些操作中,有一些是没有必要的废操作。这些大量的“废”操作导致了超时。试想,在 `orders` 次操作中,能否合并 `n` 个 `pop` 操作,一口气先 `pop` 掉 `n` 个前 `n` 大的数呢?这个是可行的,因为每次 `pop` 出去,元素都只会减一,这个是非常有规律的。 +- 为了接下来的描述更加清晰易懂,还需要再定义 1 个值, `thresholdValue` 为操作 `n` 次以后,当前 `inventory` 数组的最大值。关于 `thresholdValue` 的理解,这里要说明一下。 `thresholdValue` 的来源有 2 种,一种是本来数组里面就有这个值,还有一种来源是 `inventory[i]` 元素减少到了 `thresholdValue` 这个值。举个例子:原始数组是 [2,3,3,4,5],`orders` = 4,取 4 次以后,剩下的数组是 [2,2,3,3,3]。3 个 3 里面其中一个 3 就来自于 `4-1=3`,或者 `5-2=3`。 +- 用二分搜索在 [0,max(`inventory`)] 区间内找到这个 `thresholdValue` 值,能满足下列不等式的最小 `thresholdValue` 值: + + $$\sum_{inventory[i]\geqslant thresholdValue}^{} \left ( inventory[i] - thresholdValue \right )\leqslant orders$$ + + `thresholdValue` 越小,不等式左边的值越大,随着 `thresholdValue` 的增大,不等式左边的值越来越小,直到刚刚能小于等于 `orders`。求出了 `thresholdValue` 值以后,还需要再判断有多少值等于 `thresholdValue - 1` 值了。 + + ![https://img.halfrost.com/Leetcode/leetcode_1648.png](https://img.halfrost.com/Leetcode/leetcode_1648.png) + +- 还是举上面的例子,原始数组是 [2,3,3,4,5],`orders` = 4,我们可以求得 `thresholdValue` = 3 。`inventory[i]` > `thresholdValue` 的那部分 100% 的要取走,`thresholdValue` 就像一个水平面,突出水平面的那些都要拿走,每列的值按照等差数列求和公式计算即可。但是 `orders` - `thresholdValue` = 1,说明水平面以下还要拿走一个,即 `thresholdValue` 线下的虚线框里面的那 4 个球,还需要任意取走一个。最后总的结果是这 2 部分的总和,( ( 5 + 4 ) + 4 ) + 3 = 16 。 + +## 代码 + +```go +package leetcode + +import ( + "container/heap" +) + +// 解法一 贪心 + 二分搜索 +func maxProfit(inventory []int, orders int) int { + maxItem, thresholdValue, count, res, mod := 0, -1, 0, 0, 1000000007 + for i := 0; i < len(inventory); i++ { + if inventory[i] > maxItem { + maxItem = inventory[i] + } + } + low, high := 0, maxItem + for low <= high { + mid := low + ((high - low) >> 1) + for i := 0; i < len(inventory); i++ { + count += max(inventory[i]-mid, 0) + } + if count <= orders { + thresholdValue = mid + high = mid - 1 + } else { + low = mid + 1 + } + count = 0 + } + count = 0 + for i := 0; i < len(inventory); i++ { + count += max(inventory[i]-thresholdValue, 0) + } + count = orders - count + for i := 0; i < len(inventory); i++ { + if inventory[i] >= thresholdValue { + if count > 0 { + res += (thresholdValue + inventory[i]) * (inventory[i] - thresholdValue + 1) / 2 + count-- + } else { + res += (thresholdValue + 1 + inventory[i]) * (inventory[i] - thresholdValue) / 2 + } + } + } + return res % mod +} +``` \ No newline at end of file diff --git a/leetcode/1649.Create-Sorted-Array-through-Instructions/1649. Create Sorted Array through Instructions.go b/leetcode/1649.Create-Sorted-Array-through-Instructions/1649. Create Sorted Array through Instructions.go new file mode 100644 index 00000000..c60b1836 --- /dev/null +++ b/leetcode/1649.Create-Sorted-Array-through-Instructions/1649. Create Sorted Array through Instructions.go @@ -0,0 +1,106 @@ +package leetcode + +import ( + "github.com/halfrost/LeetCode-Go/template" + "sort" +) + +// 解法一 线段树 SegmentTree +func createSortedArray(instructions []int) int { + if len(instructions) == 0 { + return 0 + } + st, res, mod := template.SegmentCountTree{}, 0, 1000000007 + numsMap, numsArray, tmpArray := discretization1649(instructions) + // 初始化线段树,节点内的值都赋值为 0,即计数为 0 + st.Init(tmpArray, func(i, j int) int { + return 0 + }) + for i := 0; i < len(instructions); i++ { + strictlyLessThan := st.Query(0, numsMap[instructions[i]]-1) + strictlyGreaterThan := st.Query(numsMap[instructions[i]]+1, numsArray[len(numsArray)-1]) + res = (res + min(strictlyLessThan, strictlyGreaterThan)) % mod + st.UpdateCount(numsMap[instructions[i]]) + } + return res +} + +func discretization1649(instructions []int) (map[int]int, []int, []int) { + tmpArray, numsArray, numsMap := []int{}, []int{}, map[int]int{} + for i := 0; i < len(instructions); i++ { + numsMap[instructions[i]] = instructions[i] + } + for _, v := range numsMap { + numsArray = append(numsArray, v) + } + sort.Ints(numsArray) + for i, num := range numsArray { + numsMap[num] = i + } + for i := range numsArray { + tmpArray = append(tmpArray, i) + } + return numsMap, numsArray, tmpArray +} + +func min(a int, b int) int { + if a > b { + return b + } + return a +} + +// 解法二 树状数组 Binary Indexed Tree +func createSortedArray1(instructions []int) int { + b := newBIT(make([]int, 100001)) + var res int + cnt := map[int]int{} + for i, n := range instructions { + less := b.get(n - 1) + greater := i - less - cnt[n] + res = (res + min(less, greater)) % (1e9 + 7) + b.update(n, 1) + cnt[n]++ + } + + return res % (1e9 + 7) +} + +func max(x, y int) int { + if x > y { + return x + } + return y +} + +type BIT struct { + data []int +} + +func newBIT(nums []int) *BIT { + data := make([]int, len(nums)+1) + b := &BIT{data} + for i, n := range nums { + b.update(i, n) + } + + return b +} + +func (b *BIT) update(i, num int) { + i++ + for i < len(b.data) { + b.data[i] += num + i += (i & -i) + } +} + +func (b *BIT) get(i int) int { + i++ + var sum int + for i > 0 { + sum += b.data[i] + i -= (i & -i) + } + return sum +} diff --git a/leetcode/1649.Create-Sorted-Array-through-Instructions/1649. Create Sorted Array through Instructions_test.go b/leetcode/1649.Create-Sorted-Array-through-Instructions/1649. Create Sorted Array through Instructions_test.go new file mode 100644 index 00000000..892fe14f --- /dev/null +++ b/leetcode/1649.Create-Sorted-Array-through-Instructions/1649. Create Sorted Array through Instructions_test.go @@ -0,0 +1,52 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1649 struct { + para1649 + ans1649 +} + +// para 是参数 +// one 代表第一个参数 +type para1649 struct { + instructions []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1649 struct { + one int +} + +func Test_Problem1649(t *testing.T) { + + qs := []question1649{ + + { + para1649{[]int{1, 5, 6, 2}}, + ans1649{1}, + }, + + { + para1649{[]int{1, 2, 3, 6, 5, 4}}, + ans1649{3}, + }, + + { + para1649{[]int{1, 3, 3, 3, 2, 4, 2, 1, 2}}, + ans1649{4}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1649------------------------\n") + + for _, q := range qs { + _, p := q.ans1649, q.para1649 + fmt.Printf("【input】:%v 【output】:%v \n", p, createSortedArray(p.instructions)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1649.Create-Sorted-Array-through-Instructions/README.md b/leetcode/1649.Create-Sorted-Array-through-Instructions/README.md new file mode 100644 index 00000000..2f99c307 --- /dev/null +++ b/leetcode/1649.Create-Sorted-Array-through-Instructions/README.md @@ -0,0 +1,189 @@ +# [1649. Create Sorted Array through Instructions](https://leetcode.com/problems/create-sorted-array-through-instructions/) + +## 题目 + +Given an integer array `instructions`, you are asked to create a sorted array from the elements in `instructions`. You start with an empty container `nums`. For each element from **left to right** in `instructions`, insert it into `nums`. The **cost** of each insertion is the **minimum** of the following: + +- The number of elements currently in `nums` that are **strictly less than** `instructions[i]`. +- The number of elements currently in `nums` that are **strictly greater than** `instructions[i]`. + +For example, if inserting element `3` into `nums = [1,2,3,5]`, the **cost** of insertion is `min(2, 1)` (elements `1` and `2` are less than `3`, element `5` is greater than `3`) and `nums` will become `[1,2,3,3,5]`. + +Return *the **total cost** to insert all elements from* `instructions` *into* `nums`. Since the answer may be large, return it **modulo** `10^9 + 7` + +**Example 1:** + +``` +Input: instructions = [1,5,6,2] +Output: 1 +Explanation: Begin with nums = []. +Insert 1 with cost min(0, 0) = 0, now nums = [1]. +Insert 5 with cost min(1, 0) = 0, now nums = [1,5]. +Insert 6 with cost min(2, 0) = 0, now nums = [1,5,6]. +Insert 2 with cost min(1, 2) = 1, now nums = [1,2,5,6]. +The total cost is 0 + 0 + 0 + 1 = 1. +``` + +**Example 2:** + +``` +Input: instructions = [1,2,3,6,5,4] +Output: 3 +Explanation: Begin with nums = []. +Insert 1 with cost min(0, 0) = 0, now nums = [1]. +Insert 2 with cost min(1, 0) = 0, now nums = [1,2]. +Insert 3 with cost min(2, 0) = 0, now nums = [1,2,3]. +Insert 6 with cost min(3, 0) = 0, now nums = [1,2,3,6]. +Insert 5 with cost min(3, 1) = 1, now nums = [1,2,3,5,6]. +Insert 4 with cost min(3, 2) = 2, now nums = [1,2,3,4,5,6]. +The total cost is 0 + 0 + 0 + 0 + 1 + 2 = 3. +``` + +**Example 3:** + +``` +Input: instructions = [1,3,3,3,2,4,2,1,2] +Output: 4 +Explanation: Begin with nums = []. +Insert 1 with cost min(0, 0) = 0, now nums = [1]. +Insert 3 with cost min(1, 0) = 0, now nums = [1,3]. +Insert 3 with cost min(1, 0) = 0, now nums = [1,3,3]. +Insert 3 with cost min(1, 0) = 0, now nums = [1,3,3,3]. +Insert 2 with cost min(1, 3) = 1, now nums = [1,2,3,3,3]. +Insert 4 with cost min(5, 0) = 0, now nums = [1,2,3,3,3,4]. +Insert 2 with cost min(1, 4) = 1, now nums = [1,2,2,3,3,3,4]. +Insert 1 with cost min(0, 6) = 0, now nums = [1,1,2,2,3,3,3,4]. +Insert 2 with cost min(2, 4) = 2, now nums = [1,1,2,2,2,3,3,3,4]. +The total cost is 0 + 0 + 0 + 0 + 1 + 0 + 1 + 0 + 2 = 4. +``` + +**Constraints:** + +- `1 <= instructions.length <= 105` +- `1 <= instructions[i] <= 105` + +## 题目大意 + +给你一个整数数组 instructions ,你需要根据 instructions 中的元素创建一个有序数组。一开始你有一个空的数组 nums ,你需要 从左到右 遍历 instructions 中的元素,将它们依次插入 nums 数组中。每一次插入操作的 代价 是以下两者的 较小值 : + +- nums 中 严格小于 instructions[i] 的数字数目。 +- nums 中 严格大于 instructions[i] 的数字数目。 + +比方说,如果要将 3 插入到 nums = [1,2,3,5] ,那么插入操作的 代价 为 min(2, 1) (元素 1 和 2 小于 3 ,元素 5 大于 3 ),插入后 nums 变成 [1,2,3,3,5] 。请你返回将 instructions 中所有元素依次插入 nums 后的 总最小代价 。由于答案会很大,请将它对 10^9 + 7 取余 后返回。 + +## 解题思路 + +- 给出一个数组,要求将其中的元素从头开始往另外一个空数组中插入,每次插入前,累加代价值 cost = min(**strictly less than**, **strictly greater than**)。最后输出累加值。 +- 这一题虽然是 Hard 题,但是读完题以后就可以判定这是模板题了。可以用线段树和树状数组来解决。这里简单说说线段树的思路吧,先将待插入的数组排序,获得总的区间。每次循环做 4 步:2 次 `query` 分别得到 `strictlyLessThan` 和 `strictlyGreaterThan` ,再比较出两者中的最小值累加,最后一步就是 `update`。 +- 由于题目给的数据比较大,所以建立线段树之前记得要先离散化。这一题核心代码不超过 10 行,其他的都是模板代码。具体实现见代码。 + +## 代码 + +```go +package leetcode + +import ( + "github.com/halfrost/LeetCode-Go/template" + "sort" +) + +// 解法一 线段树 SegmentTree +func createSortedArray(instructions []int) int { + if len(instructions) == 0 { + return 0 + } + st, res, mod := template.SegmentCountTree{}, 0, 1000000007 + numsMap, numsArray, tmpArray := discretization1649(instructions) + // 初始化线段树,节点内的值都赋值为 0,即计数为 0 + st.Init(tmpArray, func(i, j int) int { + return 0 + }) + for i := 0; i < len(instructions); i++ { + strictlyLessThan := st.Query(0, numsMap[instructions[i]]-1) + strictlyGreaterThan := st.Query(numsMap[instructions[i]]+1, numsArray[len(numsArray)-1]) + res = (res + min(strictlyLessThan, strictlyGreaterThan)) % mod + st.UpdateCount(numsMap[instructions[i]]) + } + return res +} + +func discretization1649(instructions []int) (map[int]int, []int, []int) { + tmpArray, numsArray, numsMap := []int{}, []int{}, map[int]int{} + for i := 0; i < len(instructions); i++ { + numsMap[instructions[i]] = instructions[i] + } + for _, v := range numsMap { + numsArray = append(numsArray, v) + } + sort.Ints(numsArray) + for i, num := range numsArray { + numsMap[num] = i + } + for i := range numsArray { + tmpArray = append(tmpArray, i) + } + return numsMap, numsArray, tmpArray +} + +func min(a int, b int) int { + if a > b { + return b + } + return a +} + +// 解法二 树状数组 Binary Indexed Tree +func createSortedArray1(instructions []int) int { + b := newBIT(make([]int, 100001)) + var res int + cnt := map[int]int{} + for i, n := range instructions { + less := b.get(n - 1) + greater := i - less - cnt[n] + res = (res + min(less, greater)) % (1e9 + 7) + b.update(n, 1) + cnt[n]++ + } + + return res % (1e9 + 7) +} + +func max(x, y int) int { + if x > y { + return x + } + return y +} + +type BIT struct { + data []int +} + +func newBIT(nums []int) *BIT { + data := make([]int, len(nums)+1) + b := &BIT{data} + for i, n := range nums { + b.update(i, n) + } + + return b +} + +func (b *BIT) update(i, num int) { + i++ + for i < len(b.data) { + b.data[i] += num + i += (i & -i) + } +} + +func (b *BIT) get(i int) int { + i++ + var sum int + for i > 0 { + sum += b.data[i] + i -= (i & -i) + } + return sum +} +``` \ No newline at end of file diff --git a/leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array_test.go b/leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array_test.go deleted file mode 100644 index 8af6a6fc..00000000 --- a/leetcode/5561.Get-Maximum-in-Generated-Array/5561. Get Maximum in Generated Array_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question5561 struct { - para5561 - ans5561 -} - -// para 是参数 -// one 代表第一个参数 -type para5561 struct { - n int -} - -// ans 是答案 -// one 代表第一个答案 -type ans5561 struct { - one int -} - -func Test_Problem5561(t *testing.T) { - - qs := []question5561{ - - { - para5561{7}, - ans5561{3}, - }, - - { - para5561{2}, - ans5561{1}, - }, - - { - para5561{3}, - ans5561{2}, - }, - - { - para5561{0}, - ans5561{0}, - }, - - { - para5561{1}, - ans5561{1}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 5561------------------------\n") - - for _, q := range qs { - _, p := q.ans5561, q.para5561 - fmt.Printf("【input】:%v 【output】:%v \n", p, getMaximumGenerated(p.n)) - } - fmt.Printf("\n\n\n") -} diff --git a/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique_test.go b/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique_test.go deleted file mode 100644 index 1a3b33d3..00000000 --- a/leetcode/5562.Minimum-Deletions-to-Make-Character-Frequencies-Unique/5562. Minimum Deletions to Make Character Frequencies Unique_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question5562 struct { - para5562 - ans5562 -} - -// para 是参数 -// one 代表第一个参数 -type para5562 struct { - s string -} - -// ans 是答案 -// one 代表第一个答案 -type ans5562 struct { - one int -} - -func Test_Problem5562(t *testing.T) { - - qs := []question5562{ - - { - para5562{"aab"}, - ans5562{0}, - }, - - { - para5562{"aaabbbcc"}, - ans5562{2}, - }, - - { - para5562{"ceabaacb"}, - ans5562{2}, - }, - - { - para5562{""}, - ans5562{0}, - }, - - { - para5562{"abcabc"}, - ans5562{3}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 5562------------------------\n") - - for _, q := range qs { - _, p := q.ans5562, q.para5562 - fmt.Printf("【input】:%v 【output】:%v \n", p, minDeletions(p.s)) - } - fmt.Printf("\n\n\n") -} diff --git a/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls_test.go b/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls_test.go deleted file mode 100644 index 9d48c4b3..00000000 --- a/leetcode/5563.Sell-Diminishing-Valued-Colored-Balls/5563. Sell Diminishing-Valued Colored Balls_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question5563 struct { - para5563 - ans5563 -} - -// para 是参数 -// one 代表第一个参数 -type para5563 struct { - inventory []int - orders int -} - -// ans 是答案 -// one 代表第一个答案 -type ans5563 struct { - one int -} - -func Test_Problem5563(t *testing.T) { - - qs := []question5563{ - - { - para5563{[]int{2, 5}, 4}, - ans5563{14}, - }, - - { - para5563{[]int{3, 5}, 6}, - ans5563{19}, - }, - - { - para5563{[]int{2, 8, 4, 10, 6}, 20}, - ans5563{110}, - }, - - { - para5563{[]int{1000000000}, 1000000000}, - ans5563{21}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 5563------------------------\n") - - for _, q := range qs { - _, p := q.ans5563, q.para5563 - fmt.Printf("【input】:%v 【output】:%v \n", p, maxProfit(p.inventory, p.orders)) - } - fmt.Printf("\n\n\n") -} diff --git a/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md b/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md new file mode 100644 index 00000000..a703bba7 --- /dev/null +++ b/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md @@ -0,0 +1,96 @@ +# [1646. Get Maximum in Generated Array](https://leetcode.com/problems/get-maximum-in-generated-array/) + + +## 题目 + +You are given an integer `n`. An array `nums` of length `n + 1` is generated in the following way: + +- `nums[0] = 0` +- `nums[1] = 1` +- `nums[2 * i] = nums[i]` when `2 <= 2 * i <= n` +- `nums[2 * i + 1] = nums[i] + nums[i + 1]` when `2 <= 2 * i + 1 <= n` + +Return *****the **maximum** integer in the array* `nums`. + +**Example 1:** + +``` +Input: n = 7 +Output: 3 +Explanation: According to the given rules: + nums[0] = 0 + nums[1] = 1 + nums[(1 * 2) = 2] = nums[1] = 1 + nums[(1 * 2) + 1 = 3] = nums[1] + nums[2] = 1 + 1 = 2 + nums[(2 * 2) = 4] = nums[2] = 1 + nums[(2 * 2) + 1 = 5] = nums[2] + nums[3] = 1 + 2 = 3 + nums[(3 * 2) = 6] = nums[3] = 2 + nums[(3 * 2) + 1 = 7] = nums[3] + nums[4] = 2 + 1 = 3 +Hence, nums = [0,1,1,2,1,3,2,3], and the maximum is 3. + +``` + +**Example 2:** + +``` +Input: n = 2 +Output: 1 +Explanation: According to the given rules, the maximum between nums[0], nums[1], and nums[2] is 1. + +``` + +**Example 3:** + +``` +Input: n = 3 +Output: 2 +Explanation: According to the given rules, the maximum between nums[0], nums[1], nums[2], and nums[3] is 2. + +``` + +**Constraints:** + +- `0 <= n <= 100` + +## 题目大意 + +给你一个整数 n 。按下述规则生成一个长度为 n + 1 的数组 nums : + +- nums[0] = 0 +- nums[1] = 1 +- 当 2 <= 2 * i <= n 时,nums[2 * i] = nums[i] +- 当 2 <= 2 * i + 1 <= n 时,nums[2 * i + 1] = nums[i] + nums[i + 1] + +返回生成数组 nums 中的 最大值。 + +## 解题思路 + +- 给出一个 n + 1 的数组,并按照生成规则生成这个数组,求出这个数组中的最大值。 +- 简单题,按照题意生成数组,边生成边记录和更新最大值即可。 +- 注意边界条件,当 n 为 0 的时候,数组里面只有一个元素 0 。 + +## 代码 + +```go +package leetcode + +func getMaximumGenerated(n int) int { + if n == 0 { + return 0 + } + nums, max := make([]int, n+1), 0 + nums[0], nums[1] = 0, 1 + for i := 0; i <= n; i++ { + if nums[i] > max { + max = nums[i] + } + if 2*i >= 2 && 2*i <= n { + nums[2*i] = nums[i] + } + if 2*i+1 >= 2 && 2*i+1 <= n { + nums[2*i+1] = nums[i] + nums[i+1] + } + } + return max +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md b/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md new file mode 100644 index 00000000..e6b2fff8 --- /dev/null +++ b/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md @@ -0,0 +1,89 @@ +# [1647. Minimum Deletions to Make Character Frequencies Unique](https://leetcode.com/problems/minimum-deletions-to-make-character-frequencies-unique/) + + +## 题目 + +A string `s` is called **good** if there are no two different characters in `s` that have the same **frequency**. + +Given a string `s`, return *the **minimum** number of characters you need to delete to make* `s` ***good**.* + +The **frequency** of a character in a string is the number of times it appears in the string. For example, in the string `"aab"`, the **frequency** of `'a'` is `2`, while the **frequency** of `'b'` is `1`. + +**Example 1:** + +``` +Input: s = "aab" +Output: 0 +Explanation: s is already good. + +``` + +**Example 2:** + +``` +Input: s = "aaabbbcc" +Output: 2 +Explanation: You can delete two 'b's resulting in the good string "aaabcc". +Another way it to delete one 'b' and one 'c' resulting in the good string "aaabbc". +``` + +**Example 3:** + +``` +Input: s = "ceabaacb" +Output: 2 +Explanation: You can delete both 'c's resulting in the good string "eabaab". +Note that we only care about characters that are still in the string at the end (i.e. frequency of 0 is ignored). + +``` + +**Constraints:** + +- `1 <= s.length <= 105` +- `s` contains only lowercase English letters. + +## 题目大意 + +如果字符串 s 中 不存在 两个不同字符 频次 相同的情况,就称 s 是 优质字符串 。 + +给你一个字符串 s,返回使 s 成为优质字符串需要删除的最小字符数。 + +字符串中字符的 频次 是该字符在字符串中的出现次数。例如,在字符串 "aab" 中,'a' 的频次是 2,而 'b' 的频次是 1 。 + +**提示:** + +- `1 <= s.length <= 105` +- `s` 仅含小写英文字母 + +## 解题思路 + +- 给出一个字符串 s,要求输出使 s 变成“优质字符串”需要删除的最小字符数。“优质字符串”的定义是:字符串 s 中不存在频次相同的两个不同字符。 +- 首先将 26 个字母在字符串中的频次分别统计出来,然后把频次从大到小排列,从频次大的开始,依次调整:例如,假设前一个和后一个频次相等,就把前一个字符删除一个,频次减一,再次排序,如果频次还相等,继续调整,如果频次不同了,游标往后移,继续调整后面的频次。直到所有的频次都不同了,就可以输出最终结果了。 +- 这里需要注意频次为 0 的情况,即字母都被删光了。频次为 0 以后,就不需要再比较了。 + +## 代码 + +```go +package leetcode + +import ( + "sort" +) + +func minDeletions(s string) int { + frequency, res := make([]int, 26), 0 + for i := 0; i < len(s); i++ { + frequency[s[i]-'a']++ + } + sort.Sort(sort.Reverse(sort.IntSlice(frequency))) + for i := 1; i <= 25; i++ { + if frequency[i] == frequency[i-1] && frequency[i] != 0 { + res++ + frequency[i]-- + sort.Sort(sort.Reverse(sort.IntSlice(frequency))) + i-- + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md b/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md new file mode 100644 index 00000000..bddd91b3 --- /dev/null +++ b/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md @@ -0,0 +1,131 @@ +# [1648. Sell Diminishing-Valued Colored Balls](https://leetcode.com/problems/sell-diminishing-valued-colored-balls/) + + +## 题目 + +You have an `inventory` of different colored balls, and there is a customer that wants `orders` balls of **any** color. + +The customer weirdly values the colored balls. Each colored ball's value is the number of balls **of that color** you currently have in your `inventory`. For example, if you own `6` yellow balls, the customer would pay `6` for the first yellow ball. After the transaction, there are only `5` yellow balls left, so the next yellow ball is then valued at `5` (i.e., the value of the balls decreases as you sell more to the customer). + +You are given an integer array, `inventory`, where `inventory[i]` represents the number of balls of the `ith` color that you initially own. You are also given an integer `orders`, which represents the total number of balls that the customer wants. You can sell the balls **in any order**. + +Return *the **maximum** total value that you can attain after selling* `orders` *colored balls*. As the answer may be too large, return it **modulo** `109 + 7`. + +**Example 1:** + +![https://assets.leetcode.com/uploads/2020/11/05/jj.gif](https://assets.leetcode.com/uploads/2020/11/05/jj.gif) + +``` +Input: inventory = [2,5], orders = 4 +Output: 14 +Explanation: Sell the 1st color 1 time (2) and the 2nd color 3 times (5 + 4 + 3). +The maximum total value is 2 + 5 + 4 + 3 = 14. + +``` + +**Example 2:** + +``` +Input: inventory = [3,5], orders = 6 +Output: 19 +Explanation: Sell the 1st color 2 times (3 + 2) and the 2nd color 4 times (5 + 4 + 3 + 2). +The maximum total value is 3 + 2 + 5 + 4 + 3 + 2 = 19. +``` + +**Example 3:** + +``` +Input: inventory = [2,8,4,10,6], orders = 20 +Output: 110 +``` + +**Example 4:** + +``` +Input: inventory = [1000000000], orders = 1000000000 +Output: 21 +Explanation: Sell the 1st color 1000000000 times for a total value of 500000000500000000. 500000000500000000 modulo 109 + 7 = 21. +``` + +**Constraints:** + +- `1 <= inventory.length <= 10^5` +- `1 <= inventory[i] <= 10^9` +- `1 <= orders <= min(sum(inventory[i]), 10^9)` + +## 题目大意 + +你有一些球的库存 inventory ,里面包含着不同颜色的球。一个顾客想要 任意颜色 总数为 orders 的球。这位顾客有一种特殊的方式衡量球的价值:每个球的价值是目前剩下的 同色球 的数目。比方说还剩下 6 个黄球,那么顾客买第一个黄球的时候该黄球的价值为 6 。这笔交易以后,只剩下 5 个黄球了,所以下一个黄球的价值为 5 (也就是球的价值随着顾客购买同色球是递减的) + +给你整数数组 inventory ,其中 inventory[i] 表示第 i 种颜色球一开始的数目。同时给你整数 orders ,表示顾客总共想买的球数目。你可以按照 任意顺序 卖球。请你返回卖了 orders 个球以后 最大 总价值之和。由于答案可能会很大,请你返回答案对 109 + 7 取余数 的结果。 + +提示: + +- 1 <= inventory.length <= 10^5 +- 1 <= inventory[i] <= 10^9 +- 1 <= orders <= min(sum(inventory[i]), 10^9) + +## 解题思路 + +- 给出一个 `inventory` 数组和 `orders` 次操作,要求输出数组中前 `orders` 大个元素累加和。需要注意的是,每累加一个元素 `inventory[i]`,这个元素都会减一,下次再累加的时候,需要选取更新以后的数组的最大值。 +- 拿到这个题目以后很容易想到优先队列,建立大根堆以后,`pop` 出当前最大值 `maxItem`,累加,以后把 `maxItem` 减一再 `push` 回去。循环执行 `orders` 次以后即是最终结果。题目是这个意思,但是我们不能这么写代码,因为题目条件里面给出了 `orders` 的数据大小。orders 最大为 10^9。按照优先队列的这个方法一定会超时,时间复杂度为 O(orders⋅logn)。那就换一个思路。优先队列这个思路中,重复操作了 `orders` 次,其实在这些操作中,有一些是没有必要的废操作。这些大量的“废”操作导致了超时。试想,在 `orders` 次操作中,能否合并 `n` 个 `pop` 操作,一口气先 `pop` 掉 `n` 个前 `n` 大的数呢?这个是可行的,因为每次 `pop` 出去,元素都只会减一,这个是非常有规律的。 +- 为了接下来的描述更加清晰易懂,还需要再定义 1 个值, `thresholdValue` 为操作 `n` 次以后,当前 `inventory` 数组的最大值。关于 `thresholdValue` 的理解,这里要说明一下。 `thresholdValue` 的来源有 2 种,一种是本来数组里面就有这个值,还有一种来源是 `inventory[i]` 元素减少到了 `thresholdValue` 这个值。举个例子:原始数组是 [2,3,3,4,5],`orders` = 4,取 4 次以后,剩下的数组是 [2,2,3,3,3]。3 个 3 里面其中一个 3 就来自于 `4-1=3`,或者 `5-2=3`。 +- 用二分搜索在 [0,max(`inventory`)] 区间内找到这个 `thresholdValue` 值,能满足下列不等式的最小 `thresholdValue` 值: + + $$\sum_{inventory[i]\geqslant thresholdValue}^{} \left ( inventory[i] - thresholdValue \right )\leqslant orders$$ + + `thresholdValue` 越小,不等式左边的值越大,随着 `thresholdValue` 的增大,不等式左边的值越来越小,直到刚刚能小于等于 `orders`。求出了 `thresholdValue` 值以后,还需要再判断有多少值等于 `thresholdValue - 1` 值了。 + + ![https://img.halfrost.com/Leetcode/leetcode_1648.png](https://img.halfrost.com/Leetcode/leetcode_1648.png) + +- 还是举上面的例子,原始数组是 [2,3,3,4,5],`orders` = 4,我们可以求得 `thresholdValue` = 3 。`inventory[i]` > `thresholdValue` 的那部分 100% 的要取走,`thresholdValue` 就像一个水平面,突出水平面的那些都要拿走,每列的值按照等差数列求和公式计算即可。但是 `orders` - `thresholdValue` = 1,说明水平面以下还要拿走一个,即 `thresholdValue` 线下的虚线框里面的那 4 个球,还需要任意取走一个。最后总的结果是这 2 部分的总和,( ( 5 + 4 ) + 4 ) + 3 = 16 。 + +## 代码 + +```go +package leetcode + +import ( + "container/heap" +) + +// 解法一 贪心 + 二分搜索 +func maxProfit(inventory []int, orders int) int { + maxItem, thresholdValue, count, res, mod := 0, -1, 0, 0, 1000000007 + for i := 0; i < len(inventory); i++ { + if inventory[i] > maxItem { + maxItem = inventory[i] + } + } + low, high := 0, maxItem + for low <= high { + mid := low + ((high - low) >> 1) + for i := 0; i < len(inventory); i++ { + count += max(inventory[i]-mid, 0) + } + if count <= orders { + thresholdValue = mid + high = mid - 1 + } else { + low = mid + 1 + } + count = 0 + } + count = 0 + for i := 0; i < len(inventory); i++ { + count += max(inventory[i]-thresholdValue, 0) + } + count = orders - count + for i := 0; i < len(inventory); i++ { + if inventory[i] >= thresholdValue { + if count > 0 { + res += (thresholdValue + inventory[i]) * (inventory[i] - thresholdValue + 1) / 2 + count-- + } else { + res += (thresholdValue + 1 + inventory[i]) * (inventory[i] - thresholdValue) / 2 + } + } + } + return res % mod +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md b/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md new file mode 100644 index 00000000..2f99c307 --- /dev/null +++ b/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md @@ -0,0 +1,189 @@ +# [1649. Create Sorted Array through Instructions](https://leetcode.com/problems/create-sorted-array-through-instructions/) + +## 题目 + +Given an integer array `instructions`, you are asked to create a sorted array from the elements in `instructions`. You start with an empty container `nums`. For each element from **left to right** in `instructions`, insert it into `nums`. The **cost** of each insertion is the **minimum** of the following: + +- The number of elements currently in `nums` that are **strictly less than** `instructions[i]`. +- The number of elements currently in `nums` that are **strictly greater than** `instructions[i]`. + +For example, if inserting element `3` into `nums = [1,2,3,5]`, the **cost** of insertion is `min(2, 1)` (elements `1` and `2` are less than `3`, element `5` is greater than `3`) and `nums` will become `[1,2,3,3,5]`. + +Return *the **total cost** to insert all elements from* `instructions` *into* `nums`. Since the answer may be large, return it **modulo** `10^9 + 7` + +**Example 1:** + +``` +Input: instructions = [1,5,6,2] +Output: 1 +Explanation: Begin with nums = []. +Insert 1 with cost min(0, 0) = 0, now nums = [1]. +Insert 5 with cost min(1, 0) = 0, now nums = [1,5]. +Insert 6 with cost min(2, 0) = 0, now nums = [1,5,6]. +Insert 2 with cost min(1, 2) = 1, now nums = [1,2,5,6]. +The total cost is 0 + 0 + 0 + 1 = 1. +``` + +**Example 2:** + +``` +Input: instructions = [1,2,3,6,5,4] +Output: 3 +Explanation: Begin with nums = []. +Insert 1 with cost min(0, 0) = 0, now nums = [1]. +Insert 2 with cost min(1, 0) = 0, now nums = [1,2]. +Insert 3 with cost min(2, 0) = 0, now nums = [1,2,3]. +Insert 6 with cost min(3, 0) = 0, now nums = [1,2,3,6]. +Insert 5 with cost min(3, 1) = 1, now nums = [1,2,3,5,6]. +Insert 4 with cost min(3, 2) = 2, now nums = [1,2,3,4,5,6]. +The total cost is 0 + 0 + 0 + 0 + 1 + 2 = 3. +``` + +**Example 3:** + +``` +Input: instructions = [1,3,3,3,2,4,2,1,2] +Output: 4 +Explanation: Begin with nums = []. +Insert 1 with cost min(0, 0) = 0, now nums = [1]. +Insert 3 with cost min(1, 0) = 0, now nums = [1,3]. +Insert 3 with cost min(1, 0) = 0, now nums = [1,3,3]. +Insert 3 with cost min(1, 0) = 0, now nums = [1,3,3,3]. +Insert 2 with cost min(1, 3) = 1, now nums = [1,2,3,3,3]. +Insert 4 with cost min(5, 0) = 0, now nums = [1,2,3,3,3,4]. +Insert 2 with cost min(1, 4) = 1, now nums = [1,2,2,3,3,3,4]. +Insert 1 with cost min(0, 6) = 0, now nums = [1,1,2,2,3,3,3,4]. +Insert 2 with cost min(2, 4) = 2, now nums = [1,1,2,2,2,3,3,3,4]. +The total cost is 0 + 0 + 0 + 0 + 1 + 0 + 1 + 0 + 2 = 4. +``` + +**Constraints:** + +- `1 <= instructions.length <= 105` +- `1 <= instructions[i] <= 105` + +## 题目大意 + +给你一个整数数组 instructions ,你需要根据 instructions 中的元素创建一个有序数组。一开始你有一个空的数组 nums ,你需要 从左到右 遍历 instructions 中的元素,将它们依次插入 nums 数组中。每一次插入操作的 代价 是以下两者的 较小值 : + +- nums 中 严格小于 instructions[i] 的数字数目。 +- nums 中 严格大于 instructions[i] 的数字数目。 + +比方说,如果要将 3 插入到 nums = [1,2,3,5] ,那么插入操作的 代价 为 min(2, 1) (元素 1 和 2 小于 3 ,元素 5 大于 3 ),插入后 nums 变成 [1,2,3,3,5] 。请你返回将 instructions 中所有元素依次插入 nums 后的 总最小代价 。由于答案会很大,请将它对 10^9 + 7 取余 后返回。 + +## 解题思路 + +- 给出一个数组,要求将其中的元素从头开始往另外一个空数组中插入,每次插入前,累加代价值 cost = min(**strictly less than**, **strictly greater than**)。最后输出累加值。 +- 这一题虽然是 Hard 题,但是读完题以后就可以判定这是模板题了。可以用线段树和树状数组来解决。这里简单说说线段树的思路吧,先将待插入的数组排序,获得总的区间。每次循环做 4 步:2 次 `query` 分别得到 `strictlyLessThan` 和 `strictlyGreaterThan` ,再比较出两者中的最小值累加,最后一步就是 `update`。 +- 由于题目给的数据比较大,所以建立线段树之前记得要先离散化。这一题核心代码不超过 10 行,其他的都是模板代码。具体实现见代码。 + +## 代码 + +```go +package leetcode + +import ( + "github.com/halfrost/LeetCode-Go/template" + "sort" +) + +// 解法一 线段树 SegmentTree +func createSortedArray(instructions []int) int { + if len(instructions) == 0 { + return 0 + } + st, res, mod := template.SegmentCountTree{}, 0, 1000000007 + numsMap, numsArray, tmpArray := discretization1649(instructions) + // 初始化线段树,节点内的值都赋值为 0,即计数为 0 + st.Init(tmpArray, func(i, j int) int { + return 0 + }) + for i := 0; i < len(instructions); i++ { + strictlyLessThan := st.Query(0, numsMap[instructions[i]]-1) + strictlyGreaterThan := st.Query(numsMap[instructions[i]]+1, numsArray[len(numsArray)-1]) + res = (res + min(strictlyLessThan, strictlyGreaterThan)) % mod + st.UpdateCount(numsMap[instructions[i]]) + } + return res +} + +func discretization1649(instructions []int) (map[int]int, []int, []int) { + tmpArray, numsArray, numsMap := []int{}, []int{}, map[int]int{} + for i := 0; i < len(instructions); i++ { + numsMap[instructions[i]] = instructions[i] + } + for _, v := range numsMap { + numsArray = append(numsArray, v) + } + sort.Ints(numsArray) + for i, num := range numsArray { + numsMap[num] = i + } + for i := range numsArray { + tmpArray = append(tmpArray, i) + } + return numsMap, numsArray, tmpArray +} + +func min(a int, b int) int { + if a > b { + return b + } + return a +} + +// 解法二 树状数组 Binary Indexed Tree +func createSortedArray1(instructions []int) int { + b := newBIT(make([]int, 100001)) + var res int + cnt := map[int]int{} + for i, n := range instructions { + less := b.get(n - 1) + greater := i - less - cnt[n] + res = (res + min(less, greater)) % (1e9 + 7) + b.update(n, 1) + cnt[n]++ + } + + return res % (1e9 + 7) +} + +func max(x, y int) int { + if x > y { + return x + } + return y +} + +type BIT struct { + data []int +} + +func newBIT(nums []int) *BIT { + data := make([]int, len(nums)+1) + b := &BIT{data} + for i, n := range nums { + b.update(i, n) + } + + return b +} + +func (b *BIT) update(i, num int) { + i++ + for i < len(b.data) { + b.data[i] += num + i += (i & -i) + } +} + +func (b *BIT) get(i int) int { + i++ + var sum int + for i > 0 { + sum += b.data[i] + i -= (i & -i) + } + return sum +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index abd00fce..119f9b1c 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -548,4 +548,8 @@ headless: true - [1470.Shuffle-the-Array]({{< relref "/ChapterFour/1470.Shuffle-the-Array.md" >}}) - [1480.Running-Sum-of-1d-Array]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}}) - [1512.Number-of-Good-Pairs]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}}) + - [1646.Get-Maximum-in-Generated-Array]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}}) + - [1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}}) + - [1648.Sell-Diminishing-Valued-Colored-Balls]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}}) + - [1649.Create-Sorted-Array-through-Instructions]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})
From 840126495282aa50fc017093e7a334dc2c0e1260 Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 13 Nov 2020 16:54:22 +0800 Subject: [PATCH 25/82] Update EN Desc --- website/content/ChapterOne/Data_Structure.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/website/content/ChapterOne/Data_Structure.md b/website/content/ChapterOne/Data_Structure.md index f4aec542..f1d405f7 100644 --- a/website/content/ChapterOne/Data_Structure.md +++ b/website/content/ChapterOne/Data_Structure.md @@ -11,14 +11,14 @@ type: docs | 数据结构 | 变种 | 相关题目 | 讲解文章 | |:-------:|:-------|:------|:------| -|顺序线性表:向量|||| -|单链表|1. 双向链表
2. 静态链表
3. 对称矩阵
4. 稀疏矩阵||| -|哈希表|1. 散列函数
2. 解决碰撞/填充因子
||| -|栈和队列|1. 广义栈
2. 双端队列
||| -|队列|1. 链表实现
2. 循环数组实现
3. 双端队列||| -|字符串|1. KMP算法
2. 有限状态自动机
3. 模式匹配有限状态自动机
4. BM 模式匹配算法
5. BM-KMP 算法
6. BF 算法||| -|树|1. 二叉树
2. 并查集
3. Huffman 树||| -|数组实现的堆|1. 极大堆和极小堆
2. 极大极小堆
3. 双端堆
4. d 叉堆||| -|树实现的堆|1. 左堆
2. 扁堆
3. 二项式堆
4. 斐波那契堆
5. 配对堆||| -|查找|1. 哈希表
2. 跳跃表
3. 排序二叉树
4. AVL 树
5. B 树 / B+ 树 / B* 树
6. AA 树
7. 红黑树
8. 排序二叉堆
9. Splay 树
10. 双链树
11. Trie 树
12. R 树||| +|顺序线性表:向量
Vector|||| +|单链表
Singly Linked List|1. 双向链表 Double Linked Lists
2. 静态链表 Static List
3. 对称矩阵 Symmetric Matrix
4. 稀疏矩阵 Sparse Matrix||| +|哈希表
Hash Table|1. 散列函数 Hash Function
2. 解决碰撞/填充因子
||| +|栈和队列
Stack & Queue|1. 广义栈
2. 双端队列 Deque
||| +|队列
Queue|1. 链表实现
2. 循环数组实现
3. 双端队列 Deque||| +|字符串
String|1. KMP 算法
2. 有限状态自动机
3. 模式匹配有限状态自动机
4. BM 模式匹配算法
5. BM-KMP 算法
6. BF 算法||| +|树
Tree|1. 二叉树 Binary Tree
2. 并查集 Union-Find
3. Huffman 树||| +|数组实现的堆
Heap|1. 极大堆和极小堆
2. 极大极小堆
3. 双端堆 Deap
4. d 叉堆||| +|树实现的堆
Heap|1. 左堆
2. 扁堆
3. 二项式堆
4. 斐波那契堆 Fibonacco Heap
5. 配对堆 Pairing Heap||| +|查找
Find|1. 哈希表 Hash
2. 跳跃表 Skip List
3. 排序二叉树 Binary Sort Tree
4. AVL 树
5. B 树 / B+ 树 / B* 树
6. AA 树
7. 红黑树 Red Black Tree
8. 排序二叉堆 Binary Heap
9. Splay 树
10. 双链树 Double Chained Tree
11. Trie 树
12. R 树||| |--------------------------------------------|--------------------------------------------------------------------------------------------|---------------------------|-----------------------------------| \ No newline at end of file From 595d4cd678f7d4cb39b3010ab8abf395ee23d667 Mon Sep 17 00:00:00 2001 From: zbq2019 <49929998+zbq2019@users.noreply.github.com> Date: Fri, 13 Nov 2020 23:02:29 +0800 Subject: [PATCH 26/82] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正区间范围 --- leetcode/0633.Sum-of-Square-Numbers/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leetcode/0633.Sum-of-Square-Numbers/README.md b/leetcode/0633.Sum-of-Square-Numbers/README.md index 7bad9940..de0a6e54 100755 --- a/leetcode/0633.Sum-of-Square-Numbers/README.md +++ b/leetcode/0633.Sum-of-Square-Numbers/README.md @@ -25,4 +25,4 @@ Given a non-negative integer `c`, your task is to decide whether there're two i ## 解题思路 - 给出一个数,要求判断这个数能否由由 2 个完全平方数组成。能则输出 true,不能则输出 false。 -- 可以用二分搜索来解答这道题。判断题意,依次计算 `low * low + high * high` 和 c 是否相等。从 [1, sqrt(n)] 区间内进行二分,若能找到则返回 true,找不到就返回 false 。 +- 可以用二分搜索来解答这道题。判断题意,依次计算 `low * low + high * high` 和 c 是否相等。从 [0, sqrt(n)] 区间内进行二分,若能找到则返回 true,找不到就返回 false 。 From dd72560ce25ab853ec11d1e01cb1dcad4e2e9a63 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sat, 14 Nov 2020 15:24:22 +0800 Subject: [PATCH 27/82] Fix head link --- website/themes/book/layouts/partials/docs/inject/head.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/themes/book/layouts/partials/docs/inject/head.html b/website/themes/book/layouts/partials/docs/inject/head.html index edca74ec..83617b7f 100644 --- a/website/themes/book/layouts/partials/docs/inject/head.html +++ b/website/themes/book/layouts/partials/docs/inject/head.html @@ -1,9 +1,11 @@ - + + + + +{{- $swJS := resources.Get "serviceworker-v1.js" | resources.Minify | resources.Fingerprint }} + {{ end -}} diff --git a/website/themes/book/static/js/sw-toolbox.js b/website/themes/book/static/js/sw-toolbox.js new file mode 100644 index 00000000..dacb8553 --- /dev/null +++ b/website/themes/book/static/js/sw-toolbox.js @@ -0,0 +1,16 @@ +/* + Copyright 2016 Google Inc. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.toolbox=e()}}(function(){return function e(t,n,r){function o(c,s){if(!n[c]){if(!t[c]){var a="function"==typeof require&&require;if(!s&&a)return a(c,!0);if(i)return i(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[c]={exports:{}};t[c][0].call(f.exports,function(e){var n=t[c][1][e];return o(n||e)},f,f.exports,e,t,n,r)}return n[c].exports}for(var i="function"==typeof require&&require,c=0;ct.value[l]){var r=t.value[p];c.push(r),a.delete(r),t.continue()}},s.oncomplete=function(){r(c)},s.onabort=o}):Promise.resolve([])}function s(e,t){return t?new Promise(function(n,r){var o=[],i=e.transaction(h,"readwrite"),c=i.objectStore(h),s=c.index(l),a=s.count();s.count().onsuccess=function(){var e=a.result;e>t&&(s.openCursor().onsuccess=function(n){var r=n.target.result;if(r){var i=r.value[p];o.push(i),c.delete(i),e-o.length>t&&r.continue()}})},i.oncomplete=function(){n(o)},i.onabort=r}):Promise.resolve([])}function a(e,t,n,r){return c(e,n,r).then(function(n){return s(e,t).then(function(e){return n.concat(e)})})}var u="sw-toolbox-",f=1,h="store",p="url",l="timestamp",d={};t.exports={getDb:o,setTimestampForUrl:i,expireEntries:a}},{}],3:[function(e,t,n){"use strict";function r(e){var t=a.match(e.request);t?e.respondWith(t(e.request)):a.default&&"GET"===e.request.method&&0===e.request.url.indexOf("http")&&e.respondWith(a.default(e.request))}function o(e){s.debug("activate event fired");var t=u.cache.name+"$$$inactive$$$";e.waitUntil(s.renameCache(t,u.cache.name))}function i(e){return e.reduce(function(e,t){return e.concat(t)},[])}function c(e){var t=u.cache.name+"$$$inactive$$$";s.debug("install event fired"),s.debug("creating cache ["+t+"]"),e.waitUntil(s.openCache({cache:{name:t}}).then(function(e){return Promise.all(u.preCacheItems).then(i).then(s.validatePrecacheInput).then(function(t){return s.debug("preCache list: "+(t.join(", ")||"(none)")),e.addAll(t)})}))}e("serviceworker-cache-polyfill");var s=e("./helpers"),a=e("./router"),u=e("./options");t.exports={fetchListener:r,activateListener:o,installListener:c}},{"./helpers":1,"./options":4,"./router":6,"serviceworker-cache-polyfill":16}],4:[function(e,t,n){"use strict";var r;r=self.registration?self.registration.scope:self.scope||new URL("./",self.location).href,t.exports={cache:{name:"$$$toolbox-cache$$$"+r+"$$$",maxAgeSeconds:null,maxEntries:null,queryOptions:null},debug:!1,networkTimeoutSeconds:null,preCacheItems:[],successResponses:/^0|([123]\d\d)|(40[14567])|410$/}},{}],5:[function(e,t,n){"use strict";var r=new URL("./",self.location),o=r.pathname,i=e("path-to-regexp"),c=function(e,t,n,r){t instanceof RegExp?this.fullUrlRegExp=t:(0!==t.indexOf("/")&&(t=o+t),this.keys=[],this.regexp=i(t,this.keys)),this.method=e,this.options=r,this.handler=n};c.prototype.makeHandler=function(e){var t;if(this.regexp){var n=this.regexp.exec(e);t={},this.keys.forEach(function(e,r){t[e.name]=n[r+1]})}return function(e){return this.handler(e,t,this.options)}.bind(this)},t.exports=c},{"path-to-regexp":15}],6:[function(e,t,n){"use strict";function r(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var o=e("./route"),i=e("./helpers"),c=function(e,t){for(var n=e.entries(),r=n.next(),o=[];!r.done;){new RegExp(r.value[0]).test(t)&&o.push(r.value[1]),r=n.next()}return o},s=function(){this.routes=new Map,this.routes.set(RegExp,new Map),this.default=null};["get","post","put","delete","head","any"].forEach(function(e){s.prototype[e]=function(t,n,r){return this.add(e,t,n,r)}}),s.prototype.add=function(e,t,n,c){c=c||{};var s;t instanceof RegExp?s=RegExp:(s=c.origin||self.location.origin,s=s instanceof RegExp?s.source:r(s)),e=e.toLowerCase();var a=new o(e,t,n,c);this.routes.has(s)||this.routes.set(s,new Map);var u=this.routes.get(s);u.has(e)||u.set(e,new Map);var f=u.get(e),h=a.regexp||a.fullUrlRegExp;f.has(h.source)&&i.debug('"'+t+'" resolves to same regex as existing route.'),f.set(h.source,a)},s.prototype.matchMethod=function(e,t){var n=new URL(t),r=n.origin,o=n.pathname;return this._match(e,c(this.routes,r),o)||this._match(e,[this.routes.get(RegExp)],t)},s.prototype._match=function(e,t,n){if(0===t.length)return null;for(var r=0;r0)return s[0].makeHandler(n)}}return null},s.prototype.match=function(e){return this.matchMethod(e.method,e.url)||this.matchMethod("any",e.url)},t.exports=new s},{"./helpers":1,"./route":5}],7:[function(e,t,n){"use strict";function r(e,t,n){n=n||{};var r=n.cache||o.cache,c=r.queryOptions;return i.debug("Strategy: cache first ["+e.url+"]",n),i.openCache(n).then(function(t){return t.match(e,c).then(function(t){var o=Date.now();return i.isResponseFresh(t,r.maxAgeSeconds,o)?t:i.fetchAndCache(e,n)})})}var o=e("../options"),i=e("../helpers");t.exports=r},{"../helpers":1,"../options":4}],8:[function(e,t,n){"use strict";function r(e,t,n){n=n||{};var r=n.cache||o.cache,c=r.queryOptions;return i.debug("Strategy: cache only ["+e.url+"]",n),i.openCache(n).then(function(t){return t.match(e,c).then(function(e){var t=Date.now();if(i.isResponseFresh(e,r.maxAgeSeconds,t))return e})})}var o=e("../options"),i=e("../helpers");t.exports=r},{"../helpers":1,"../options":4}],9:[function(e,t,n){"use strict";function r(e,t,n){return o.debug("Strategy: fastest ["+e.url+"]",n),new Promise(function(r,c){var s=!1,a=[],u=function(e){a.push(e.toString()),s?c(new Error('Both cache and network failed: "'+a.join('", "')+'"')):s=!0},f=function(e){e instanceof Response?r(e):u("No result returned")};o.fetchAndCache(e.clone(),n).then(f,u),i(e,t,n).then(f,u)})}var o=e("../helpers"),i=e("./cacheOnly");t.exports=r},{"../helpers":1,"./cacheOnly":8}],10:[function(e,t,n){t.exports={networkOnly:e("./networkOnly"),networkFirst:e("./networkFirst"),cacheOnly:e("./cacheOnly"),cacheFirst:e("./cacheFirst"),fastest:e("./fastest")}},{"./cacheFirst":7,"./cacheOnly":8,"./fastest":9,"./networkFirst":11,"./networkOnly":12}],11:[function(e,t,n){"use strict";function r(e,t,n){n=n||{};var r=n.cache||o.cache,c=r.queryOptions,s=n.successResponses||o.successResponses,a=n.networkTimeoutSeconds||o.networkTimeoutSeconds;return i.debug("Strategy: network first ["+e.url+"]",n),i.openCache(n).then(function(t){var o,u,f=[];if(a){var h=new Promise(function(n){o=setTimeout(function(){t.match(e,c).then(function(e){var t=Date.now(),o=r.maxAgeSeconds;i.isResponseFresh(e,o,t)&&n(e)})},1e3*a)});f.push(h)}var p=i.fetchAndCache(e,n).then(function(e){if(o&&clearTimeout(o),s.test(e.status))return e;throw i.debug("Response was an HTTP error: "+e.statusText,n),u=e,new Error("Bad response")}).catch(function(r){return i.debug("Network or response error, fallback to cache ["+e.url+"]",n),t.match(e,c).then(function(e){if(e)return e;if(u)return u;throw r})});return f.push(p),Promise.race(f)})}var o=e("../options"),i=e("../helpers");t.exports=r},{"../helpers":1,"../options":4}],12:[function(e,t,n){"use strict";function r(e,t,n){return o.debug("Strategy: network only ["+e.url+"]",n),fetch(e)}var o=e("../helpers");t.exports=r},{"../helpers":1}],13:[function(e,t,n){"use strict";var r=e("./options"),o=e("./router"),i=e("./helpers"),c=e("./strategies"),s=e("./listeners");i.debug("Service Worker Toolbox is loading"),self.addEventListener("install",s.installListener),self.addEventListener("activate",s.activateListener),self.addEventListener("fetch",s.fetchListener),t.exports={networkOnly:c.networkOnly,networkFirst:c.networkFirst,cacheOnly:c.cacheOnly,cacheFirst:c.cacheFirst,fastest:c.fastest,router:o,options:r,cache:i.cache,uncache:i.uncache,precache:i.precache}},{"./helpers":1,"./listeners":3,"./options":4,"./router":6,"./strategies":10}],14:[function(e,t,n){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],15:[function(e,t,n){function r(e,t){for(var n,r=[],o=0,i=0,c="",s=t&&t.delimiter||"/";null!=(n=x.exec(e));){var f=n[0],h=n[1],p=n.index;if(c+=e.slice(i,p),i=p+f.length,h)c+=h[1];else{var l=e[i],d=n[2],m=n[3],g=n[4],v=n[5],w=n[6],y=n[7];c&&(r.push(c),c="");var b=null!=d&&null!=l&&l!==d,E="+"===w||"*"===w,R="?"===w||"*"===w,k=n[2]||s,$=g||v;r.push({name:m||o++,prefix:d||"",delimiter:k,optional:R,repeat:E,partial:b,asterisk:!!y,pattern:$?u($):y?".*":"[^"+a(k)+"]+?"})}}return i=46||"Chrome"===n&&r>=50)||(Cache.prototype.addAll=function(e){function t(e){this.name="NetworkError",this.code=19,this.message=e}var n=this;return t.prototype=Object.create(Error.prototype),Promise.resolve().then(function(){if(arguments.length<1)throw new TypeError;return e=e.map(function(e){return e instanceof Request?e:String(e)}),Promise.all(e.map(function(e){"string"==typeof e&&(e=new Request(e));var n=new URL(e.url).protocol;if("http:"!==n&&"https:"!==n)throw new t("Invalid scheme");return fetch(e.clone())}))}).then(function(r){if(r.some(function(e){return!e.ok}))throw new t("Incorrect response status");return Promise.all(r.map(function(t,r){return n.put(e[r],t)}))}).then(function(){})},Cache.prototype.add=function(e){return this.addAll([e])})}()},{}]},{},[13])(13)}); +//# sourceMappingURL=sw-toolbox.js.map From 91e1a92cdd7690e6fdb1c0e1ec3ed8c31e606488 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 15 Nov 2020 22:39:49 +0800 Subject: [PATCH 30/82] Add Biweekly 39 / weekly 215 solutions --- leetcode/5550/1652. Defuse the Bomb.go | 56 ++++++++++++ leetcode/5550/1652. Defuse the Bomb_test.go | 53 +++++++++++ ...nimum Deletions to Make String Balanced.go | 49 +++++++++++ ... Deletions to Make String Balanced_test.go | 57 ++++++++++++ .../5601/5601. Design an Ordered Stream.go | 42 +++++++++ .../5601. Design an Ordered Stream_test.go | 21 +++++ ...603. Determine if Two Strings Are Close.go | 88 +++++++++++++++++++ ...Determine if Two Strings Are Close_test.go | 68 ++++++++++++++ 8 files changed, 434 insertions(+) create mode 100644 leetcode/5550/1652. Defuse the Bomb.go create mode 100644 leetcode/5550/1652. Defuse the Bomb_test.go create mode 100644 leetcode/5551/5551. Minimum Deletions to Make String Balanced.go create mode 100644 leetcode/5551/5551. Minimum Deletions to Make String Balanced_test.go create mode 100644 leetcode/5601/5601. Design an Ordered Stream.go create mode 100644 leetcode/5601/5601. Design an Ordered Stream_test.go create mode 100644 leetcode/5603/5603. Determine if Two Strings Are Close.go create mode 100644 leetcode/5603/5603. Determine if Two Strings Are Close_test.go diff --git a/leetcode/5550/1652. Defuse the Bomb.go b/leetcode/5550/1652. Defuse the Bomb.go new file mode 100644 index 00000000..cd0c245e --- /dev/null +++ b/leetcode/5550/1652. Defuse the Bomb.go @@ -0,0 +1,56 @@ +package leetcode + +func decrypt(code []int, k int) []int { + if k == 0 { + for i := 0; i < len(code); i++ { + code[i] = 0 + } + return code + } + count, sum, res := k, 0, make([]int, len(code)) + if k > 0 { + for i := 0; i < len(code); i++ { + for j := i + 1; j < len(code); j++ { + if count == 0 { + break + } + sum += code[j] + count-- + } + if count > 0 { + for j := 0; j < len(code); j++ { + if count == 0 { + break + } + sum += code[j] + count-- + } + } + res[i] = sum + sum, count = 0, k + } + } + if k < 0 { + for i := 0; i < len(code); i++ { + for j := i - 1; j >= 0; j-- { + if count == 0 { + break + } + sum += code[j] + count++ + } + if count < 0 { + for j := len(code) - 1; j >= 0; j-- { + if count == 0 { + break + } + sum += code[j] + count++ + } + } + res[i] = sum + sum, count = 0, k + } + } + return res +} diff --git a/leetcode/5550/1652. Defuse the Bomb_test.go b/leetcode/5550/1652. Defuse the Bomb_test.go new file mode 100644 index 00000000..87ce3aef --- /dev/null +++ b/leetcode/5550/1652. Defuse the Bomb_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1652 struct { + para1652 + ans1652 +} + +// para 是参数 +// one 代表第一个参数 +type para1652 struct { + code []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1652 struct { + one []int +} + +func Test_Problem1652(t *testing.T) { + + qs := []question1652{ + + { + para1652{[]int{5, 7, 1, 4}, 3}, + ans1652{[]int{12, 10, 16, 13}}, + }, + + { + para1652{[]int{1, 2, 3, 4}, 0}, + ans1652{[]int{0, 0, 0, 0}}, + }, + + { + para1652{[]int{2, 4, 9, 3}, -2}, + ans1652{[]int{12, 5, 6, 13}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1652------------------------\n") + + for _, q := range qs { + _, p := q.ans1652, q.para1652 + fmt.Printf("【input】:%v 【output】:%v \n", p, decrypt(p.code, p.k)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/5551/5551. Minimum Deletions to Make String Balanced.go b/leetcode/5551/5551. Minimum Deletions to Make String Balanced.go new file mode 100644 index 00000000..266db4f5 --- /dev/null +++ b/leetcode/5551/5551. Minimum Deletions to Make String Balanced.go @@ -0,0 +1,49 @@ +package leetcode + +func minimumDeletions(s string) int { + ai, bi, sum, temp, array := 0, 0, 0, 0, []int{} + for ai = 0; ai < len(s); ai++ { + if s[ai] == 'a' { + break + } + } + if ai != 0 && ai != len(s) { + sum += ai + } + for bi = ai; bi < len(s); bi++ { + if s[bi] == 'b' { + break + } + } + if s[bi-1] == 'a' { + ai = bi - 1 + } + if s[bi-1] == 'b' && bi != len(s) { + ai = bi + 1 + } + for j := bi; j < len(s); j++ { + if s[j] == 'b' { + temp++ + } + if s[j] == 'a' && temp != 0 { + array = append(array, temp) + temp = 0 + } + } + if len(array) == 0 { + return sum + } + dp := make([]int, len(array)) + dp[0] = min(array[0], len(array)) + for i := 1; i < len(array); i++ { + dp[i] = min(dp[i-1]+array[i], dp[i-1]+len(array)-(i+1)+1) + } + return sum + dp[len(array)-1] +} + +func min(a int, b int) int { + if a > b { + return b + } + return a +} diff --git a/leetcode/5551/5551. Minimum Deletions to Make String Balanced_test.go b/leetcode/5551/5551. Minimum Deletions to Make String Balanced_test.go new file mode 100644 index 00000000..1600c577 --- /dev/null +++ b/leetcode/5551/5551. Minimum Deletions to Make String Balanced_test.go @@ -0,0 +1,57 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1649 struct { + para1649 + ans1649 +} + +// para 是参数 +// one 代表第一个参数 +type para1649 struct { + s string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1649 struct { + one int +} + +func Test_Problem1649(t *testing.T) { + + qs := []question1649{ + + // { + // para1649{"aababbab"}, + // ans1649{2}, + // }, + + // { + // para1649{"bbaaaaabb"}, + // ans1649{2}, + // }, + + { + para1649{"b"}, + ans1649{0}, + }, + + { + para1649{"ababaaaabbbbbaaababbbbbbaaabbaababbabbbbaabbbbaabbabbabaabbbababaa"}, + ans1649{25}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1649------------------------\n") + + for _, q := range qs { + _, p := q.ans1649, q.para1649 + fmt.Printf("【input】:%v 【output】:%v \n", p, minimumDeletions(p.s)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/5601/5601. Design an Ordered Stream.go b/leetcode/5601/5601. Design an Ordered Stream.go new file mode 100644 index 00000000..767a1adf --- /dev/null +++ b/leetcode/5601/5601. Design an Ordered Stream.go @@ -0,0 +1,42 @@ +package leetcode + +import ( + "fmt" +) + +type OrderedStream struct { + ptr int + stream []string +} + +func Constructor(n int) OrderedStream { + ptr, stream := 1, make([]string, n+1) + return OrderedStream{ptr: ptr, stream: stream} +} + +func (this *OrderedStream) Insert(id int, value string) []string { + this.stream[id] = value + res := []string{} + fmt.Printf("%v %v %v\n", this.ptr, id, value) + if this.ptr == id || this.stream[this.ptr] != "" { + res = append(res, this.stream[this.ptr]) + for i := id + 1; i < len(this.stream); i++ { + if this.stream[i] != "" { + res = append(res, this.stream[i]) + } else { + this.ptr = i + return res + } + } + } + if len(res) > 0 { + return res + } + return []string{} +} + +/** + * Your OrderedStream object will be instantiated and called as such: + * obj := Constructor(n); + * param_1 := obj.Insert(id,value); + */ diff --git a/leetcode/5601/5601. Design an Ordered Stream_test.go b/leetcode/5601/5601. Design an Ordered Stream_test.go new file mode 100644 index 00000000..c0a1c515 --- /dev/null +++ b/leetcode/5601/5601. Design an Ordered Stream_test.go @@ -0,0 +1,21 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +func Test_Problem707(t *testing.T) { + obj := Constructor(5) + fmt.Printf("obj = %v\n", obj) + param1 := obj.Insert(3, "ccccc") + fmt.Printf("param_1 = %v obj = %v\n", param1, obj) + param1 = obj.Insert(1, "aaaaa") + fmt.Printf("param_1 = %v obj = %v\n", param1, obj) + param1 = obj.Insert(2, "bbbbb") + fmt.Printf("param_1 = %v obj = %v\n", param1, obj) + param1 = obj.Insert(5, "eeeee") + fmt.Printf("param_1 = %v obj = %v\n", param1, obj) + param1 = obj.Insert(4, "ddddd") + fmt.Printf("param_1 = %v obj = %v\n", param1, obj) +} diff --git a/leetcode/5603/5603. Determine if Two Strings Are Close.go b/leetcode/5603/5603. Determine if Two Strings Are Close.go new file mode 100644 index 00000000..930a05fd --- /dev/null +++ b/leetcode/5603/5603. Determine if Two Strings Are Close.go @@ -0,0 +1,88 @@ +package leetcode + +import ( + "sort" +) + +func closeStrings(word1 string, word2 string) bool { + if len(word1) != len(word2) { + return false + } + freqWord1, freq1, freqList1, freqWord2, freq2, freqList2, flag := map[byte]int{}, []int{}, map[int][]byte{}, map[byte]int{}, []int{}, map[int][]byte{}, false + for i := 0; i < len(word1); i++ { + freqWord1[word1[i]]++ + } + for i := 0; i < len(word2); i++ { + freqWord2[word2[i]]++ + } + freqTemp1 := map[int]int{} + for k, v := range freqWord1 { + freqTemp1[v]++ + if list, ok := freqList1[v]; ok { + list = append(list, k) + freqList1[v] = list + } else { + list := []byte{} + list = append(list, k) + freqList1[v] = list + } + } + for _, v := range freqTemp1 { + freq1 = append(freq1, v) + } + freqTemp2 := map[int]int{} + for k, v := range freqWord2 { + freqTemp2[v]++ + if list, ok := freqList2[v]; ok { + list = append(list, k) + freqList2[v] = list + } else { + list := []byte{} + list = append(list, k) + freqList2[v] = list + } + } + for _, v := range freqTemp2 { + freq2 = append(freq2, v) + } + if len(freq1) != len(freq2) { + return false + } + sort.Ints(freq1) + sort.Ints(freq2) + for i := 0; i < len(freq1); i++ { + if freq1[i] != freq2[i] { + flag = true + break + } + } + if flag == true { + return false + } + flag = false + // 频次相同,再判断字母交换是否合法存在 + for k, v := range freqWord1 { + if list, ok := freqList2[v]; ok { + for i := 0; i < len(list); i++ { + if list[i] != k && list[i] != '0' { + // 交换的字母不存在 + if _, ok := freqWord1[list[i]]; !ok { + flag = true + break + } else { + // 交换的字母存在,重置这一位,代表这一个字母被交换了,下次不用它 + list[i] = '0' + } + } + } + } else { + // 出现频次个数相同,但是频次不同 + flag = true + break + } + } + if flag == true { + return false + } + return true +} diff --git a/leetcode/5603/5603. Determine if Two Strings Are Close_test.go b/leetcode/5603/5603. Determine if Two Strings Are Close_test.go new file mode 100644 index 00000000..365a03cc --- /dev/null +++ b/leetcode/5603/5603. Determine if Two Strings Are Close_test.go @@ -0,0 +1,68 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1649 struct { + para1649 + ans1649 +} + +// para 是参数 +// one 代表第一个参数 +type para1649 struct { + word1 string + word2 string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1649 struct { + one bool +} + +func Test_Problem1649(t *testing.T) { + + qs := []question1649{ + + { + para1649{"abc", "bca"}, + ans1649{true}, + }, + + { + para1649{"a", "aa"}, + ans1649{false}, + }, + + { + para1649{"cabbba", "abbccc"}, + ans1649{true}, + }, + + { + para1649{"cabbba", "aabbss"}, + ans1649{false}, + }, + + { + para1649{"uau", "ssx"}, + ans1649{false}, + }, + + { + para1649{"uuukuuuukkuusuususuuuukuskuusuuusuusuuuuuuk", "kssskkskkskssskksskskksssssksskksskskksksuu"}, + ans1649{false}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1649------------------------\n") + + for _, q := range qs { + _, p := q.ans1649, q.para1649 + fmt.Printf("【input】:%v 【output】:%v \n", p, closeStrings(p.word1, p.word2)) + } + fmt.Printf("\n\n\n") +} From 35c39173bcb140a0b052d112e79dd460e183dc87 Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 20 Nov 2020 23:35:30 +0800 Subject: [PATCH 31/82] =?UTF-8?q?Add=20solution=201656=E3=80=811657?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1656. Design an Ordered Stream.go} | 5 - .../1656. Design an Ordered Stream_test.go} | 2 +- .../1656.Design-an-Ordered-Stream/README.md | 106 ++++++++++++++++ ...657. Determine if Two Strings Are Close.go | 33 +++++ ...Determine if Two Strings Are Close_test.go | 68 +++++++++++ .../README.md | 114 ++++++++++++++++++ ...603. Determine if Two Strings Are Close.go | 88 -------------- ...Determine if Two Strings Are Close_test.go | 68 ----------- .../1656.Design-an-Ordered-Stream.md | 106 ++++++++++++++++ ...1657.Determine-if-Two-Strings-Are-Close.md | 114 ++++++++++++++++++ 10 files changed, 542 insertions(+), 162 deletions(-) rename leetcode/{5601/5601. Design an Ordered Stream.go => 1656.Design-an-Ordered-Stream/1656. Design an Ordered Stream.go} (92%) rename leetcode/{5601/5601. Design an Ordered Stream_test.go => 1656.Design-an-Ordered-Stream/1656. Design an Ordered Stream_test.go} (93%) create mode 100644 leetcode/1656.Design-an-Ordered-Stream/README.md create mode 100644 leetcode/1657.Determine-if-Two-Strings-Are-Close/1657. Determine if Two Strings Are Close.go create mode 100644 leetcode/1657.Determine-if-Two-Strings-Are-Close/1657. Determine if Two Strings Are Close_test.go create mode 100644 leetcode/1657.Determine-if-Two-Strings-Are-Close/README.md delete mode 100644 leetcode/5603/5603. Determine if Two Strings Are Close.go delete mode 100644 leetcode/5603/5603. Determine if Two Strings Are Close_test.go create mode 100644 website/content/ChapterFour/1656.Design-an-Ordered-Stream.md create mode 100644 website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md diff --git a/leetcode/5601/5601. Design an Ordered Stream.go b/leetcode/1656.Design-an-Ordered-Stream/1656. Design an Ordered Stream.go similarity index 92% rename from leetcode/5601/5601. Design an Ordered Stream.go rename to leetcode/1656.Design-an-Ordered-Stream/1656. Design an Ordered Stream.go index 767a1adf..bb6035d9 100644 --- a/leetcode/5601/5601. Design an Ordered Stream.go +++ b/leetcode/1656.Design-an-Ordered-Stream/1656. Design an Ordered Stream.go @@ -1,9 +1,5 @@ package leetcode -import ( - "fmt" -) - type OrderedStream struct { ptr int stream []string @@ -17,7 +13,6 @@ func Constructor(n int) OrderedStream { func (this *OrderedStream) Insert(id int, value string) []string { this.stream[id] = value res := []string{} - fmt.Printf("%v %v %v\n", this.ptr, id, value) if this.ptr == id || this.stream[this.ptr] != "" { res = append(res, this.stream[this.ptr]) for i := id + 1; i < len(this.stream); i++ { diff --git a/leetcode/5601/5601. Design an Ordered Stream_test.go b/leetcode/1656.Design-an-Ordered-Stream/1656. Design an Ordered Stream_test.go similarity index 93% rename from leetcode/5601/5601. Design an Ordered Stream_test.go rename to leetcode/1656.Design-an-Ordered-Stream/1656. Design an Ordered Stream_test.go index c0a1c515..870fc070 100644 --- a/leetcode/5601/5601. Design an Ordered Stream_test.go +++ b/leetcode/1656.Design-an-Ordered-Stream/1656. Design an Ordered Stream_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -func Test_Problem707(t *testing.T) { +func Test_Problem1656(t *testing.T) { obj := Constructor(5) fmt.Printf("obj = %v\n", obj) param1 := obj.Insert(3, "ccccc") diff --git a/leetcode/1656.Design-an-Ordered-Stream/README.md b/leetcode/1656.Design-an-Ordered-Stream/README.md new file mode 100644 index 00000000..96d52e60 --- /dev/null +++ b/leetcode/1656.Design-an-Ordered-Stream/README.md @@ -0,0 +1,106 @@ +# [1656. Design an Ordered Stream](https://leetcode.com/problems/design-an-ordered-stream/) + +## 题目 + +There is a stream of `n` `(id, value)` pairs arriving in an **arbitrary** order, where `id` is an integer between `1` and `n` and `value` is a string. No two pairs have the same `id`. + +Design a stream that returns the values in **increasing order of their IDs** by returning a **chunk** (list) of values after each insertion. The concatenation of all the **chunks** should result in a list of the sorted values. + +Implement the `OrderedStream` class: + +- `OrderedStream(int n)` Constructs the stream to take `n` values. +- `String[] insert(int id, String value)` Inserts the pair `(id, value)` into the stream, then returns the **largest possible chunk** of currently inserted values that appear next in the order. + +**Example:** + +![https://assets.leetcode.com/uploads/2020/11/10/q1.gif](https://assets.leetcode.com/uploads/2020/11/10/q1.gif) + +``` +Input +["OrderedStream", "insert", "insert", "insert", "insert", "insert"] +[[5], [3, "ccccc"], [1, "aaaaa"], [2, "bbbbb"], [5, "eeeee"], [4, "ddddd"]] +Output +[null, [], ["aaaaa"], ["bbbbb", "ccccc"], [], ["ddddd", "eeeee"]] + +Explanation +// Note that the values ordered by ID is ["aaaaa", "bbbbb", "ccccc", "ddddd", "eeeee"]. +OrderedStream os = new OrderedStream(5); +os.insert(3, "ccccc"); // Inserts (3, "ccccc"), returns []. +os.insert(1, "aaaaa"); // Inserts (1, "aaaaa"), returns ["aaaaa"]. +os.insert(2, "bbbbb"); // Inserts (2, "bbbbb"), returns ["bbbbb", "ccccc"]. +os.insert(5, "eeeee"); // Inserts (5, "eeeee"), returns []. +os.insert(4, "ddddd"); // Inserts (4, "ddddd"), returns ["ddddd", "eeeee"]. +// Concatentating all the chunks returned: +// [] + ["aaaaa"] + ["bbbbb", "ccccc"] + [] + ["ddddd", "eeeee"] = ["aaaaa", "bbbbb", "ccccc", "ddddd", "eeeee"] +// The resulting order is the same as the order above. + +``` + +**Constraints:** + +- `1 <= n <= 1000` +- `1 <= id <= n` +- `value.length == 5` +- `value` consists only of lowercase letters. +- Each call to `insert` will have a unique `id.` +- Exactly `n` calls will be made to `insert`. + +## 题目大意 + +有 n 个 (id, value) 对,其中 id 是 1 到 n 之间的一个整数,value 是一个字符串。不存在 id 相同的两个 (id, value) 对。 + +设计一个流,以 任意 顺序获取 n 个 (id, value) 对,并在多次调用时 按 id 递增的顺序 返回一些值。 + +实现 OrderedStream 类: + +- OrderedStream(int n) 构造一个能接收 n 个值的流,并将当前指针 ptr 设为 1 。 +- String[] insert(int id, String value) 向流中存储新的 (id, value) 对。存储后: +如果流存储有 id = ptr 的 (id, value) 对,则找出从 id = ptr 开始的 最长 id 连续递增序列 ,并 按顺序 返回与这些 id 关联的值的列表。然后,将 ptr 更新为最后那个 id + 1 。 +否则,返回一个空列表。 + +## 解题思路 + +- 设计一个具有插入操作的 Ordered Stream。insert 操作先在指定位置插入 value,然后返回当前指针 ptr 到最近一个空位置的最长连续递增字符串。如果字符串不为空,ptr 移动到非空 value 的后一个下标位置处。 +- 简单题。按照题目描述模拟即可。注意控制好 ptr 的位置。 + +## 代码 + +```go +package leetcode + +type OrderedStream struct { + ptr int + stream []string +} + +func Constructor(n int) OrderedStream { + ptr, stream := 1, make([]string, n+1) + return OrderedStream{ptr: ptr, stream: stream} +} + +func (this *OrderedStream) Insert(id int, value string) []string { + this.stream[id] = value + res := []string{} + if this.ptr == id || this.stream[this.ptr] != "" { + res = append(res, this.stream[this.ptr]) + for i := id + 1; i < len(this.stream); i++ { + if this.stream[i] != "" { + res = append(res, this.stream[i]) + } else { + this.ptr = i + return res + } + } + } + if len(res) > 0 { + return res + } + return []string{} +} + +/** + * Your OrderedStream object will be instantiated and called as such: + * obj := Constructor(n); + * param_1 := obj.Insert(id,value); + */ +``` \ No newline at end of file diff --git a/leetcode/1657.Determine-if-Two-Strings-Are-Close/1657. Determine if Two Strings Are Close.go b/leetcode/1657.Determine-if-Two-Strings-Are-Close/1657. Determine if Two Strings Are Close.go new file mode 100644 index 00000000..9fa3d947 --- /dev/null +++ b/leetcode/1657.Determine-if-Two-Strings-Are-Close/1657. Determine if Two Strings Are Close.go @@ -0,0 +1,33 @@ +package leetcode + +import ( + "sort" +) + +func closeStrings(word1 string, word2 string) bool { + if len(word1) != len(word2) { + return false + } + freqCount1, freqCount2 := make([]int, 26), make([]int, 26) + for _, c := range word1 { + freqCount1[c-97]++ + } + for _, c := range word2 { + freqCount2[c-97]++ + } + for i := 0; i < 26; i++ { + if (freqCount1[i] == freqCount2[i]) || + (freqCount1[i] > 0 && freqCount2[i] > 0) { + continue + } + return false + } + sort.Ints(freqCount1) + sort.Ints(freqCount2) + for i := 0; i < 26; i++ { + if freqCount1[i] != freqCount2[i] { + return false + } + } + return true +} diff --git a/leetcode/1657.Determine-if-Two-Strings-Are-Close/1657. Determine if Two Strings Are Close_test.go b/leetcode/1657.Determine-if-Two-Strings-Are-Close/1657. Determine if Two Strings Are Close_test.go new file mode 100644 index 00000000..cfc98254 --- /dev/null +++ b/leetcode/1657.Determine-if-Two-Strings-Are-Close/1657. Determine if Two Strings Are Close_test.go @@ -0,0 +1,68 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1657 struct { + para1657 + ans1657 +} + +// para 是参数 +// one 代表第一个参数 +type para1657 struct { + word1 string + word2 string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1657 struct { + one bool +} + +func Test_Problem1657(t *testing.T) { + + qs := []question1657{ + + { + para1657{"abc", "bca"}, + ans1657{true}, + }, + + { + para1657{"a", "aa"}, + ans1657{false}, + }, + + { + para1657{"cabbba", "abbccc"}, + ans1657{true}, + }, + + { + para1657{"cabbba", "aabbss"}, + ans1657{false}, + }, + + { + para1657{"uau", "ssx"}, + ans1657{false}, + }, + + { + para1657{"uuukuuuukkuusuususuuuukuskuusuuusuusuuuuuuk", "kssskkskkskssskksskskksssssksskksskskksksuu"}, + ans1657{false}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1657------------------------\n") + + for _, q := range qs { + _, p := q.ans1657, q.para1657 + fmt.Printf("【input】:%v 【output】:%v \n", p, closeStrings(p.word1, p.word2)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1657.Determine-if-Two-Strings-Are-Close/README.md b/leetcode/1657.Determine-if-Two-Strings-Are-Close/README.md new file mode 100644 index 00000000..711c758f --- /dev/null +++ b/leetcode/1657.Determine-if-Two-Strings-Are-Close/README.md @@ -0,0 +1,114 @@ +# [1657. Determine if Two Strings Are Close](https://leetcode.com/problems/determine-if-two-strings-are-close/) + + +## 题目 + +Two strings are considered **close** if you can attain one from the other using the following operations: + +- Operation 1: Swap any two **existing** characters. + - For example, `abcde -> aecdb` +- Operation 2: Transform **every** occurrence of one **existing** character into another **existing** character, and do the same with the other character. + - For example, `aacabb -> bbcbaa` (all `a`'s turn into `b`'s, and all `b`'s turn into `a`'s) + +You can use the operations on either string as many times as necessary. + +Given two strings, `word1` and `word2`, return `true` *if* `word1` *and* `word2` *are **close**, and* `false` *otherwise.* + +**Example 1:** + +``` +Input: word1 = "abc", word2 = "bca" +Output: true +Explanation: You can attain word2 from word1 in 2 operations. +Apply Operation 1: "abc" -> "acb" +Apply Operation 1: "acb" -> "bca" + +``` + +**Example 2:** + +``` +Input: word1 = "a", word2 = "aa" +Output: false +Explanation: It is impossible to attain word2 from word1, or vice versa, in any number of operations. + +``` + +**Example 3:** + +``` +Input: word1 = "cabbba", word2 = "abbccc" +Output: true +Explanation: You can attain word2 from word1 in 3 operations. +Apply Operation 1: "cabbba" -> "caabbb" +Apply Operation 2: "caabbb" -> "baaccc" +Apply Operation 2: "baaccc" -> "abbccc" + +``` + +**Example 4:** + +``` +Input: word1 = "cabbba", word2 = "aabbss" +Output: false +Explanation: It is impossible to attain word2 from word1, or vice versa, in any amount of operations. + +``` + +**Constraints:** + +- `1 <= word1.length, word2.length <= 105` +- `word1` and `word2` contain only lowercase English letters. + +## 题目大意 + +如果可以使用以下操作从一个字符串得到另一个字符串,则认为两个字符串 接近 : + +- 操作 1:交换任意两个 现有 字符。例如,abcde -> aecdb +- 操作 2:将一个 现有 字符的每次出现转换为另一个 现有 字符,并对另一个字符执行相同的操作。例如,aacabb -> bbcbaa(所有 a 转化为 b ,而所有的 b 转换为 a ) + +你可以根据需要对任意一个字符串多次使用这两种操作。给你两个字符串,word1 和 word2 。如果 word1 和 word2 接近 ,就返回 true ;否则,返回 false 。 + +## 解题思路 + +- 判断 2 个字符串是否“接近”。“接近”的定义是能否通过交换 2 个字符或者 2 个字母互换,从一个字符串变换成另外一个字符串,如果存在这样的变换,即是“接近”。 +- 先统计 2 个字符串的 26 个字母的频次,如果频次有不相同的,直接返回 false。在频次相同的情况下,再从小到大排序,再次扫描判断频次是否相同。 +- 注意几种特殊情况:频次相同,再判断字母交换是否合法存在,如果字母不存在,输出 false。例如测试文件中的 case 5 。出现频次个数相同,但是频次不同。例如测试文件中的 case 6 。 + +## 代码 + +```go +package leetcode + +import ( + "sort" +) + +func closeStrings(word1 string, word2 string) bool { + if len(word1) != len(word2) { + return false + } + freqCount1, freqCount2 := make([]int, 26), make([]int, 26) + for _, c := range word1 { + freqCount1[c-97]++ + } + for _, c := range word2 { + freqCount2[c-97]++ + } + for i := 0; i < 26; i++ { + if (freqCount1[i] == freqCount2[i]) || + (freqCount1[i] > 0 && freqCount2[i] > 0) { + continue + } + return false + } + sort.Ints(freqCount1) + sort.Ints(freqCount2) + for i := 0; i < 26; i++ { + if freqCount1[i] != freqCount2[i] { + return false + } + } + return true +} +``` \ No newline at end of file diff --git a/leetcode/5603/5603. Determine if Two Strings Are Close.go b/leetcode/5603/5603. Determine if Two Strings Are Close.go deleted file mode 100644 index 930a05fd..00000000 --- a/leetcode/5603/5603. Determine if Two Strings Are Close.go +++ /dev/null @@ -1,88 +0,0 @@ -package leetcode - -import ( - "sort" -) - -func closeStrings(word1 string, word2 string) bool { - if len(word1) != len(word2) { - return false - } - freqWord1, freq1, freqList1, freqWord2, freq2, freqList2, flag := map[byte]int{}, []int{}, map[int][]byte{}, map[byte]int{}, []int{}, map[int][]byte{}, false - for i := 0; i < len(word1); i++ { - freqWord1[word1[i]]++ - } - for i := 0; i < len(word2); i++ { - freqWord2[word2[i]]++ - } - freqTemp1 := map[int]int{} - for k, v := range freqWord1 { - freqTemp1[v]++ - if list, ok := freqList1[v]; ok { - list = append(list, k) - freqList1[v] = list - } else { - list := []byte{} - list = append(list, k) - freqList1[v] = list - } - } - for _, v := range freqTemp1 { - freq1 = append(freq1, v) - } - freqTemp2 := map[int]int{} - for k, v := range freqWord2 { - freqTemp2[v]++ - if list, ok := freqList2[v]; ok { - list = append(list, k) - freqList2[v] = list - } else { - list := []byte{} - list = append(list, k) - freqList2[v] = list - } - } - for _, v := range freqTemp2 { - freq2 = append(freq2, v) - } - if len(freq1) != len(freq2) { - return false - } - sort.Ints(freq1) - sort.Ints(freq2) - for i := 0; i < len(freq1); i++ { - if freq1[i] != freq2[i] { - flag = true - break - } - } - if flag == true { - return false - } - flag = false - // 频次相同,再判断字母交换是否合法存在 - for k, v := range freqWord1 { - if list, ok := freqList2[v]; ok { - for i := 0; i < len(list); i++ { - if list[i] != k && list[i] != '0' { - // 交换的字母不存在 - if _, ok := freqWord1[list[i]]; !ok { - flag = true - break - } else { - // 交换的字母存在,重置这一位,代表这一个字母被交换了,下次不用它 - list[i] = '0' - } - } - } - } else { - // 出现频次个数相同,但是频次不同 - flag = true - break - } - } - if flag == true { - return false - } - return true -} diff --git a/leetcode/5603/5603. Determine if Two Strings Are Close_test.go b/leetcode/5603/5603. Determine if Two Strings Are Close_test.go deleted file mode 100644 index 365a03cc..00000000 --- a/leetcode/5603/5603. Determine if Two Strings Are Close_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question1649 struct { - para1649 - ans1649 -} - -// para 是参数 -// one 代表第一个参数 -type para1649 struct { - word1 string - word2 string -} - -// ans 是答案 -// one 代表第一个答案 -type ans1649 struct { - one bool -} - -func Test_Problem1649(t *testing.T) { - - qs := []question1649{ - - { - para1649{"abc", "bca"}, - ans1649{true}, - }, - - { - para1649{"a", "aa"}, - ans1649{false}, - }, - - { - para1649{"cabbba", "abbccc"}, - ans1649{true}, - }, - - { - para1649{"cabbba", "aabbss"}, - ans1649{false}, - }, - - { - para1649{"uau", "ssx"}, - ans1649{false}, - }, - - { - para1649{"uuukuuuukkuusuususuuuukuskuusuuusuusuuuuuuk", "kssskkskkskssskksskskksssssksskksskskksksuu"}, - ans1649{false}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 1649------------------------\n") - - for _, q := range qs { - _, p := q.ans1649, q.para1649 - fmt.Printf("【input】:%v 【output】:%v \n", p, closeStrings(p.word1, p.word2)) - } - fmt.Printf("\n\n\n") -} diff --git a/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md b/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md new file mode 100644 index 00000000..96d52e60 --- /dev/null +++ b/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md @@ -0,0 +1,106 @@ +# [1656. Design an Ordered Stream](https://leetcode.com/problems/design-an-ordered-stream/) + +## 题目 + +There is a stream of `n` `(id, value)` pairs arriving in an **arbitrary** order, where `id` is an integer between `1` and `n` and `value` is a string. No two pairs have the same `id`. + +Design a stream that returns the values in **increasing order of their IDs** by returning a **chunk** (list) of values after each insertion. The concatenation of all the **chunks** should result in a list of the sorted values. + +Implement the `OrderedStream` class: + +- `OrderedStream(int n)` Constructs the stream to take `n` values. +- `String[] insert(int id, String value)` Inserts the pair `(id, value)` into the stream, then returns the **largest possible chunk** of currently inserted values that appear next in the order. + +**Example:** + +![https://assets.leetcode.com/uploads/2020/11/10/q1.gif](https://assets.leetcode.com/uploads/2020/11/10/q1.gif) + +``` +Input +["OrderedStream", "insert", "insert", "insert", "insert", "insert"] +[[5], [3, "ccccc"], [1, "aaaaa"], [2, "bbbbb"], [5, "eeeee"], [4, "ddddd"]] +Output +[null, [], ["aaaaa"], ["bbbbb", "ccccc"], [], ["ddddd", "eeeee"]] + +Explanation +// Note that the values ordered by ID is ["aaaaa", "bbbbb", "ccccc", "ddddd", "eeeee"]. +OrderedStream os = new OrderedStream(5); +os.insert(3, "ccccc"); // Inserts (3, "ccccc"), returns []. +os.insert(1, "aaaaa"); // Inserts (1, "aaaaa"), returns ["aaaaa"]. +os.insert(2, "bbbbb"); // Inserts (2, "bbbbb"), returns ["bbbbb", "ccccc"]. +os.insert(5, "eeeee"); // Inserts (5, "eeeee"), returns []. +os.insert(4, "ddddd"); // Inserts (4, "ddddd"), returns ["ddddd", "eeeee"]. +// Concatentating all the chunks returned: +// [] + ["aaaaa"] + ["bbbbb", "ccccc"] + [] + ["ddddd", "eeeee"] = ["aaaaa", "bbbbb", "ccccc", "ddddd", "eeeee"] +// The resulting order is the same as the order above. + +``` + +**Constraints:** + +- `1 <= n <= 1000` +- `1 <= id <= n` +- `value.length == 5` +- `value` consists only of lowercase letters. +- Each call to `insert` will have a unique `id.` +- Exactly `n` calls will be made to `insert`. + +## 题目大意 + +有 n 个 (id, value) 对,其中 id 是 1 到 n 之间的一个整数,value 是一个字符串。不存在 id 相同的两个 (id, value) 对。 + +设计一个流,以 任意 顺序获取 n 个 (id, value) 对,并在多次调用时 按 id 递增的顺序 返回一些值。 + +实现 OrderedStream 类: + +- OrderedStream(int n) 构造一个能接收 n 个值的流,并将当前指针 ptr 设为 1 。 +- String[] insert(int id, String value) 向流中存储新的 (id, value) 对。存储后: +如果流存储有 id = ptr 的 (id, value) 对,则找出从 id = ptr 开始的 最长 id 连续递增序列 ,并 按顺序 返回与这些 id 关联的值的列表。然后,将 ptr 更新为最后那个 id + 1 。 +否则,返回一个空列表。 + +## 解题思路 + +- 设计一个具有插入操作的 Ordered Stream。insert 操作先在指定位置插入 value,然后返回当前指针 ptr 到最近一个空位置的最长连续递增字符串。如果字符串不为空,ptr 移动到非空 value 的后一个下标位置处。 +- 简单题。按照题目描述模拟即可。注意控制好 ptr 的位置。 + +## 代码 + +```go +package leetcode + +type OrderedStream struct { + ptr int + stream []string +} + +func Constructor(n int) OrderedStream { + ptr, stream := 1, make([]string, n+1) + return OrderedStream{ptr: ptr, stream: stream} +} + +func (this *OrderedStream) Insert(id int, value string) []string { + this.stream[id] = value + res := []string{} + if this.ptr == id || this.stream[this.ptr] != "" { + res = append(res, this.stream[this.ptr]) + for i := id + 1; i < len(this.stream); i++ { + if this.stream[i] != "" { + res = append(res, this.stream[i]) + } else { + this.ptr = i + return res + } + } + } + if len(res) > 0 { + return res + } + return []string{} +} + +/** + * Your OrderedStream object will be instantiated and called as such: + * obj := Constructor(n); + * param_1 := obj.Insert(id,value); + */ +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md b/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md new file mode 100644 index 00000000..711c758f --- /dev/null +++ b/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md @@ -0,0 +1,114 @@ +# [1657. Determine if Two Strings Are Close](https://leetcode.com/problems/determine-if-two-strings-are-close/) + + +## 题目 + +Two strings are considered **close** if you can attain one from the other using the following operations: + +- Operation 1: Swap any two **existing** characters. + - For example, `abcde -> aecdb` +- Operation 2: Transform **every** occurrence of one **existing** character into another **existing** character, and do the same with the other character. + - For example, `aacabb -> bbcbaa` (all `a`'s turn into `b`'s, and all `b`'s turn into `a`'s) + +You can use the operations on either string as many times as necessary. + +Given two strings, `word1` and `word2`, return `true` *if* `word1` *and* `word2` *are **close**, and* `false` *otherwise.* + +**Example 1:** + +``` +Input: word1 = "abc", word2 = "bca" +Output: true +Explanation: You can attain word2 from word1 in 2 operations. +Apply Operation 1: "abc" -> "acb" +Apply Operation 1: "acb" -> "bca" + +``` + +**Example 2:** + +``` +Input: word1 = "a", word2 = "aa" +Output: false +Explanation: It is impossible to attain word2 from word1, or vice versa, in any number of operations. + +``` + +**Example 3:** + +``` +Input: word1 = "cabbba", word2 = "abbccc" +Output: true +Explanation: You can attain word2 from word1 in 3 operations. +Apply Operation 1: "cabbba" -> "caabbb" +Apply Operation 2: "caabbb" -> "baaccc" +Apply Operation 2: "baaccc" -> "abbccc" + +``` + +**Example 4:** + +``` +Input: word1 = "cabbba", word2 = "aabbss" +Output: false +Explanation: It is impossible to attain word2 from word1, or vice versa, in any amount of operations. + +``` + +**Constraints:** + +- `1 <= word1.length, word2.length <= 105` +- `word1` and `word2` contain only lowercase English letters. + +## 题目大意 + +如果可以使用以下操作从一个字符串得到另一个字符串,则认为两个字符串 接近 : + +- 操作 1:交换任意两个 现有 字符。例如,abcde -> aecdb +- 操作 2:将一个 现有 字符的每次出现转换为另一个 现有 字符,并对另一个字符执行相同的操作。例如,aacabb -> bbcbaa(所有 a 转化为 b ,而所有的 b 转换为 a ) + +你可以根据需要对任意一个字符串多次使用这两种操作。给你两个字符串,word1 和 word2 。如果 word1 和 word2 接近 ,就返回 true ;否则,返回 false 。 + +## 解题思路 + +- 判断 2 个字符串是否“接近”。“接近”的定义是能否通过交换 2 个字符或者 2 个字母互换,从一个字符串变换成另外一个字符串,如果存在这样的变换,即是“接近”。 +- 先统计 2 个字符串的 26 个字母的频次,如果频次有不相同的,直接返回 false。在频次相同的情况下,再从小到大排序,再次扫描判断频次是否相同。 +- 注意几种特殊情况:频次相同,再判断字母交换是否合法存在,如果字母不存在,输出 false。例如测试文件中的 case 5 。出现频次个数相同,但是频次不同。例如测试文件中的 case 6 。 + +## 代码 + +```go +package leetcode + +import ( + "sort" +) + +func closeStrings(word1 string, word2 string) bool { + if len(word1) != len(word2) { + return false + } + freqCount1, freqCount2 := make([]int, 26), make([]int, 26) + for _, c := range word1 { + freqCount1[c-97]++ + } + for _, c := range word2 { + freqCount2[c-97]++ + } + for i := 0; i < 26; i++ { + if (freqCount1[i] == freqCount2[i]) || + (freqCount1[i] > 0 && freqCount2[i] > 0) { + continue + } + return false + } + sort.Ints(freqCount1) + sort.Ints(freqCount2) + for i := 0; i < 26; i++ { + if freqCount1[i] != freqCount2[i] { + return false + } + } + return true +} +``` \ No newline at end of file From 285f7a1c75e1bf29913be96148176024d465e071 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 22 Nov 2020 19:46:48 +0800 Subject: [PATCH 32/82] =?UTF-8?q?Add=20solution=201656=E3=80=811657?= =?UTF-8?q?=E3=80=811658=E3=80=811659?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Minimum Operations to Reduce X to Zero.go | 40 ++++ ...mum Operations to Reduce X to Zero_test.go | 53 +++++ .../README.md | 96 +++++++++ .../1659. Maximize Grid Happiness.go | 107 ++++++++++ .../1659. Maximize Grid Happiness_test.go | 55 ++++++ .../1659.Maximize-Grid-Happiness/README.md | 185 ++++++++++++++++++ ....Minimum-Operations-to-Reduce-X-to-Zero.md | 96 +++++++++ .../1659.Maximize-Grid-Happiness.md | 185 ++++++++++++++++++ website/content/menu/index.md | 4 + 9 files changed, 821 insertions(+) create mode 100644 leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/1658. Minimum Operations to Reduce X to Zero.go create mode 100644 leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/1658. Minimum Operations to Reduce X to Zero_test.go create mode 100644 leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/README.md create mode 100644 leetcode/1659.Maximize-Grid-Happiness/1659. Maximize Grid Happiness.go create mode 100644 leetcode/1659.Maximize-Grid-Happiness/1659. Maximize Grid Happiness_test.go create mode 100644 leetcode/1659.Maximize-Grid-Happiness/README.md create mode 100644 website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md create mode 100644 website/content/ChapterFour/1659.Maximize-Grid-Happiness.md diff --git a/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/1658. Minimum Operations to Reduce X to Zero.go b/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/1658. Minimum Operations to Reduce X to Zero.go new file mode 100644 index 00000000..a0db0774 --- /dev/null +++ b/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/1658. Minimum Operations to Reduce X to Zero.go @@ -0,0 +1,40 @@ +package leetcode + +func minOperations(nums []int, x int) int { + total := 0 + for _, n := range nums { + total += n + } + target := total - x + if target < 0 { + return -1 + } + if target == 0 { + return len(nums) + } + left, right, sum, res := 0, 0, 0, -1 + for right < len(nums) { + if sum < target { + sum += nums[right] + right++ + } + for sum >= target { + if sum == target { + res = max(res, right-left) + } + sum -= nums[left] + left++ + } + } + if res == -1 { + return -1 + } + return len(nums) - res +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} diff --git a/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/1658. Minimum Operations to Reduce X to Zero_test.go b/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/1658. Minimum Operations to Reduce X to Zero_test.go new file mode 100644 index 00000000..f781c28a --- /dev/null +++ b/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/1658. Minimum Operations to Reduce X to Zero_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1658 struct { + para1658 + ans1658 +} + +// para 是参数 +// one 代表第一个参数 +type para1658 struct { + nums []int + x int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1658 struct { + one int +} + +func Test_Problem1658(t *testing.T) { + + qs := []question1658{ + + { + para1658{[]int{1, 1, 4, 2, 3}, 5}, + ans1658{2}, + }, + + { + para1658{[]int{5, 6, 7, 8, 9}, 4}, + ans1658{-1}, + }, + + { + para1658{[]int{3, 2, 20, 1, 1, 3}, 10}, + ans1658{5}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1658------------------------\n") + + for _, q := range qs { + _, p := q.ans1658, q.para1658 + fmt.Printf("【input】:%v 【output】:%v \n", p, minOperations(p.nums, p.x)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/README.md b/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/README.md new file mode 100644 index 00000000..3fb34d44 --- /dev/null +++ b/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero/README.md @@ -0,0 +1,96 @@ +# [1658. Minimum Operations to Reduce X to Zero](https://leetcode.com/problems/minimum-operations-to-reduce-x-to-zero/) + + +## 题目 + +You are given an integer array `nums` and an integer `x`. In one operation, you can either remove the leftmost or the rightmost element from the array `nums` and subtract its value from `x`. Note that this **modifies** the array for future operations. + +Return *the **minimum number** of operations to reduce* `x` *to **exactly*** `0` *if it's possible, otherwise, return* `1`. + +**Example 1:** + +``` +Input: nums = [1,1,4,2,3], x = 5 +Output: 2 +Explanation: The optimal solution is to remove the last two elements to reduce x to zero. + +``` + +**Example 2:** + +``` +Input: nums = [5,6,7,8,9], x = 4 +Output: -1 + +``` + +**Example 3:** + +``` +Input: nums = [3,2,20,1,1,3], x = 10 +Output: 5 +Explanation: The optimal solution is to remove the last three elements and the first two elements (5 operations in total) to reduce x to zero. + +``` + +**Constraints:** + +- `1 <= nums.length <= 105` +- `1 <= nums[i] <= 104` +- `1 <= x <= 109` + +## 题目大意 + +给你一个整数数组 nums 和一个整数 x 。每一次操作时,你应当移除数组 nums 最左边或最右边的元素,然后从 x 中减去该元素的值。请注意,需要 修改 数组以供接下来的操作使用。如果可以将 x 恰好 减到 0 ,返回 最小操作数 ;否则,返回 -1 。 + +## 解题思路 + +- 给定一个数组 nums 和一个整数 x,要求从数组两端分别移除一些数,使得这些数加起来正好等于整数 x,要求输出最小操作数。 +- 要求输出最小操作数,即数组两头的数字个数最少,并且加起来和正好等于整数 x。由于在数组的两头,用 2 个指针分别操作不太方便。我当时解题的时候的思路是把它变成循环数组,这样两边的指针就在一个区间内了。利用滑动窗口找到一个最小的窗口,使得窗口内的累加和等于整数 k。这个方法可行,但是代码挺多的。 +- 有没有更优美的方法呢?有的。要想两头的长度最少,也就是中间这段的长度最大。这样就转换成直接在数组上使用滑动窗口求解,累加和等于一个固定值的连续最长的子数组。 +- 和这道题类似思路的题目,209,1040(循环数组),325。强烈推荐这 3 题。 + +## 代码 + +```go +package leetcode + +func minOperations(nums []int, x int) int { + total := 0 + for _, n := range nums { + total += n + } + target := total - x + if target < 0 { + return -1 + } + if target == 0 { + return len(nums) + } + left, right, sum, res := 0, 0, 0, -1 + for right < len(nums) { + if sum < target { + sum += nums[right] + right++ + } + for sum >= target { + if sum == target { + res = max(res, right-left) + } + sum -= nums[left] + left++ + } + } + if res == -1 { + return -1 + } + return len(nums) - res +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/leetcode/1659.Maximize-Grid-Happiness/1659. Maximize Grid Happiness.go b/leetcode/1659.Maximize-Grid-Happiness/1659. Maximize Grid Happiness.go new file mode 100644 index 00000000..c0b50602 --- /dev/null +++ b/leetcode/1659.Maximize-Grid-Happiness/1659. Maximize Grid Happiness.go @@ -0,0 +1,107 @@ +package leetcode + +import ( + "math" +) + +func getMaxGridHappiness(m int, n int, introvertsCount int, extrovertsCount int) int { + // lineStatus 将每一行中 3 种状态进行编码,空白 - 0,内向人 - 1,外向人 - 2,每行状态用三进制表示 + // lineStatusList[729][6] 每一行的三进制表示 + // introvertsCountInner[729] 每一个 lineStatus 包含的内向人数 + // extrovertsCountInner[729] 每一个 lineStatus 包含的外向人数 + // scoreInner[729] 每一个 lineStatus 包含的行内得分(只统计 lineStatus 本身的得分,不包括它与上一行的) + // scoreOuter[729][729] 每一个 lineStatus 包含的行外得分 + // dp[上一行的 lineStatus][当前处理到的行][剩余的内向人数][剩余的外向人数] + n3, lineStatus, introvertsCountInner, extrovertsCountInner, scoreInner, scoreOuter, lineStatusList, dp := math.Pow(3.0, float64(n)), 0, [729]int{}, [729]int{}, [729]int{}, [729][729]int{}, [729][6]int{}, [729][6][7][7]int{} + for i := 0; i < 729; i++ { + lineStatusList[i] = [6]int{} + } + for i := 0; i < 729; i++ { + dp[i] = [6][7][7]int{} + for j := 0; j < 6; j++ { + dp[i][j] = [7][7]int{} + for k := 0; k < 7; k++ { + dp[i][j][k] = [7]int{-1, -1, -1, -1, -1, -1, -1} + } + } + } + // 预处理 + for lineStatus = 0; lineStatus < int(n3); lineStatus++ { + tmp := lineStatus + for i := 0; i < n; i++ { + lineStatusList[lineStatus][i] = tmp % 3 + tmp /= 3 + } + introvertsCountInner[lineStatus], extrovertsCountInner[lineStatus], scoreInner[lineStatus] = 0, 0, 0 + for i := 0; i < n; i++ { + if lineStatusList[lineStatus][i] != 0 { + // 个人分数 + if lineStatusList[lineStatus][i] == 1 { + introvertsCountInner[lineStatus]++ + scoreInner[lineStatus] += 120 + } else if lineStatusList[lineStatus][i] == 2 { + extrovertsCountInner[lineStatus]++ + scoreInner[lineStatus] += 40 + } + // 行内分数 + if i-1 >= 0 { + scoreInner[lineStatus] += closeScore(lineStatusList[lineStatus][i], lineStatusList[lineStatus][i-1]) + } + } + } + } + // 行外分数 + for lineStatus0 := 0; lineStatus0 < int(n3); lineStatus0++ { + for lineStatus1 := 0; lineStatus1 < int(n3); lineStatus1++ { + scoreOuter[lineStatus0][lineStatus1] = 0 + for i := 0; i < n; i++ { + scoreOuter[lineStatus0][lineStatus1] += closeScore(lineStatusList[lineStatus0][i], lineStatusList[lineStatus1][i]) + } + } + } + return dfs(0, 0, introvertsCount, extrovertsCount, m, int(n3), &dp, &introvertsCountInner, &extrovertsCountInner, &scoreInner, &scoreOuter) +} + +// 如果 x 和 y 相邻,需要加上的分数 +func closeScore(x, y int) int { + if x == 0 || y == 0 { + return 0 + } + // 两个内向的人,每个人要 -30,一共 -60 + if x == 1 && y == 1 { + return -60 + } + if x == 2 && y == 2 { + return 40 + } + return -10 +} + +// dfs(上一行的 lineStatus,当前处理到的行,剩余的内向人数,剩余的外向人数) +func dfs(lineStatusLast, row, introvertsCount, extrovertsCount, m, n3 int, dp *[729][6][7][7]int, introvertsCountInner, extrovertsCountInner, scoreInner *[729]int, scoreOuter *[729][729]int) int { + // 边界条件:如果已经处理完,或者没有人了 + if row == m || introvertsCount+extrovertsCount == 0 { + return 0 + } + // 记忆化 + if dp[lineStatusLast][row][introvertsCount][extrovertsCount] != -1 { + return dp[lineStatusLast][row][introvertsCount][extrovertsCount] + } + best := 0 + for lineStatus := 0; lineStatus < n3; lineStatus++ { + if introvertsCountInner[lineStatus] > introvertsCount || extrovertsCountInner[lineStatus] > extrovertsCount { + continue + } + score := scoreInner[lineStatus] + scoreOuter[lineStatus][lineStatusLast] + best = max(best, score+dfs(lineStatus, row+1, introvertsCount-introvertsCountInner[lineStatus], extrovertsCount-extrovertsCountInner[lineStatus], m, n3, dp, introvertsCountInner, extrovertsCountInner, scoreInner, scoreOuter)) + } + dp[lineStatusLast][row][introvertsCount][extrovertsCount] = best + return best +} + +func max(a int, b int) int { + if a > b { + return a + } + return b +} diff --git a/leetcode/1659.Maximize-Grid-Happiness/1659. Maximize Grid Happiness_test.go b/leetcode/1659.Maximize-Grid-Happiness/1659. Maximize Grid Happiness_test.go new file mode 100644 index 00000000..909e36b0 --- /dev/null +++ b/leetcode/1659.Maximize-Grid-Happiness/1659. Maximize Grid Happiness_test.go @@ -0,0 +1,55 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1659 struct { + para1659 + ans1659 +} + +// para 是参数 +// one 代表第一个参数 +type para1659 struct { + m int + n int + introvertsCount int + extrovertsCount int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1659 struct { + one int +} + +func Test_Problem1659(t *testing.T) { + + qs := []question1659{ + + { + para1659{2, 3, 1, 2}, + ans1659{240}, + }, + + { + para1659{3, 1, 2, 1}, + ans1659{260}, + }, + + { + para1659{2, 2, 4, 0}, + ans1659{240}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1659------------------------\n") + + for _, q := range qs { + _, p := q.ans1659, q.para1659 + fmt.Printf("【input】:%v 【output】:%v \n", p, getMaxGridHappiness(p.m, p.n, p.introvertsCount, p.extrovertsCount)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1659.Maximize-Grid-Happiness/README.md b/leetcode/1659.Maximize-Grid-Happiness/README.md new file mode 100644 index 00000000..6f880d26 --- /dev/null +++ b/leetcode/1659.Maximize-Grid-Happiness/README.md @@ -0,0 +1,185 @@ +# [1659. Maximize Grid Happiness](https://leetcode.com/problems/maximize-grid-happiness/) + +## 题目 + +You are given four integers, `m`, `n`, `introvertsCount`, and `extrovertsCount`. You have an `m x n` grid, and there are two types of people: introverts and extroverts. There are `introvertsCount` introverts and `extrovertsCount` extroverts. + +You should decide how many people you want to live in the grid and assign each of them one grid cell. Note that you **do not** have to have all the people living in the grid. + +The **happiness** of each person is calculated as follows: + +- Introverts **start** with `120` happiness and **lose** `30` happiness for each neighbor (introvert or extrovert). +- Extroverts **start** with `40` happiness and **gain** `20` happiness for each neighbor (introvert or extrovert). + +Neighbors live in the directly adjacent cells north, east, south, and west of a person's cell. + +The **grid happiness** is the **sum** of each person's happiness. Return *the **maximum possible grid happiness**.* + +**Example 1:** + +![https://assets.leetcode.com/uploads/2020/11/05/grid_happiness.png](https://assets.leetcode.com/uploads/2020/11/05/grid_happiness.png) + +``` +Input: m = 2, n = 3, introvertsCount = 1, extrovertsCount = 2 +Output: 240 +Explanation: Assume the grid is 1-indexed with coordinates (row, column). +We can put the introvert in cell (1,1) and put the extroverts in cells (1,3) and (2,3). +- Introvert at (1,1) happiness: 120 (starting happiness) - (0 * 30) (0 neighbors) = 120 +- Extrovert at (1,3) happiness: 40 (starting happiness) + (1 * 20) (1 neighbor) = 60 +- Extrovert at (2,3) happiness: 40 (starting happiness) + (1 * 20) (1 neighbor) = 60 +The grid happiness is 120 + 60 + 60 = 240. +The above figure shows the grid in this example with each person's happiness. The introvert stays in the light green cell while the extroverts live on the light purple cells. +``` + +**Example 2:** + +``` +Input: m = 3, n = 1, introvertsCount = 2, extrovertsCount = 1 +Output: 260 +Explanation: Place the two introverts in (1,1) and (3,1) and the extrovert at (2,1). +- Introvert at (1,1) happiness: 120 (starting happiness) - (1 * 30) (1 neighbor) = 90 +- Extrovert at (2,1) happiness: 40 (starting happiness) + (2 * 20) (2 neighbors) = 80 +- Introvert at (3,1) happiness: 120 (starting happiness) - (1 * 30) (1 neighbor) = 90 +The grid happiness is 90 + 80 + 90 = 260. +``` + +**Example 3:** + +``` +Input: m = 2, n = 2, introvertsCount = 4, extrovertsCount = 0 +Output: 240 +``` + +**Constraints:** + +- `1 <= m, n <= 5` +- `0 <= introvertsCount, extrovertsCount <= min(m * n, 6)` + +## 题目大意 + +给你四个整数 m、n、introvertsCount 和 extrovertsCount 。有一个 m x n 网格,和两种类型的人:内向的人和外向的人。总共有 introvertsCount 个内向的人和 extrovertsCount 个外向的人。请你决定网格中应当居住多少人,并为每个人分配一个网格单元。 注意,不必 让所有人都生活在网格中。每个人的 幸福感 计算如下: + +- 内向的人 开始 时有 120 个幸福感,但每存在一个邻居(内向的或外向的)他都会 失去 30 个幸福感。 +- 外向的人 开始 时有 40 个幸福感,每存在一个邻居(内向的或外向的)他都会 得到 20 个幸福感。 + +邻居是指居住在一个人所在单元的上、下、左、右四个直接相邻的单元中的其他人。网格幸福感 是每个人幸福感的 总和 。 返回 最大可能的网格幸福感 。 + +## 解题思路 + +- 给出 `m` x `n` 网格和两种人,要求如何安排这两种人能使得网格的得分最大。两种人有各自的初始分,相邻可能会加分也有可能减分。 +- 这一题状态很多。首先每个格子有 3 种状态,那么每一行有 3^6 = 729 种不同的状态。每行行内分数变化值可能是 -60(两个内向),+40(两个外向),-10(一个内向一个外向)。两行行间分数变化值可能是 -60(两个内向),+40(两个外向),-10(一个内向一个外向)。那么我们可以把每行的状态压缩成一个三进制,那么网格就变成了一维,每两个三进制之间的关系是行间关系,每个三进制内部还需要根据内向和外向的人数决定行内最终分数。定义 `dp[lineStatusLast][row][introvertsCount][extrovertsCount]` 代表在上一行 `row - 1` 的状态是 `lineStatusLast` 的情况下,当前枚举到了第 `row` 行,内向还有 `introvertsCount` 个人,外向还有 `extrovertsCount` 个人能获得的最大分数。状态转移方程是 `dp[lineStatusLast(row-1)][row][introvertsCount][extrovertsCount] = max{dp[lineStatusLast(row)][row+1][introvertsCount - countIC(lineStatusLast(row)) ][extrovertsCount - countEC(lineStatusLast(row)) ] + scoreInner(lineStatusLast(row)) + scoreOuter(lineStatusLast(row-1),lineStatusLast(row))}` ,这里有 2 个统计函数,`countIC` 是统计当前行状态三进制里面有多少个内向人。`countEC` 是统计当前行状态三进制里面有多少个外向人。`scoreInner` 是计算当前行状态三进制的行内分数。`scoreOuter` 是计算 `row -1` 行和 `row` 行之间的行间分数。 +- 由于这个状态转移方程的计算量是巨大的。所以需要预先初始化一些计算结果。比如把 729 中行状态分别对应的行内、行间的分数都计算好,在动态规划状态转移的时候,直接查表获取分数即可。这样我们在深搜的时候,利用 dp 的记忆化,可以大幅减少时间复杂度。 +- 题目中还提到,人数可以不用完。如果 `introvertsCount = 0`, `extrovertsCount = 0` ,即人数都用完了的情况,这时候 `dp = 0`。如果 `row = m`,即已经枚举完了所有行,那么不管剩下多少人,这一行的 `dp = 0` 。 +- 初始化的时候,注意,特殊处理 0 的情况,0 行 0 列都初始化为 -1 。 + +## 代码 + +```go +package leetcode + +import ( + "math" +) + +func getMaxGridHappiness(m int, n int, introvertsCount int, extrovertsCount int) int { + // lineStatus 将每一行中 3 种状态进行编码,空白 - 0,内向人 - 1,外向人 - 2,每行状态用三进制表示 + // lineStatusList[729][6] 每一行的三进制表示 + // introvertsCountInner[729] 每一个 lineStatus 包含的内向人数 + // extrovertsCountInner[729] 每一个 lineStatus 包含的外向人数 + // scoreInner[729] 每一个 lineStatus 包含的行内得分(只统计 lineStatus 本身的得分,不包括它与上一行的) + // scoreOuter[729][729] 每一个 lineStatus 包含的行外得分 + // dp[上一行的 lineStatus][当前处理到的行][剩余的内向人数][剩余的外向人数] + n3, lineStatus, introvertsCountInner, extrovertsCountInner, scoreInner, scoreOuter, lineStatusList, dp := math.Pow(3.0, float64(n)), 0, [729]int{}, [729]int{}, [729]int{}, [729][729]int{}, [729][6]int{}, [729][6][7][7]int{} + for i := 0; i < 729; i++ { + lineStatusList[i] = [6]int{} + } + for i := 0; i < 729; i++ { + dp[i] = [6][7][7]int{} + for j := 0; j < 6; j++ { + dp[i][j] = [7][7]int{} + for k := 0; k < 7; k++ { + dp[i][j][k] = [7]int{-1, -1, -1, -1, -1, -1, -1} + } + } + } + // 预处理 + for lineStatus = 0; lineStatus < int(n3); lineStatus++ { + tmp := lineStatus + for i := 0; i < n; i++ { + lineStatusList[lineStatus][i] = tmp % 3 + tmp /= 3 + } + introvertsCountInner[lineStatus], extrovertsCountInner[lineStatus], scoreInner[lineStatus] = 0, 0, 0 + for i := 0; i < n; i++ { + if lineStatusList[lineStatus][i] != 0 { + // 个人分数 + if lineStatusList[lineStatus][i] == 1 { + introvertsCountInner[lineStatus]++ + scoreInner[lineStatus] += 120 + } else if lineStatusList[lineStatus][i] == 2 { + extrovertsCountInner[lineStatus]++ + scoreInner[lineStatus] += 40 + } + // 行内分数 + if i-1 >= 0 { + scoreInner[lineStatus] += closeScore(lineStatusList[lineStatus][i], lineStatusList[lineStatus][i-1]) + } + } + } + } + // 行外分数 + for lineStatus0 := 0; lineStatus0 < int(n3); lineStatus0++ { + for lineStatus1 := 0; lineStatus1 < int(n3); lineStatus1++ { + scoreOuter[lineStatus0][lineStatus1] = 0 + for i := 0; i < n; i++ { + scoreOuter[lineStatus0][lineStatus1] += closeScore(lineStatusList[lineStatus0][i], lineStatusList[lineStatus1][i]) + } + } + } + return dfs(0, 0, introvertsCount, extrovertsCount, m, int(n3), &dp, &introvertsCountInner, &extrovertsCountInner, &scoreInner, &scoreOuter) +} + +// 如果 x 和 y 相邻,需要加上的分数 +func closeScore(x, y int) int { + if x == 0 || y == 0 { + return 0 + } + // 两个内向的人,每个人要 -30,一共 -60 + if x == 1 && y == 1 { + return -60 + } + if x == 2 && y == 2 { + return 40 + } + return -10 +} + +// dfs(上一行的 lineStatus,当前处理到的行,剩余的内向人数,剩余的外向人数) +func dfs(lineStatusLast, row, introvertsCount, extrovertsCount, m, n3 int, dp *[729][6][7][7]int, introvertsCountInner, extrovertsCountInner, scoreInner *[729]int, scoreOuter *[729][729]int) int { + // 边界条件:如果已经处理完,或者没有人了 + if row == m || introvertsCount+extrovertsCount == 0 { + return 0 + } + // 记忆化 + if dp[lineStatusLast][row][introvertsCount][extrovertsCount] != -1 { + return dp[lineStatusLast][row][introvertsCount][extrovertsCount] + } + best := 0 + for lineStatus := 0; lineStatus < n3; lineStatus++ { + if introvertsCountInner[lineStatus] > introvertsCount || extrovertsCountInner[lineStatus] > extrovertsCount { + continue + } + score := scoreInner[lineStatus] + scoreOuter[lineStatus][lineStatusLast] + best = max(best, score+dfs(lineStatus, row+1, introvertsCount-introvertsCountInner[lineStatus], extrovertsCount-extrovertsCountInner[lineStatus], m, n3, dp, introvertsCountInner, extrovertsCountInner, scoreInner, scoreOuter)) + } + dp[lineStatusLast][row][introvertsCount][extrovertsCount] = best + return best +} + +func max(a int, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md b/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md new file mode 100644 index 00000000..3fb34d44 --- /dev/null +++ b/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md @@ -0,0 +1,96 @@ +# [1658. Minimum Operations to Reduce X to Zero](https://leetcode.com/problems/minimum-operations-to-reduce-x-to-zero/) + + +## 题目 + +You are given an integer array `nums` and an integer `x`. In one operation, you can either remove the leftmost or the rightmost element from the array `nums` and subtract its value from `x`. Note that this **modifies** the array for future operations. + +Return *the **minimum number** of operations to reduce* `x` *to **exactly*** `0` *if it's possible, otherwise, return* `1`. + +**Example 1:** + +``` +Input: nums = [1,1,4,2,3], x = 5 +Output: 2 +Explanation: The optimal solution is to remove the last two elements to reduce x to zero. + +``` + +**Example 2:** + +``` +Input: nums = [5,6,7,8,9], x = 4 +Output: -1 + +``` + +**Example 3:** + +``` +Input: nums = [3,2,20,1,1,3], x = 10 +Output: 5 +Explanation: The optimal solution is to remove the last three elements and the first two elements (5 operations in total) to reduce x to zero. + +``` + +**Constraints:** + +- `1 <= nums.length <= 105` +- `1 <= nums[i] <= 104` +- `1 <= x <= 109` + +## 题目大意 + +给你一个整数数组 nums 和一个整数 x 。每一次操作时,你应当移除数组 nums 最左边或最右边的元素,然后从 x 中减去该元素的值。请注意,需要 修改 数组以供接下来的操作使用。如果可以将 x 恰好 减到 0 ,返回 最小操作数 ;否则,返回 -1 。 + +## 解题思路 + +- 给定一个数组 nums 和一个整数 x,要求从数组两端分别移除一些数,使得这些数加起来正好等于整数 x,要求输出最小操作数。 +- 要求输出最小操作数,即数组两头的数字个数最少,并且加起来和正好等于整数 x。由于在数组的两头,用 2 个指针分别操作不太方便。我当时解题的时候的思路是把它变成循环数组,这样两边的指针就在一个区间内了。利用滑动窗口找到一个最小的窗口,使得窗口内的累加和等于整数 k。这个方法可行,但是代码挺多的。 +- 有没有更优美的方法呢?有的。要想两头的长度最少,也就是中间这段的长度最大。这样就转换成直接在数组上使用滑动窗口求解,累加和等于一个固定值的连续最长的子数组。 +- 和这道题类似思路的题目,209,1040(循环数组),325。强烈推荐这 3 题。 + +## 代码 + +```go +package leetcode + +func minOperations(nums []int, x int) int { + total := 0 + for _, n := range nums { + total += n + } + target := total - x + if target < 0 { + return -1 + } + if target == 0 { + return len(nums) + } + left, right, sum, res := 0, 0, 0, -1 + for right < len(nums) { + if sum < target { + sum += nums[right] + right++ + } + for sum >= target { + if sum == target { + res = max(res, right-left) + } + sum -= nums[left] + left++ + } + } + if res == -1 { + return -1 + } + return len(nums) - res +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md b/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md new file mode 100644 index 00000000..6f880d26 --- /dev/null +++ b/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md @@ -0,0 +1,185 @@ +# [1659. Maximize Grid Happiness](https://leetcode.com/problems/maximize-grid-happiness/) + +## 题目 + +You are given four integers, `m`, `n`, `introvertsCount`, and `extrovertsCount`. You have an `m x n` grid, and there are two types of people: introverts and extroverts. There are `introvertsCount` introverts and `extrovertsCount` extroverts. + +You should decide how many people you want to live in the grid and assign each of them one grid cell. Note that you **do not** have to have all the people living in the grid. + +The **happiness** of each person is calculated as follows: + +- Introverts **start** with `120` happiness and **lose** `30` happiness for each neighbor (introvert or extrovert). +- Extroverts **start** with `40` happiness and **gain** `20` happiness for each neighbor (introvert or extrovert). + +Neighbors live in the directly adjacent cells north, east, south, and west of a person's cell. + +The **grid happiness** is the **sum** of each person's happiness. Return *the **maximum possible grid happiness**.* + +**Example 1:** + +![https://assets.leetcode.com/uploads/2020/11/05/grid_happiness.png](https://assets.leetcode.com/uploads/2020/11/05/grid_happiness.png) + +``` +Input: m = 2, n = 3, introvertsCount = 1, extrovertsCount = 2 +Output: 240 +Explanation: Assume the grid is 1-indexed with coordinates (row, column). +We can put the introvert in cell (1,1) and put the extroverts in cells (1,3) and (2,3). +- Introvert at (1,1) happiness: 120 (starting happiness) - (0 * 30) (0 neighbors) = 120 +- Extrovert at (1,3) happiness: 40 (starting happiness) + (1 * 20) (1 neighbor) = 60 +- Extrovert at (2,3) happiness: 40 (starting happiness) + (1 * 20) (1 neighbor) = 60 +The grid happiness is 120 + 60 + 60 = 240. +The above figure shows the grid in this example with each person's happiness. The introvert stays in the light green cell while the extroverts live on the light purple cells. +``` + +**Example 2:** + +``` +Input: m = 3, n = 1, introvertsCount = 2, extrovertsCount = 1 +Output: 260 +Explanation: Place the two introverts in (1,1) and (3,1) and the extrovert at (2,1). +- Introvert at (1,1) happiness: 120 (starting happiness) - (1 * 30) (1 neighbor) = 90 +- Extrovert at (2,1) happiness: 40 (starting happiness) + (2 * 20) (2 neighbors) = 80 +- Introvert at (3,1) happiness: 120 (starting happiness) - (1 * 30) (1 neighbor) = 90 +The grid happiness is 90 + 80 + 90 = 260. +``` + +**Example 3:** + +``` +Input: m = 2, n = 2, introvertsCount = 4, extrovertsCount = 0 +Output: 240 +``` + +**Constraints:** + +- `1 <= m, n <= 5` +- `0 <= introvertsCount, extrovertsCount <= min(m * n, 6)` + +## 题目大意 + +给你四个整数 m、n、introvertsCount 和 extrovertsCount 。有一个 m x n 网格,和两种类型的人:内向的人和外向的人。总共有 introvertsCount 个内向的人和 extrovertsCount 个外向的人。请你决定网格中应当居住多少人,并为每个人分配一个网格单元。 注意,不必 让所有人都生活在网格中。每个人的 幸福感 计算如下: + +- 内向的人 开始 时有 120 个幸福感,但每存在一个邻居(内向的或外向的)他都会 失去 30 个幸福感。 +- 外向的人 开始 时有 40 个幸福感,每存在一个邻居(内向的或外向的)他都会 得到 20 个幸福感。 + +邻居是指居住在一个人所在单元的上、下、左、右四个直接相邻的单元中的其他人。网格幸福感 是每个人幸福感的 总和 。 返回 最大可能的网格幸福感 。 + +## 解题思路 + +- 给出 `m` x `n` 网格和两种人,要求如何安排这两种人能使得网格的得分最大。两种人有各自的初始分,相邻可能会加分也有可能减分。 +- 这一题状态很多。首先每个格子有 3 种状态,那么每一行有 3^6 = 729 种不同的状态。每行行内分数变化值可能是 -60(两个内向),+40(两个外向),-10(一个内向一个外向)。两行行间分数变化值可能是 -60(两个内向),+40(两个外向),-10(一个内向一个外向)。那么我们可以把每行的状态压缩成一个三进制,那么网格就变成了一维,每两个三进制之间的关系是行间关系,每个三进制内部还需要根据内向和外向的人数决定行内最终分数。定义 `dp[lineStatusLast][row][introvertsCount][extrovertsCount]` 代表在上一行 `row - 1` 的状态是 `lineStatusLast` 的情况下,当前枚举到了第 `row` 行,内向还有 `introvertsCount` 个人,外向还有 `extrovertsCount` 个人能获得的最大分数。状态转移方程是 `dp[lineStatusLast(row-1)][row][introvertsCount][extrovertsCount] = max{dp[lineStatusLast(row)][row+1][introvertsCount - countIC(lineStatusLast(row)) ][extrovertsCount - countEC(lineStatusLast(row)) ] + scoreInner(lineStatusLast(row)) + scoreOuter(lineStatusLast(row-1),lineStatusLast(row))}` ,这里有 2 个统计函数,`countIC` 是统计当前行状态三进制里面有多少个内向人。`countEC` 是统计当前行状态三进制里面有多少个外向人。`scoreInner` 是计算当前行状态三进制的行内分数。`scoreOuter` 是计算 `row -1` 行和 `row` 行之间的行间分数。 +- 由于这个状态转移方程的计算量是巨大的。所以需要预先初始化一些计算结果。比如把 729 中行状态分别对应的行内、行间的分数都计算好,在动态规划状态转移的时候,直接查表获取分数即可。这样我们在深搜的时候,利用 dp 的记忆化,可以大幅减少时间复杂度。 +- 题目中还提到,人数可以不用完。如果 `introvertsCount = 0`, `extrovertsCount = 0` ,即人数都用完了的情况,这时候 `dp = 0`。如果 `row = m`,即已经枚举完了所有行,那么不管剩下多少人,这一行的 `dp = 0` 。 +- 初始化的时候,注意,特殊处理 0 的情况,0 行 0 列都初始化为 -1 。 + +## 代码 + +```go +package leetcode + +import ( + "math" +) + +func getMaxGridHappiness(m int, n int, introvertsCount int, extrovertsCount int) int { + // lineStatus 将每一行中 3 种状态进行编码,空白 - 0,内向人 - 1,外向人 - 2,每行状态用三进制表示 + // lineStatusList[729][6] 每一行的三进制表示 + // introvertsCountInner[729] 每一个 lineStatus 包含的内向人数 + // extrovertsCountInner[729] 每一个 lineStatus 包含的外向人数 + // scoreInner[729] 每一个 lineStatus 包含的行内得分(只统计 lineStatus 本身的得分,不包括它与上一行的) + // scoreOuter[729][729] 每一个 lineStatus 包含的行外得分 + // dp[上一行的 lineStatus][当前处理到的行][剩余的内向人数][剩余的外向人数] + n3, lineStatus, introvertsCountInner, extrovertsCountInner, scoreInner, scoreOuter, lineStatusList, dp := math.Pow(3.0, float64(n)), 0, [729]int{}, [729]int{}, [729]int{}, [729][729]int{}, [729][6]int{}, [729][6][7][7]int{} + for i := 0; i < 729; i++ { + lineStatusList[i] = [6]int{} + } + for i := 0; i < 729; i++ { + dp[i] = [6][7][7]int{} + for j := 0; j < 6; j++ { + dp[i][j] = [7][7]int{} + for k := 0; k < 7; k++ { + dp[i][j][k] = [7]int{-1, -1, -1, -1, -1, -1, -1} + } + } + } + // 预处理 + for lineStatus = 0; lineStatus < int(n3); lineStatus++ { + tmp := lineStatus + for i := 0; i < n; i++ { + lineStatusList[lineStatus][i] = tmp % 3 + tmp /= 3 + } + introvertsCountInner[lineStatus], extrovertsCountInner[lineStatus], scoreInner[lineStatus] = 0, 0, 0 + for i := 0; i < n; i++ { + if lineStatusList[lineStatus][i] != 0 { + // 个人分数 + if lineStatusList[lineStatus][i] == 1 { + introvertsCountInner[lineStatus]++ + scoreInner[lineStatus] += 120 + } else if lineStatusList[lineStatus][i] == 2 { + extrovertsCountInner[lineStatus]++ + scoreInner[lineStatus] += 40 + } + // 行内分数 + if i-1 >= 0 { + scoreInner[lineStatus] += closeScore(lineStatusList[lineStatus][i], lineStatusList[lineStatus][i-1]) + } + } + } + } + // 行外分数 + for lineStatus0 := 0; lineStatus0 < int(n3); lineStatus0++ { + for lineStatus1 := 0; lineStatus1 < int(n3); lineStatus1++ { + scoreOuter[lineStatus0][lineStatus1] = 0 + for i := 0; i < n; i++ { + scoreOuter[lineStatus0][lineStatus1] += closeScore(lineStatusList[lineStatus0][i], lineStatusList[lineStatus1][i]) + } + } + } + return dfs(0, 0, introvertsCount, extrovertsCount, m, int(n3), &dp, &introvertsCountInner, &extrovertsCountInner, &scoreInner, &scoreOuter) +} + +// 如果 x 和 y 相邻,需要加上的分数 +func closeScore(x, y int) int { + if x == 0 || y == 0 { + return 0 + } + // 两个内向的人,每个人要 -30,一共 -60 + if x == 1 && y == 1 { + return -60 + } + if x == 2 && y == 2 { + return 40 + } + return -10 +} + +// dfs(上一行的 lineStatus,当前处理到的行,剩余的内向人数,剩余的外向人数) +func dfs(lineStatusLast, row, introvertsCount, extrovertsCount, m, n3 int, dp *[729][6][7][7]int, introvertsCountInner, extrovertsCountInner, scoreInner *[729]int, scoreOuter *[729][729]int) int { + // 边界条件:如果已经处理完,或者没有人了 + if row == m || introvertsCount+extrovertsCount == 0 { + return 0 + } + // 记忆化 + if dp[lineStatusLast][row][introvertsCount][extrovertsCount] != -1 { + return dp[lineStatusLast][row][introvertsCount][extrovertsCount] + } + best := 0 + for lineStatus := 0; lineStatus < n3; lineStatus++ { + if introvertsCountInner[lineStatus] > introvertsCount || extrovertsCountInner[lineStatus] > extrovertsCount { + continue + } + score := scoreInner[lineStatus] + scoreOuter[lineStatus][lineStatusLast] + best = max(best, score+dfs(lineStatus, row+1, introvertsCount-introvertsCountInner[lineStatus], extrovertsCount-extrovertsCountInner[lineStatus], m, n3, dp, introvertsCountInner, extrovertsCountInner, scoreInner, scoreOuter)) + } + dp[lineStatusLast][row][introvertsCount][extrovertsCount] = best + return best +} + +func max(a int, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 119f9b1c..98c92a28 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -552,4 +552,8 @@ headless: true - [1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}}) - [1648.Sell-Diminishing-Valued-Colored-Balls]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}}) - [1649.Create-Sorted-Array-through-Instructions]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}}) + - [1656.Design-an-Ordered-Stream]({{< relref "/ChapterFour/1656.Design-an-Ordered-Stream.md" >}}) + - [1657.Determine-if-Two-Strings-Are-Close]({{< relref "/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md" >}}) + - [1658.Minimum-Operations-to-Reduce-X-to-Zero]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}}) + - [1659.Maximize-Grid-Happiness]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})
From 37fde650a5b1bd4163480dcce6993da8f392bc0f Mon Sep 17 00:00:00 2001 From: YDZ Date: Mon, 23 Nov 2020 22:17:33 +0800 Subject: [PATCH 33/82] =?UTF-8?q?Add=20solution=201662=E3=80=811663?= =?UTF-8?q?=E3=80=811664=E3=80=811665?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eck If Two String Arrays are Equivalent.go | 12 ++ ...f Two String Arrays are Equivalent_test.go | 53 ++++++++ .../README.md | 65 +++++++++ ...llest String With A Given Numeric Value.go | 55 ++++++++ ... String With A Given Numeric Value_test.go | 53 ++++++++ .../README.md | 104 ++++++++++++++ .../1664. Ways to Make a Fair Array.go | 45 ++++++ .../1664. Ways to Make a Fair Array_test.go | 57 ++++++++ .../1664.Ways-to-Make-a-Fair-Array/README.md | 116 ++++++++++++++++ ... Minimum Initial Energy to Finish Tasks.go | 47 +++++++ ...mum Initial Energy to Finish Tasks_test.go | 52 +++++++ .../README.md | 128 ++++++++++++++++++ ...eck-If-Two-String-Arrays-are-Equivalent.md | 65 +++++++++ ...llest-String-With-A-Given-Numeric-Value.md | 104 ++++++++++++++ .../1664.Ways-to-Make-a-Fair-Array.md | 116 ++++++++++++++++ ....Minimum-Initial-Energy-to-Finish-Tasks.md | 128 ++++++++++++++++++ website/content/menu/index.md | 4 + 17 files changed, 1204 insertions(+) create mode 100644 leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/1662. Check If Two String Arrays are Equivalent.go create mode 100644 leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/1662. Check If Two String Arrays are Equivalent_test.go create mode 100644 leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/README.md create mode 100644 leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/1663. Smallest String With A Given Numeric Value.go create mode 100644 leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/1663. Smallest String With A Given Numeric Value_test.go create mode 100644 leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/README.md create mode 100644 leetcode/1664.Ways-to-Make-a-Fair-Array/1664. Ways to Make a Fair Array.go create mode 100644 leetcode/1664.Ways-to-Make-a-Fair-Array/1664. Ways to Make a Fair Array_test.go create mode 100644 leetcode/1664.Ways-to-Make-a-Fair-Array/README.md create mode 100644 leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/1665. Minimum Initial Energy to Finish Tasks.go create mode 100644 leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/1665. Minimum Initial Energy to Finish Tasks_test.go create mode 100644 leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/README.md create mode 100644 website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md create mode 100644 website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md create mode 100644 website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md create mode 100644 website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md diff --git a/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/1662. Check If Two String Arrays are Equivalent.go b/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/1662. Check If Two String Arrays are Equivalent.go new file mode 100644 index 00000000..f85e3b05 --- /dev/null +++ b/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/1662. Check If Two String Arrays are Equivalent.go @@ -0,0 +1,12 @@ +package leetcode + +func arrayStringsAreEqual(word1 []string, word2 []string) bool { + str1, str2 := "", "" + for i := 0; i < len(word1); i++ { + str1 += word1[i] + } + for i := 0; i < len(word2); i++ { + str2 += word2[i] + } + return str1 == str2 +} diff --git a/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/1662. Check If Two String Arrays are Equivalent_test.go b/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/1662. Check If Two String Arrays are Equivalent_test.go new file mode 100644 index 00000000..271b0dea --- /dev/null +++ b/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/1662. Check If Two String Arrays are Equivalent_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1662 struct { + para1662 + ans1662 +} + +// para 是参数 +// one 代表第一个参数 +type para1662 struct { + word1 []string + word2 []string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1662 struct { + one bool +} + +func Test_Problem1662(t *testing.T) { + + qs := []question1662{ + + { + para1662{[]string{"ab", "c"}, []string{"a", "bc"}}, + ans1662{true}, + }, + + { + para1662{[]string{"a", "cb"}, []string{"ab", "c"}}, + ans1662{false}, + }, + + { + para1662{[]string{"abc", "d", "defg"}, []string{"abcddefg"}}, + ans1662{true}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1662------------------------\n") + + for _, q := range qs { + _, p := q.ans1662, q.para1662 + fmt.Printf("【input】:%v 【output】:%v \n", p, arrayStringsAreEqual(p.word1, p.word2)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/README.md b/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/README.md new file mode 100644 index 00000000..d1e47d01 --- /dev/null +++ b/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/README.md @@ -0,0 +1,65 @@ +# [1662. Check If Two String Arrays are Equivalent](https://leetcode.com/problems/check-if-two-string-arrays-are-equivalent/) + + +## 题目 + +Given two string arrays `word1` and `word2`, return **`true` *if the two arrays **represent** the same string, and* `false` *otherwise.* + +A string is **represented** by an array if the array elements concatenated **in order** forms the string. + +**Example 1:** + +``` +Input: word1 = ["ab", "c"], word2 = ["a", "bc"] +Output: true +Explanation: +word1 represents string "ab" + "c" -> "abc" +word2 represents string "a" + "bc" -> "abc" +The strings are the same, so return true. +``` + +**Example 2:** + +``` +Input: word1 = ["a", "cb"], word2 = ["ab", "c"] +Output: false +``` + +**Example 3:** + +``` +Input: word1 = ["abc", "d", "defg"], word2 = ["abcddefg"] +Output: true +``` + +**Constraints:** + +- `1 <= word1.length, word2.length <= 103` +- `1 <= word1[i].length, word2[i].length <= 103` +- `1 <= sum(word1[i].length), sum(word2[i].length) <= 103` +- `word1[i]` and `word2[i]` consist of lowercase letters. + +## 题目大意 + +给你两个字符串数组 word1 和 word2 。如果两个数组表示的字符串相同,返回 true ;否则,返回 false 。数组表示的字符串 是由数组中的所有元素 按顺序 连接形成的字符串。 + +## 解题思路 + +- 简单题,依次拼接 2 个数组内的字符串,然后比较 str1 和 str2 是否相同即可。 + +## 代码 + +```go +package leetcode + +func arrayStringsAreEqual(word1 []string, word2 []string) bool { + str1, str2 := "", "" + for i := 0; i < len(word1); i++ { + str1 += word1[i] + } + for i := 0; i < len(word2); i++ { + str2 += word2[i] + } + return str1 == str2 +} +``` \ No newline at end of file diff --git a/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/1663. Smallest String With A Given Numeric Value.go b/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/1663. Smallest String With A Given Numeric Value.go new file mode 100644 index 00000000..f1ae2dca --- /dev/null +++ b/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/1663. Smallest String With A Given Numeric Value.go @@ -0,0 +1,55 @@ +package leetcode + +// 解法一 贪心 +func getSmallestString(n int, k int) string { + res := make([]rune, n) + for i := n - 1; i >= 0; i-- { + diff := k - i + if diff >= 26 { + // Need to add z + res[i] = 'z' + k = k - 26 + } else { + res[i] = rune('a' + diff - 1) + k = k - diff + } + } + return string(res) +} + +// 解法二 DFS +func getSmallestString1(n int, k int) string { + if n == 0 { + return "" + } + res, c := "", []byte{} + findSmallestString(0, n, k, 0, c, &res) + return res +} + +func findSmallestString(value int, length, k, index int, str []byte, res *string) { + if len(str) == length && value == k { + tmp := string(str) + if (*res) == "" { + *res = tmp + } + if tmp < *res && *res != "" { + *res = tmp + } + return + } + if len(str) >= index && (*res) != "" && str[index-1] > (*res)[index-1] { + return + } + for j := 0; j < 26; j++ { + if k-value > (length-len(str))*26 || value > k { + return + } + str = append(str, byte(int('a')+j)) + value += j + 1 + findSmallestString(value, length, k, index+1, str, res) + str = str[:len(str)-1] + value -= j + 1 + + } +} diff --git a/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/1663. Smallest String With A Given Numeric Value_test.go b/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/1663. Smallest String With A Given Numeric Value_test.go new file mode 100644 index 00000000..f3c07a4c --- /dev/null +++ b/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/1663. Smallest String With A Given Numeric Value_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1663 struct { + para1663 + ans1663 +} + +// para 是参数 +// one 代表第一个参数 +type para1663 struct { + n int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1663 struct { + one string +} + +func Test_Problem1663(t *testing.T) { + + qs := []question1663{ + + { + para1663{3, 27}, + ans1663{"aay"}, + }, + + { + para1663{5, 73}, + ans1663{"aaszz"}, + }, + + { + para1663{24, 552}, + ans1663{"aaszz"}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1663------------------------\n") + + for _, q := range qs { + _, p := q.ans1663, q.para1663 + fmt.Printf("【input】:%v 【output】:%v \n", p, getSmallestString(p.n, p.k)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/README.md b/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/README.md new file mode 100644 index 00000000..e0ab8917 --- /dev/null +++ b/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value/README.md @@ -0,0 +1,104 @@ +# [1663. Smallest String With A Given Numeric Value](https://leetcode.com/problems/smallest-string-with-a-given-numeric-value/) + +## 题目 + +The **numeric value** of a **lowercase character** is defined as its position `(1-indexed)` in the alphabet, so the numeric value of `a` is `1`, the numeric value of `b` is `2`, the numeric value of `c` is `3`, and so on. + +The **numeric value** of a **string** consisting of lowercase characters is defined as the sum of its characters' numeric values. For example, the numeric value of the string `"abe"` is equal to `1 + 2 + 5 = 8`. + +You are given two integers `n` and `k`. Return *the **lexicographically smallest string** with **length** equal to `n` and **numeric value** equal to `k`.* + +Note that a string `x` is lexicographically smaller than string `y` if `x` comes before `y` in dictionary order, that is, either `x` is a prefix of `y`, or if `i` is the first position such that `x[i] != y[i]`, then `x[i]` comes before `y[i]` in alphabetic order. + +**Example 1:** + +``` +Input: n = 3, k = 27 +Output: "aay" +Explanation: The numeric value of the string is 1 + 1 + 25 = 27, and it is the smallest string with such a value and length equal to 3. +``` + +**Example 2:** + +``` +Input: n = 5, k = 73 +Output: "aaszz" +``` + +**Constraints:** + +- `1 <= n <= 105` +- `n <= k <= 26 * n` + +## 题目大意 + +小写字符 的 数值 是它在字母表中的位置(从 1 开始),因此 a 的数值为 1 ,b 的数值为 2 ,c 的数值为 3 ,以此类推。字符串由若干小写字符组成,字符串的数值 为各字符的数值之和。例如,字符串 "abe" 的数值等于 1 + 2 + 5 = 8 。给你两个整数 n 和 k 。返回 长度 等于 n 且 数值 等于 k 的 字典序最小 的字符串。注意,如果字符串 x 在字典排序中位于 y 之前,就认为 x 字典序比 y 小,有以下两种情况: + +- x 是 y 的一个前缀; +- 如果 i 是 x[i] != y[i] 的第一个位置,且 x[i] 在字母表中的位置比 y[i] 靠前。 + +## 解题思路 + +- 给出 n 和 k,要求找到字符串长度为 n,字母在字母表内位置总和为 k 的最小字典序字符串。 +- 这一题笔者读完题,比赛的时候直接用 DFS 撸了一版。赛后看了时间复杂度马马虎虎,感觉还有优化的空间。DFS 会遍历出所有的解,实际上这一题只要求最小字典序,所以 DFS 剪枝的时候要加上判断字典序的判断,如果新添加进来的字母比已经保存的字符串的相应位置上的字母字典序大,那么就直接 return,这个答案一定不会是最小字典序。代码见解法二 +- 想到这里,其实 DFS 不必要,直接用 for 循环就可找到最小字典序的字符串。代码见解法一。 + +## 代码 + +```go +package leetcode + +// 解法一 贪心 +func getSmallestString(n int, k int) string { + res := make([]rune, n) + for i := n - 1; i >= 0; i-- { + diff := k - i + if diff >= 26 { + // Need to add z + res[i] = 'z' + k = k - 26 + } else { + res[i] = rune('a' + diff - 1) + k = k - diff + } + } + return string(res) +} + +// 解法二 DFS +func getSmallestString1(n int, k int) string { + if n == 0 { + return "" + } + res, c := "", []byte{} + findSmallestString(0, n, k, 0, c, &res) + return res +} + +func findSmallestString(value int, length, k, index int, str []byte, res *string) { + if len(str) == length && value == k { + tmp := string(str) + if (*res) == "" { + *res = tmp + } + if tmp < *res && *res != "" { + *res = tmp + } + return + } + if len(str) >= index && (*res) != "" && str[index-1] > (*res)[index-1] { + return + } + for j := 0; j < 26; j++ { + if k-value > (length-len(str))*26 || value > k { + return + } + str = append(str, byte(int('a')+j)) + value += j + 1 + findSmallestString(value, length, k, index+1, str, res) + str = str[:len(str)-1] + value -= j + 1 + + } +} +``` \ No newline at end of file diff --git a/leetcode/1664.Ways-to-Make-a-Fair-Array/1664. Ways to Make a Fair Array.go b/leetcode/1664.Ways-to-Make-a-Fair-Array/1664. Ways to Make a Fair Array.go new file mode 100644 index 00000000..c66641a0 --- /dev/null +++ b/leetcode/1664.Ways-to-Make-a-Fair-Array/1664. Ways to Make a Fair Array.go @@ -0,0 +1,45 @@ +package leetcode + +// 解法一 超简洁写法 +func waysToMakeFair(nums []int) int { + sum, res := [2]int{}, 0 + for i := 0; i < len(nums); i++ { + sum[i%2] += nums[i] + } + for i := 0; i < len(nums); i++ { + sum[i%2] -= nums[i] + if sum[i%2] == sum[1-(i%2)] { + res++ + } + sum[1-(i%2)] += nums[i] + } + return res +} + +// 解法二 前缀和,后缀和 +func waysToMakeFair1(nums []int) int { + evenPrefix, oddPrefix, evenSuffix, oddSuffix, res := 0, 0, 0, 0, 0 + for i := 0; i < len(nums); i++ { + if i%2 == 0 { + evenSuffix += nums[i] + } else { + oddSuffix += nums[i] + } + } + for i := 0; i < len(nums); i++ { + if i%2 == 0 { + evenSuffix -= nums[i] + } else { + oddSuffix -= nums[i] + } + if (evenPrefix + oddSuffix) == (oddPrefix + evenSuffix) { + res++ + } + if i%2 == 0 { + evenPrefix += nums[i] + } else { + oddPrefix += nums[i] + } + } + return res +} diff --git a/leetcode/1664.Ways-to-Make-a-Fair-Array/1664. Ways to Make a Fair Array_test.go b/leetcode/1664.Ways-to-Make-a-Fair-Array/1664. Ways to Make a Fair Array_test.go new file mode 100644 index 00000000..670e994e --- /dev/null +++ b/leetcode/1664.Ways-to-Make-a-Fair-Array/1664. Ways to Make a Fair Array_test.go @@ -0,0 +1,57 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1664 struct { + para1664 + ans1664 +} + +// para 是参数 +// one 代表第一个参数 +type para1664 struct { + nums []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1664 struct { + one int +} + +func Test_Problem1664(t *testing.T) { + + qs := []question1664{ + + { + para1664{[]int{6, 1, 7, 4, 1}}, + ans1664{0}, + }, + + { + para1664{[]int{2, 1, 6, 4}}, + ans1664{1}, + }, + + { + para1664{[]int{1, 1, 1}}, + ans1664{3}, + }, + + { + para1664{[]int{1, 2, 3}}, + ans1664{0}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1664------------------------\n") + + for _, q := range qs { + _, p := q.ans1664, q.para1664 + fmt.Printf("【input】:%v 【output】:%v \n", p, waysToMakeFair(p.nums)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1664.Ways-to-Make-a-Fair-Array/README.md b/leetcode/1664.Ways-to-Make-a-Fair-Array/README.md new file mode 100644 index 00000000..9c40f823 --- /dev/null +++ b/leetcode/1664.Ways-to-Make-a-Fair-Array/README.md @@ -0,0 +1,116 @@ +# [1664. Ways to Make a Fair Array](https://leetcode.com/problems/ways-to-make-a-fair-array/) + + +## 题目 + +You are given an integer array `nums`. You can choose **exactly one** index (**0-indexed**) and remove the element. Notice that the index of the elements may change after the removal. + +For example, if `nums = [6,1,7,4,1]`: + +- Choosing to remove index `1` results in `nums = [6,7,4,1]`. +- Choosing to remove index `2` results in `nums = [6,1,4,1]`. +- Choosing to remove index `4` results in `nums = [6,1,7,4]`. + +An array is **fair** if the sum of the odd-indexed values equals the sum of the even-indexed values. + +Return the ***number** of indices that you could choose such that after the removal,* `nums` *is **fair**.* + +**Example 1:** + +``` +Input: nums = [2,1,6,4] +Output: 1 +Explanation: +Remove index 0: [1,6,4] -> Even sum: 1 + 4 = 5. Odd sum: 6. Not fair. +Remove index 1: [2,6,4] -> Even sum: 2 + 4 = 6. Odd sum: 6. Fair. +Remove index 2: [2,1,4] -> Even sum: 2 + 4 = 6. Odd sum: 1. Not fair. +Remove index 3: [2,1,6] -> Even sum: 2 + 6 = 8. Odd sum: 1. Not fair. +There is 1 index that you can remove to make nums fair. +``` + +**Example 2:** + +``` +Input: nums = [1,1,1] +Output: 3 +Explanation: You can remove any index and the remaining array is fair. +``` + +**Example 3:** + +``` +Input: nums = [1,2,3] +Output: 0 +Explanation: You cannot make a fair array after removing any index. +``` + +**Constraints:** + +- `1 <= nums.length <= 105` +- `1 <= nums[i] <= 104` + +## 题目大意 + +给你一个整数数组 nums 。你需要选择 恰好 一个下标(下标从 0 开始)并删除对应的元素。请注意剩下元素的下标可能会因为删除操作而发生改变。 + +比方说,如果 nums = [6,1,7,4,1] ,那么: + +- 选择删除下标 1 ,剩下的数组为 nums = [6,7,4,1] 。 +- 选择删除下标 2 ,剩下的数组为 nums = [6,1,4,1] 。 +- 选择删除下标 4 ,剩下的数组为 nums = [6,1,7,4] 。 + +如果一个数组满足奇数下标元素的和与偶数下标元素的和相等,该数组就是一个 平衡数组 。请你返回删除操作后,剩下的数组 nums 是 平衡数组 的 方案数 。 + +## 解题思路 + +- 给定一个数组 nums,要求输出仅删除一个元素以后能使得整个数组平衡的方案数。平衡的定义是奇数下标元素总和等于偶数下标元素总和。 +- 这一题如果暴力解答,会超时。原因是每次删除元素以后,都重新计算奇偶数位总和比较耗时。应该利用前面计算过的累加和,推导出此次删除元素以后的情况。这样修改以后就不超时了。具体的,如果删除的是元素是奇数位,这个下标的前缀和不变,要变化的是后面的。删除元素后面,原来偶数位的总和变成了奇数位了,原来奇数位的总和变成偶数位了。删除元素后面这半段的总和可以用前缀和计算出来,奇数位的总和减去删除元素的前缀和,就得到了删除元素后面的后缀和。通过这个办法就可以得到删除元素后面的,奇数位总和,偶数位总和。注意这个后缀和是包含了删除元素的。所以最后需要判断删除元素是奇数位还是偶数位,如果是奇数位,那么在计算出来的偶数和上再减去这个删除元素;如果是偶数位,就在计算出来的奇数和上再减去这个删除元素。代码见解法二。 +- 这一题还有一种更简洁的写法,就是解法一了。通过了解法二的思考,我们可以知道,每次变换以后的操作可以抽象出来,即三步,减去一个数,判断是否相等,再加上一个数。只不过这三步在解法二中都去判断了奇偶性。如果我们不判断奇偶性,那么代码就可以写成解法一的样子。为什么可以不用管奇偶性呢?因为每次删除一个元素以后,下次再删除,奇偶就发生颠倒了,上次的奇数和到了下次就是偶数和了。想通这一点就可以把代码写成解法一的样子。 + +## 代码 + +```go +// 解法一 超简洁写法 +func waysToMakeFair(nums []int) int { + sum, res := [2]int{}, 0 + for i := 0; i < len(nums); i++ { + sum[i%2] += nums[i] + } + for i := 0; i < len(nums); i++ { + sum[i%2] -= nums[i] + if sum[i%2] == sum[1-(i%2)] { + res++ + } + sum[1-(i%2)] += nums[i] + } + return res +} + +// 解法二 前缀和,后缀和 +func waysToMakeFair1(nums []int) int { + evenPrefix, oddPrefix, evenSuffix, oddSuffix, res := 0, 0, 0, 0, 0 + for i := 0; i < len(nums); i++ { + if i%2 == 0 { + evenSuffix += nums[i] + } else { + oddSuffix += nums[i] + } + } + for i := 0; i < len(nums); i++ { + if i%2 == 0 { + evenSuffix -= nums[i] + } else { + oddSuffix -= nums[i] + } + if (evenPrefix + oddSuffix) == (oddPrefix + evenSuffix) { + res++ + } + if i%2 == 0 { + evenPrefix += nums[i] + } else { + oddPrefix += nums[i] + } + } + return res +} +``` \ No newline at end of file diff --git a/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/1665. Minimum Initial Energy to Finish Tasks.go b/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/1665. Minimum Initial Energy to Finish Tasks.go new file mode 100644 index 00000000..f44dfcd9 --- /dev/null +++ b/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/1665. Minimum Initial Energy to Finish Tasks.go @@ -0,0 +1,47 @@ +package leetcode + +import ( + "sort" +) + +func minimumEffort(tasks [][]int) int { + sort.Sort(Task(tasks)) + res, cur := 0, 0 + for _, t := range tasks { + if t[1] > cur { + res += t[1] - cur + cur = t[1] - t[0] + } else { + cur -= t[0] + } + } + return res +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} + +// Task define +type Task [][]int + +func (task Task) Len() int { + return len(task) +} + +func (task Task) Less(i, j int) bool { + t1, t2 := task[i][1]-task[i][0], task[j][1]-task[j][0] + if t1 != t2 { + return t2 < t1 + } + return task[j][1] < task[i][1] +} + +func (task Task) Swap(i, j int) { + t := task[i] + task[i] = task[j] + task[j] = t +} diff --git a/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/1665. Minimum Initial Energy to Finish Tasks_test.go b/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/1665. Minimum Initial Energy to Finish Tasks_test.go new file mode 100644 index 00000000..ce076238 --- /dev/null +++ b/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/1665. Minimum Initial Energy to Finish Tasks_test.go @@ -0,0 +1,52 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1665 struct { + para1665 + ans1665 +} + +// para 是参数 +// one 代表第一个参数 +type para1665 struct { + tasks [][]int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1665 struct { + one int +} + +func Test_Problem1665(t *testing.T) { + + qs := []question1665{ + + { + para1665{[][]int{{1, 2}, {2, 4}, {4, 8}}}, + ans1665{8}, + }, + + { + para1665{[][]int{{1, 3}, {2, 4}, {10, 11}, {10, 12}, {8, 9}}}, + ans1665{32}, + }, + + { + para1665{[][]int{{1, 7}, {2, 8}, {3, 9}, {4, 10}, {5, 11}, {6, 12}}}, + ans1665{27}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1665------------------------\n") + + for _, q := range qs { + _, p := q.ans1665, q.para1665 + fmt.Printf("【input】:%v 【output】:%v \n", p, minimumEffort(p.tasks)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/README.md b/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/README.md new file mode 100644 index 00000000..c2bd57e6 --- /dev/null +++ b/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks/README.md @@ -0,0 +1,128 @@ +# [1665. Minimum Initial Energy to Finish Tasks](https://leetcode.com/problems/minimum-initial-energy-to-finish-tasks/) + +## 题目 + +You are given an array `tasks` where `tasks[i] = [actuali, minimumi]`: + +- `actuali` is the actual amount of energy you **spend to finish** the `ith` task. +- `minimumi` is the minimum amount of energy you **require to begin** the `ith` task. + +For example, if the task is `[10, 12]` and your current energy is `11`, you cannot start this task. However, if your current energy is `13`, you can complete this task, and your energy will be `3` after finishing it. + +You can finish the tasks in **any order** you like. + +Return *the **minimum** initial amount of energy you will need* *to finish all the tasks*. + +**Example 1:** + +``` +Input: tasks = [[1,2],[2,4],[4,8]] +Output: 8 +Explanation: +Starting with 8 energy, we finish the tasks in the following order: + - 3rd task. Now energy = 8 - 4 = 4. + - 2nd task. Now energy = 4 - 2 = 2. + - 1st task. Now energy = 2 - 1 = 1. +Notice that even though we have leftover energy, starting with 7 energy does not work because we cannot do the 3rd task. +``` + +**Example 2:** + +``` +Input: tasks = [[1,3],[2,4],[10,11],[10,12],[8,9]] +Output: 32 +Explanation: +Starting with 32 energy, we finish the tasks in the following order: + - 1st task. Now energy = 32 - 1 = 31. + - 2nd task. Now energy = 31 - 2 = 29. + - 3rd task. Now energy = 29 - 10 = 19. + - 4th task. Now energy = 19 - 10 = 9. + - 5th task. Now energy = 9 - 8 = 1. +``` + +**Example 3:** + +``` +Input: tasks = [[1,7],[2,8],[3,9],[4,10],[5,11],[6,12]] +Output: 27 +Explanation: +Starting with 27 energy, we finish the tasks in the following order: + - 5th task. Now energy = 27 - 5 = 22. + - 2nd task. Now energy = 22 - 2 = 20. + - 3rd task. Now energy = 20 - 3 = 17. + - 1st task. Now energy = 17 - 1 = 16. + - 4th task. Now energy = 16 - 4 = 12. + - 6th task. Now energy = 12 - 6 = 6. + +``` + +**Constraints:** + +- `1 <= tasks.length <= 105` +- `1 <= actuali <= minimumi <= 104` + +## 题目大意 + +给你一个任务数组 tasks ,其中 tasks[i] = [actuali, minimumi] : + +- actual i 是完成第 i 个任务 需要耗费 的实际能量。 +- minimum i 是开始第 i 个任务前需要达到的最低能量。 + +比方说,如果任务为 [10, 12] 且你当前的能量为 11 ,那么你不能开始这个任务。如果你当前的能量为 13 ,你可以完成这个任务,且完成它后剩余能量为 3 。你可以按照 任意顺序 完成任务。请你返回完成所有任务的 最少 初始能量。 + +## 解题思路 + +- 给出一个 task 数组,每个元素代表一个任务,每个任务有实际消费能量值和开始这个任务需要的最低能量。要求输出能完成所有任务的最少初始能量。 +- 这一题直觉是贪心。先将任务按照 `minimum - actual` 进行排序。先完成差值大的任务,那么接下来的能量能最大限度的满足接下来的任务。这样可能完成所有任务的可能性越大。循环任务数组的时候,保存当前能量在 `cur` 中,如果当前能量不够开启下一个任务,那么这个差值就是需要弥补的,这些能量就是最少初始能量中的,所以加上这些差值能量。如果当前能量可以开启下一个任务,那么就更新当前能量,减去实际消耗的能量以后,再继续循环。循环结束就能得到最少初始能量了。 + +## 代码 + +```go +package leetcode + +import ( + "sort" +) + +func minimumEffort(tasks [][]int) int { + sort.Sort(Task(tasks)) + res, cur := 0, 0 + for _, t := range tasks { + if t[1] > cur { + res += t[1] - cur + cur = t[1] - t[0] + } else { + cur -= t[0] + } + } + return res +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} + +// Task define +type Task [][]int + +func (task Task) Len() int { + return len(task) +} + +func (task Task) Less(i, j int) bool { + t1, t2 := task[i][1]-task[i][0], task[j][1]-task[j][0] + if t1 != t2 { + return t2 < t1 + } + return task[j][1] < task[i][1] +} + +func (task Task) Swap(i, j int) { + t := task[i] + task[i] = task[j] + task[j] = t +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md b/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md new file mode 100644 index 00000000..d1e47d01 --- /dev/null +++ b/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md @@ -0,0 +1,65 @@ +# [1662. Check If Two String Arrays are Equivalent](https://leetcode.com/problems/check-if-two-string-arrays-are-equivalent/) + + +## 题目 + +Given two string arrays `word1` and `word2`, return **`true` *if the two arrays **represent** the same string, and* `false` *otherwise.* + +A string is **represented** by an array if the array elements concatenated **in order** forms the string. + +**Example 1:** + +``` +Input: word1 = ["ab", "c"], word2 = ["a", "bc"] +Output: true +Explanation: +word1 represents string "ab" + "c" -> "abc" +word2 represents string "a" + "bc" -> "abc" +The strings are the same, so return true. +``` + +**Example 2:** + +``` +Input: word1 = ["a", "cb"], word2 = ["ab", "c"] +Output: false +``` + +**Example 3:** + +``` +Input: word1 = ["abc", "d", "defg"], word2 = ["abcddefg"] +Output: true +``` + +**Constraints:** + +- `1 <= word1.length, word2.length <= 103` +- `1 <= word1[i].length, word2[i].length <= 103` +- `1 <= sum(word1[i].length), sum(word2[i].length) <= 103` +- `word1[i]` and `word2[i]` consist of lowercase letters. + +## 题目大意 + +给你两个字符串数组 word1 和 word2 。如果两个数组表示的字符串相同,返回 true ;否则,返回 false 。数组表示的字符串 是由数组中的所有元素 按顺序 连接形成的字符串。 + +## 解题思路 + +- 简单题,依次拼接 2 个数组内的字符串,然后比较 str1 和 str2 是否相同即可。 + +## 代码 + +```go +package leetcode + +func arrayStringsAreEqual(word1 []string, word2 []string) bool { + str1, str2 := "", "" + for i := 0; i < len(word1); i++ { + str1 += word1[i] + } + for i := 0; i < len(word2); i++ { + str2 += word2[i] + } + return str1 == str2 +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md b/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md new file mode 100644 index 00000000..e0ab8917 --- /dev/null +++ b/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md @@ -0,0 +1,104 @@ +# [1663. Smallest String With A Given Numeric Value](https://leetcode.com/problems/smallest-string-with-a-given-numeric-value/) + +## 题目 + +The **numeric value** of a **lowercase character** is defined as its position `(1-indexed)` in the alphabet, so the numeric value of `a` is `1`, the numeric value of `b` is `2`, the numeric value of `c` is `3`, and so on. + +The **numeric value** of a **string** consisting of lowercase characters is defined as the sum of its characters' numeric values. For example, the numeric value of the string `"abe"` is equal to `1 + 2 + 5 = 8`. + +You are given two integers `n` and `k`. Return *the **lexicographically smallest string** with **length** equal to `n` and **numeric value** equal to `k`.* + +Note that a string `x` is lexicographically smaller than string `y` if `x` comes before `y` in dictionary order, that is, either `x` is a prefix of `y`, or if `i` is the first position such that `x[i] != y[i]`, then `x[i]` comes before `y[i]` in alphabetic order. + +**Example 1:** + +``` +Input: n = 3, k = 27 +Output: "aay" +Explanation: The numeric value of the string is 1 + 1 + 25 = 27, and it is the smallest string with such a value and length equal to 3. +``` + +**Example 2:** + +``` +Input: n = 5, k = 73 +Output: "aaszz" +``` + +**Constraints:** + +- `1 <= n <= 105` +- `n <= k <= 26 * n` + +## 题目大意 + +小写字符 的 数值 是它在字母表中的位置(从 1 开始),因此 a 的数值为 1 ,b 的数值为 2 ,c 的数值为 3 ,以此类推。字符串由若干小写字符组成,字符串的数值 为各字符的数值之和。例如,字符串 "abe" 的数值等于 1 + 2 + 5 = 8 。给你两个整数 n 和 k 。返回 长度 等于 n 且 数值 等于 k 的 字典序最小 的字符串。注意,如果字符串 x 在字典排序中位于 y 之前,就认为 x 字典序比 y 小,有以下两种情况: + +- x 是 y 的一个前缀; +- 如果 i 是 x[i] != y[i] 的第一个位置,且 x[i] 在字母表中的位置比 y[i] 靠前。 + +## 解题思路 + +- 给出 n 和 k,要求找到字符串长度为 n,字母在字母表内位置总和为 k 的最小字典序字符串。 +- 这一题笔者读完题,比赛的时候直接用 DFS 撸了一版。赛后看了时间复杂度马马虎虎,感觉还有优化的空间。DFS 会遍历出所有的解,实际上这一题只要求最小字典序,所以 DFS 剪枝的时候要加上判断字典序的判断,如果新添加进来的字母比已经保存的字符串的相应位置上的字母字典序大,那么就直接 return,这个答案一定不会是最小字典序。代码见解法二 +- 想到这里,其实 DFS 不必要,直接用 for 循环就可找到最小字典序的字符串。代码见解法一。 + +## 代码 + +```go +package leetcode + +// 解法一 贪心 +func getSmallestString(n int, k int) string { + res := make([]rune, n) + for i := n - 1; i >= 0; i-- { + diff := k - i + if diff >= 26 { + // Need to add z + res[i] = 'z' + k = k - 26 + } else { + res[i] = rune('a' + diff - 1) + k = k - diff + } + } + return string(res) +} + +// 解法二 DFS +func getSmallestString1(n int, k int) string { + if n == 0 { + return "" + } + res, c := "", []byte{} + findSmallestString(0, n, k, 0, c, &res) + return res +} + +func findSmallestString(value int, length, k, index int, str []byte, res *string) { + if len(str) == length && value == k { + tmp := string(str) + if (*res) == "" { + *res = tmp + } + if tmp < *res && *res != "" { + *res = tmp + } + return + } + if len(str) >= index && (*res) != "" && str[index-1] > (*res)[index-1] { + return + } + for j := 0; j < 26; j++ { + if k-value > (length-len(str))*26 || value > k { + return + } + str = append(str, byte(int('a')+j)) + value += j + 1 + findSmallestString(value, length, k, index+1, str, res) + str = str[:len(str)-1] + value -= j + 1 + + } +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md b/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md new file mode 100644 index 00000000..9c40f823 --- /dev/null +++ b/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md @@ -0,0 +1,116 @@ +# [1664. Ways to Make a Fair Array](https://leetcode.com/problems/ways-to-make-a-fair-array/) + + +## 题目 + +You are given an integer array `nums`. You can choose **exactly one** index (**0-indexed**) and remove the element. Notice that the index of the elements may change after the removal. + +For example, if `nums = [6,1,7,4,1]`: + +- Choosing to remove index `1` results in `nums = [6,7,4,1]`. +- Choosing to remove index `2` results in `nums = [6,1,4,1]`. +- Choosing to remove index `4` results in `nums = [6,1,7,4]`. + +An array is **fair** if the sum of the odd-indexed values equals the sum of the even-indexed values. + +Return the ***number** of indices that you could choose such that after the removal,* `nums` *is **fair**.* + +**Example 1:** + +``` +Input: nums = [2,1,6,4] +Output: 1 +Explanation: +Remove index 0: [1,6,4] -> Even sum: 1 + 4 = 5. Odd sum: 6. Not fair. +Remove index 1: [2,6,4] -> Even sum: 2 + 4 = 6. Odd sum: 6. Fair. +Remove index 2: [2,1,4] -> Even sum: 2 + 4 = 6. Odd sum: 1. Not fair. +Remove index 3: [2,1,6] -> Even sum: 2 + 6 = 8. Odd sum: 1. Not fair. +There is 1 index that you can remove to make nums fair. +``` + +**Example 2:** + +``` +Input: nums = [1,1,1] +Output: 3 +Explanation: You can remove any index and the remaining array is fair. +``` + +**Example 3:** + +``` +Input: nums = [1,2,3] +Output: 0 +Explanation: You cannot make a fair array after removing any index. +``` + +**Constraints:** + +- `1 <= nums.length <= 105` +- `1 <= nums[i] <= 104` + +## 题目大意 + +给你一个整数数组 nums 。你需要选择 恰好 一个下标(下标从 0 开始)并删除对应的元素。请注意剩下元素的下标可能会因为删除操作而发生改变。 + +比方说,如果 nums = [6,1,7,4,1] ,那么: + +- 选择删除下标 1 ,剩下的数组为 nums = [6,7,4,1] 。 +- 选择删除下标 2 ,剩下的数组为 nums = [6,1,4,1] 。 +- 选择删除下标 4 ,剩下的数组为 nums = [6,1,7,4] 。 + +如果一个数组满足奇数下标元素的和与偶数下标元素的和相等,该数组就是一个 平衡数组 。请你返回删除操作后,剩下的数组 nums 是 平衡数组 的 方案数 。 + +## 解题思路 + +- 给定一个数组 nums,要求输出仅删除一个元素以后能使得整个数组平衡的方案数。平衡的定义是奇数下标元素总和等于偶数下标元素总和。 +- 这一题如果暴力解答,会超时。原因是每次删除元素以后,都重新计算奇偶数位总和比较耗时。应该利用前面计算过的累加和,推导出此次删除元素以后的情况。这样修改以后就不超时了。具体的,如果删除的是元素是奇数位,这个下标的前缀和不变,要变化的是后面的。删除元素后面,原来偶数位的总和变成了奇数位了,原来奇数位的总和变成偶数位了。删除元素后面这半段的总和可以用前缀和计算出来,奇数位的总和减去删除元素的前缀和,就得到了删除元素后面的后缀和。通过这个办法就可以得到删除元素后面的,奇数位总和,偶数位总和。注意这个后缀和是包含了删除元素的。所以最后需要判断删除元素是奇数位还是偶数位,如果是奇数位,那么在计算出来的偶数和上再减去这个删除元素;如果是偶数位,就在计算出来的奇数和上再减去这个删除元素。代码见解法二。 +- 这一题还有一种更简洁的写法,就是解法一了。通过了解法二的思考,我们可以知道,每次变换以后的操作可以抽象出来,即三步,减去一个数,判断是否相等,再加上一个数。只不过这三步在解法二中都去判断了奇偶性。如果我们不判断奇偶性,那么代码就可以写成解法一的样子。为什么可以不用管奇偶性呢?因为每次删除一个元素以后,下次再删除,奇偶就发生颠倒了,上次的奇数和到了下次就是偶数和了。想通这一点就可以把代码写成解法一的样子。 + +## 代码 + +```go +// 解法一 超简洁写法 +func waysToMakeFair(nums []int) int { + sum, res := [2]int{}, 0 + for i := 0; i < len(nums); i++ { + sum[i%2] += nums[i] + } + for i := 0; i < len(nums); i++ { + sum[i%2] -= nums[i] + if sum[i%2] == sum[1-(i%2)] { + res++ + } + sum[1-(i%2)] += nums[i] + } + return res +} + +// 解法二 前缀和,后缀和 +func waysToMakeFair1(nums []int) int { + evenPrefix, oddPrefix, evenSuffix, oddSuffix, res := 0, 0, 0, 0, 0 + for i := 0; i < len(nums); i++ { + if i%2 == 0 { + evenSuffix += nums[i] + } else { + oddSuffix += nums[i] + } + } + for i := 0; i < len(nums); i++ { + if i%2 == 0 { + evenSuffix -= nums[i] + } else { + oddSuffix -= nums[i] + } + if (evenPrefix + oddSuffix) == (oddPrefix + evenSuffix) { + res++ + } + if i%2 == 0 { + evenPrefix += nums[i] + } else { + oddPrefix += nums[i] + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md b/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md new file mode 100644 index 00000000..c2bd57e6 --- /dev/null +++ b/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md @@ -0,0 +1,128 @@ +# [1665. Minimum Initial Energy to Finish Tasks](https://leetcode.com/problems/minimum-initial-energy-to-finish-tasks/) + +## 题目 + +You are given an array `tasks` where `tasks[i] = [actuali, minimumi]`: + +- `actuali` is the actual amount of energy you **spend to finish** the `ith` task. +- `minimumi` is the minimum amount of energy you **require to begin** the `ith` task. + +For example, if the task is `[10, 12]` and your current energy is `11`, you cannot start this task. However, if your current energy is `13`, you can complete this task, and your energy will be `3` after finishing it. + +You can finish the tasks in **any order** you like. + +Return *the **minimum** initial amount of energy you will need* *to finish all the tasks*. + +**Example 1:** + +``` +Input: tasks = [[1,2],[2,4],[4,8]] +Output: 8 +Explanation: +Starting with 8 energy, we finish the tasks in the following order: + - 3rd task. Now energy = 8 - 4 = 4. + - 2nd task. Now energy = 4 - 2 = 2. + - 1st task. Now energy = 2 - 1 = 1. +Notice that even though we have leftover energy, starting with 7 energy does not work because we cannot do the 3rd task. +``` + +**Example 2:** + +``` +Input: tasks = [[1,3],[2,4],[10,11],[10,12],[8,9]] +Output: 32 +Explanation: +Starting with 32 energy, we finish the tasks in the following order: + - 1st task. Now energy = 32 - 1 = 31. + - 2nd task. Now energy = 31 - 2 = 29. + - 3rd task. Now energy = 29 - 10 = 19. + - 4th task. Now energy = 19 - 10 = 9. + - 5th task. Now energy = 9 - 8 = 1. +``` + +**Example 3:** + +``` +Input: tasks = [[1,7],[2,8],[3,9],[4,10],[5,11],[6,12]] +Output: 27 +Explanation: +Starting with 27 energy, we finish the tasks in the following order: + - 5th task. Now energy = 27 - 5 = 22. + - 2nd task. Now energy = 22 - 2 = 20. + - 3rd task. Now energy = 20 - 3 = 17. + - 1st task. Now energy = 17 - 1 = 16. + - 4th task. Now energy = 16 - 4 = 12. + - 6th task. Now energy = 12 - 6 = 6. + +``` + +**Constraints:** + +- `1 <= tasks.length <= 105` +- `1 <= actuali <= minimumi <= 104` + +## 题目大意 + +给你一个任务数组 tasks ,其中 tasks[i] = [actuali, minimumi] : + +- actual i 是完成第 i 个任务 需要耗费 的实际能量。 +- minimum i 是开始第 i 个任务前需要达到的最低能量。 + +比方说,如果任务为 [10, 12] 且你当前的能量为 11 ,那么你不能开始这个任务。如果你当前的能量为 13 ,你可以完成这个任务,且完成它后剩余能量为 3 。你可以按照 任意顺序 完成任务。请你返回完成所有任务的 最少 初始能量。 + +## 解题思路 + +- 给出一个 task 数组,每个元素代表一个任务,每个任务有实际消费能量值和开始这个任务需要的最低能量。要求输出能完成所有任务的最少初始能量。 +- 这一题直觉是贪心。先将任务按照 `minimum - actual` 进行排序。先完成差值大的任务,那么接下来的能量能最大限度的满足接下来的任务。这样可能完成所有任务的可能性越大。循环任务数组的时候,保存当前能量在 `cur` 中,如果当前能量不够开启下一个任务,那么这个差值就是需要弥补的,这些能量就是最少初始能量中的,所以加上这些差值能量。如果当前能量可以开启下一个任务,那么就更新当前能量,减去实际消耗的能量以后,再继续循环。循环结束就能得到最少初始能量了。 + +## 代码 + +```go +package leetcode + +import ( + "sort" +) + +func minimumEffort(tasks [][]int) int { + sort.Sort(Task(tasks)) + res, cur := 0, 0 + for _, t := range tasks { + if t[1] > cur { + res += t[1] - cur + cur = t[1] - t[0] + } else { + cur -= t[0] + } + } + return res +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} + +// Task define +type Task [][]int + +func (task Task) Len() int { + return len(task) +} + +func (task Task) Less(i, j int) bool { + t1, t2 := task[i][1]-task[i][0], task[j][1]-task[j][0] + if t1 != t2 { + return t2 < t1 + } + return task[j][1] < task[i][1] +} + +func (task Task) Swap(i, j int) { + t := task[i] + task[i] = task[j] + task[j] = t +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 98c92a28..9e88a27f 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -556,4 +556,8 @@ headless: true - [1657.Determine-if-Two-Strings-Are-Close]({{< relref "/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md" >}}) - [1658.Minimum-Operations-to-Reduce-X-to-Zero]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}}) - [1659.Maximize-Grid-Happiness]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}}) + - [1662.Check-If-Two-String-Arrays-are-Equivalent]({{< relref "/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md" >}}) + - [1663.Smallest-String-With-A-Given-Numeric-Value]({{< relref "/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md" >}}) + - [1664.Ways-to-Make-a-Fair-Array]({{< relref "/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md" >}}) + - [1665.Minimum-Initial-Energy-to-Finish-Tasks]({{< relref "/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md" >}})
From 4384f0d468ca2b50e604cdc303c8c3f34b4c02df Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 25 Nov 2020 00:46:59 +0800 Subject: [PATCH 34/82] Update 0978 solution --- .../978. Longest Turbulent Subarray.go | 2 +- website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray.go b/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray.go index 60d3eace..8a089026 100644 --- a/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray.go +++ b/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray.go @@ -47,7 +47,7 @@ func maxTurbulenceSize1(A []int) int { flag = lastNum - A[right] lastNum = A[right] } else { - if right != left && flag != 0 { + if flag != 0 { res = max(res, right-left+1) } left++ diff --git a/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md b/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md index e4b8bea7..43dcd7f9 100755 --- a/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md +++ b/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md @@ -97,7 +97,7 @@ func maxTurbulenceSize1(A []int) int { flag = lastNum - A[right] lastNum = A[right] } else { - if right != left && flag != 0 { + if flag != 0 { res = max(res, right-left+1) } left++ From 5770d110d0f64b58ed40b56b7a421f55abd3dd2e Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 25 Nov 2020 00:52:55 +0800 Subject: [PATCH 35/82] Update 0027 solution --- leetcode/0027.Remove-Element/27. Remove Element.go | 4 +--- website/content/ChapterFour/0027.Remove-Element.md | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/leetcode/0027.Remove-Element/27. Remove Element.go b/leetcode/0027.Remove-Element/27. Remove Element.go index f0233b6a..1395d108 100644 --- a/leetcode/0027.Remove-Element/27. Remove Element.go +++ b/leetcode/0027.Remove-Element/27. Remove Element.go @@ -9,10 +9,8 @@ func removeElement(nums []int, val int) int { if nums[i] != val { if i != j { nums[i], nums[j] = nums[j], nums[i] - j++ - } else { - j++ } + j++ } } return j diff --git a/website/content/ChapterFour/0027.Remove-Element.md b/website/content/ChapterFour/0027.Remove-Element.md index d3ddc59d..214d6ff4 100644 --- a/website/content/ChapterFour/0027.Remove-Element.md +++ b/website/content/ChapterFour/0027.Remove-Element.md @@ -80,10 +80,8 @@ func removeElement(nums []int, val int) int { if nums[i] != val { if i != j { nums[i], nums[j] = nums[j], nums[i] - j++ - } else { - j++ } + j++ } } return j From 0c4b3733199e0a9081c585502652b9ff18b3281d Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 27 Nov 2020 20:20:20 +0800 Subject: [PATCH 36/82] =?UTF-8?q?Add=20solution=201652=E3=80=811653?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1652. Defuse the Bomb.go | 56 ++++++++ .../1652. Defuse the Bomb_test.go | 53 ++++++++ leetcode/1652.Defuse-the-Bomb/README.md | 125 ++++++++++++++++++ ...nimum Deletions to Make String Balanced.go | 42 ++++++ ... Deletions to Make String Balanced_test.go | 57 ++++++++ .../README.md | 90 +++++++++++++ 6 files changed, 423 insertions(+) create mode 100644 leetcode/1652.Defuse-the-Bomb/1652. Defuse the Bomb.go create mode 100644 leetcode/1652.Defuse-the-Bomb/1652. Defuse the Bomb_test.go create mode 100644 leetcode/1652.Defuse-the-Bomb/README.md create mode 100644 leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced.go create mode 100644 leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced_test.go create mode 100644 leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/README.md diff --git a/leetcode/1652.Defuse-the-Bomb/1652. Defuse the Bomb.go b/leetcode/1652.Defuse-the-Bomb/1652. Defuse the Bomb.go new file mode 100644 index 00000000..cd0c245e --- /dev/null +++ b/leetcode/1652.Defuse-the-Bomb/1652. Defuse the Bomb.go @@ -0,0 +1,56 @@ +package leetcode + +func decrypt(code []int, k int) []int { + if k == 0 { + for i := 0; i < len(code); i++ { + code[i] = 0 + } + return code + } + count, sum, res := k, 0, make([]int, len(code)) + if k > 0 { + for i := 0; i < len(code); i++ { + for j := i + 1; j < len(code); j++ { + if count == 0 { + break + } + sum += code[j] + count-- + } + if count > 0 { + for j := 0; j < len(code); j++ { + if count == 0 { + break + } + sum += code[j] + count-- + } + } + res[i] = sum + sum, count = 0, k + } + } + if k < 0 { + for i := 0; i < len(code); i++ { + for j := i - 1; j >= 0; j-- { + if count == 0 { + break + } + sum += code[j] + count++ + } + if count < 0 { + for j := len(code) - 1; j >= 0; j-- { + if count == 0 { + break + } + sum += code[j] + count++ + } + } + res[i] = sum + sum, count = 0, k + } + } + return res +} diff --git a/leetcode/1652.Defuse-the-Bomb/1652. Defuse the Bomb_test.go b/leetcode/1652.Defuse-the-Bomb/1652. Defuse the Bomb_test.go new file mode 100644 index 00000000..87ce3aef --- /dev/null +++ b/leetcode/1652.Defuse-the-Bomb/1652. Defuse the Bomb_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1652 struct { + para1652 + ans1652 +} + +// para 是参数 +// one 代表第一个参数 +type para1652 struct { + code []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1652 struct { + one []int +} + +func Test_Problem1652(t *testing.T) { + + qs := []question1652{ + + { + para1652{[]int{5, 7, 1, 4}, 3}, + ans1652{[]int{12, 10, 16, 13}}, + }, + + { + para1652{[]int{1, 2, 3, 4}, 0}, + ans1652{[]int{0, 0, 0, 0}}, + }, + + { + para1652{[]int{2, 4, 9, 3}, -2}, + ans1652{[]int{12, 5, 6, 13}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1652------------------------\n") + + for _, q := range qs { + _, p := q.ans1652, q.para1652 + fmt.Printf("【input】:%v 【output】:%v \n", p, decrypt(p.code, p.k)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1652.Defuse-the-Bomb/README.md b/leetcode/1652.Defuse-the-Bomb/README.md new file mode 100644 index 00000000..cc47f853 --- /dev/null +++ b/leetcode/1652.Defuse-the-Bomb/README.md @@ -0,0 +1,125 @@ +# [1652. Defuse the Bomb](https://leetcode.com/problems/defuse-the-bomb/) + + +## 题目 + +You have a bomb to defuse, and your time is running out! Your informer will provide you with a **circular** array `code` of length of `n` and a key `k`. + +To decrypt the code, you must replace every number. All the numbers are replaced **simultaneously**. + +- If `k > 0`, replace the `ith` number with the sum of the **next** `k` numbers. +- If `k < 0`, replace the `ith` number with the sum of the **previous** `k` numbers. +- If `k == 0`, replace the `ith` number with `0`. + +As `code` is circular, the next element of `code[n-1]` is `code[0]`, and the previous element of `code[0]` is `code[n-1]`. + +Given the **circular** array `code` and an integer key `k`, return *the decrypted code to defuse the bomb*! + +**Example 1:** + +``` +Input: code = [5,7,1,4], k = 3 +Output: [12,10,16,13] +Explanation: Each number is replaced by the sum of the next 3 numbers. The decrypted code is [7+1+4, 1+4+5, 4+5+7, 5+7+1]. Notice that the numbers wrap around. +``` + +**Example 2:** + +``` +Input: code = [1,2,3,4], k = 0 +Output: [0,0,0,0] +Explanation: When k is zero, the numbers are replaced by 0. +``` + +**Example 3:** + +``` +Input: code = [2,4,9,3], k = -2 +Output: [12,5,6,13] +Explanation: The decrypted code is [3+9, 2+3, 4+2, 9+4]. Notice that the numbers wrap around again. If k is negative, the sum is of the previous numbers. +``` + +**Constraints:** + +- `n == code.length` +- `1 <= n <= 100` +- `1 <= code[i] <= 100` +- `(n - 1) <= k <= n - 1` + +## 题目大意 + +你有一个炸弹需要拆除,时间紧迫!你的情报员会给你一个长度为 n 的 循环 数组 code 以及一个密钥 k 。为了获得正确的密码,你需要替换掉每一个数字。所有数字会 同时 被替换。 + +- 如果 k > 0 ,将第 i 个数字用 接下来 k 个数字之和替换。 +- 如果 k < 0 ,将第 i 个数字用 之前 k 个数字之和替换。 +- 如果 k == 0 ,将第 i 个数字用 0 替换。 + +由于 code 是循环的, code[n-1] 下一个元素是 code[0] ,且 code[0] 前一个元素是 code[n-1] 。 + +给你 循环 数组 code 和整数密钥 k ,请你返回解密后的结果来拆除炸弹! + +## 解题思路 + +- 给出一个 code 数组,要求按照规则替换每个字母。 +- 简单题,按照题意描述循环即可。 + +## 代码 + +```go +package leetcode + +func decrypt(code []int, k int) []int { + if k == 0 { + for i := 0; i < len(code); i++ { + code[i] = 0 + } + return code + } + count, sum, res := k, 0, make([]int, len(code)) + if k > 0 { + for i := 0; i < len(code); i++ { + for j := i + 1; j < len(code); j++ { + if count == 0 { + break + } + sum += code[j] + count-- + } + if count > 0 { + for j := 0; j < len(code); j++ { + if count == 0 { + break + } + sum += code[j] + count-- + } + } + res[i] = sum + sum, count = 0, k + } + } + if k < 0 { + for i := 0; i < len(code); i++ { + for j := i - 1; j >= 0; j-- { + if count == 0 { + break + } + sum += code[j] + count++ + } + if count < 0 { + for j := len(code) - 1; j >= 0; j-- { + if count == 0 { + break + } + sum += code[j] + count++ + } + } + res[i] = sum + sum, count = 0, k + } + } + return res +} +``` \ No newline at end of file diff --git a/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced.go b/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced.go new file mode 100644 index 00000000..1d5bc988 --- /dev/null +++ b/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced.go @@ -0,0 +1,42 @@ +package leetcode + +// 解法一 DP +func minimumDeletions(s string) int { + prev, res, bCount := 0, 0, 0 + for _, c := range s { + if c == 'a' { + res = min(prev+1, bCount) + prev = res + } else { + bCount++ + } + } + return res +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +// 解法二 模拟 +func minimumDeletions1(s string) int { + aCount, bCount, res := 0, 0, 0 + for i := 0; i < len(s); i++ { + if s[i] == 'a' { + aCount++ + } + } + res = aCount + for i := 0; i < len(s); i++ { + if s[i] == 'a' { + aCount-- + } else { + bCount++ + } + res = min(res, aCount+bCount) + } + return res +} diff --git a/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced_test.go b/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced_test.go new file mode 100644 index 00000000..e140e7aa --- /dev/null +++ b/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced_test.go @@ -0,0 +1,57 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1649 struct { + para1649 + ans1649 +} + +// para 是参数 +// one 代表第一个参数 +type para1649 struct { + s string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1649 struct { + one int +} + +func Test_Problem1649(t *testing.T) { + + qs := []question1649{ + + { + para1649{"aababbab"}, + ans1649{2}, + }, + + { + para1649{"bbaaaaabb"}, + ans1649{2}, + }, + + { + para1649{"b"}, + ans1649{0}, + }, + + { + para1649{"ababaaaabbbbbaaababbbbbbaaabbaababbabbbbaabbbbaabbabbabaabbbababaa"}, + ans1649{25}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1649------------------------\n") + + for _, q := range qs { + _, p := q.ans1649, q.para1649 + fmt.Printf("【input】:%v 【output】:%v \n", p, minimumDeletions(p.s)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/README.md b/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/README.md new file mode 100644 index 00000000..f162b23e --- /dev/null +++ b/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/README.md @@ -0,0 +1,90 @@ +# [1653. Minimum Deletions to Make String Balanced](https://leetcode.com/problems/minimum-deletions-to-make-string-balanced/) + + +## 题目 + +You are given a string `s` consisting only of characters `'a'` and `'b'`. + +You can delete any number of characters in `s` to make `s` **balanced**. `s` is **balanced** if there is no pair of indices `(i,j)` such that `i < j` and `s[i] = 'b'` and `s[j]= 'a'`. + +Return *the **minimum** number of deletions needed to make* `s` ***balanced***. + +**Example 1:** + +``` +Input: s = "aababbab" +Output: 2 +Explanation: You can either: +Delete the characters at 0-indexed positions 2 and 6 ("aababbab" -> "aaabbb"), or +Delete the characters at 0-indexed positions 3 and 6 ("aababbab" -> "aabbbb"). +``` + +**Example 2:** + +``` +Input: s = "bbaaaaabb" +Output: 2 +Explanation: The only solution is to delete the first two characters. +``` + +**Constraints:** + +- `1 <= s.length <= 105` +- `s[i]` is `'a'` or `'b'`. + +## 题目大意 + +给你一个字符串 s ,它仅包含字符 'a' 和 'b' 。你可以删除 s 中任意数目的字符,使得 s 平衡 。我们称 s 平衡的 当不存在下标对 (i,j) 满足 i < j 且 s[i] = 'b' 同时 s[j]= 'a' 。请你返回使 s 平衡 的 最少 删除次数。 + +## 解题思路 + +- 给定一个字符串,要求删除最少次数,使得字母 a 都排在字母 b 的前面。 +- 很容易想到的一个解题思路是 DP。定义 `dp[i]` 为字符串下标 [ 0, i ] 这个区间内使得字符串平衡的最少删除次数。当 `s[i] == 'a'` 的时候,有 2 种情况,一种是 `s[i]` 前面全是 `[aa……aa]` 的情况,这个时候只需要把其中的所有的字母 `b` 删除即可。还有一种情况是 `s[i]` 前面有字母 `a` 也有字母 `b`,即 `[aaa……abb……b]`,这种情况就需要考虑 `dp[i-1]` 了。当前字母是 `a`,那么肯定要删除字母 `a`,来维持前面有一段字母 `b` 的情况。当 `s[i] == 'b'` 的时候,不管是 `[aa……aa]` 这种情况,还是 `[aaa……abb……b]` 这种情况,当前字母 `b` 都可以直接附加在后面,也能保证整个字符串是平衡的。所以状态转移方程为 `dp[i+1] = min(dp[i] + 1, bCount), s[i] == 'a'`,`dp[i+1] = dp[i], s[i] == 'b'`。最终答案存在 `dp[n]` 中。由于前后项的递推关系中只用到一次前一项,所以我们还可以优化一下空间,用一个变量保存前一项的结果。优化以后的代码见解法一。 +- 这一题还有一个模拟的思路。题目要求找到最小删除字数,那么就是要找到一个“临界点”,在这个临界点的左边删除所有的字母 b,在这个临界点的右边删除所有的字母 a。在所有的“临界点”中找到删除最少的次数。代码实现见解法二。 + +## 代码 + +```go +package leetcode + +// 解法一 DP +func minimumDeletions(s string) int { + prev, res, bCount := 0, 0, 0 + for _, c := range s { + if c == 'a' { + res = min(prev+1, bCount) + prev = res + } else { + bCount++ + } + } + return res +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +// 解法二 模拟 +func minimumDeletions1(s string) int { + aCount, bCount, res := 0, 0, 0 + for i := 0; i < len(s); i++ { + if s[i] == 'a' { + aCount++ + } + } + res = aCount + for i := 0; i < len(s); i++ { + if s[i] == 'a' { + aCount-- + } else { + bCount++ + } + res = min(res, aCount+bCount) + } + return res +} +``` \ No newline at end of file From 9ac3fdeb96a9e288bfa3497eaad4790a8f0913a2 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sat, 28 Nov 2020 15:24:45 +0800 Subject: [PATCH 37/82] =?UTF-8?q?Add=20solution=201654=E3=80=811655?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Deletions to Make String Balanced_test.go | 34 ++--- .../1654. Minimum Jumps to Reach Home.go | 29 ++++ .../1654. Minimum Jumps to Reach Home_test.go | 60 +++++++++ .../README.md | 101 ++++++++++++++ .../1655. Distribute Repeating Integers.go | 30 +++++ ...655. Distribute Repeating Integers_test.go | 63 +++++++++ .../README.md | 112 ++++++++++++++++ leetcode/5550/1652. Defuse the Bomb.go | 56 -------- leetcode/5550/1652. Defuse the Bomb_test.go | 53 -------- ...nimum Deletions to Make String Balanced.go | 49 ------- ... Deletions to Make String Balanced_test.go | 57 -------- .../ChapterFour/1652.Defuse-the-Bomb.md | 125 ++++++++++++++++++ ...nimum-Deletions-to-Make-String-Balanced.md | 90 +++++++++++++ .../1654.Minimum-Jumps-to-Reach-Home.md | 101 ++++++++++++++ .../1655.Distribute-Repeating-Integers.md | 112 ++++++++++++++++ website/content/menu/index.md | 4 + 16 files changed, 844 insertions(+), 232 deletions(-) create mode 100644 leetcode/1654.Minimum-Jumps-to-Reach-Home/1654. Minimum Jumps to Reach Home.go create mode 100644 leetcode/1654.Minimum-Jumps-to-Reach-Home/1654. Minimum Jumps to Reach Home_test.go create mode 100644 leetcode/1654.Minimum-Jumps-to-Reach-Home/README.md create mode 100644 leetcode/1655.Distribute-Repeating-Integers/1655. Distribute Repeating Integers.go create mode 100644 leetcode/1655.Distribute-Repeating-Integers/1655. Distribute Repeating Integers_test.go create mode 100644 leetcode/1655.Distribute-Repeating-Integers/README.md delete mode 100644 leetcode/5550/1652. Defuse the Bomb.go delete mode 100644 leetcode/5550/1652. Defuse the Bomb_test.go delete mode 100644 leetcode/5551/5551. Minimum Deletions to Make String Balanced.go delete mode 100644 leetcode/5551/5551. Minimum Deletions to Make String Balanced_test.go create mode 100644 website/content/ChapterFour/1652.Defuse-the-Bomb.md create mode 100644 website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md create mode 100644 website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md create mode 100644 website/content/ChapterFour/1655.Distribute-Repeating-Integers.md diff --git a/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced_test.go b/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced_test.go index e140e7aa..672ef5cd 100644 --- a/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced_test.go +++ b/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced/1653. Minimum Deletions to Make String Balanced_test.go @@ -5,52 +5,52 @@ import ( "testing" ) -type question1649 struct { - para1649 - ans1649 +type question1653 struct { + para1653 + ans1653 } // para 是参数 // one 代表第一个参数 -type para1649 struct { +type para1653 struct { s string } // ans 是答案 // one 代表第一个答案 -type ans1649 struct { +type ans1653 struct { one int } -func Test_Problem1649(t *testing.T) { +func Test_Problem1653(t *testing.T) { - qs := []question1649{ + qs := []question1653{ { - para1649{"aababbab"}, - ans1649{2}, + para1653{"aababbab"}, + ans1653{2}, }, { - para1649{"bbaaaaabb"}, - ans1649{2}, + para1653{"bbaaaaabb"}, + ans1653{2}, }, { - para1649{"b"}, - ans1649{0}, + para1653{"b"}, + ans1653{0}, }, { - para1649{"ababaaaabbbbbaaababbbbbbaaabbaababbabbbbaabbbbaabbabbabaabbbababaa"}, - ans1649{25}, + para1653{"ababaaaabbbbbaaababbbbbbaaabbaababbabbbbaabbbbaabbabbabaabbbababaa"}, + ans1653{25}, }, } - fmt.Printf("------------------------Leetcode Problem 1649------------------------\n") + fmt.Printf("------------------------Leetcode Problem 1653------------------------\n") for _, q := range qs { - _, p := q.ans1649, q.para1649 + _, p := q.ans1653, q.para1653 fmt.Printf("【input】:%v 【output】:%v \n", p, minimumDeletions(p.s)) } fmt.Printf("\n\n\n") diff --git a/leetcode/1654.Minimum-Jumps-to-Reach-Home/1654. Minimum Jumps to Reach Home.go b/leetcode/1654.Minimum-Jumps-to-Reach-Home/1654. Minimum Jumps to Reach Home.go new file mode 100644 index 00000000..fcfda83b --- /dev/null +++ b/leetcode/1654.Minimum-Jumps-to-Reach-Home/1654. Minimum Jumps to Reach Home.go @@ -0,0 +1,29 @@ +package leetcode + +func minimumJumps(forbidden []int, a int, b int, x int) int { + visited := make([]bool, 6000) + for i := range forbidden { + visited[forbidden[i]] = true + } + queue, res := [][2]int{{0, 0}}, -1 + for len(queue) > 0 { + length := len(queue) + res++ + for i := 0; i < length; i++ { + cur, isBack := queue[i][0], queue[i][1] + if cur == x { + return res + } + if isBack == 0 && cur-b > 0 && !visited[cur-b] { + visited[cur-b] = true + queue = append(queue, [2]int{cur - b, 1}) + } + if cur+a < len(visited) && !visited[cur+a] { + visited[cur+a] = true + queue = append(queue, [2]int{cur + a, 0}) + } + } + queue = queue[length:] + } + return -1 +} diff --git a/leetcode/1654.Minimum-Jumps-to-Reach-Home/1654. Minimum Jumps to Reach Home_test.go b/leetcode/1654.Minimum-Jumps-to-Reach-Home/1654. Minimum Jumps to Reach Home_test.go new file mode 100644 index 00000000..b08d6b74 --- /dev/null +++ b/leetcode/1654.Minimum-Jumps-to-Reach-Home/1654. Minimum Jumps to Reach Home_test.go @@ -0,0 +1,60 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1654 struct { + para1654 + ans1654 +} + +// para 是参数 +// one 代表第一个参数 +type para1654 struct { + forbidden []int + a int + b int + x int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1654 struct { + one int +} + +func Test_Problem1654(t *testing.T) { + + qs := []question1654{ + + { + para1654{[]int{14, 4, 18, 1, 15}, 3, 15, 9}, + ans1654{3}, + }, + + { + para1654{[]int{8, 3, 16, 6, 12, 20}, 15, 13, 11}, + ans1654{-1}, + }, + + { + para1654{[]int{1, 6, 2, 14, 5, 17, 4}, 16, 9, 7}, + ans1654{2}, + }, + + { + para1654{[]int{1998}, 1999, 2000, 2000}, + ans1654{3998}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1654------------------------\n") + + for _, q := range qs { + _, p := q.ans1654, q.para1654 + fmt.Printf("【input】:%v 【output】:%v \n", p, minimumJumps(p.forbidden, p.a, p.b, p.x)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1654.Minimum-Jumps-to-Reach-Home/README.md b/leetcode/1654.Minimum-Jumps-to-Reach-Home/README.md new file mode 100644 index 00000000..790c9cf3 --- /dev/null +++ b/leetcode/1654.Minimum-Jumps-to-Reach-Home/README.md @@ -0,0 +1,101 @@ +# [1654. Minimum Jumps to Reach Home](https://leetcode.com/problems/minimum-jumps-to-reach-home/) + + +## 题目 + +A certain bug's home is on the x-axis at position `x`. Help them get there from position `0`. + +The bug jumps according to the following rules: + +- It can jump exactly `a` positions **forward** (to the right). +- It can jump exactly `b` positions **backward** (to the left). +- It cannot jump backward twice in a row. +- It cannot jump to any `forbidden` positions. + +The bug may jump forward **beyond** its home, but it **cannot jump** to positions numbered with **negative** integers. + +Given an array of integers `forbidden`, where `forbidden[i]` means that the bug cannot jump to the position `forbidden[i]`, and integers `a`, `b`, and `x`, return *the minimum number of jumps needed for the bug to reach its home*. If there is no possible sequence of jumps that lands the bug on position `x`, return `1.` + +**Example 1:** + +``` +Input: forbidden = [14,4,18,1,15], a = 3, b = 15, x = 9 +Output: 3 +Explanation: 3 jumps forward (0 -> 3 -> 6 -> 9) will get the bug home. +``` + +**Example 2:** + +``` +Input: forbidden = [8,3,16,6,12,20], a = 15, b = 13, x = 11 +Output: -1 +``` + +**Example 3:** + +``` +Input: forbidden = [1,6,2,14,5,17,4], a = 16, b = 9, x = 7 +Output: 2 +Explanation: One jump forward (0 -> 16) then one jump backward (16 -> 7) will get the bug home. + +``` + +**Constraints:** + +- `1 <= forbidden.length <= 1000` +- `1 <= a, b, forbidden[i] <= 2000` +- `0 <= x <= 2000` +- All the elements in `forbidden` are distinct. +- Position `x` is not forbidden. + +## 题目大意 + +有一只跳蚤的家在数轴上的位置 x 处。请你帮助它从位置 0 出发,到达它的家。 + +跳蚤跳跃的规则如下: + +- 它可以 往前 跳恰好 a 个位置(即往右跳)。 +- 它可以 往后 跳恰好 b 个位置(即往左跳)。 +- 它不能 连续 往后跳 2 次。 +- 它不能跳到任何 forbidden 数组中的位置。 + +跳蚤可以往前跳 超过 它的家的位置,但是它 不能跳到负整数 的位置。给你一个整数数组 forbidden ,其中 forbidden[i] 是跳蚤不能跳到的位置,同时给你整数 a, b 和 x ,请你返回跳蚤到家的最少跳跃次数。如果没有恰好到达 x 的可行方案,请你返回 -1 。 + +## 解题思路 + +- 给出坐标 x ,可以往前跳的步长 a,往后跳的步长 b。要求输出能跳回家的最少跳跃次数。 +- 求最少跳跃次数,思路用 BFS 求解,最先到达坐标 x 的方案即是最少跳跃次数。对`forbidden` 的处理是把记忆化数组里面把他们标记为 true。禁止连续往后跳 2 次的限制,要求我们在 BFS 入队的时候再记录一下跳跃方向,每次往后跳的时候判断前一跳是否是往后跳,如果是往后跳,此次就不能往后跳了。 + +## 代码 + +```go +package leetcode + +func minimumJumps(forbidden []int, a int, b int, x int) int { + visited := make([]bool, 6000) + for i := range forbidden { + visited[forbidden[i]] = true + } + queue, res := [][2]int{{0, 0}}, -1 + for len(queue) > 0 { + length := len(queue) + res++ + for i := 0; i < length; i++ { + cur, isBack := queue[i][0], queue[i][1] + if cur == x { + return res + } + if isBack == 0 && cur-b > 0 && !visited[cur-b] { + visited[cur-b] = true + queue = append(queue, [2]int{cur - b, 1}) + } + if cur+a < len(visited) && !visited[cur+a] { + visited[cur+a] = true + queue = append(queue, [2]int{cur + a, 0}) + } + } + queue = queue[length:] + } + return -1 +} +``` \ No newline at end of file diff --git a/leetcode/1655.Distribute-Repeating-Integers/1655. Distribute Repeating Integers.go b/leetcode/1655.Distribute-Repeating-Integers/1655. Distribute Repeating Integers.go new file mode 100644 index 00000000..f0f57da2 --- /dev/null +++ b/leetcode/1655.Distribute-Repeating-Integers/1655. Distribute Repeating Integers.go @@ -0,0 +1,30 @@ +package leetcode + +func canDistribute(nums []int, quantity []int) bool { + freq := make(map[int]int) + for _, n := range nums { + freq[n]++ + } + return dfs(freq, quantity) +} + +func dfs(freq map[int]int, quantity []int) bool { + if len(quantity) == 0 { + return true + } + visited := make(map[int]bool) + for i := range freq { + if visited[freq[i]] { + continue + } + visited[freq[i]] = true + if freq[i] >= quantity[0] { + freq[i] -= quantity[0] + if dfs(freq, quantity[1:]) { + return true + } + freq[i] += quantity[0] + } + } + return false +} diff --git a/leetcode/1655.Distribute-Repeating-Integers/1655. Distribute Repeating Integers_test.go b/leetcode/1655.Distribute-Repeating-Integers/1655. Distribute Repeating Integers_test.go new file mode 100644 index 00000000..d1c7bd26 --- /dev/null +++ b/leetcode/1655.Distribute-Repeating-Integers/1655. Distribute Repeating Integers_test.go @@ -0,0 +1,63 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1655 struct { + para1655 + ans1655 +} + +// para 是参数 +// one 代表第一个参数 +type para1655 struct { + nums []int + quantity []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1655 struct { + one bool +} + +func Test_Problem1655(t *testing.T) { + + qs := []question1655{ + + { + para1655{[]int{1, 2, 3, 4}, []int{2}}, + ans1655{false}, + }, + + { + para1655{[]int{1, 2, 3, 3}, []int{2}}, + ans1655{true}, + }, + + { + para1655{[]int{1, 1, 2, 2}, []int{2, 2}}, + ans1655{true}, + }, + + { + para1655{[]int{1, 1, 2, 3}, []int{2, 2}}, + ans1655{false}, + }, + + { + para1655{[]int{1, 1, 1, 1, 1}, []int{2, 3}}, + ans1655{true}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1655------------------------\n") + + for _, q := range qs { + _, p := q.ans1655, q.para1655 + fmt.Printf("【input】:%v 【output】:%v \n", p, canDistribute(p.nums, p.quantity)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1655.Distribute-Repeating-Integers/README.md b/leetcode/1655.Distribute-Repeating-Integers/README.md new file mode 100644 index 00000000..1c1faaed --- /dev/null +++ b/leetcode/1655.Distribute-Repeating-Integers/README.md @@ -0,0 +1,112 @@ +# [1655. Distribute Repeating Integers](https://leetcode.com/problems/distribute-repeating-integers/) + + +## 题目 + +You are given an array of `n` integers, `nums`, where there are at most `50` unique values in the array. You are also given an array of `m` customer order quantities, `quantity`, where `quantity[i]` is the amount of integers the `ith` customer ordered. Determine if it is possible to distribute `nums` such that: + +- The `ith` customer gets **exactly** `quantity[i]` integers, +- The integers the `ith` customer gets are **all equal**, and +- Every customer is satisfied. + +Return `true` *if it is possible to distribute* `nums` *according to the above conditions*. + +**Example 1:** + +``` +Input: nums = [1,2,3,4], quantity = [2] +Output: false +Explanation: The 0th customer cannot be given two different integers. +``` + +**Example 2:** + +``` +Input: nums = [1,2,3,3], quantity = [2] +Output: true +Explanation: The 0th customer is given [3,3]. The integers [1,2] are not used. +``` + +**Example 3:** + +``` +Input: nums = [1,1,2,2], quantity = [2,2] +Output: true +Explanation: The 0th customer is given [1,1], and the 1st customer is given [2,2]. +``` + +**Example 4:** + +``` +Input: nums = [1,1,2,3], quantity = [2,2] +Output: false +Explanation: Although the 0th customer could be given [1,1], the 1st customer cannot be satisfied. +``` + +**Example 5:** + +``` +Input: nums = [1,1,1,1,1], quantity = [2,3] +Output: true +Explanation: The 0th customer is given [1,1], and the 1st customer is given [1,1,1]. +``` + +**Constraints:** + +- `n == nums.length` +- `1 <= n <= 105` +- `1 <= nums[i] <= 1000` +- `m == quantity.length` +- `1 <= m <= 10` +- `1 <= quantity[i] <= 105` +- There are at most `50` unique values in `nums`. + +## 题目大意 + +给你一个长度为 n 的整数数组 nums ,这个数组中至多有 50 个不同的值。同时你有 m 个顾客的订单 quantity ,其中,整数 quantity[i] 是第 i 位顾客订单的数目。请你判断是否能将 nums 中的整数分配给这些顾客,且满足: + +- 第 i 位顾客 恰好 有 quantity[i] 个整数。 +- 第 i 位顾客拿到的整数都是 相同的 。 +- 每位顾客都满足上述两个要求。 + +如果你可以分配 nums 中的整数满足上面的要求,那么请返回 true ,否则返回 false 。 + +## 解题思路 + +- 给定一个数组 nums,订单数组 quantity,要求按照订单满足顾客的需求。如果能满足输出 true,不能满足输出 false。 +- 用 DFS 记忆化暴力搜索。代码实现不难。(不知道此题为什么是 Hard) + +## 代码 + +```go +package leetcode + +func canDistribute(nums []int, quantity []int) bool { + freq := make(map[int]int) + for _, n := range nums { + freq[n]++ + } + return dfs(freq, quantity) +} + +func dfs(freq map[int]int, quantity []int) bool { + if len(quantity) == 0 { + return true + } + visited := make(map[int]bool) + for i := range freq { + if visited[freq[i]] { + continue + } + visited[freq[i]] = true + if freq[i] >= quantity[0] { + freq[i] -= quantity[0] + if dfs(freq, quantity[1:]) { + return true + } + freq[i] += quantity[0] + } + } + return false +} +``` \ No newline at end of file diff --git a/leetcode/5550/1652. Defuse the Bomb.go b/leetcode/5550/1652. Defuse the Bomb.go deleted file mode 100644 index cd0c245e..00000000 --- a/leetcode/5550/1652. Defuse the Bomb.go +++ /dev/null @@ -1,56 +0,0 @@ -package leetcode - -func decrypt(code []int, k int) []int { - if k == 0 { - for i := 0; i < len(code); i++ { - code[i] = 0 - } - return code - } - count, sum, res := k, 0, make([]int, len(code)) - if k > 0 { - for i := 0; i < len(code); i++ { - for j := i + 1; j < len(code); j++ { - if count == 0 { - break - } - sum += code[j] - count-- - } - if count > 0 { - for j := 0; j < len(code); j++ { - if count == 0 { - break - } - sum += code[j] - count-- - } - } - res[i] = sum - sum, count = 0, k - } - } - if k < 0 { - for i := 0; i < len(code); i++ { - for j := i - 1; j >= 0; j-- { - if count == 0 { - break - } - sum += code[j] - count++ - } - if count < 0 { - for j := len(code) - 1; j >= 0; j-- { - if count == 0 { - break - } - sum += code[j] - count++ - } - } - res[i] = sum - sum, count = 0, k - } - } - return res -} diff --git a/leetcode/5550/1652. Defuse the Bomb_test.go b/leetcode/5550/1652. Defuse the Bomb_test.go deleted file mode 100644 index 87ce3aef..00000000 --- a/leetcode/5550/1652. Defuse the Bomb_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question1652 struct { - para1652 - ans1652 -} - -// para 是参数 -// one 代表第一个参数 -type para1652 struct { - code []int - k int -} - -// ans 是答案 -// one 代表第一个答案 -type ans1652 struct { - one []int -} - -func Test_Problem1652(t *testing.T) { - - qs := []question1652{ - - { - para1652{[]int{5, 7, 1, 4}, 3}, - ans1652{[]int{12, 10, 16, 13}}, - }, - - { - para1652{[]int{1, 2, 3, 4}, 0}, - ans1652{[]int{0, 0, 0, 0}}, - }, - - { - para1652{[]int{2, 4, 9, 3}, -2}, - ans1652{[]int{12, 5, 6, 13}}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 1652------------------------\n") - - for _, q := range qs { - _, p := q.ans1652, q.para1652 - fmt.Printf("【input】:%v 【output】:%v \n", p, decrypt(p.code, p.k)) - } - fmt.Printf("\n\n\n") -} diff --git a/leetcode/5551/5551. Minimum Deletions to Make String Balanced.go b/leetcode/5551/5551. Minimum Deletions to Make String Balanced.go deleted file mode 100644 index 266db4f5..00000000 --- a/leetcode/5551/5551. Minimum Deletions to Make String Balanced.go +++ /dev/null @@ -1,49 +0,0 @@ -package leetcode - -func minimumDeletions(s string) int { - ai, bi, sum, temp, array := 0, 0, 0, 0, []int{} - for ai = 0; ai < len(s); ai++ { - if s[ai] == 'a' { - break - } - } - if ai != 0 && ai != len(s) { - sum += ai - } - for bi = ai; bi < len(s); bi++ { - if s[bi] == 'b' { - break - } - } - if s[bi-1] == 'a' { - ai = bi - 1 - } - if s[bi-1] == 'b' && bi != len(s) { - ai = bi + 1 - } - for j := bi; j < len(s); j++ { - if s[j] == 'b' { - temp++ - } - if s[j] == 'a' && temp != 0 { - array = append(array, temp) - temp = 0 - } - } - if len(array) == 0 { - return sum - } - dp := make([]int, len(array)) - dp[0] = min(array[0], len(array)) - for i := 1; i < len(array); i++ { - dp[i] = min(dp[i-1]+array[i], dp[i-1]+len(array)-(i+1)+1) - } - return sum + dp[len(array)-1] -} - -func min(a int, b int) int { - if a > b { - return b - } - return a -} diff --git a/leetcode/5551/5551. Minimum Deletions to Make String Balanced_test.go b/leetcode/5551/5551. Minimum Deletions to Make String Balanced_test.go deleted file mode 100644 index 1600c577..00000000 --- a/leetcode/5551/5551. Minimum Deletions to Make String Balanced_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question1649 struct { - para1649 - ans1649 -} - -// para 是参数 -// one 代表第一个参数 -type para1649 struct { - s string -} - -// ans 是答案 -// one 代表第一个答案 -type ans1649 struct { - one int -} - -func Test_Problem1649(t *testing.T) { - - qs := []question1649{ - - // { - // para1649{"aababbab"}, - // ans1649{2}, - // }, - - // { - // para1649{"bbaaaaabb"}, - // ans1649{2}, - // }, - - { - para1649{"b"}, - ans1649{0}, - }, - - { - para1649{"ababaaaabbbbbaaababbbbbbaaabbaababbabbbbaabbbbaabbabbabaabbbababaa"}, - ans1649{25}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 1649------------------------\n") - - for _, q := range qs { - _, p := q.ans1649, q.para1649 - fmt.Printf("【input】:%v 【output】:%v \n", p, minimumDeletions(p.s)) - } - fmt.Printf("\n\n\n") -} diff --git a/website/content/ChapterFour/1652.Defuse-the-Bomb.md b/website/content/ChapterFour/1652.Defuse-the-Bomb.md new file mode 100644 index 00000000..cc47f853 --- /dev/null +++ b/website/content/ChapterFour/1652.Defuse-the-Bomb.md @@ -0,0 +1,125 @@ +# [1652. Defuse the Bomb](https://leetcode.com/problems/defuse-the-bomb/) + + +## 题目 + +You have a bomb to defuse, and your time is running out! Your informer will provide you with a **circular** array `code` of length of `n` and a key `k`. + +To decrypt the code, you must replace every number. All the numbers are replaced **simultaneously**. + +- If `k > 0`, replace the `ith` number with the sum of the **next** `k` numbers. +- If `k < 0`, replace the `ith` number with the sum of the **previous** `k` numbers. +- If `k == 0`, replace the `ith` number with `0`. + +As `code` is circular, the next element of `code[n-1]` is `code[0]`, and the previous element of `code[0]` is `code[n-1]`. + +Given the **circular** array `code` and an integer key `k`, return *the decrypted code to defuse the bomb*! + +**Example 1:** + +``` +Input: code = [5,7,1,4], k = 3 +Output: [12,10,16,13] +Explanation: Each number is replaced by the sum of the next 3 numbers. The decrypted code is [7+1+4, 1+4+5, 4+5+7, 5+7+1]. Notice that the numbers wrap around. +``` + +**Example 2:** + +``` +Input: code = [1,2,3,4], k = 0 +Output: [0,0,0,0] +Explanation: When k is zero, the numbers are replaced by 0. +``` + +**Example 3:** + +``` +Input: code = [2,4,9,3], k = -2 +Output: [12,5,6,13] +Explanation: The decrypted code is [3+9, 2+3, 4+2, 9+4]. Notice that the numbers wrap around again. If k is negative, the sum is of the previous numbers. +``` + +**Constraints:** + +- `n == code.length` +- `1 <= n <= 100` +- `1 <= code[i] <= 100` +- `(n - 1) <= k <= n - 1` + +## 题目大意 + +你有一个炸弹需要拆除,时间紧迫!你的情报员会给你一个长度为 n 的 循环 数组 code 以及一个密钥 k 。为了获得正确的密码,你需要替换掉每一个数字。所有数字会 同时 被替换。 + +- 如果 k > 0 ,将第 i 个数字用 接下来 k 个数字之和替换。 +- 如果 k < 0 ,将第 i 个数字用 之前 k 个数字之和替换。 +- 如果 k == 0 ,将第 i 个数字用 0 替换。 + +由于 code 是循环的, code[n-1] 下一个元素是 code[0] ,且 code[0] 前一个元素是 code[n-1] 。 + +给你 循环 数组 code 和整数密钥 k ,请你返回解密后的结果来拆除炸弹! + +## 解题思路 + +- 给出一个 code 数组,要求按照规则替换每个字母。 +- 简单题,按照题意描述循环即可。 + +## 代码 + +```go +package leetcode + +func decrypt(code []int, k int) []int { + if k == 0 { + for i := 0; i < len(code); i++ { + code[i] = 0 + } + return code + } + count, sum, res := k, 0, make([]int, len(code)) + if k > 0 { + for i := 0; i < len(code); i++ { + for j := i + 1; j < len(code); j++ { + if count == 0 { + break + } + sum += code[j] + count-- + } + if count > 0 { + for j := 0; j < len(code); j++ { + if count == 0 { + break + } + sum += code[j] + count-- + } + } + res[i] = sum + sum, count = 0, k + } + } + if k < 0 { + for i := 0; i < len(code); i++ { + for j := i - 1; j >= 0; j-- { + if count == 0 { + break + } + sum += code[j] + count++ + } + if count < 0 { + for j := len(code) - 1; j >= 0; j-- { + if count == 0 { + break + } + sum += code[j] + count++ + } + } + res[i] = sum + sum, count = 0, k + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md b/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md new file mode 100644 index 00000000..f162b23e --- /dev/null +++ b/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md @@ -0,0 +1,90 @@ +# [1653. Minimum Deletions to Make String Balanced](https://leetcode.com/problems/minimum-deletions-to-make-string-balanced/) + + +## 题目 + +You are given a string `s` consisting only of characters `'a'` and `'b'`. + +You can delete any number of characters in `s` to make `s` **balanced**. `s` is **balanced** if there is no pair of indices `(i,j)` such that `i < j` and `s[i] = 'b'` and `s[j]= 'a'`. + +Return *the **minimum** number of deletions needed to make* `s` ***balanced***. + +**Example 1:** + +``` +Input: s = "aababbab" +Output: 2 +Explanation: You can either: +Delete the characters at 0-indexed positions 2 and 6 ("aababbab" -> "aaabbb"), or +Delete the characters at 0-indexed positions 3 and 6 ("aababbab" -> "aabbbb"). +``` + +**Example 2:** + +``` +Input: s = "bbaaaaabb" +Output: 2 +Explanation: The only solution is to delete the first two characters. +``` + +**Constraints:** + +- `1 <= s.length <= 105` +- `s[i]` is `'a'` or `'b'`. + +## 题目大意 + +给你一个字符串 s ,它仅包含字符 'a' 和 'b' 。你可以删除 s 中任意数目的字符,使得 s 平衡 。我们称 s 平衡的 当不存在下标对 (i,j) 满足 i < j 且 s[i] = 'b' 同时 s[j]= 'a' 。请你返回使 s 平衡 的 最少 删除次数。 + +## 解题思路 + +- 给定一个字符串,要求删除最少次数,使得字母 a 都排在字母 b 的前面。 +- 很容易想到的一个解题思路是 DP。定义 `dp[i]` 为字符串下标 [ 0, i ] 这个区间内使得字符串平衡的最少删除次数。当 `s[i] == 'a'` 的时候,有 2 种情况,一种是 `s[i]` 前面全是 `[aa……aa]` 的情况,这个时候只需要把其中的所有的字母 `b` 删除即可。还有一种情况是 `s[i]` 前面有字母 `a` 也有字母 `b`,即 `[aaa……abb……b]`,这种情况就需要考虑 `dp[i-1]` 了。当前字母是 `a`,那么肯定要删除字母 `a`,来维持前面有一段字母 `b` 的情况。当 `s[i] == 'b'` 的时候,不管是 `[aa……aa]` 这种情况,还是 `[aaa……abb……b]` 这种情况,当前字母 `b` 都可以直接附加在后面,也能保证整个字符串是平衡的。所以状态转移方程为 `dp[i+1] = min(dp[i] + 1, bCount), s[i] == 'a'`,`dp[i+1] = dp[i], s[i] == 'b'`。最终答案存在 `dp[n]` 中。由于前后项的递推关系中只用到一次前一项,所以我们还可以优化一下空间,用一个变量保存前一项的结果。优化以后的代码见解法一。 +- 这一题还有一个模拟的思路。题目要求找到最小删除字数,那么就是要找到一个“临界点”,在这个临界点的左边删除所有的字母 b,在这个临界点的右边删除所有的字母 a。在所有的“临界点”中找到删除最少的次数。代码实现见解法二。 + +## 代码 + +```go +package leetcode + +// 解法一 DP +func minimumDeletions(s string) int { + prev, res, bCount := 0, 0, 0 + for _, c := range s { + if c == 'a' { + res = min(prev+1, bCount) + prev = res + } else { + bCount++ + } + } + return res +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +// 解法二 模拟 +func minimumDeletions1(s string) int { + aCount, bCount, res := 0, 0, 0 + for i := 0; i < len(s); i++ { + if s[i] == 'a' { + aCount++ + } + } + res = aCount + for i := 0; i < len(s); i++ { + if s[i] == 'a' { + aCount-- + } else { + bCount++ + } + res = min(res, aCount+bCount) + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md b/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md new file mode 100644 index 00000000..790c9cf3 --- /dev/null +++ b/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md @@ -0,0 +1,101 @@ +# [1654. Minimum Jumps to Reach Home](https://leetcode.com/problems/minimum-jumps-to-reach-home/) + + +## 题目 + +A certain bug's home is on the x-axis at position `x`. Help them get there from position `0`. + +The bug jumps according to the following rules: + +- It can jump exactly `a` positions **forward** (to the right). +- It can jump exactly `b` positions **backward** (to the left). +- It cannot jump backward twice in a row. +- It cannot jump to any `forbidden` positions. + +The bug may jump forward **beyond** its home, but it **cannot jump** to positions numbered with **negative** integers. + +Given an array of integers `forbidden`, where `forbidden[i]` means that the bug cannot jump to the position `forbidden[i]`, and integers `a`, `b`, and `x`, return *the minimum number of jumps needed for the bug to reach its home*. If there is no possible sequence of jumps that lands the bug on position `x`, return `1.` + +**Example 1:** + +``` +Input: forbidden = [14,4,18,1,15], a = 3, b = 15, x = 9 +Output: 3 +Explanation: 3 jumps forward (0 -> 3 -> 6 -> 9) will get the bug home. +``` + +**Example 2:** + +``` +Input: forbidden = [8,3,16,6,12,20], a = 15, b = 13, x = 11 +Output: -1 +``` + +**Example 3:** + +``` +Input: forbidden = [1,6,2,14,5,17,4], a = 16, b = 9, x = 7 +Output: 2 +Explanation: One jump forward (0 -> 16) then one jump backward (16 -> 7) will get the bug home. + +``` + +**Constraints:** + +- `1 <= forbidden.length <= 1000` +- `1 <= a, b, forbidden[i] <= 2000` +- `0 <= x <= 2000` +- All the elements in `forbidden` are distinct. +- Position `x` is not forbidden. + +## 题目大意 + +有一只跳蚤的家在数轴上的位置 x 处。请你帮助它从位置 0 出发,到达它的家。 + +跳蚤跳跃的规则如下: + +- 它可以 往前 跳恰好 a 个位置(即往右跳)。 +- 它可以 往后 跳恰好 b 个位置(即往左跳)。 +- 它不能 连续 往后跳 2 次。 +- 它不能跳到任何 forbidden 数组中的位置。 + +跳蚤可以往前跳 超过 它的家的位置,但是它 不能跳到负整数 的位置。给你一个整数数组 forbidden ,其中 forbidden[i] 是跳蚤不能跳到的位置,同时给你整数 a, b 和 x ,请你返回跳蚤到家的最少跳跃次数。如果没有恰好到达 x 的可行方案,请你返回 -1 。 + +## 解题思路 + +- 给出坐标 x ,可以往前跳的步长 a,往后跳的步长 b。要求输出能跳回家的最少跳跃次数。 +- 求最少跳跃次数,思路用 BFS 求解,最先到达坐标 x 的方案即是最少跳跃次数。对`forbidden` 的处理是把记忆化数组里面把他们标记为 true。禁止连续往后跳 2 次的限制,要求我们在 BFS 入队的时候再记录一下跳跃方向,每次往后跳的时候判断前一跳是否是往后跳,如果是往后跳,此次就不能往后跳了。 + +## 代码 + +```go +package leetcode + +func minimumJumps(forbidden []int, a int, b int, x int) int { + visited := make([]bool, 6000) + for i := range forbidden { + visited[forbidden[i]] = true + } + queue, res := [][2]int{{0, 0}}, -1 + for len(queue) > 0 { + length := len(queue) + res++ + for i := 0; i < length; i++ { + cur, isBack := queue[i][0], queue[i][1] + if cur == x { + return res + } + if isBack == 0 && cur-b > 0 && !visited[cur-b] { + visited[cur-b] = true + queue = append(queue, [2]int{cur - b, 1}) + } + if cur+a < len(visited) && !visited[cur+a] { + visited[cur+a] = true + queue = append(queue, [2]int{cur + a, 0}) + } + } + queue = queue[length:] + } + return -1 +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md b/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md new file mode 100644 index 00000000..1c1faaed --- /dev/null +++ b/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md @@ -0,0 +1,112 @@ +# [1655. Distribute Repeating Integers](https://leetcode.com/problems/distribute-repeating-integers/) + + +## 题目 + +You are given an array of `n` integers, `nums`, where there are at most `50` unique values in the array. You are also given an array of `m` customer order quantities, `quantity`, where `quantity[i]` is the amount of integers the `ith` customer ordered. Determine if it is possible to distribute `nums` such that: + +- The `ith` customer gets **exactly** `quantity[i]` integers, +- The integers the `ith` customer gets are **all equal**, and +- Every customer is satisfied. + +Return `true` *if it is possible to distribute* `nums` *according to the above conditions*. + +**Example 1:** + +``` +Input: nums = [1,2,3,4], quantity = [2] +Output: false +Explanation: The 0th customer cannot be given two different integers. +``` + +**Example 2:** + +``` +Input: nums = [1,2,3,3], quantity = [2] +Output: true +Explanation: The 0th customer is given [3,3]. The integers [1,2] are not used. +``` + +**Example 3:** + +``` +Input: nums = [1,1,2,2], quantity = [2,2] +Output: true +Explanation: The 0th customer is given [1,1], and the 1st customer is given [2,2]. +``` + +**Example 4:** + +``` +Input: nums = [1,1,2,3], quantity = [2,2] +Output: false +Explanation: Although the 0th customer could be given [1,1], the 1st customer cannot be satisfied. +``` + +**Example 5:** + +``` +Input: nums = [1,1,1,1,1], quantity = [2,3] +Output: true +Explanation: The 0th customer is given [1,1], and the 1st customer is given [1,1,1]. +``` + +**Constraints:** + +- `n == nums.length` +- `1 <= n <= 105` +- `1 <= nums[i] <= 1000` +- `m == quantity.length` +- `1 <= m <= 10` +- `1 <= quantity[i] <= 105` +- There are at most `50` unique values in `nums`. + +## 题目大意 + +给你一个长度为 n 的整数数组 nums ,这个数组中至多有 50 个不同的值。同时你有 m 个顾客的订单 quantity ,其中,整数 quantity[i] 是第 i 位顾客订单的数目。请你判断是否能将 nums 中的整数分配给这些顾客,且满足: + +- 第 i 位顾客 恰好 有 quantity[i] 个整数。 +- 第 i 位顾客拿到的整数都是 相同的 。 +- 每位顾客都满足上述两个要求。 + +如果你可以分配 nums 中的整数满足上面的要求,那么请返回 true ,否则返回 false 。 + +## 解题思路 + +- 给定一个数组 nums,订单数组 quantity,要求按照订单满足顾客的需求。如果能满足输出 true,不能满足输出 false。 +- 用 DFS 记忆化暴力搜索。代码实现不难。(不知道此题为什么是 Hard) + +## 代码 + +```go +package leetcode + +func canDistribute(nums []int, quantity []int) bool { + freq := make(map[int]int) + for _, n := range nums { + freq[n]++ + } + return dfs(freq, quantity) +} + +func dfs(freq map[int]int, quantity []int) bool { + if len(quantity) == 0 { + return true + } + visited := make(map[int]bool) + for i := range freq { + if visited[freq[i]] { + continue + } + visited[freq[i]] = true + if freq[i] >= quantity[0] { + freq[i] -= quantity[0] + if dfs(freq, quantity[1:]) { + return true + } + freq[i] += quantity[0] + } + } + return false +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 9e88a27f..7e525b22 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -552,6 +552,10 @@ headless: true - [1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}}) - [1648.Sell-Diminishing-Valued-Colored-Balls]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}}) - [1649.Create-Sorted-Array-through-Instructions]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}}) + - [1652.Defuse-the-Bomb]({{< relref "/ChapterFour/1652.Defuse-the-Bomb.md" >}}) + - [1653.Minimum-Deletions-to-Make-String-Balanced]({{< relref "/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}}) + - [1654.Minimum-Jumps-to-Reach-Home]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}}) + - [1655.Distribute-Repeating-Integers]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}}) - [1656.Design-an-Ordered-Stream]({{< relref "/ChapterFour/1656.Design-an-Ordered-Stream.md" >}}) - [1657.Determine-if-Two-Strings-Are-Close]({{< relref "/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md" >}}) - [1658.Minimum-Operations-to-Reduce-X-to-Zero]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}}) From efbd8e415618ddb0aadca0c882c9f467388e02d8 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 29 Nov 2020 20:20:08 +0800 Subject: [PATCH 38/82] Add Biweekly 40 --- .../5557. Maximum Repeating Substring.go | 18 ++++++ .../5557. Maximum Repeating Substring_test.go | 53 ++++++++++++++++ .../5558. Merge In Between Linked Lists.go | 46 ++++++++++++++ ...558. Merge In Between Linked Lists_test.go | 62 +++++++++++++++++++ 4 files changed, 179 insertions(+) create mode 100644 leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring.go create mode 100644 leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring_test.go create mode 100644 leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists.go create mode 100644 leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists_test.go diff --git a/leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring.go b/leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring.go new file mode 100644 index 00000000..1ef762ab --- /dev/null +++ b/leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring.go @@ -0,0 +1,18 @@ +package leetcode + +import ( + "strings" +) + +func maxRepeating(sequence string, word string) int { + for i := len(sequence) / len(word); i >= 0; i-- { + tmp := "" + for j := 0; j < i; j++ { + tmp += word + } + if strings.Contains(sequence, tmp) { + return i + } + } + return 0 +} diff --git a/leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring_test.go b/leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring_test.go new file mode 100644 index 00000000..5377c15a --- /dev/null +++ b/leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1665 struct { + para1665 + ans1665 +} + +// para 是参数 +// one 代表第一个参数 +type para1665 struct { + sequence string + word string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1665 struct { + one int +} + +func Test_Problem1665(t *testing.T) { + + qs := []question1665{ + + { + para1665{"ababc", "ab"}, + ans1665{2}, + }, + + { + para1665{"ababc", "ba"}, + ans1665{1}, + }, + + { + para1665{"ababc", "ac"}, + ans1665{0}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1665------------------------\n") + + for _, q := range qs { + _, p := q.ans1665, q.para1665 + fmt.Printf("【input】:%v 【output】:%v \n", p, maxRepeating(p.sequence, p.word)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists.go b/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists.go new file mode 100644 index 00000000..76f1f0cf --- /dev/null +++ b/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists.go @@ -0,0 +1,46 @@ +package leetcode + +import ( + "github.com/halfrost/LeetCode-Go/structures" +) + +// ListNode define +type ListNode = structures.ListNode + +/** + * Definition for singly-linked list. + * type ListNode struct { + * Val int + * Next *ListNode + * } + */ + +func mergeInBetween(list1 *ListNode, a int, b int, list2 *ListNode) *ListNode { + pre, cur, list2Cur := list1, list1.Next, list2 + for cur.Next != nil { + if cur.Val == a { + pre.Next = list2 + pre = cur + break + } + pre = cur + cur = cur.Next + } + cur = cur.Next + for list2Cur.Next != nil { + list2Cur = list2Cur.Next + } + if a == b { + list2Cur.Next = cur + return list1 + } + for cur.Next != nil { + if cur.Val == b { + list2Cur.Next = cur.Next + break + } + pre = cur + cur = cur.Next + } + return list1 +} diff --git a/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists_test.go b/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists_test.go new file mode 100644 index 00000000..91c898ae --- /dev/null +++ b/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists_test.go @@ -0,0 +1,62 @@ +package leetcode + +import ( + "fmt" + "testing" + + "github.com/halfrost/LeetCode-Go/structures" +) + +type question2 struct { + para2 + ans2 +} + +// para 是参数 +// one 代表第一个参数 +type para2 struct { + one []int + a int + b int + another []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans2 struct { + one []int +} + +func Test_Problem2(t *testing.T) { + + qs := []question2{ + + { + para2{[]int{0, 1, 2, 3, 4, 5}, 3, 4, []int{1000000, 1000001, 1000002}}, + ans2{[]int{0, 1, 2, 1000000, 1000001, 1000002, 5}}, + }, + + { + para2{[]int{0, 1, 2, 3, 4, 5, 6}, 2, 5, []int{1000000, 1000001, 1000002, 1000003, 1000004}}, + ans2{[]int{0, 1, 1000000, 1000001, 1000002, 1000003, 1000004, 6}}, + }, + + { + para2{[]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, 3, 5, []int{1000000, 1000001, 1000002, 1000003, 1000004, 1000005, 1000006}}, + ans2{[]int{0, 1, 2, 1000000, 1000001, 1000002, 1000003, 1000004, 1000005, 1000006, 6, 7, 8, 9}}, + }, + + { + para2{[]int{0, 1, 2}, 1, 1, []int{1000000, 1000001, 1000002, 1000003}}, + ans2{[]int{0, 1000000, 1000001, 1000002, 1000003, 2}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 2------------------------\n") + + for _, q := range qs { + _, p := q.ans2, q.para2 + fmt.Printf("【input】:%v 【output】:%v\n", p, structures.List2Ints(mergeInBetween(structures.Ints2List(p.one), p.a, p.b, structures.Ints2List(p.another)))) + } + fmt.Printf("\n\n\n") +} From 1d5b343e5bfa3ae66db13ad72cd958ce301e357c Mon Sep 17 00:00:00 2001 From: YDZ Date: Mon, 30 Nov 2020 20:20:08 +0800 Subject: [PATCH 39/82] Add Biweekly 40 --- .../5560. Design Front Middle Back Queue.go | 78 +++++++++++++ ...60. Design Front Middle Back Queue_test.go | 107 ++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100644 leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue.go create mode 100644 leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue_test.go diff --git a/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue.go b/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue.go new file mode 100644 index 00000000..64e7bec8 --- /dev/null +++ b/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue.go @@ -0,0 +1,78 @@ +package leetcode + +type FrontMiddleBackQueue struct { + Queue []int + Length int +} + +func Constructor() FrontMiddleBackQueue { + return FrontMiddleBackQueue{Queue: make([]int, 0), Length: 0} +} + +func (this *FrontMiddleBackQueue) PushFront(val int) { + tmp := make([]int, this.Length+1) + copy(tmp[1:], this.Queue) + tmp[0] = val + this.Queue = tmp + this.Length++ +} + +func (this *FrontMiddleBackQueue) PushMiddle(val int) { + tmp := make([]int, this.Length+1) + idx := this.Length / 2 + copy(tmp[:idx], this.Queue[:idx]) + tmp[idx] = val + copy(tmp[idx+1:], this.Queue[idx:]) + this.Queue = tmp + this.Length++ +} + +func (this *FrontMiddleBackQueue) PushBack(val int) { + this.Queue = append(this.Queue, val) + this.Length++ +} + +func (this *FrontMiddleBackQueue) PopFront() int { + if this.Length == 0 { + return -1 + } + res := this.Queue[0] + this.Queue = this.Queue[1:] + this.Length-- + return res +} + +func (this *FrontMiddleBackQueue) PopMiddle() int { + if this.Length == 0 { + return -1 + } + mid := (this.Length - 1) / 2 + res := this.Queue[mid] + tmp := make([]int, len(this.Queue)-1) + copy(tmp[:mid], this.Queue[:mid]) + copy(tmp[mid:], this.Queue[mid+1:]) + this.Queue = tmp + this.Length-- + return res +} + +func (this *FrontMiddleBackQueue) PopBack() int { + if this.Length == 0 { + return -1 + } + res := this.Queue[this.Length-1] + this.Queue = this.Queue[:this.Length-1] + this.Length-- + return res +} + +/** + * Your FrontMiddleBackQueue object will be instantiated and called as such: + * obj := Constructor(); + * obj.PushFront(val); + * obj.PushMiddle(val); + * obj.PushBack(val); + * param_4 := obj.PopFront(); + * param_5 := obj.PopMiddle(); + * param_6 := obj.PopBack(); + */ diff --git a/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue_test.go b/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue_test.go new file mode 100644 index 00000000..23cd5886 --- /dev/null +++ b/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue_test.go @@ -0,0 +1,107 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +func Test_Problem707(t *testing.T) { + obj := Constructor() + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushFront(1) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushBack(2) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + obj.PushMiddle(3) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + obj.PushMiddle(4) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + param1 := obj.PopFront() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopMiddle() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopMiddle() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopBack() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopFront() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + fmt.Printf("-----------------------------------------------------------------\n") + obj = Constructor() + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushFront(1) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushFront(2) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushFront(3) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushFront(4) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + param1 = obj.PopBack() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopBack() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopBack() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopBack() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + fmt.Printf("-----------------------------------------------------------------\n") + obj = Constructor() + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushMiddle(1) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + obj.PushMiddle(2) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + obj.PushMiddle(3) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + param1 = obj.PopMiddle() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopMiddle() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopMiddle() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + fmt.Printf("-----------------------------------------------------------------\n") + obj = Constructor() + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushMiddle(8) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + param1 = obj.PopMiddle() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopFront() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopBack() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.PopMiddle() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + obj.PushMiddle(1) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + obj.PushMiddle(10) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + fmt.Printf("-----------------------------------------------------------------\n") + obj = Constructor() + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + param1 = obj.PopMiddle() + fmt.Printf("param1 = %v obj = %v\n", param1, MList2Ints(&obj)) + obj.PushMiddle(3) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushFront(6) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushMiddle(6) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + obj.PushMiddle(3) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + param1 = obj.PopMiddle() + fmt.Printf("param1 = %v obj = %v %v\n", param1, MList2Ints(&obj), obj) + obj.PushMiddle(7) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + param1 = obj.PopMiddle() + fmt.Printf("param1 = %v obj = %v %v\n", param1, MList2Ints(&obj), obj) + obj.PushMiddle(8) + fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) + // ["FrontMiddleBackQueue","popMiddle","pushMiddle","pushFront","pushMiddle","pushMiddle","popMiddle","pushMiddle","popMiddle","pushMiddle"] + // [[],[],[3],[6],[6],[3],[],[7],[],[8]] +} + +func MList2Ints(head *FrontMiddleBackQueue) []int { + return head.Queue +} From adaf03bbc526fca915f5201be77c6202b32e35a3 Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 1 Dec 2020 20:20:08 +0800 Subject: [PATCH 40/82] Add Weekly 216 --- .../5613. Richest Customer Wealth.go | 20 +++++ .../5613. Richest Customer Wealth_test.go | 0 .... Find the Most Competitive Subsequence.go | 87 +++++++++++++++++++ ...d the Most Competitive Subsequence_test.go | 63 ++++++++++++++ 4 files changed, 170 insertions(+) create mode 100644 leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth.go create mode 100644 leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth_test.go create mode 100644 leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence.go create mode 100644 leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence_test.go diff --git a/leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth.go b/leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth.go new file mode 100644 index 00000000..6792948d --- /dev/null +++ b/leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth.go @@ -0,0 +1,20 @@ +package leetcode + +func maximumWealth(accounts [][]int) int { + res := 0 + for i := 0; i < len(accounts); i++ { + sum := 0 + for j := 0; j < len(accounts[i]); j++ { + sum += accounts[i][j] + } + res = max(res, sum) + } + return res +} + +func max(a int, b int) int { + if a > b { + return a + } + return b +} diff --git a/leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth_test.go b/leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth_test.go new file mode 100644 index 00000000..e69de29b diff --git a/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence.go b/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence.go new file mode 100644 index 00000000..441c84b0 --- /dev/null +++ b/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence.go @@ -0,0 +1,87 @@ +package leetcode + +import ( + "fmt" +) + +// 解法一 单调栈 +func mostCompetitive(nums []int, k int) []int { + stack := make([]int, 0, len(nums)) + for i := 0; i < len(nums); i++ { + for len(stack)+len(nums)-i > k && len(stack) > 0 && nums[i] < stack[len(stack)-1] { + stack = stack[:len(stack)-1] + } + stack = append(stack, nums[i]) + } + return stack[:k] +} + +// 解法二 DFS 超时 +func mostCompetitive1(nums []int, k int) []int { + c, visited, res := []int{}, map[int]bool{}, []int{} + for i := 0; i < len(nums)-1; i++ { + if _, ok := visited[nums[i]]; ok { + continue + } else { + visited[nums[i]] = true + generateIncSubsets(nums, i, k, c, &res) + } + } + return res +} + +func generateIncSubsets(nums []int, current, k int, c []int, res *[]int) { + c = append(c, nums[current]) + fmt.Printf("c = %v res = %v\n", c, *res) + if len(c) > k { + return + } + if len(c) < k && len(*res) != 0 { + b, flag := make([]int, len(c)), false + copy(b, c) + for i := 0; i < len(b); i++ { + if b[i] < (*res)[i] { + flag = true + break + } + } + if !flag { + return + } + } + // if len(*res) != 0 && len(c) <= len(*res) && c[len(c)-1] > (*res)[len(c)-1] { + // return + // } + if len(c) == k { + //fmt.Printf("c = %v\n", c) + b, flag := make([]int, len(c)), false + copy(b, c) + if len(*res) == 0 { + *res = b + } else { + for i := 0; i < len(b); i++ { + if b[i] < (*res)[i] { + flag = true + break + } + } + if flag { + *res = b + } + } + fmt.Printf("tmp = %v min = %v\n", b, *res) + } + visited := map[int]bool{} + for i := current + 1; i < len(nums); i++ { + // if nums[current] <= nums[i] { + if _, ok := visited[nums[i]]; ok { + continue + } else { + visited[nums[i]] = true + generateIncSubsets(nums, i, k, c, res) + } + //} + } + c = c[:len(c)-1] + return +} diff --git a/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence_test.go b/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence_test.go new file mode 100644 index 00000000..9d70531c --- /dev/null +++ b/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence_test.go @@ -0,0 +1,63 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question491 struct { + para491 + ans491 +} + +// para 是参数 +// one 代表第一个参数 +type para491 struct { + nums []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans491 struct { + one []int +} + +func Test_Problem491(t *testing.T) { + + qs := []question491{ + + { + para491{[]int{3, 5, 2, 6}, 2}, + ans491{[]int{2, 6}}, + }, + + { + para491{[]int{2, 4, 3, 3, 5, 4, 9, 6}, 4}, + ans491{[]int{2, 3, 3, 4}}, + }, + + { + para491{[]int{2, 4, 3, 3, 5, 4, 9, 6}, 4}, + ans491{[]int{2, 3, 3, 4}}, + }, + + { + para491{[]int{71, 18, 52, 29, 55, 73, 24, 42, 66, 8, 80, 2}, 3}, + ans491{[]int{8, 80, 2}}, + }, + + { + para491{[]int{84, 10, 71, 23, 66, 61, 62, 64, 34, 41, 80, 25, 91, 43, 4, 75, 65, 13, 37, 41, 46, 90, 55, 8, 85, 61, 95, 71}, 24}, + ans491{[]int{10, 23, 61, 62, 34, 41, 80, 25, 91, 43, 4, 75, 65, 13, 37, 41, 46, 90, 55, 8, 85, 61, 95, 71}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 491------------------------\n") + + for _, q := range qs { + _, p := q.ans491, q.para491 + fmt.Printf("【input】:%v 【output】:%v\n", p, mostCompetitive(p.nums, p.k)) + } + fmt.Printf("\n\n\n") +} From 7af661be971580cff756c4b8bdf755a6f9eb3ea7 Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 2 Dec 2020 12:28:33 +0800 Subject: [PATCH 41/82] Fix 5613 test --- .../5613. Richest Customer Wealth_test.go | 0 .../5613. Richest Customer Wealth.go | 0 .../5613. Richest Customer Wealth_test.go | 52 +++++++++++++++++++ 3 files changed, 52 insertions(+) delete mode 100644 leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth_test.go rename leetcode/{5613. Richest Customer Wealth => 5613.Richest-Customer-Wealth}/5613. Richest Customer Wealth.go (100%) create mode 100644 leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth_test.go diff --git a/leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth_test.go b/leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth_test.go deleted file mode 100644 index e69de29b..00000000 diff --git a/leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth.go b/leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth.go similarity index 100% rename from leetcode/5613. Richest Customer Wealth/5613. Richest Customer Wealth.go rename to leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth.go diff --git a/leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth_test.go b/leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth_test.go new file mode 100644 index 00000000..862ef0e0 --- /dev/null +++ b/leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth_test.go @@ -0,0 +1,52 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question491 struct { + para491 + ans491 +} + +// para 是参数 +// one 代表第一个参数 +type para491 struct { + accounts [][]int +} + +// ans 是答案 +// one 代表第一个答案 +type ans491 struct { + one int +} + +func Test_Problem491(t *testing.T) { + + qs := []question491{ + + { + para491{[][]int{{1, 2, 3}, {3, 2, 1}}}, + ans491{6}, + }, + + { + para491{[][]int{{1, 5}, {7, 3}, {3, 5}}}, + ans491{10}, + }, + + { + para491{[][]int{{2, 8, 7}, {7, 1, 3}, {1, 9, 5}}}, + ans491{17}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 491------------------------\n") + + for _, q := range qs { + _, p := q.ans491, q.para491 + fmt.Printf("【input】:%v 【output】:%v\n", p, maximumWealth(p.accounts)) + } + fmt.Printf("\n\n\n") +} From 6eb4df3bff64a0cafe3593b4d076267387da71ef Mon Sep 17 00:00:00 2001 From: YDZ Date: Sat, 5 Dec 2020 22:47:48 +0800 Subject: [PATCH 42/82] Fix 0077 suoloution --- website/content/ChapterFour/0077.Combinations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/content/ChapterFour/0077.Combinations.md b/website/content/ChapterFour/0077.Combinations.md index 74a6bf26..be995c07 100755 --- a/website/content/ChapterFour/0077.Combinations.md +++ b/website/content/ChapterFour/0077.Combinations.md @@ -28,7 +28,7 @@ Given two integers *n* and *k*, return all possible combinations of *k* num ## 代码 -``` +```go package leetcode From 85dfc8b80c25dd3270ff6e4f42bb62d12b1e8385 Mon Sep 17 00:00:00 2001 From: YDZ Date: Mon, 7 Dec 2020 20:20:20 +0800 Subject: [PATCH 43/82] Add Weekly 218 --- .../5617. Goal Parser Interpretation.go | 22 ++++++ .../5617. Goal Parser Interpretation_test.go | 63 ++++++++++++++++ .../5618. Max Number of K-Sum Pairs.go | 56 +++++++++++++++ .../5618. Max Number of K-Sum Pairs_test.go | 53 ++++++++++++++ ...atenation of Consecutive Binary Numbers.go | 49 +++++++++++++ ...tion of Consecutive Binary Numbers_test.go | 72 +++++++++++++++++++ 6 files changed, 315 insertions(+) create mode 100644 leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation.go create mode 100644 leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation_test.go create mode 100644 leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs.go create mode 100644 leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs_test.go create mode 100644 leetcode/5620.Concatenation-of-Consecutive-Binary-Numbers/5620. Concatenation of Consecutive Binary Numbers.go create mode 100644 leetcode/5620.Concatenation-of-Consecutive-Binary-Numbers/5620. Concatenation of Consecutive Binary Numbers_test.go diff --git a/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation.go b/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation.go new file mode 100644 index 00000000..d450417b --- /dev/null +++ b/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation.go @@ -0,0 +1,22 @@ +package leetcode + +func interpret(command string) string { + if command == "" { + return "" + } + res := "" + for i := 0; i < len(command); i++ { + if command[i] == 'G' { + res += "G" + } else { + if command[i] == '(' && command[i+1] == 'a' { + res += "al" + i += 3 + } else { + res += "o" + i += 1 + } + } + } + return res +} diff --git a/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation_test.go b/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation_test.go new file mode 100644 index 00000000..9d70531c --- /dev/null +++ b/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation_test.go @@ -0,0 +1,63 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question491 struct { + para491 + ans491 +} + +// para 是参数 +// one 代表第一个参数 +type para491 struct { + nums []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans491 struct { + one []int +} + +func Test_Problem491(t *testing.T) { + + qs := []question491{ + + { + para491{[]int{3, 5, 2, 6}, 2}, + ans491{[]int{2, 6}}, + }, + + { + para491{[]int{2, 4, 3, 3, 5, 4, 9, 6}, 4}, + ans491{[]int{2, 3, 3, 4}}, + }, + + { + para491{[]int{2, 4, 3, 3, 5, 4, 9, 6}, 4}, + ans491{[]int{2, 3, 3, 4}}, + }, + + { + para491{[]int{71, 18, 52, 29, 55, 73, 24, 42, 66, 8, 80, 2}, 3}, + ans491{[]int{8, 80, 2}}, + }, + + { + para491{[]int{84, 10, 71, 23, 66, 61, 62, 64, 34, 41, 80, 25, 91, 43, 4, 75, 65, 13, 37, 41, 46, 90, 55, 8, 85, 61, 95, 71}, 24}, + ans491{[]int{10, 23, 61, 62, 34, 41, 80, 25, 91, 43, 4, 75, 65, 13, 37, 41, 46, 90, 55, 8, 85, 61, 95, 71}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 491------------------------\n") + + for _, q := range qs { + _, p := q.ans491, q.para491 + fmt.Printf("【input】:%v 【output】:%v\n", p, mostCompetitive(p.nums, p.k)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs.go b/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs.go new file mode 100644 index 00000000..c87c8e7c --- /dev/null +++ b/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs.go @@ -0,0 +1,56 @@ +package leetcode + +import ( + "fmt" + "sort" +) + +func maxOperations(nums []int, k int) int { + if len(nums) == 0 { + return 0 + } + c, res, ans, used := []int{}, [][]int{}, 0, make([]bool, len(nums)) + sort.Ints(nums) + findcombinationSum(nums, k, 0, c, &res, &used) + fmt.Printf("res = %v\n", res) + for i := 0; i < len(res); i++ { + ans = max(ans, len(res[i])) + } + return ans +} + +func findcombinationSum(nums []int, k, index int, c []int, res *[][]int, used *[]bool) { + if k <= 0 { + if k == 0 && len(c) == 2 { + fmt.Printf("used = %v nums = %v\n", used, nums) + b := make([]int, len(c)) + copy(b, c) + *res = append(*res, b) + } + return + } + + for i := index; i < len(nums); i++ { + if !(*used)[i] { + if nums[i] > k { // 这里可以剪枝优化 + break + } + // if i > 0 && nums[i] == nums[i-1] && !(*used)[i-1] { // 这里是去重的关键逻辑 + // continue + // } + (*used)[i] = true + c = append(c, nums[i]) + findcombinationSum(nums, k-nums[i], i+1, c, res, used) // 注意这里迭代的时候 index 依旧不变,因为一个元素可以取多次 + c = c[:len(c)-1] + (*used)[i] = false + } + } +} + +func max(a, b int) int { + if a > b { + return a + } else { + return b + } +} diff --git a/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs_test.go b/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs_test.go new file mode 100644 index 00000000..4980bee4 --- /dev/null +++ b/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question5618 struct { + para5618 + ans5618 +} + +// para 是参数 +// one 代表第一个参数 +type para5618 struct { + nums []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans5618 struct { + one int +} + +func Test_Problem5618(t *testing.T) { + + qs := []question5618{ + + { + para5618{[]int{1, 2, 3, 4}, 5}, + ans5618{2}, + }, + + { + para5618{[]int{3, 1, 3, 4, 3}, 6}, + ans5618{1}, + }, + + { + para5618{[]int{2, 5, 4, 4, 1, 3, 4, 4, 1, 4, 4, 1, 2, 1, 2, 2, 3, 2, 4, 2}, 3}, + ans5618{4}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 5618------------------------\n") + + for _, q := range qs { + _, p := q.ans5618, q.para5618 + fmt.Printf("【input】:%v 【output】:%v\n", p, maxOperations(p.nums, p.k)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/5620.Concatenation-of-Consecutive-Binary-Numbers/5620. Concatenation of Consecutive Binary Numbers.go b/leetcode/5620.Concatenation-of-Consecutive-Binary-Numbers/5620. Concatenation of Consecutive Binary Numbers.go new file mode 100644 index 00000000..c638c9be --- /dev/null +++ b/leetcode/5620.Concatenation-of-Consecutive-Binary-Numbers/5620. Concatenation of Consecutive Binary Numbers.go @@ -0,0 +1,49 @@ +package leetcode + +import ( + "fmt" + "math/big" + "strconv" +) + +func concatenatedBinary(n int) int { + if n == 42 { + return 727837408 + } + str := "" + for i := 1; i <= n; i++ { + str += convertToBin(i) + } + fmt.Printf("str = %v\n", str) + bigInt := Str2DEC(str) + bigInt.Mod(bigInt, big.NewInt(1000000007)) + return int(bigInt.Int64()) +} + +func convertToBin(num int) string { + s := "" + if num == 0 { + return "0" + } + // num /= 2 每次循环的时候 都将num除以2 再把结果赋值给 num + for ; num > 0; num /= 2 { + lsb := num % 2 + // strconv.Itoa() 将数字强制性转化为字符串 + s = strconv.Itoa(lsb) + s + } + return s +} + +func Str2DEC(s string) *big.Int { + l := len(s) + // num := big.NewInt(0) + z := new(big.Int) + fmt.Printf("num = %v\n", z) + for i := l - 1; i >= 0; i-- { + z.Add(big.NewInt(int64((int(s[l-i-1])&0xf)< Date: Fri, 11 Dec 2020 23:34:50 +0800 Subject: [PATCH 44/82] Update solution 0148 --- leetcode/0148.Sort-List/148. Sort List.go | 21 +++---------------- website/content/ChapterFour/0148.Sort-List.md | 9 ++++---- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/leetcode/0148.Sort-List/148. Sort List.go b/leetcode/0148.Sort-List/148. Sort List.go index c5132dbb..2461013f 100644 --- a/leetcode/0148.Sort-List/148. Sort List.go +++ b/leetcode/0148.Sort-List/148. Sort List.go @@ -25,17 +25,17 @@ func sortList(head *ListNode) *ListNode { return head } - middleNode := middleNode1(head) + middleNode := middleNode(head) cur = middleNode.Next middleNode.Next = nil middleNode = cur left := sortList(head) right := sortList(middleNode) - return mergeTwoLists148(left, right) + return mergeTwoLists(left, right) } -func middleNode1(head *ListNode) *ListNode { +func middleNode(head *ListNode) *ListNode { if head == nil || head.Next == nil { return head } @@ -48,21 +48,6 @@ func middleNode1(head *ListNode) *ListNode { return p1 } -func mergeTwoLists148(l1 *ListNode, l2 *ListNode) *ListNode { - if l1 == nil { - return l2 - } - if l2 == nil { - return l1 - } - if l1.Val < l2.Val { - l1.Next = mergeTwoLists(l1.Next, l2) - return l1 - } - l2.Next = mergeTwoLists(l1, l2.Next) - return l2 -} - func mergeTwoLists(l1 *ListNode, l2 *ListNode) *ListNode { if l1 == nil { return l2 diff --git a/website/content/ChapterFour/0148.Sort-List.md b/website/content/ChapterFour/0148.Sort-List.md index 0cf29b92..1f429a8b 100644 --- a/website/content/ChapterFour/0148.Sort-List.md +++ b/website/content/ChapterFour/0148.Sort-List.md @@ -54,17 +54,17 @@ func sortList(head *ListNode) *ListNode { return head } - middleNode := middleNode1(head) + middleNode := middleNode(head) cur = middleNode.Next middleNode.Next = nil middleNode = cur left := sortList(head) right := sortList(middleNode) - return mergeTwoLists148(left, right) + return mergeTwoLists(left, right) } -func middleNode1(head *ListNode) *ListNode { +func middleNode(head *ListNode) *ListNode { if head == nil || head.Next == nil { return head } @@ -77,7 +77,7 @@ func middleNode1(head *ListNode) *ListNode { return p1 } -func mergeTwoLists148(l1 *ListNode, l2 *ListNode) *ListNode { +func mergeTwoLists(l1 *ListNode, l2 *ListNode) *ListNode { if l1 == nil { return l2 } @@ -92,4 +92,5 @@ func mergeTwoLists148(l1 *ListNode, l2 *ListNode) *ListNode { return l2 } + ``` \ No newline at end of file From 7c6a8bd33da3482c313e37150dea97094a0d048a Mon Sep 17 00:00:00 2001 From: YDZ Date: Mon, 14 Dec 2020 20:20:08 +0800 Subject: [PATCH 45/82] Add Weekly Contest 218 --- .../1678. Goal Parser Interpretation.go} | 2 +- .../1678. Goal Parser Interpretation_test.go | 52 ++++++++ .../1678.Goal-Parser-Interpretation/README.md | 73 +++++++++++ .../1679. Max Number of K-Sum Pairs.go | 48 +++++++ .../1679. Max Number of K-Sum Pairs_test.go | 58 +++++++++ .../1679.Max-Number-of-K-Sum-Pairs/README.md | 98 ++++++++++++++ ...atenation of Consecutive Binary Numbers.go | 26 ++++ ...ion of Consecutive Binary Numbers_test.go} | 0 .../README.md | 95 ++++++++++++++ .../1681. Minimum Incompatibility.go | 58 +++++++++ .../1681. Minimum Incompatibility_test.go | 53 ++++++++ .../1681.Minimum-Incompatibility/README.md | 122 ++++++++++++++++++ .../5617. Goal Parser Interpretation_test.go | 63 --------- .../5618. Max Number of K-Sum Pairs.go | 56 -------- .../5618. Max Number of K-Sum Pairs_test.go | 53 -------- ...atenation of Consecutive Binary Numbers.go | 49 ------- .../1678.Goal-Parser-Interpretation.md | 73 +++++++++++ .../1679.Max-Number-of-K-Sum-Pairs.md | 98 ++++++++++++++ ...atenation-of-Consecutive-Binary-Numbers.md | 95 ++++++++++++++ .../1681.Minimum-Incompatibility.md | 122 ++++++++++++++++++ website/content/menu/index.md | 4 + 21 files changed, 1076 insertions(+), 222 deletions(-) rename leetcode/{5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation.go => 1678.Goal-Parser-Interpretation/1678. Goal Parser Interpretation.go} (96%) create mode 100644 leetcode/1678.Goal-Parser-Interpretation/1678. Goal Parser Interpretation_test.go create mode 100644 leetcode/1678.Goal-Parser-Interpretation/README.md create mode 100644 leetcode/1679.Max-Number-of-K-Sum-Pairs/1679. Max Number of K-Sum Pairs.go create mode 100644 leetcode/1679.Max-Number-of-K-Sum-Pairs/1679. Max Number of K-Sum Pairs_test.go create mode 100644 leetcode/1679.Max-Number-of-K-Sum-Pairs/README.md create mode 100644 leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers/1680. Concatenation of Consecutive Binary Numbers.go rename leetcode/{5620.Concatenation-of-Consecutive-Binary-Numbers/5620. Concatenation of Consecutive Binary Numbers_test.go => 1680.Concatenation-of-Consecutive-Binary-Numbers/1680. Concatenation of Consecutive Binary Numbers_test.go} (100%) create mode 100644 leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers/README.md create mode 100644 leetcode/1681.Minimum-Incompatibility/1681. Minimum Incompatibility.go create mode 100644 leetcode/1681.Minimum-Incompatibility/1681. Minimum Incompatibility_test.go create mode 100644 leetcode/1681.Minimum-Incompatibility/README.md delete mode 100644 leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation_test.go delete mode 100644 leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs.go delete mode 100644 leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs_test.go delete mode 100644 leetcode/5620.Concatenation-of-Consecutive-Binary-Numbers/5620. Concatenation of Consecutive Binary Numbers.go create mode 100644 website/content/ChapterFour/1678.Goal-Parser-Interpretation.md create mode 100644 website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md create mode 100644 website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md create mode 100644 website/content/ChapterFour/1681.Minimum-Incompatibility.md diff --git a/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation.go b/leetcode/1678.Goal-Parser-Interpretation/1678. Goal Parser Interpretation.go similarity index 96% rename from leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation.go rename to leetcode/1678.Goal-Parser-Interpretation/1678. Goal Parser Interpretation.go index d450417b..de161200 100644 --- a/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation.go +++ b/leetcode/1678.Goal-Parser-Interpretation/1678. Goal Parser Interpretation.go @@ -14,7 +14,7 @@ func interpret(command string) string { i += 3 } else { res += "o" - i += 1 + i++ } } } diff --git a/leetcode/1678.Goal-Parser-Interpretation/1678. Goal Parser Interpretation_test.go b/leetcode/1678.Goal-Parser-Interpretation/1678. Goal Parser Interpretation_test.go new file mode 100644 index 00000000..588368aa --- /dev/null +++ b/leetcode/1678.Goal-Parser-Interpretation/1678. Goal Parser Interpretation_test.go @@ -0,0 +1,52 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1678 struct { + para1678 + ans1678 +} + +// para 是参数 +// one 代表第一个参数 +type para1678 struct { + command string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1678 struct { + one string +} + +func Test_Problem1678(t *testing.T) { + + qs := []question1678{ + + { + para1678{"G()(al)"}, + ans1678{"Goal"}, + }, + + { + para1678{"G()()()()(al)"}, + ans1678{"Gooooal"}, + }, + + { + para1678{"(al)G(al)()()G"}, + ans1678{"alGalooG"}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1678------------------------\n") + + for _, q := range qs { + _, p := q.ans1678, q.para1678 + fmt.Printf("【input】:%v 【output】:%v\n", p, interpret(p.command)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1678.Goal-Parser-Interpretation/README.md b/leetcode/1678.Goal-Parser-Interpretation/README.md new file mode 100644 index 00000000..4f8145f4 --- /dev/null +++ b/leetcode/1678.Goal-Parser-Interpretation/README.md @@ -0,0 +1,73 @@ +# [1678. Goal Parser Interpretation](https://leetcode.com/problems/goal-parser-interpretation/) + +## 题目 + +You own a **Goal Parser** that can interpret a string `command`. The `command` consists of an alphabet of `"G"`, `"()"` and/or `"(al)"` in some order. The Goal Parser will interpret `"G"` as the string `"G"`, `"()"` as the string `"o"`, and `"(al)"` as the string `"al"`. The interpreted strings are then concatenated in the original order. + +Given the string `command`, return *the **Goal Parser**'s interpretation of* `command`. + +**Example 1:** + +``` +Input: command = "G()(al)" +Output: "Goal" +Explanation: The Goal Parser interprets the command as follows: +G -> G +() -> o +(al) -> al +The final concatenated result is "Goal". +``` + +**Example 2:** + +``` +Input: command = "G()()()()(al)" +Output: "Gooooal" +``` + +**Example 3:** + +``` +Input: command = "(al)G(al)()()G" +Output: "alGalooG" +``` + +**Constraints:** + +- `1 <= command.length <= 100` +- `command` consists of `"G"`, `"()"`, and/or `"(al)"` in some order. + +## 题目大意 + +请你设计一个可以解释字符串 command 的 Goal 解析器 。command 由 "G"、"()" 和/或 "(al)" 按某种顺序组成。Goal 解析器会将 "G" 解释为字符串 "G"、"()" 解释为字符串 "o" ,"(al)" 解释为字符串 "al" 。然后,按原顺序将经解释得到的字符串连接成一个字符串。给你字符串 command ,返回 Goal 解析器 对 command 的解释结果。 + +## 解题思路 + +- 简单题,按照题意修改字符串即可。由于是简单题,这一题也不用考虑嵌套的情况。 + +## 代码 + +```go +package leetcode + +func interpret(command string) string { + if command == "" { + return "" + } + res := "" + for i := 0; i < len(command); i++ { + if command[i] == 'G' { + res += "G" + } else { + if command[i] == '(' && command[i+1] == 'a' { + res += "al" + i += 3 + } else { + res += "o" + i ++ + } + } + } + return res +} +``` \ No newline at end of file diff --git a/leetcode/1679.Max-Number-of-K-Sum-Pairs/1679. Max Number of K-Sum Pairs.go b/leetcode/1679.Max-Number-of-K-Sum-Pairs/1679. Max Number of K-Sum Pairs.go new file mode 100644 index 00000000..8a601ffa --- /dev/null +++ b/leetcode/1679.Max-Number-of-K-Sum-Pairs/1679. Max Number of K-Sum Pairs.go @@ -0,0 +1,48 @@ +package leetcode + +// 解法一 优化版 +func maxOperations(nums []int, k int) int { + counter, res := make(map[int]int), 0 + for _, n := range nums { + counter[n]++ + } + if (k & 1) == 0 { + res += counter[k>>1] >> 1 + // 能够由 2 个相同的数构成 k 的组合已经都排除出去了,剩下的一个单独的也不能组成 k 了 + // 所以这里要把它的频次置为 0 。如果这里不置为 0,下面代码判断逻辑还需要考虑重复使用数字的情况 + counter[k>>1] = 0 + } + for num, freq := range counter { + if num <= k/2 { + remain := k - num + if counter[remain] < freq { + res += counter[remain] + } else { + res += freq + } + } + } + return res +} + +// 解法二 +func maxOperations_(nums []int, k int) int { + counter, res := make(map[int]int), 0 + for _, num := range nums { + counter[num]++ + remain := k - num + if num == remain { + if counter[num] >= 2 { + res++ + counter[num] -= 2 + } + } else { + if counter[remain] > 0 { + res++ + counter[remain]-- + counter[num]-- + } + } + } + return res +} diff --git a/leetcode/1679.Max-Number-of-K-Sum-Pairs/1679. Max Number of K-Sum Pairs_test.go b/leetcode/1679.Max-Number-of-K-Sum-Pairs/1679. Max Number of K-Sum Pairs_test.go new file mode 100644 index 00000000..c9a96b2b --- /dev/null +++ b/leetcode/1679.Max-Number-of-K-Sum-Pairs/1679. Max Number of K-Sum Pairs_test.go @@ -0,0 +1,58 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1679 struct { + para1679 + ans1679 +} + +// para 是参数 +// one 代表第一个参数 +type para1679 struct { + nums []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1679 struct { + one int +} + +func Test_Problem1679(t *testing.T) { + + qs := []question1679{ + + { + para1679{[]int{1, 2, 3, 4}, 5}, + ans1679{2}, + }, + + { + para1679{[]int{3, 1, 3, 4, 3}, 6}, + ans1679{1}, + }, + + { + para1679{[]int{2, 5, 4, 4, 1, 3, 4, 4, 1, 4, 4, 1, 2, 1, 2, 2, 3, 2, 4, 2}, 3}, + ans1679{4}, + }, + + { + para1679{[]int{2, 5, 5, 5, 1, 3, 4, 4, 1, 4, 4, 1, 3, 1, 3, 1, 3, 2, 4, 2}, 6}, + ans1679{8}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1679------------------------\n") + + for _, q := range qs { + _, p := q.ans1679, q.para1679 + fmt.Printf("【input】:%v 【output】:%v\n", p, maxOperations(p.nums, p.k)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1679.Max-Number-of-K-Sum-Pairs/README.md b/leetcode/1679.Max-Number-of-K-Sum-Pairs/README.md new file mode 100644 index 00000000..83ed4b31 --- /dev/null +++ b/leetcode/1679.Max-Number-of-K-Sum-Pairs/README.md @@ -0,0 +1,98 @@ +# [1679. Max Number of K-Sum Pairs](https://leetcode.com/problems/max-number-of-k-sum-pairs/) + + +## 题目 + +You are given an integer array `nums` and an integer `k`. + +In one operation, you can pick two numbers from the array whose sum equals `k` and remove them from the array. + +Return *the maximum number of operations you can perform on the array*. + +**Example 1:** + +``` +Input: nums = [1,2,3,4], k = 5 +Output: 2 +Explanation: Starting with nums = [1,2,3,4]: +- Remove numbers 1 and 4, then nums = [2,3] +- Remove numbers 2 and 3, then nums = [] +There are no more pairs that sum up to 5, hence a total of 2 operations. +``` + +**Example 2:** + +``` +Input: nums = [3,1,3,4,3], k = 6 +Output: 1 +Explanation: Starting with nums = [3,1,3,4,3]: +- Remove the first two 3's, then nums = [1,4,3] +There are no more pairs that sum up to 6, hence a total of 1 operation. +``` + +**Constraints:** + +- `1 <= nums.length <= 105` +- `1 <= nums[i] <= 109` +- `1 <= k <= 109` + +## 题目大意 + +给你一个整数数组 nums 和一个整数 k 。每一步操作中,你需要从数组中选出和为 k 的两个整数,并将它们移出数组。返回你可以对数组执行的最大操作数。 + +## 解题思路 + +- 读完题第一感觉这道题是 TWO SUM 题目的加强版。需要找到所有满足和是 k 的数对。先考虑能不能找到两个数都是 k/2 ,如果能找到多个这样的数,可以先移除他们。其次在利用 TWO SUM 的思路,找出和为 k 的数对。利用 TWO SUM 里面 map 的做法,时间复杂度 O(n)。 + +## 代码 + +```go +package leetcode + +// 解法一 优化版 +func maxOperations(nums []int, k int) int { + counter, res := make(map[int]int), 0 + for _, n := range nums { + counter[n]++ + } + if (k & 1) == 0 { + res += counter[k>>1] >> 1 + // 能够由 2 个相同的数构成 k 的组合已经都排除出去了,剩下的一个单独的也不能组成 k 了 + // 所以这里要把它的频次置为 0 。如果这里不置为 0,下面代码判断逻辑还需要考虑重复使用数字的情况 + counter[k>>1] = 0 + } + for num, freq := range counter { + if num <= k/2 { + remain := k - num + if counter[remain] < freq { + res += counter[remain] + } else { + res += freq + } + } + } + return res +} + +// 解法二 +func maxOperations_(nums []int, k int) int { + counter, res := make(map[int]int), 0 + for _, num := range nums { + counter[num]++ + remain := k - num + if num == remain { + if counter[num] >= 2 { + res++ + counter[num] -= 2 + } + } else { + if counter[remain] > 0 { + res++ + counter[remain]-- + counter[num]-- + } + } + } + return res +} +``` \ No newline at end of file diff --git a/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers/1680. Concatenation of Consecutive Binary Numbers.go b/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers/1680. Concatenation of Consecutive Binary Numbers.go new file mode 100644 index 00000000..eff4e12b --- /dev/null +++ b/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers/1680. Concatenation of Consecutive Binary Numbers.go @@ -0,0 +1,26 @@ +package leetcode + +import ( + "math/bits" +) + +// 解法一 模拟 +func concatenatedBinary(n int) int { + res, mod, shift := 0, 1000000007, 0 + for i := 1; i <= n; i++ { + if (i & (i - 1)) == 0 { + shift++ + } + res = ((res << shift) + i) % mod + } + return res +} + +// 解法二 位运算 +func concatenatedBinary1(n int) int { + res := 0 + for i := 1; i <= n; i++ { + res = (res< k { + return -1 + } + } + orders := []int{} + for i := range counts { + orders = append(orders, i) + } + sort.Ints(orders) + res := math.MaxInt32 + generatePermutation1681(nums, counts, orders, 0, 0, eachSize, &res, []int{}) + if res == math.MaxInt32 { + return -1 + } + return res +} + +func generatePermutation1681(nums, counts, order []int, index, sum, eachSize int, res *int, current []int) { + if len(current) > 0 && len(current)%eachSize == 0 { + sum += current[len(current)-1] - current[len(current)-eachSize] + index = 0 + } + if sum >= *res { + return + } + if len(current) == len(nums) { + if sum < *res { + *res = sum + } + return + } + for i := index; i < len(counts); i++ { + if counts[order[i]] == 0 { + continue + } + counts[order[i]]-- + current = append(current, order[i]) + generatePermutation1681(nums, counts, order, i+1, sum, eachSize, res, current) + current = current[:len(current)-1] + counts[order[i]]++ + // 这里是关键的剪枝 + if index == 0 { + break + } + } +} diff --git a/leetcode/1681.Minimum-Incompatibility/1681. Minimum Incompatibility_test.go b/leetcode/1681.Minimum-Incompatibility/1681. Minimum Incompatibility_test.go new file mode 100644 index 00000000..903c963b --- /dev/null +++ b/leetcode/1681.Minimum-Incompatibility/1681. Minimum Incompatibility_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1681 struct { + para1681 + ans1681 +} + +// para 是参数 +// one 代表第一个参数 +type para1681 struct { + nums []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1681 struct { + one int +} + +func Test_Problem1681(t *testing.T) { + + qs := []question1681{ + + { + para1681{[]int{1, 2, 1, 4}, 2}, + ans1681{4}, + }, + + { + para1681{[]int{6, 3, 8, 1, 3, 1, 2, 2}, 4}, + ans1681{6}, + }, + + { + para1681{[]int{5, 3, 3, 6, 3, 3}, 3}, + ans1681{-1}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1681------------------------\n") + + for _, q := range qs { + _, p := q.ans1681, q.para1681 + fmt.Printf("【input】:%v 【output】:%v\n", p, minimumIncompatibility(p.nums, p.k)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1681.Minimum-Incompatibility/README.md b/leetcode/1681.Minimum-Incompatibility/README.md new file mode 100644 index 00000000..a46fd91e --- /dev/null +++ b/leetcode/1681.Minimum-Incompatibility/README.md @@ -0,0 +1,122 @@ +# [1681. Minimum Incompatibility](https://leetcode.com/problems/minimum-incompatibility/) + + +## 题目 + +You are given an integer array `nums` and an integer `k`. You are asked to distribute this array into `k` subsets of **equal size** such that there are no two equal elements in the same subset. + +A subset's **incompatibility** is the difference between the maximum and minimum elements in that array. + +Return *the **minimum possible sum of incompatibilities** of the* `k` *subsets after distributing the array optimally, or return* `-1` *if it is not possible.* + +A subset is a group integers that appear in the array with no particular order. + +**Example 1:** + +``` +Input: nums = [1,2,1,4], k = 2 +Output: 4 +Explanation: The optimal distribution of subsets is [1,2] and [1,4]. +The incompatibility is (2-1) + (4-1) = 4. +Note that [1,1] and [2,4] would result in a smaller sum, but the first subset contains 2 equal elements. +``` + +**Example 2:** + +``` +Input: nums = [6,3,8,1,3,1,2,2], k = 4 +Output: 6 +Explanation: The optimal distribution of subsets is [1,2], [2,3], [6,8], and [1,3]. +The incompatibility is (2-1) + (3-2) + (8-6) + (3-1) = 6. + +``` + +**Example 3:** + +``` +Input: nums = [5,3,3,6,3,3], k = 3 +Output: -1 +Explanation: It is impossible to distribute nums into 3 subsets where no two elements are equal in the same subset. + +``` + +**Constraints:** + +- `1 <= k <= nums.length <= 16` +- `nums.length` is divisible by `k` +- `1 <= nums[i] <= nums.length` + +## 题目大意 + +给你一个整数数组 nums 和一个整数 k 。你需要将这个数组划分到 k 个相同大小的子集中,使得同一个子集里面没有两个相同的元素。一个子集的 不兼容性 是该子集里面最大值和最小值的差。 + +请你返回将数组分成 k 个子集后,各子集 **不兼容性** 的 **和** 的 **最小值** ,如果无法分成分成 k 个子集,返回 -1 。子集的定义是数组中一些数字的集合,对数字顺序没有要求。 + +## 解题思路 + +- 读完题最直白的思路就是 DFS。做法类似第 77 题。这里就不赘述了。可以见第 77 题题解。 +- 这一题还需要用到贪心的思想。每次取数都取最小的数。这样可以不会让最大数和最小数在一个集合中。由于每次取数都是取最小的,那么能保证不兼容性每次都尽量最小。于是在 order 数组中定义取数的顺序。然后再把数组从小到大排列。这样每次按照 order 顺序取数,都是取的最小值。 +- 正常的 DFS 写完提交,耗时是很长的。大概是 1532ms。如何优化到极致呢?这里需要加上 2 个剪枝条件。第一个剪枝条件比较简单,如果累计 sum 比之前存储的 res 大,那么直接 return,不需要继续递归了。第二个剪枝条件就非常重要了,可以一下子减少很多次递归。每次取数产生新的集合的时候,要从第一个最小数开始取,一旦取了,后面就不需要再循环递归了。举个例子,[1,2,3,4],第一个数如果取 2,集合可以是 [[2,3],[1,4]] 或 [[2,4], [1,3]], 这个集合和[[1,3],[2,4]]、[[1,4], [2,3]] 情况一样。可以看到如果取出第一个最小值以后,后面的循环是不必要的了。所以在取下标为 0 的数的时候,递归到底层以后,返回就可以直接 break,不用接下去的循环了,接下去的循环和递归是不必要的。加了这 2 个剪枝条件以后,耗时就变成了 0ms 了。beats 100% + +## 代码 + +```go +package leetcode + +import ( + "math" + "sort" +) + +func minimumIncompatibility(nums []int, k int) int { + sort.Ints(nums) + eachSize, counts := len(nums)/k, make([]int, len(nums)+1) + for i := range nums { + counts[nums[i]]++ + if counts[nums[i]] > k { + return -1 + } + } + orders := []int{} + for i := range counts { + orders = append(orders, i) + } + sort.Ints(orders) + res := math.MaxInt32 + generatePermutation1681(nums, counts, orders, 0, 0, eachSize, &res, []int{}) + if res == math.MaxInt32 { + return -1 + } + return res +} + +func generatePermutation1681(nums, counts, order []int, index, sum, eachSize int, res *int, current []int) { + if len(current) > 0 && len(current)%eachSize == 0 { + sum += current[len(current)-1] - current[len(current)-eachSize] + index = 0 + } + if sum >= *res { + return + } + if len(current) == len(nums) { + if sum < *res { + *res = sum + } + return + } + for i := index; i < len(counts); i++ { + if counts[order[i]] == 0 { + continue + } + counts[order[i]]-- + current = append(current, order[i]) + generatePermutation1681(nums, counts, order, i+1, sum, eachSize, res, current) + current = current[:len(current)-1] + counts[order[i]]++ + // 这里是关键的剪枝 + if index == 0 { + break + } + } +} +``` \ No newline at end of file diff --git a/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation_test.go b/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation_test.go deleted file mode 100644 index 9d70531c..00000000 --- a/leetcode/5617.Goal-Parser-Interpretation/5617. Goal Parser Interpretation_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question491 struct { - para491 - ans491 -} - -// para 是参数 -// one 代表第一个参数 -type para491 struct { - nums []int - k int -} - -// ans 是答案 -// one 代表第一个答案 -type ans491 struct { - one []int -} - -func Test_Problem491(t *testing.T) { - - qs := []question491{ - - { - para491{[]int{3, 5, 2, 6}, 2}, - ans491{[]int{2, 6}}, - }, - - { - para491{[]int{2, 4, 3, 3, 5, 4, 9, 6}, 4}, - ans491{[]int{2, 3, 3, 4}}, - }, - - { - para491{[]int{2, 4, 3, 3, 5, 4, 9, 6}, 4}, - ans491{[]int{2, 3, 3, 4}}, - }, - - { - para491{[]int{71, 18, 52, 29, 55, 73, 24, 42, 66, 8, 80, 2}, 3}, - ans491{[]int{8, 80, 2}}, - }, - - { - para491{[]int{84, 10, 71, 23, 66, 61, 62, 64, 34, 41, 80, 25, 91, 43, 4, 75, 65, 13, 37, 41, 46, 90, 55, 8, 85, 61, 95, 71}, 24}, - ans491{[]int{10, 23, 61, 62, 34, 41, 80, 25, 91, 43, 4, 75, 65, 13, 37, 41, 46, 90, 55, 8, 85, 61, 95, 71}}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 491------------------------\n") - - for _, q := range qs { - _, p := q.ans491, q.para491 - fmt.Printf("【input】:%v 【output】:%v\n", p, mostCompetitive(p.nums, p.k)) - } - fmt.Printf("\n\n\n") -} diff --git a/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs.go b/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs.go deleted file mode 100644 index c87c8e7c..00000000 --- a/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs.go +++ /dev/null @@ -1,56 +0,0 @@ -package leetcode - -import ( - "fmt" - "sort" -) - -func maxOperations(nums []int, k int) int { - if len(nums) == 0 { - return 0 - } - c, res, ans, used := []int{}, [][]int{}, 0, make([]bool, len(nums)) - sort.Ints(nums) - findcombinationSum(nums, k, 0, c, &res, &used) - fmt.Printf("res = %v\n", res) - for i := 0; i < len(res); i++ { - ans = max(ans, len(res[i])) - } - return ans -} - -func findcombinationSum(nums []int, k, index int, c []int, res *[][]int, used *[]bool) { - if k <= 0 { - if k == 0 && len(c) == 2 { - fmt.Printf("used = %v nums = %v\n", used, nums) - b := make([]int, len(c)) - copy(b, c) - *res = append(*res, b) - } - return - } - - for i := index; i < len(nums); i++ { - if !(*used)[i] { - if nums[i] > k { // 这里可以剪枝优化 - break - } - // if i > 0 && nums[i] == nums[i-1] && !(*used)[i-1] { // 这里是去重的关键逻辑 - // continue - // } - (*used)[i] = true - c = append(c, nums[i]) - findcombinationSum(nums, k-nums[i], i+1, c, res, used) // 注意这里迭代的时候 index 依旧不变,因为一个元素可以取多次 - c = c[:len(c)-1] - (*used)[i] = false - } - } -} - -func max(a, b int) int { - if a > b { - return a - } else { - return b - } -} diff --git a/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs_test.go b/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs_test.go deleted file mode 100644 index 4980bee4..00000000 --- a/leetcode/5618.Max-Number-of-K-Sum-Pairs/5618. Max Number of K-Sum Pairs_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question5618 struct { - para5618 - ans5618 -} - -// para 是参数 -// one 代表第一个参数 -type para5618 struct { - nums []int - k int -} - -// ans 是答案 -// one 代表第一个答案 -type ans5618 struct { - one int -} - -func Test_Problem5618(t *testing.T) { - - qs := []question5618{ - - { - para5618{[]int{1, 2, 3, 4}, 5}, - ans5618{2}, - }, - - { - para5618{[]int{3, 1, 3, 4, 3}, 6}, - ans5618{1}, - }, - - { - para5618{[]int{2, 5, 4, 4, 1, 3, 4, 4, 1, 4, 4, 1, 2, 1, 2, 2, 3, 2, 4, 2}, 3}, - ans5618{4}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 5618------------------------\n") - - for _, q := range qs { - _, p := q.ans5618, q.para5618 - fmt.Printf("【input】:%v 【output】:%v\n", p, maxOperations(p.nums, p.k)) - } - fmt.Printf("\n\n\n") -} diff --git a/leetcode/5620.Concatenation-of-Consecutive-Binary-Numbers/5620. Concatenation of Consecutive Binary Numbers.go b/leetcode/5620.Concatenation-of-Consecutive-Binary-Numbers/5620. Concatenation of Consecutive Binary Numbers.go deleted file mode 100644 index c638c9be..00000000 --- a/leetcode/5620.Concatenation-of-Consecutive-Binary-Numbers/5620. Concatenation of Consecutive Binary Numbers.go +++ /dev/null @@ -1,49 +0,0 @@ -package leetcode - -import ( - "fmt" - "math/big" - "strconv" -) - -func concatenatedBinary(n int) int { - if n == 42 { - return 727837408 - } - str := "" - for i := 1; i <= n; i++ { - str += convertToBin(i) - } - fmt.Printf("str = %v\n", str) - bigInt := Str2DEC(str) - bigInt.Mod(bigInt, big.NewInt(1000000007)) - return int(bigInt.Int64()) -} - -func convertToBin(num int) string { - s := "" - if num == 0 { - return "0" - } - // num /= 2 每次循环的时候 都将num除以2 再把结果赋值给 num - for ; num > 0; num /= 2 { - lsb := num % 2 - // strconv.Itoa() 将数字强制性转化为字符串 - s = strconv.Itoa(lsb) + s - } - return s -} - -func Str2DEC(s string) *big.Int { - l := len(s) - // num := big.NewInt(0) - z := new(big.Int) - fmt.Printf("num = %v\n", z) - for i := l - 1; i >= 0; i-- { - z.Add(big.NewInt(int64((int(s[l-i-1])&0xf)< G +() -> o +(al) -> al +The final concatenated result is "Goal". +``` + +**Example 2:** + +``` +Input: command = "G()()()()(al)" +Output: "Gooooal" +``` + +**Example 3:** + +``` +Input: command = "(al)G(al)()()G" +Output: "alGalooG" +``` + +**Constraints:** + +- `1 <= command.length <= 100` +- `command` consists of `"G"`, `"()"`, and/or `"(al)"` in some order. + +## 题目大意 + +请你设计一个可以解释字符串 command 的 Goal 解析器 。command 由 "G"、"()" 和/或 "(al)" 按某种顺序组成。Goal 解析器会将 "G" 解释为字符串 "G"、"()" 解释为字符串 "o" ,"(al)" 解释为字符串 "al" 。然后,按原顺序将经解释得到的字符串连接成一个字符串。给你字符串 command ,返回 Goal 解析器 对 command 的解释结果。 + +## 解题思路 + +- 简单题,按照题意修改字符串即可。由于是简单题,这一题也不用考虑嵌套的情况。 + +## 代码 + +```go +package leetcode + +func interpret(command string) string { + if command == "" { + return "" + } + res := "" + for i := 0; i < len(command); i++ { + if command[i] == 'G' { + res += "G" + } else { + if command[i] == '(' && command[i+1] == 'a' { + res += "al" + i += 3 + } else { + res += "o" + i ++ + } + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md b/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md new file mode 100644 index 00000000..83ed4b31 --- /dev/null +++ b/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md @@ -0,0 +1,98 @@ +# [1679. Max Number of K-Sum Pairs](https://leetcode.com/problems/max-number-of-k-sum-pairs/) + + +## 题目 + +You are given an integer array `nums` and an integer `k`. + +In one operation, you can pick two numbers from the array whose sum equals `k` and remove them from the array. + +Return *the maximum number of operations you can perform on the array*. + +**Example 1:** + +``` +Input: nums = [1,2,3,4], k = 5 +Output: 2 +Explanation: Starting with nums = [1,2,3,4]: +- Remove numbers 1 and 4, then nums = [2,3] +- Remove numbers 2 and 3, then nums = [] +There are no more pairs that sum up to 5, hence a total of 2 operations. +``` + +**Example 2:** + +``` +Input: nums = [3,1,3,4,3], k = 6 +Output: 1 +Explanation: Starting with nums = [3,1,3,4,3]: +- Remove the first two 3's, then nums = [1,4,3] +There are no more pairs that sum up to 6, hence a total of 1 operation. +``` + +**Constraints:** + +- `1 <= nums.length <= 105` +- `1 <= nums[i] <= 109` +- `1 <= k <= 109` + +## 题目大意 + +给你一个整数数组 nums 和一个整数 k 。每一步操作中,你需要从数组中选出和为 k 的两个整数,并将它们移出数组。返回你可以对数组执行的最大操作数。 + +## 解题思路 + +- 读完题第一感觉这道题是 TWO SUM 题目的加强版。需要找到所有满足和是 k 的数对。先考虑能不能找到两个数都是 k/2 ,如果能找到多个这样的数,可以先移除他们。其次在利用 TWO SUM 的思路,找出和为 k 的数对。利用 TWO SUM 里面 map 的做法,时间复杂度 O(n)。 + +## 代码 + +```go +package leetcode + +// 解法一 优化版 +func maxOperations(nums []int, k int) int { + counter, res := make(map[int]int), 0 + for _, n := range nums { + counter[n]++ + } + if (k & 1) == 0 { + res += counter[k>>1] >> 1 + // 能够由 2 个相同的数构成 k 的组合已经都排除出去了,剩下的一个单独的也不能组成 k 了 + // 所以这里要把它的频次置为 0 。如果这里不置为 0,下面代码判断逻辑还需要考虑重复使用数字的情况 + counter[k>>1] = 0 + } + for num, freq := range counter { + if num <= k/2 { + remain := k - num + if counter[remain] < freq { + res += counter[remain] + } else { + res += freq + } + } + } + return res +} + +// 解法二 +func maxOperations_(nums []int, k int) int { + counter, res := make(map[int]int), 0 + for _, num := range nums { + counter[num]++ + remain := k - num + if num == remain { + if counter[num] >= 2 { + res++ + counter[num] -= 2 + } + } else { + if counter[remain] > 0 { + res++ + counter[remain]-- + counter[num]-- + } + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md b/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md new file mode 100644 index 00000000..b43a3e66 --- /dev/null +++ b/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md @@ -0,0 +1,95 @@ +# [1680. Concatenation of Consecutive Binary Numbers](https://leetcode.com/problems/concatenation-of-consecutive-binary-numbers/) + + +## 题目 + +Given an integer `n`, return *the **decimal value** of the binary string formed by concatenating the binary representations of* `1` *to* `n` *in order, **modulo*** `109 + 7`. + +**Example 1:** + +``` +Input: n = 1 +Output: 1 +Explanation: "1" in binary corresponds to the decimal value 1. +``` + +**Example 2:** + +``` +Input: n = 3 +Output: 27 +Explanation: In binary, 1, 2, and 3 corresponds to "1", "10", and "11". +After concatenating them, we have "11011", which corresponds to the decimal value 27. +``` + +**Example 3:** + +``` +Input: n = 12 +Output: 505379714 +Explanation: The concatenation results in "1101110010111011110001001101010111100". +The decimal value of that is 118505380540. +After modulo 109 + 7, the result is 505379714. +``` + +**Constraints:** + +- `1 <= n <= 10^5` + +## 题目大意 + +给你一个整数 n ,请你将 1 到 n 的二进制表示连接起来,并返回连接结果对应的 十进制 数字对 10^9 + 7 取余的结果。 + +## 解题思路 + +- 理解题意以后,先找到如何拼接最终二进制数的规律。假设 `f(n)` 为最终变换以后的十进制数。那么根据题意,`f(n) = f(n-1) << shift + n` 这是一个递推公式。`shift` 左移的位数就是 `n` 的二进制对应的长度。`shift` 的值是随着 `n` 变化而变化的。由二进制进位规律可以知道,2 的整数次幂的时候,对应的二进制长度会增加 1 位。这里可以利用位运算来判断是否是 2 的整数次幂。 +- 这道题另外一个需要处理的是模运算的法则。此题需要用到模运算的加法法则。 + + ```go + 模运算与基本四则运算有些相似,但是除法例外。 + (a + b) % p = (a % p + b % p) % p (1) + (a - b) % p = (a % p - b % p) % p (2) + (a * b) % p = (a % p * b % p) % p (3) + a ^ b % p = ((a % p)^b) % p (4) + 结合律: + ((a+b) % p + c) % p = (a + (b+c) % p) % p (5) + ((a*b) % p * c)% p = (a * (b*c) % p) % p (6) + 交换律: + (a + b) % p = (b+a) % p (7) + (a * b) % p = (b * a) % p (8) + 分配律: + ((a +b)% p * c) % p = ((a * c) % p + (b * c) % p) % p (9) + ``` + + 这一题需要用到模运算的加法运算法则。 + +## 代码 + +```go +package leetcode + +import ( + "math/bits" +) + +// 解法一 模拟 +func concatenatedBinary(n int) int { + res, mod, shift := 0, 1000000007, 0 + for i := 1; i <= n; i++ { + if (i & (i - 1)) == 0 { + shift++ + } + res = ((res << shift) + i) % mod + } + return res +} + +// 解法二 位运算 +func concatenatedBinary1(n int) int { + res := 0 + for i := 1; i <= n; i++ { + res = (res< k { + return -1 + } + } + orders := []int{} + for i := range counts { + orders = append(orders, i) + } + sort.Ints(orders) + res := math.MaxInt32 + generatePermutation1681(nums, counts, orders, 0, 0, eachSize, &res, []int{}) + if res == math.MaxInt32 { + return -1 + } + return res +} + +func generatePermutation1681(nums, counts, order []int, index, sum, eachSize int, res *int, current []int) { + if len(current) > 0 && len(current)%eachSize == 0 { + sum += current[len(current)-1] - current[len(current)-eachSize] + index = 0 + } + if sum >= *res { + return + } + if len(current) == len(nums) { + if sum < *res { + *res = sum + } + return + } + for i := index; i < len(counts); i++ { + if counts[order[i]] == 0 { + continue + } + counts[order[i]]-- + current = append(current, order[i]) + generatePermutation1681(nums, counts, order, i+1, sum, eachSize, res, current) + current = current[:len(current)-1] + counts[order[i]]++ + // 这里是关键的剪枝 + if index == 0 { + break + } + } +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 7e525b22..a769bcc7 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -564,4 +564,8 @@ headless: true - [1663.Smallest-String-With-A-Given-Numeric-Value]({{< relref "/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md" >}}) - [1664.Ways-to-Make-a-Fair-Array]({{< relref "/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md" >}}) - [1665.Minimum-Initial-Energy-to-Finish-Tasks]({{< relref "/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md" >}}) + - [1678.Goal-Parser-Interpretation]({{< relref "/ChapterFour/1678.Goal-Parser-Interpretation.md" >}}) + - [1679.Max-Number-of-K-Sum-Pairs]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}}) + - [1680.Concatenation-of-Consecutive-Binary-Numbers]({{< relref "/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md" >}}) + - [1681.Minimum-Incompatibility]({{< relref "/ChapterFour/1681.Minimum-Incompatibility.md" >}})
From 75e5a7eeffe1409c8d2e1ae56f813ee452b2c21d Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 15 Dec 2020 13:47:29 +0800 Subject: [PATCH 46/82] Update 1680 test --- ...tion of Consecutive Binary Numbers_test.go | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers/1680. Concatenation of Consecutive Binary Numbers_test.go b/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers/1680. Concatenation of Consecutive Binary Numbers_test.go index 10c575b2..88cebf97 100644 --- a/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers/1680. Concatenation of Consecutive Binary Numbers_test.go +++ b/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers/1680. Concatenation of Consecutive Binary Numbers_test.go @@ -5,67 +5,67 @@ import ( "testing" ) -type question5620 struct { - para5620 - ans5620 +type question1680 struct { + para1680 + ans1680 } // para 是参数 // one 代表第一个参数 -type para5620 struct { +type para1680 struct { n int } // ans 是答案 // one 代表第一个答案 -type ans5620 struct { +type ans1680 struct { one int } -func Test_Problem5620(t *testing.T) { +func Test_Problem1680(t *testing.T) { - qs := []question5620{ + qs := []question1680{ { - para5620{1}, - ans5620{1}, + para1680{1}, + ans1680{1}, }, { - para5620{3}, - ans5620{27}, + para1680{3}, + ans1680{27}, }, { - para5620{12}, - ans5620{505379714}, + para1680{12}, + ans1680{505379714}, }, { - para5620{42}, - ans5620{727837408}, + para1680{42}, + ans1680{727837408}, }, { - para5620{24}, - ans5620{385951001}, + para1680{24}, + ans1680{385951001}, }, { - para5620{81}, - ans5620{819357292}, + para1680{81}, + ans1680{819357292}, }, { - para5620{66}, - ans5620{627730462}, + para1680{66}, + ans1680{627730462}, }, } - fmt.Printf("------------------------Leetcode Problem 5620------------------------\n") + fmt.Printf("------------------------Leetcode Problem 1680------------------------\n") for _, q := range qs { - _, p := q.ans5620, q.para5620 + _, p := q.ans1680, q.para1680 fmt.Printf("【input】:%v 【output】:%v\n", p, concatenatedBinary(p.n)) } fmt.Printf("\n\n\n") From 2e796fe70eac5a1fd04ec3f948ec40f46a5cbe72 Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 15 Dec 2020 21:22:19 +0800 Subject: [PATCH 47/82] =?UTF-8?q?Add=20solution=201573=E3=80=811684?= =?UTF-8?q?=E3=80=811685=E3=80=811688=E3=80=811689?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1573. Number of Ways to Split a String.go | 38 ++++++ .... Number of Ways to Split a String_test.go | 57 +++++++++ .../README.md | 108 ++++++++++++++++++ ... Count the Number of Consistent Strings.go | 21 ++++ ...t the Number of Consistent Strings_test.go | 53 +++++++++ .../README.md | 79 +++++++++++++ ... Absolute Differences in a Sorted Array.go | 42 +++++++ ...lute Differences in a Sorted Array_test.go | 47 ++++++++ .../README.md | 88 ++++++++++++++ .../1688. Count of Matches in Tournament.go | 21 ++++ ...88. Count of Matches in Tournament_test.go | 47 ++++++++ .../README.md | 80 +++++++++++++ ...o Minimum Number Of Deci-Binary Numbers.go | 11 ++ ...imum Number Of Deci-Binary Numbers_test.go | 47 ++++++++ .../README.md | 60 ++++++++++ .../1573.Number-of-Ways-to-Split-a-String.md | 108 ++++++++++++++++++ ....Count-the-Number-of-Consistent-Strings.md | 79 +++++++++++++ ...-Absolute-Differences-in-a-Sorted-Array.md | 88 ++++++++++++++ .../1688.Count-of-Matches-in-Tournament.md | 80 +++++++++++++ ...o-Minimum-Number-Of-Deci-Binary-Numbers.md | 60 ++++++++++ website/content/menu/index.md | 5 + 21 files changed, 1219 insertions(+) create mode 100644 leetcode/1573.Number-of-Ways-to-Split-a-String/1573. Number of Ways to Split a String.go create mode 100644 leetcode/1573.Number-of-Ways-to-Split-a-String/1573. Number of Ways to Split a String_test.go create mode 100644 leetcode/1573.Number-of-Ways-to-Split-a-String/README.md create mode 100644 leetcode/1684.Count-the-Number-of-Consistent-Strings/1684. Count the Number of Consistent Strings.go create mode 100644 leetcode/1684.Count-the-Number-of-Consistent-Strings/1684. Count the Number of Consistent Strings_test.go create mode 100644 leetcode/1684.Count-the-Number-of-Consistent-Strings/README.md create mode 100644 leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/1685. Sum of Absolute Differences in a Sorted Array.go create mode 100644 leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/1685. Sum of Absolute Differences in a Sorted Array_test.go create mode 100644 leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/README.md create mode 100644 leetcode/1688.Count-of-Matches-in-Tournament/1688. Count of Matches in Tournament.go create mode 100644 leetcode/1688.Count-of-Matches-in-Tournament/1688. Count of Matches in Tournament_test.go create mode 100644 leetcode/1688.Count-of-Matches-in-Tournament/README.md create mode 100644 leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/1689. Partitioning Into Minimum Number Of Deci-Binary Numbers.go create mode 100644 leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/1689. Partitioning Into Minimum Number Of Deci-Binary Numbers_test.go create mode 100644 leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/README.md create mode 100644 website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md create mode 100644 website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md create mode 100644 website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md create mode 100644 website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md create mode 100644 website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md diff --git a/leetcode/1573.Number-of-Ways-to-Split-a-String/1573. Number of Ways to Split a String.go b/leetcode/1573.Number-of-Ways-to-Split-a-String/1573. Number of Ways to Split a String.go new file mode 100644 index 00000000..8d81e495 --- /dev/null +++ b/leetcode/1573.Number-of-Ways-to-Split-a-String/1573. Number of Ways to Split a String.go @@ -0,0 +1,38 @@ +package leetcode + +func numWays(s string) int { + ones := 0 + for _, c := range s { + if c == '1' { + ones++ + } + } + if ones%3 != 0 { + return 0 + } + if ones == 0 { + return (len(s) - 1) * (len(s) - 2) / 2 % 1000000007 + } + N, a, b, c, d, count := ones/3, 0, 0, 0, 0, 0 + for i, letter := range s { + if letter == '0' { + continue + } + if letter == '1' { + count++ + } + if count == N { + a = i + } + if count == N+1 { + b = i + } + if count == 2*N { + c = i + } + if count == 2*N+1 { + d = i + } + } + return (b - a) * (d - c) % 1000000007 +} diff --git a/leetcode/1573.Number-of-Ways-to-Split-a-String/1573. Number of Ways to Split a String_test.go b/leetcode/1573.Number-of-Ways-to-Split-a-String/1573. Number of Ways to Split a String_test.go new file mode 100644 index 00000000..36719145 --- /dev/null +++ b/leetcode/1573.Number-of-Ways-to-Split-a-String/1573. Number of Ways to Split a String_test.go @@ -0,0 +1,57 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1573 struct { + para1573 + ans1573 +} + +// para 是参数 +// one 代表第一个参数 +type para1573 struct { + s string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1573 struct { + one int +} + +func Test_Problem1573(t *testing.T) { + + qs := []question1573{ + + { + para1573{"10101"}, + ans1573{4}, + }, + + { + para1573{"1001"}, + ans1573{0}, + }, + + { + para1573{"0000"}, + ans1573{3}, + }, + + { + para1573{"100100010100110"}, + ans1573{12}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1573------------------------\n") + + for _, q := range qs { + _, p := q.ans1573, q.para1573 + fmt.Printf("【input】:%v 【output】:%v \n", p, numWays(p.s)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1573.Number-of-Ways-to-Split-a-String/README.md b/leetcode/1573.Number-of-Ways-to-Split-a-String/README.md new file mode 100644 index 00000000..6b8ac226 --- /dev/null +++ b/leetcode/1573.Number-of-Ways-to-Split-a-String/README.md @@ -0,0 +1,108 @@ +# [1573. Number of Ways to Split a String](https://leetcode.com/problems/number-of-ways-to-split-a-string/) + + +## 题目 + +Given a binary string `s` (a string consisting only of '0's and '1's), we can split `s` into 3 **non-empty** strings s1, s2, s3 (s1+ s2+ s3 = s). + +Return the number of ways `s` can be split such that the number of characters '1' is the same in s1, s2, and s3. + +Since the answer may be too large, return it modulo 10^9 + 7. + +**Example 1:** + +``` +Input: s = "10101" +Output: 4 +Explanation: There are four ways to split s in 3 parts where each part contain the same number of letters '1'. +"1|010|1" +"1|01|01" +"10|10|1" +"10|1|01" + +``` + +**Example 2:** + +``` +Input: s = "1001" +Output: 0 + +``` + +**Example 3:** + +``` +Input: s = "0000" +Output: 3 +Explanation: There are three ways to split s in 3 parts. +"0|0|00" +"0|00|0" +"00|0|0" + +``` + +**Example 4:** + +``` +Input: s = "100100010100110" +Output: 12 + +``` + +**Constraints:** + +- `3 <= s.length <= 10^5` +- `s[i]` is `'0'` or `'1'`. + +## 题目大意 + +给你一个二进制串 s  (一个只包含 0 和 1 的字符串),我们可以将 s 分割成 3 个 非空 字符串 s1, s2, s3 (s1 + s2 + s3 = s)。请你返回分割 s 的方案数,满足 s1,s2 和 s3 中字符 '1' 的数目相同。由于答案可能很大,请将它对 10^9 + 7 取余后返回。 + +## 解题思路 + +- 这一题是考察的排列组合的知识。根据题意,如果 1 的个数不是 3 的倍数,直接返回 -1。如果字符串里面没有 1,那么切分的方案就是组合,在 n-1 个字母里面选出 2 个位置。利用组合的计算方法,组合数是 (n-1) * (n-2) / 2 。 +- 剩下的是 3 的倍数的情况。在字符串中选 2 个位置隔成 3 段。从第一段最后一个 1 到第二段第一个 1 之间的 0 的个数为 m1,从第二段最后一个 1 到第三段第一个 1 之间的 0 的个数为 m2。利用乘法原理,方案数为 m1 * m2。 + +## 代码 + +```go +package leetcode + +func numWays(s string) int { + ones := 0 + for _, c := range s { + if c == '1' { + ones++ + } + } + if ones%3 != 0 { + return 0 + } + if ones == 0 { + return (len(s) - 1) * (len(s) - 2) / 2 % 1000000007 + } + N, a, b, c, d, count := ones/3, 0, 0, 0, 0, 0 + for i, letter := range s { + if letter == '0' { + continue + } + if letter == '1' { + count++ + } + if count == N { + a = i + } + if count == N+1 { + b = i + } + if count == 2*N { + c = i + } + if count == 2*N+1 { + d = i + } + } + return (b - a) * (d - c) % 1000000007 +} +``` \ No newline at end of file diff --git a/leetcode/1684.Count-the-Number-of-Consistent-Strings/1684. Count the Number of Consistent Strings.go b/leetcode/1684.Count-the-Number-of-Consistent-Strings/1684. Count the Number of Consistent Strings.go new file mode 100644 index 00000000..80b40a08 --- /dev/null +++ b/leetcode/1684.Count-the-Number-of-Consistent-Strings/1684. Count the Number of Consistent Strings.go @@ -0,0 +1,21 @@ +package leetcode + +func countConsistentStrings(allowed string, words []string) int { + allowedMap, res, flag := map[rune]int{}, 0, true + for _, str := range allowed { + allowedMap[str]++ + } + for i := 0; i < len(words); i++ { + flag = true + for j := 0; j < len(words[i]); j++ { + if _, ok := allowedMap[rune(words[i][j])]; !ok { + flag = false + break + } + } + if flag { + res++ + } + } + return res +} diff --git a/leetcode/1684.Count-the-Number-of-Consistent-Strings/1684. Count the Number of Consistent Strings_test.go b/leetcode/1684.Count-the-Number-of-Consistent-Strings/1684. Count the Number of Consistent Strings_test.go new file mode 100644 index 00000000..c94501b6 --- /dev/null +++ b/leetcode/1684.Count-the-Number-of-Consistent-Strings/1684. Count the Number of Consistent Strings_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1684 struct { + para1684 + ans1684 +} + +// para 是参数 +// one 代表第一个参数 +type para1684 struct { + allowed string + words []string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1684 struct { + one int +} + +func Test_Problem1684(t *testing.T) { + + qs := []question1684{ + + { + para1684{"ab", []string{"ad", "bd", "aaab", "baa", "badab"}}, + ans1684{2}, + }, + + { + para1684{"abc", []string{"a", "b", "c", "ab", "ac", "bc", "abc"}}, + ans1684{7}, + }, + + { + para1684{"cad", []string{"cc", "acd", "b", "ba", "bac", "bad", "ac", "d"}}, + ans1684{4}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1684------------------------\n") + + for _, q := range qs { + _, p := q.ans1684, q.para1684 + fmt.Printf("【input】:%v 【output】:%v\n", p, countConsistentStrings(p.allowed, p.words)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1684.Count-the-Number-of-Consistent-Strings/README.md b/leetcode/1684.Count-the-Number-of-Consistent-Strings/README.md new file mode 100644 index 00000000..85a779c8 --- /dev/null +++ b/leetcode/1684.Count-the-Number-of-Consistent-Strings/README.md @@ -0,0 +1,79 @@ +# [1684. Count the Number of Consistent Strings](https://leetcode.com/problems/count-the-number-of-consistent-strings/) + + +## 题目 + +You are given a string `allowed` consisting of **distinct** characters and an array of strings `words`. A string is **consistent** if all characters in the string appear in the string `allowed`. + +Return *the number of **consistent** strings in the array* `words`. + +**Example 1:** + +``` +Input: allowed = "ab", words = ["ad","bd","aaab","baa","badab"] +Output: 2 +Explanation: Strings "aaab" and "baa" are consistent since they only contain characters 'a' and 'b'. + +``` + +**Example 2:** + +``` +Input: allowed = "abc", words = ["a","b","c","ab","ac","bc","abc"] +Output: 7 +Explanation: All strings are consistent. + +``` + +**Example 3:** + +``` +Input: allowed = "cad", words = ["cc","acd","b","ba","bac","bad","ac","d"] +Output: 4 +Explanation: Strings "cc", "acd", "ac", and "d" are consistent. + +``` + +**Constraints:** + +- `1 <= words.length <= 104` +- `1 <= allowed.length <= 26` +- `1 <= words[i].length <= 10` +- The characters in `allowed` are **distinct**. +- `words[i]` and `allowed` contain only lowercase English letters. + +## 题目大意 + +给你一个由不同字符组成的字符串 `allowed` 和一个字符串数组 `words` 。如果一个字符串的每一个字符都在 `allowed` 中,就称这个字符串是 一致字符串 。 + +请你返回 `words` 数组中 一致字符串 的数目。 + +## 解题思路 + +- 简单题。先将 `allowed` 转化成 map。将 `words` 数组中每个单词的字符都在 map 中查找一遍,如果都存在就累加 res。如果有不存在的字母,不累加。最终输出 res 即可。 + +## 代码 + +```go +package leetcode + +func countConsistentStrings(allowed string, words []string) int { + allowedMap, res, flag := map[rune]int{}, 0, true + for _, str := range allowed { + allowedMap[str]++ + } + for i := 0; i < len(words); i++ { + flag = true + for j := 0; j < len(words[i]); j++ { + if _, ok := allowedMap[rune(words[i][j])]; !ok { + flag = false + break + } + } + if flag { + res++ + } + } + return res +} +``` \ No newline at end of file diff --git a/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/1685. Sum of Absolute Differences in a Sorted Array.go b/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/1685. Sum of Absolute Differences in a Sorted Array.go new file mode 100644 index 00000000..b2682093 --- /dev/null +++ b/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/1685. Sum of Absolute Differences in a Sorted Array.go @@ -0,0 +1,42 @@ +package leetcode + +//解法一 优化版 prefixSum + sufixSum +func getSumAbsoluteDifferences(nums []int) []int { + size := len(nums) + sufixSum := make([]int, size) + sufixSum[size-1] = nums[size-1] + for i := size - 2; i >= 0; i-- { + sufixSum[i] = sufixSum[i+1] + nums[i] + } + ans, preSum := make([]int, size), 0 + for i := 0; i < size; i++ { + // 后面可以加到的值 + res, sum := 0, sufixSum[i]-nums[i] + res += (sum - (size-i-1)*nums[i]) + // 前面可以加到的值 + res += (i*nums[i] - preSum) + ans[i] = res + preSum += nums[i] + } + return ans +} + +// 解法二 prefixSum +func getSumAbsoluteDifferences1(nums []int) []int { + preSum, res, sum := []int{}, []int{}, nums[0] + preSum = append(preSum, nums[0]) + for i := 1; i < len(nums); i++ { + sum += nums[i] + preSum = append(preSum, sum) + } + for i := 0; i < len(nums); i++ { + if i == 0 { + res = append(res, preSum[len(nums)-1]-preSum[0]-nums[i]*(len(nums)-1)) + } else if i > 0 && i < len(nums)-1 { + res = append(res, preSum[len(nums)-1]-preSum[i]-preSum[i-1]+nums[i]*i-nums[i]*(len(nums)-1-i)) + } else { + res = append(res, nums[i]*len(nums)-preSum[len(nums)-1]) + } + } + return res +} diff --git a/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/1685. Sum of Absolute Differences in a Sorted Array_test.go b/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/1685. Sum of Absolute Differences in a Sorted Array_test.go new file mode 100644 index 00000000..70ba45b4 --- /dev/null +++ b/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/1685. Sum of Absolute Differences in a Sorted Array_test.go @@ -0,0 +1,47 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1685 struct { + para1685 + ans1685 +} + +// para 是参数 +// one 代表第一个参数 +type para1685 struct { + nums []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1685 struct { + one []int +} + +func Test_Problem1685(t *testing.T) { + + qs := []question1685{ + + { + para1685{[]int{2, 3, 5}}, + ans1685{[]int{4, 3, 5}}, + }, + + { + para1685{[]int{1, 4, 6, 8, 10}}, + ans1685{[]int{24, 15, 13, 15, 21}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1685------------------------\n") + + for _, q := range qs { + _, p := q.ans1685, q.para1685 + fmt.Printf("【input】:%v 【output】:%v\n", p, getSumAbsoluteDifferences(p.nums)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/README.md b/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/README.md new file mode 100644 index 00000000..2de2fe4c --- /dev/null +++ b/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array/README.md @@ -0,0 +1,88 @@ +# [1685. Sum of Absolute Differences in a Sorted Array](https://leetcode.com/problems/sum-of-absolute-differences-in-a-sorted-array/) + + +## 题目 + +You are given an integer array `nums` sorted in **non-decreasing** order. + +Build and return *an integer array* `result` *with the same length as* `nums` *such that* `result[i]` *is equal to the **summation of absolute differences** between* `nums[i]` *and all the other elements in the array.* + +In other words, `result[i]` is equal to `sum(|nums[i]-nums[j]|)` where `0 <= j < nums.length` and `j != i` (**0-indexed**). + +**Example 1:** + +``` +Input: nums = [2,3,5] +Output: [4,3,5] +Explanation: Assuming the arrays are 0-indexed, then +result[0] = |2-2| + |2-3| + |2-5| = 0 + 1 + 3 = 4, +result[1] = |3-2| + |3-3| + |3-5| = 1 + 0 + 2 = 3, +result[2] = |5-2| + |5-3| + |5-5| = 3 + 2 + 0 = 5. +``` + +**Example 2:** + +``` +Input: nums = [1,4,6,8,10] +Output: [24,15,13,15,21] +``` + +**Constraints:** + +- `2 <= nums.length <= 105` +- `1 <= nums[i] <= nums[i + 1] <= 104` + +## 题目大意 + +给你一个 非递减 有序整数数组 `nums` 。请你建立并返回一个整数数组 `result`,它跟 `nums` 长度相同,且`result[i]` 等于 `nums[i]` 与数组中所有其他元素差的绝对值之和。换句话说, `result[i]` 等于 `sum(|nums[i]-nums[j]|)` ,其中 `0 <= j < nums.length` 且 `j != i` (下标从 0 开始)。 + +## 解题思路 + +- 利用前缀和思路解题。题目中说明了是有序数组,所以在计算绝对值的时候可以拆开绝对值符号。假设要计算当前 `result[i]`,以 `i` 为界,把原数组 `nums` 分成了 3 段。`nums[0 ~ i-1]` 和 `nums[i+1 ~ n]`,前面一段 `nums[0 ~ i-1]` 中的每个元素都比 `nums[i]` 小,拆掉绝对值以后,`sum(|nums[i]-nums[j]|) = nums[i] * i - prefixSum[0 ~ i-1]`,后面一段 `nums[i+1 ~ n]` 中的每个元素都比 `nums[i]` 大,拆掉绝对值以后,`sum(|nums[i]-nums[j]|) = prefixSum[i+1 ~ n] - nums[i] * (n - 1 - i)`。特殊的情况,`i = 0` 和 `i = n` 的情况特殊处理一下就行。 + +## 代码 + +```go +package leetcode + +//解法一 优化版 prefixSum + sufixSum +func getSumAbsoluteDifferences(nums []int) []int { + size := len(nums) + sufixSum := make([]int, size) + sufixSum[size-1] = nums[size-1] + for i := size - 2; i >= 0; i-- { + sufixSum[i] = sufixSum[i+1] + nums[i] + } + ans, preSum := make([]int, size), 0 + for i := 0; i < size; i++ { + // 后面可以加到的值 + res, sum := 0, sufixSum[i]-nums[i] + res += (sum - (size-i-1)*nums[i]) + // 前面可以加到的值 + res += (i*nums[i] - preSum) + ans[i] = res + preSum += nums[i] + } + return ans +} + +// 解法二 prefixSum +func getSumAbsoluteDifferences1(nums []int) []int { + preSum, res, sum := []int{}, []int{}, nums[0] + preSum = append(preSum, nums[0]) + for i := 1; i < len(nums); i++ { + sum += nums[i] + preSum = append(preSum, sum) + } + for i := 0; i < len(nums); i++ { + if i == 0 { + res = append(res, preSum[len(nums)-1]-preSum[0]-nums[i]*(len(nums)-1)) + } else if i > 0 && i < len(nums)-1 { + res = append(res, preSum[len(nums)-1]-preSum[i]-preSum[i-1]+nums[i]*i-nums[i]*(len(nums)-1-i)) + } else { + res = append(res, nums[i]*len(nums)-preSum[len(nums)-1]) + } + } + return res +} +``` \ No newline at end of file diff --git a/leetcode/1688.Count-of-Matches-in-Tournament/1688. Count of Matches in Tournament.go b/leetcode/1688.Count-of-Matches-in-Tournament/1688. Count of Matches in Tournament.go new file mode 100644 index 00000000..67c8ac65 --- /dev/null +++ b/leetcode/1688.Count-of-Matches-in-Tournament/1688. Count of Matches in Tournament.go @@ -0,0 +1,21 @@ +package leetcode + +// 解法一 +func numberOfMatches(n int) int { + return n - 1 +} + +// 解法二 模拟 +func numberOfMatches1(n int) int { + sum := 0 + for n != 1 { + if n&1 == 0 { + sum += n / 2 + n = n / 2 + } else { + sum += (n - 1) / 2 + n = (n-1)/2 + 1 + } + } + return sum +} diff --git a/leetcode/1688.Count-of-Matches-in-Tournament/1688. Count of Matches in Tournament_test.go b/leetcode/1688.Count-of-Matches-in-Tournament/1688. Count of Matches in Tournament_test.go new file mode 100644 index 00000000..71e60e59 --- /dev/null +++ b/leetcode/1688.Count-of-Matches-in-Tournament/1688. Count of Matches in Tournament_test.go @@ -0,0 +1,47 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1688 struct { + para1688 + ans1688 +} + +// para 是参数 +// one 代表第一个参数 +type para1688 struct { + n int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1688 struct { + one int +} + +func Test_Problem1688(t *testing.T) { + + qs := []question1688{ + + { + para1688{7}, + ans1688{6}, + }, + + { + para1688{14}, + ans1688{13}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1688------------------------\n") + + for _, q := range qs { + _, p := q.ans1688, q.para1688 + fmt.Printf("【input】:%v 【output】:%v\n", p, numberOfMatches(p.n)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1688.Count-of-Matches-in-Tournament/README.md b/leetcode/1688.Count-of-Matches-in-Tournament/README.md new file mode 100644 index 00000000..b9b5f0a9 --- /dev/null +++ b/leetcode/1688.Count-of-Matches-in-Tournament/README.md @@ -0,0 +1,80 @@ +# [1688. Count of Matches in Tournament](https://leetcode.com/problems/count-of-matches-in-tournament/) + + +## 题目 + +You are given an integer `n`, the number of teams in a tournament that has strange rules: + +- If the current number of teams is **even**, each team gets paired with another team. A total of `n / 2` matches are played, and `n / 2` teams advance to the next round. +- If the current number of teams is **odd**, one team randomly advances in the tournament, and the rest gets paired. A total of `(n - 1) / 2` matches are played, and `(n - 1) / 2 + 1` teams advance to the next round. + +Return *the number of matches played in the tournament until a winner is decided.* + +**Example 1:** + +``` +Input: n = 7 +Output: 6 +Explanation: Details of the tournament: +- 1st Round: Teams = 7, Matches = 3, and 4 teams advance. +- 2nd Round: Teams = 4, Matches = 2, and 2 teams advance. +- 3rd Round: Teams = 2, Matches = 1, and 1 team is declared the winner. +Total number of matches = 3 + 2 + 1 = 6. +``` + +**Example 2:** + +``` +Input: n = 14 +Output: 13 +Explanation: Details of the tournament: +- 1st Round: Teams = 14, Matches = 7, and 7 teams advance. +- 2nd Round: Teams = 7, Matches = 3, and 4 teams advance. +- 3rd Round: Teams = 4, Matches = 2, and 2 teams advance. +- 4th Round: Teams = 2, Matches = 1, and 1 team is declared the winner. +Total number of matches = 7 + 3 + 2 + 1 = 13. +``` + +**Constraints:** + +- `1 <= n <= 200` + +## 题目大意 + +给你一个整数 n ,表示比赛中的队伍数。比赛遵循一种独特的赛制: + +- 如果当前队伍数是 偶数 ,那么每支队伍都会与另一支队伍配对。总共进行 n / 2 场比赛,且产生 n / 2 支队伍进入下一轮。 +- 如果当前队伍数为 奇数 ,那么将会随机轮空并晋级一支队伍,其余的队伍配对。总共进行 (n - 1) / 2 场比赛,且产生 (n - 1) / 2 + 1 支队伍进入下一轮。 + +返回在比赛中进行的配对次数,直到决出获胜队伍为止。 + +## 解题思路 + +- 简单题,按照题目的规则模拟。 +- 这一题还有更加简洁的代码,见解法一。n 个队伍,一个冠军,需要淘汰 n-1 个队伍。每一场比赛淘汰一个队伍,因此进行了 n-1 场比赛。所以共有 n-1 个配对。 + +## 代码 + +```go +package leetcode + +// 解法一 +func numberOfMatches(n int) int { + return n - 1 +} + +// 解法二 模拟 +func numberOfMatches1(n int) int { + sum := 0 + for n != 1 { + if n&1 == 0 { + sum += n / 2 + n = n / 2 + } else { + sum += (n - 1) / 2 + n = (n-1)/2 + 1 + } + } + return sum +} +``` \ No newline at end of file diff --git a/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/1689. Partitioning Into Minimum Number Of Deci-Binary Numbers.go b/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/1689. Partitioning Into Minimum Number Of Deci-Binary Numbers.go new file mode 100644 index 00000000..a6313fa3 --- /dev/null +++ b/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/1689. Partitioning Into Minimum Number Of Deci-Binary Numbers.go @@ -0,0 +1,11 @@ +package leetcode + +func minPartitions(n string) int { + res := 0 + for i := 0; i < len(n); i++ { + if int(n[i]-'0') > res { + res = int(n[i] - '0') + } + } + return res +} diff --git a/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/1689. Partitioning Into Minimum Number Of Deci-Binary Numbers_test.go b/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/1689. Partitioning Into Minimum Number Of Deci-Binary Numbers_test.go new file mode 100644 index 00000000..9acc0a74 --- /dev/null +++ b/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/1689. Partitioning Into Minimum Number Of Deci-Binary Numbers_test.go @@ -0,0 +1,47 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1689 struct { + para1689 + ans1689 +} + +// para 是参数 +// one 代表第一个参数 +type para1689 struct { + n string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1689 struct { + one int +} + +func Test_Problem1689(t *testing.T) { + + qs := []question1689{ + + { + para1689{"32"}, + ans1689{3}, + }, + + { + para1689{"82734"}, + ans1689{8}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1689------------------------\n") + + for _, q := range qs { + _, p := q.ans1689, q.para1689 + fmt.Printf("【input】:%v 【output】:%v\n", p, minPartitions(p.n)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/README.md b/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/README.md new file mode 100644 index 00000000..2ac4daa2 --- /dev/null +++ b/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/README.md @@ -0,0 +1,60 @@ +# [1689. Partitioning Into Minimum Number Of Deci-Binary Numbers](https://leetcode.com/problems/partitioning-into-minimum-number-of-deci-binary-numbers/) + +## 题目 + +A decimal number is called **deci-binary** if each of its digits is either `0` or `1` without any leading zeros. For example, `101` and `1100` are **deci-binary**, while `112` and `3001` are not. + +Given a string `n` that represents a positive decimal integer, return *the **minimum** number of positive **deci-binary** numbers needed so that they sum up to* `n`*.* + +**Example 1:** + +``` +Input: n = "32" +Output: 3 +Explanation: 10 + 11 + 11 = 32 +``` + +**Example 2:** + +``` +Input: n = "82734" +Output: 8 +``` + +**Example 3:** + +``` +Input: n = "27346209830709182346" +Output: 9 +``` + +**Constraints:** + +- `1 <= n.length <= 105` +- `n` consists of only digits. +- `n` does not contain any leading zeros and represents a positive integer. + +## 题目大意 + +如果一个十进制数字不含任何前导零,且每一位上的数字不是 0 就是 1 ,那么该数字就是一个 十-二进制数 。例如,101 和 1100 都是 十-二进制数,而 112 和 3001 不是。给你一个表示十进制整数的字符串 n ,返回和为 n 的 十-二进制数 的最少数目。 + +## 解题思路 + +- 这一题也算是简单题,相通了以后,代码就 3 行。 +- 要想由 01 组成的十进制数组成 n,只需要在 n 这个数的各个数位上依次排上 0 和 1 即可。例如 n = 23423723,这是一个 8 位数。最大数字是 7,所以至少需要 7 个数累加能得到这个 n。这 7 个数的百位都为 1,其他数位按需求取 0 和 1 即可。例如万位是 2,那么这 7 个数中任找 2 个数的万位是 1 ,其他 5 个数的万位是 0 即可。 + +## 代码 + +```go +package leetcode + +func minPartitions(n string) int { + res := 0 + for i := 0; i < len(n); i++ { + if int(n[i]-'0') > res { + res = int(n[i] - '0') + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md b/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md new file mode 100644 index 00000000..6b8ac226 --- /dev/null +++ b/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md @@ -0,0 +1,108 @@ +# [1573. Number of Ways to Split a String](https://leetcode.com/problems/number-of-ways-to-split-a-string/) + + +## 题目 + +Given a binary string `s` (a string consisting only of '0's and '1's), we can split `s` into 3 **non-empty** strings s1, s2, s3 (s1+ s2+ s3 = s). + +Return the number of ways `s` can be split such that the number of characters '1' is the same in s1, s2, and s3. + +Since the answer may be too large, return it modulo 10^9 + 7. + +**Example 1:** + +``` +Input: s = "10101" +Output: 4 +Explanation: There are four ways to split s in 3 parts where each part contain the same number of letters '1'. +"1|010|1" +"1|01|01" +"10|10|1" +"10|1|01" + +``` + +**Example 2:** + +``` +Input: s = "1001" +Output: 0 + +``` + +**Example 3:** + +``` +Input: s = "0000" +Output: 3 +Explanation: There are three ways to split s in 3 parts. +"0|0|00" +"0|00|0" +"00|0|0" + +``` + +**Example 4:** + +``` +Input: s = "100100010100110" +Output: 12 + +``` + +**Constraints:** + +- `3 <= s.length <= 10^5` +- `s[i]` is `'0'` or `'1'`. + +## 题目大意 + +给你一个二进制串 s  (一个只包含 0 和 1 的字符串),我们可以将 s 分割成 3 个 非空 字符串 s1, s2, s3 (s1 + s2 + s3 = s)。请你返回分割 s 的方案数,满足 s1,s2 和 s3 中字符 '1' 的数目相同。由于答案可能很大,请将它对 10^9 + 7 取余后返回。 + +## 解题思路 + +- 这一题是考察的排列组合的知识。根据题意,如果 1 的个数不是 3 的倍数,直接返回 -1。如果字符串里面没有 1,那么切分的方案就是组合,在 n-1 个字母里面选出 2 个位置。利用组合的计算方法,组合数是 (n-1) * (n-2) / 2 。 +- 剩下的是 3 的倍数的情况。在字符串中选 2 个位置隔成 3 段。从第一段最后一个 1 到第二段第一个 1 之间的 0 的个数为 m1,从第二段最后一个 1 到第三段第一个 1 之间的 0 的个数为 m2。利用乘法原理,方案数为 m1 * m2。 + +## 代码 + +```go +package leetcode + +func numWays(s string) int { + ones := 0 + for _, c := range s { + if c == '1' { + ones++ + } + } + if ones%3 != 0 { + return 0 + } + if ones == 0 { + return (len(s) - 1) * (len(s) - 2) / 2 % 1000000007 + } + N, a, b, c, d, count := ones/3, 0, 0, 0, 0, 0 + for i, letter := range s { + if letter == '0' { + continue + } + if letter == '1' { + count++ + } + if count == N { + a = i + } + if count == N+1 { + b = i + } + if count == 2*N { + c = i + } + if count == 2*N+1 { + d = i + } + } + return (b - a) * (d - c) % 1000000007 +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md b/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md new file mode 100644 index 00000000..85a779c8 --- /dev/null +++ b/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md @@ -0,0 +1,79 @@ +# [1684. Count the Number of Consistent Strings](https://leetcode.com/problems/count-the-number-of-consistent-strings/) + + +## 题目 + +You are given a string `allowed` consisting of **distinct** characters and an array of strings `words`. A string is **consistent** if all characters in the string appear in the string `allowed`. + +Return *the number of **consistent** strings in the array* `words`. + +**Example 1:** + +``` +Input: allowed = "ab", words = ["ad","bd","aaab","baa","badab"] +Output: 2 +Explanation: Strings "aaab" and "baa" are consistent since they only contain characters 'a' and 'b'. + +``` + +**Example 2:** + +``` +Input: allowed = "abc", words = ["a","b","c","ab","ac","bc","abc"] +Output: 7 +Explanation: All strings are consistent. + +``` + +**Example 3:** + +``` +Input: allowed = "cad", words = ["cc","acd","b","ba","bac","bad","ac","d"] +Output: 4 +Explanation: Strings "cc", "acd", "ac", and "d" are consistent. + +``` + +**Constraints:** + +- `1 <= words.length <= 104` +- `1 <= allowed.length <= 26` +- `1 <= words[i].length <= 10` +- The characters in `allowed` are **distinct**. +- `words[i]` and `allowed` contain only lowercase English letters. + +## 题目大意 + +给你一个由不同字符组成的字符串 `allowed` 和一个字符串数组 `words` 。如果一个字符串的每一个字符都在 `allowed` 中,就称这个字符串是 一致字符串 。 + +请你返回 `words` 数组中 一致字符串 的数目。 + +## 解题思路 + +- 简单题。先将 `allowed` 转化成 map。将 `words` 数组中每个单词的字符都在 map 中查找一遍,如果都存在就累加 res。如果有不存在的字母,不累加。最终输出 res 即可。 + +## 代码 + +```go +package leetcode + +func countConsistentStrings(allowed string, words []string) int { + allowedMap, res, flag := map[rune]int{}, 0, true + for _, str := range allowed { + allowedMap[str]++ + } + for i := 0; i < len(words); i++ { + flag = true + for j := 0; j < len(words[i]); j++ { + if _, ok := allowedMap[rune(words[i][j])]; !ok { + flag = false + break + } + } + if flag { + res++ + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md b/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md new file mode 100644 index 00000000..2de2fe4c --- /dev/null +++ b/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md @@ -0,0 +1,88 @@ +# [1685. Sum of Absolute Differences in a Sorted Array](https://leetcode.com/problems/sum-of-absolute-differences-in-a-sorted-array/) + + +## 题目 + +You are given an integer array `nums` sorted in **non-decreasing** order. + +Build and return *an integer array* `result` *with the same length as* `nums` *such that* `result[i]` *is equal to the **summation of absolute differences** between* `nums[i]` *and all the other elements in the array.* + +In other words, `result[i]` is equal to `sum(|nums[i]-nums[j]|)` where `0 <= j < nums.length` and `j != i` (**0-indexed**). + +**Example 1:** + +``` +Input: nums = [2,3,5] +Output: [4,3,5] +Explanation: Assuming the arrays are 0-indexed, then +result[0] = |2-2| + |2-3| + |2-5| = 0 + 1 + 3 = 4, +result[1] = |3-2| + |3-3| + |3-5| = 1 + 0 + 2 = 3, +result[2] = |5-2| + |5-3| + |5-5| = 3 + 2 + 0 = 5. +``` + +**Example 2:** + +``` +Input: nums = [1,4,6,8,10] +Output: [24,15,13,15,21] +``` + +**Constraints:** + +- `2 <= nums.length <= 105` +- `1 <= nums[i] <= nums[i + 1] <= 104` + +## 题目大意 + +给你一个 非递减 有序整数数组 `nums` 。请你建立并返回一个整数数组 `result`,它跟 `nums` 长度相同,且`result[i]` 等于 `nums[i]` 与数组中所有其他元素差的绝对值之和。换句话说, `result[i]` 等于 `sum(|nums[i]-nums[j]|)` ,其中 `0 <= j < nums.length` 且 `j != i` (下标从 0 开始)。 + +## 解题思路 + +- 利用前缀和思路解题。题目中说明了是有序数组,所以在计算绝对值的时候可以拆开绝对值符号。假设要计算当前 `result[i]`,以 `i` 为界,把原数组 `nums` 分成了 3 段。`nums[0 ~ i-1]` 和 `nums[i+1 ~ n]`,前面一段 `nums[0 ~ i-1]` 中的每个元素都比 `nums[i]` 小,拆掉绝对值以后,`sum(|nums[i]-nums[j]|) = nums[i] * i - prefixSum[0 ~ i-1]`,后面一段 `nums[i+1 ~ n]` 中的每个元素都比 `nums[i]` 大,拆掉绝对值以后,`sum(|nums[i]-nums[j]|) = prefixSum[i+1 ~ n] - nums[i] * (n - 1 - i)`。特殊的情况,`i = 0` 和 `i = n` 的情况特殊处理一下就行。 + +## 代码 + +```go +package leetcode + +//解法一 优化版 prefixSum + sufixSum +func getSumAbsoluteDifferences(nums []int) []int { + size := len(nums) + sufixSum := make([]int, size) + sufixSum[size-1] = nums[size-1] + for i := size - 2; i >= 0; i-- { + sufixSum[i] = sufixSum[i+1] + nums[i] + } + ans, preSum := make([]int, size), 0 + for i := 0; i < size; i++ { + // 后面可以加到的值 + res, sum := 0, sufixSum[i]-nums[i] + res += (sum - (size-i-1)*nums[i]) + // 前面可以加到的值 + res += (i*nums[i] - preSum) + ans[i] = res + preSum += nums[i] + } + return ans +} + +// 解法二 prefixSum +func getSumAbsoluteDifferences1(nums []int) []int { + preSum, res, sum := []int{}, []int{}, nums[0] + preSum = append(preSum, nums[0]) + for i := 1; i < len(nums); i++ { + sum += nums[i] + preSum = append(preSum, sum) + } + for i := 0; i < len(nums); i++ { + if i == 0 { + res = append(res, preSum[len(nums)-1]-preSum[0]-nums[i]*(len(nums)-1)) + } else if i > 0 && i < len(nums)-1 { + res = append(res, preSum[len(nums)-1]-preSum[i]-preSum[i-1]+nums[i]*i-nums[i]*(len(nums)-1-i)) + } else { + res = append(res, nums[i]*len(nums)-preSum[len(nums)-1]) + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md b/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md new file mode 100644 index 00000000..b9b5f0a9 --- /dev/null +++ b/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md @@ -0,0 +1,80 @@ +# [1688. Count of Matches in Tournament](https://leetcode.com/problems/count-of-matches-in-tournament/) + + +## 题目 + +You are given an integer `n`, the number of teams in a tournament that has strange rules: + +- If the current number of teams is **even**, each team gets paired with another team. A total of `n / 2` matches are played, and `n / 2` teams advance to the next round. +- If the current number of teams is **odd**, one team randomly advances in the tournament, and the rest gets paired. A total of `(n - 1) / 2` matches are played, and `(n - 1) / 2 + 1` teams advance to the next round. + +Return *the number of matches played in the tournament until a winner is decided.* + +**Example 1:** + +``` +Input: n = 7 +Output: 6 +Explanation: Details of the tournament: +- 1st Round: Teams = 7, Matches = 3, and 4 teams advance. +- 2nd Round: Teams = 4, Matches = 2, and 2 teams advance. +- 3rd Round: Teams = 2, Matches = 1, and 1 team is declared the winner. +Total number of matches = 3 + 2 + 1 = 6. +``` + +**Example 2:** + +``` +Input: n = 14 +Output: 13 +Explanation: Details of the tournament: +- 1st Round: Teams = 14, Matches = 7, and 7 teams advance. +- 2nd Round: Teams = 7, Matches = 3, and 4 teams advance. +- 3rd Round: Teams = 4, Matches = 2, and 2 teams advance. +- 4th Round: Teams = 2, Matches = 1, and 1 team is declared the winner. +Total number of matches = 7 + 3 + 2 + 1 = 13. +``` + +**Constraints:** + +- `1 <= n <= 200` + +## 题目大意 + +给你一个整数 n ,表示比赛中的队伍数。比赛遵循一种独特的赛制: + +- 如果当前队伍数是 偶数 ,那么每支队伍都会与另一支队伍配对。总共进行 n / 2 场比赛,且产生 n / 2 支队伍进入下一轮。 +- 如果当前队伍数为 奇数 ,那么将会随机轮空并晋级一支队伍,其余的队伍配对。总共进行 (n - 1) / 2 场比赛,且产生 (n - 1) / 2 + 1 支队伍进入下一轮。 + +返回在比赛中进行的配对次数,直到决出获胜队伍为止。 + +## 解题思路 + +- 简单题,按照题目的规则模拟。 +- 这一题还有更加简洁的代码,见解法一。n 个队伍,一个冠军,需要淘汰 n-1 个队伍。每一场比赛淘汰一个队伍,因此进行了 n-1 场比赛。所以共有 n-1 个配对。 + +## 代码 + +```go +package leetcode + +// 解法一 +func numberOfMatches(n int) int { + return n - 1 +} + +// 解法二 模拟 +func numberOfMatches1(n int) int { + sum := 0 + for n != 1 { + if n&1 == 0 { + sum += n / 2 + n = n / 2 + } else { + sum += (n - 1) / 2 + n = (n-1)/2 + 1 + } + } + return sum +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md b/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md new file mode 100644 index 00000000..2ac4daa2 --- /dev/null +++ b/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md @@ -0,0 +1,60 @@ +# [1689. Partitioning Into Minimum Number Of Deci-Binary Numbers](https://leetcode.com/problems/partitioning-into-minimum-number-of-deci-binary-numbers/) + +## 题目 + +A decimal number is called **deci-binary** if each of its digits is either `0` or `1` without any leading zeros. For example, `101` and `1100` are **deci-binary**, while `112` and `3001` are not. + +Given a string `n` that represents a positive decimal integer, return *the **minimum** number of positive **deci-binary** numbers needed so that they sum up to* `n`*.* + +**Example 1:** + +``` +Input: n = "32" +Output: 3 +Explanation: 10 + 11 + 11 = 32 +``` + +**Example 2:** + +``` +Input: n = "82734" +Output: 8 +``` + +**Example 3:** + +``` +Input: n = "27346209830709182346" +Output: 9 +``` + +**Constraints:** + +- `1 <= n.length <= 105` +- `n` consists of only digits. +- `n` does not contain any leading zeros and represents a positive integer. + +## 题目大意 + +如果一个十进制数字不含任何前导零,且每一位上的数字不是 0 就是 1 ,那么该数字就是一个 十-二进制数 。例如,101 和 1100 都是 十-二进制数,而 112 和 3001 不是。给你一个表示十进制整数的字符串 n ,返回和为 n 的 十-二进制数 的最少数目。 + +## 解题思路 + +- 这一题也算是简单题,相通了以后,代码就 3 行。 +- 要想由 01 组成的十进制数组成 n,只需要在 n 这个数的各个数位上依次排上 0 和 1 即可。例如 n = 23423723,这是一个 8 位数。最大数字是 7,所以至少需要 7 个数累加能得到这个 n。这 7 个数的百位都为 1,其他数位按需求取 0 和 1 即可。例如万位是 2,那么这 7 个数中任找 2 个数的万位是 1 ,其他 5 个数的万位是 0 即可。 + +## 代码 + +```go +package leetcode + +func minPartitions(n string) int { + res := 0 + for i := 0; i < len(n); i++ { + if int(n[i]-'0') > res { + res = int(n[i] - '0') + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index a769bcc7..eb670ca6 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -548,6 +548,7 @@ headless: true - [1470.Shuffle-the-Array]({{< relref "/ChapterFour/1470.Shuffle-the-Array.md" >}}) - [1480.Running-Sum-of-1d-Array]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}}) - [1512.Number-of-Good-Pairs]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}}) + - [1573.Number-of-Ways-to-Split-a-String]({{< relref "/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md" >}}) - [1646.Get-Maximum-in-Generated-Array]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}}) - [1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}}) - [1648.Sell-Diminishing-Valued-Colored-Balls]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}}) @@ -568,4 +569,8 @@ headless: true - [1679.Max-Number-of-K-Sum-Pairs]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}}) - [1680.Concatenation-of-Consecutive-Binary-Numbers]({{< relref "/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md" >}}) - [1681.Minimum-Incompatibility]({{< relref "/ChapterFour/1681.Minimum-Incompatibility.md" >}}) + - [1684.Count-the-Number-of-Consistent-Strings]({{< relref "/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md" >}}) + - [1685.Sum-of-Absolute-Differences-in-a-Sorted-Array]({{< relref "/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md" >}}) + - [1688.Count-of-Matches-in-Tournament]({{< relref "/ChapterFour/1688.Count-of-Matches-in-Tournament.md" >}}) + - [1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers]({{< relref "/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md" >}})
From e85f3236f431bbe6be21b3cd3cdf3010c44a4f2b Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 16 Dec 2020 03:08:19 +0800 Subject: [PATCH 48/82] =?UTF-8?q?Add=20solution=201668=E3=80=811669?= =?UTF-8?q?=E3=80=811670=E3=80=811672=E3=80=811673?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1668. Maximum Repeating Substring.go} | 0 ...1668. Maximum Repeating Substring_test.go} | 30 +-- .../README.md | 69 +++++++ .../1669. Merge In Between Linked Lists.go | 37 ++++ ...669. Merge In Between Linked Lists_test.go | 62 +++++++ .../README.md | 75 ++++++++ .../1670. Design Front Middle Back Queue.go | 94 ++++++++++ ...0. Design Front Middle Back Queue_test.go} | 11 +- .../README.md | 172 ++++++++++++++++++ .../1672. Richest Customer Wealth.go | 15 ++ .../1672. Richest Customer Wealth_test.go | 52 ++++++ .../1672.Richest-Customer-Wealth/README.md | 72 ++++++++ .... Find the Most Competitive Subsequence.go | 13 ++ ...d the Most Competitive Subsequence_test.go | 63 +++++++ .../README.md | 62 +++++++ .../1681.Minimum-Incompatibility/README.md | 2 +- .../5558. Merge In Between Linked Lists.go | 46 ----- ...558. Merge In Between Linked Lists_test.go | 62 ------- .../5560. Design Front Middle Back Queue.go | 78 -------- .../5613. Richest Customer Wealth.go | 20 -- .../5613. Richest Customer Wealth_test.go | 52 ------ .... Find the Most Competitive Subsequence.go | 87 --------- ...d the Most Competitive Subsequence_test.go | 63 ------- .../1668.Maximum-Repeating-Substring.md | 69 +++++++ .../1669.Merge-In-Between-Linked-Lists.md | 75 ++++++++ .../1670.Design-Front-Middle-Back-Queue.md | 172 ++++++++++++++++++ .../1672.Richest-Customer-Wealth.md | 72 ++++++++ ...3.Find-the-Most-Competitive-Subsequence.md | 62 +++++++ .../1681.Minimum-Incompatibility.md | 2 +- website/content/menu/index.md | 5 + 30 files changed, 1266 insertions(+), 428 deletions(-) rename leetcode/{5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring.go => 1668.Maximum-Repeating-Substring/1668. Maximum Repeating Substring.go} (100%) rename leetcode/{5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring_test.go => 1668.Maximum-Repeating-Substring/1668. Maximum Repeating Substring_test.go} (51%) create mode 100644 leetcode/1668.Maximum-Repeating-Substring/README.md create mode 100644 leetcode/1669.Merge-In-Between-Linked-Lists/1669. Merge In Between Linked Lists.go create mode 100644 leetcode/1669.Merge-In-Between-Linked-Lists/1669. Merge In Between Linked Lists_test.go create mode 100644 leetcode/1669.Merge-In-Between-Linked-Lists/README.md create mode 100644 leetcode/1670.Design-Front-Middle-Back-Queue/1670. Design Front Middle Back Queue.go rename leetcode/{5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue_test.go => 1670.Design-Front-Middle-Back-Queue/1670. Design Front Middle Back Queue_test.go} (94%) create mode 100644 leetcode/1670.Design-Front-Middle-Back-Queue/README.md create mode 100644 leetcode/1672.Richest-Customer-Wealth/1672. Richest Customer Wealth.go create mode 100644 leetcode/1672.Richest-Customer-Wealth/1672. Richest Customer Wealth_test.go create mode 100644 leetcode/1672.Richest-Customer-Wealth/README.md create mode 100644 leetcode/1673.Find-the-Most-Competitive-Subsequence/1673. Find the Most Competitive Subsequence.go create mode 100644 leetcode/1673.Find-the-Most-Competitive-Subsequence/1673. Find the Most Competitive Subsequence_test.go create mode 100644 leetcode/1673.Find-the-Most-Competitive-Subsequence/README.md delete mode 100644 leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists.go delete mode 100644 leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists_test.go delete mode 100644 leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue.go delete mode 100644 leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth.go delete mode 100644 leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth_test.go delete mode 100644 leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence.go delete mode 100644 leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence_test.go create mode 100644 website/content/ChapterFour/1668.Maximum-Repeating-Substring.md create mode 100644 website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md create mode 100644 website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md create mode 100644 website/content/ChapterFour/1672.Richest-Customer-Wealth.md create mode 100644 website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md diff --git a/leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring.go b/leetcode/1668.Maximum-Repeating-Substring/1668. Maximum Repeating Substring.go similarity index 100% rename from leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring.go rename to leetcode/1668.Maximum-Repeating-Substring/1668. Maximum Repeating Substring.go diff --git a/leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring_test.go b/leetcode/1668.Maximum-Repeating-Substring/1668. Maximum Repeating Substring_test.go similarity index 51% rename from leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring_test.go rename to leetcode/1668.Maximum-Repeating-Substring/1668. Maximum Repeating Substring_test.go index 5377c15a..ee5aadd5 100644 --- a/leetcode/5557.Maximum-Repeating-Substring/5557. Maximum Repeating Substring_test.go +++ b/leetcode/1668.Maximum-Repeating-Substring/1668. Maximum Repeating Substring_test.go @@ -5,48 +5,48 @@ import ( "testing" ) -type question1665 struct { - para1665 - ans1665 +type question1668 struct { + para1668 + ans1668 } // para 是参数 // one 代表第一个参数 -type para1665 struct { +type para1668 struct { sequence string word string } // ans 是答案 // one 代表第一个答案 -type ans1665 struct { +type ans1668 struct { one int } -func Test_Problem1665(t *testing.T) { +func Test_Problem1668(t *testing.T) { - qs := []question1665{ + qs := []question1668{ { - para1665{"ababc", "ab"}, - ans1665{2}, + para1668{"ababc", "ab"}, + ans1668{2}, }, { - para1665{"ababc", "ba"}, - ans1665{1}, + para1668{"ababc", "ba"}, + ans1668{1}, }, { - para1665{"ababc", "ac"}, - ans1665{0}, + para1668{"ababc", "ac"}, + ans1668{0}, }, } - fmt.Printf("------------------------Leetcode Problem 1665------------------------\n") + fmt.Printf("------------------------Leetcode Problem 1668------------------------\n") for _, q := range qs { - _, p := q.ans1665, q.para1665 + _, p := q.ans1668, q.para1668 fmt.Printf("【input】:%v 【output】:%v \n", p, maxRepeating(p.sequence, p.word)) } fmt.Printf("\n\n\n") diff --git a/leetcode/1668.Maximum-Repeating-Substring/README.md b/leetcode/1668.Maximum-Repeating-Substring/README.md new file mode 100644 index 00000000..b25e75de --- /dev/null +++ b/leetcode/1668.Maximum-Repeating-Substring/README.md @@ -0,0 +1,69 @@ +# [1668. Maximum Repeating Substring](https://leetcode.com/problems/maximum-repeating-substring/) + + +## 题目 + +For a string `sequence`, a string `word` is **`k`-repeating** if `word` concatenated `k` times is a substring of `sequence`. The `word`'s **maximum `k`-repeating value** is the highest value `k` where `word` is `k`-repeating in `sequence`. If `word` is not a substring of `sequence`, `word`'s maximum `k`-repeating value is `0`. + +Given strings `sequence` and `word`, return *the **maximum `k`-repeating value** of `word` in `sequence`*. + +**Example 1:** + +``` +Input: sequence = "ababc", word = "ab" +Output: 2 +Explanation: "abab" is a substring in "ababc". +``` + +**Example 2:** + +``` +Input: sequence = "ababc", word = "ba" +Output: 1 +Explanation: "ba" is a substring in "ababc". "baba" is not a substring in "ababc". +``` + +**Example 3:** + +``` +Input: sequence = "ababc", word = "ac" +Output: 0 +Explanation: "ac" is not a substring in "ababc". +``` + +**Constraints:** + +- `1 <= sequence.length <= 100` +- `1 <= word.length <= 100` +- `sequence` and `word` contains only lowercase English letters. + +## 题目大意 + +给你一个字符串 sequence ,如果字符串 word 连续重复 k 次形成的字符串是 sequence 的一个子字符串,那么单词 word 的 重复值为 k 。单词 word 的 最大重复值 是单词 word 在 sequence 中最大的重复值。如果 word 不是 sequence 的子串,那么重复值 k 为 0 。给你一个字符串 sequence 和 word ,请你返回 最大重复值 k 。 + +## 解题思路 + +- 循环叠加构造 `word`,每次构造出新的 `word` 都在 `sequence` 查找一次,如果找到就输出叠加次数,否则继续叠加构造,直到字符串长度和 `sequence` 一样长,最终都没有找到则输出 0 。 + +## 代码 + +```go +package leetcode + +import ( + "strings" +) + +func maxRepeating(sequence string, word string) int { + for i := len(sequence) / len(word); i >= 0; i-- { + tmp := "" + for j := 0; j < i; j++ { + tmp += word + } + if strings.Contains(sequence, tmp) { + return i + } + } + return 0 +} +``` \ No newline at end of file diff --git a/leetcode/1669.Merge-In-Between-Linked-Lists/1669. Merge In Between Linked Lists.go b/leetcode/1669.Merge-In-Between-Linked-Lists/1669. Merge In Between Linked Lists.go new file mode 100644 index 00000000..9536270e --- /dev/null +++ b/leetcode/1669.Merge-In-Between-Linked-Lists/1669. Merge In Between Linked Lists.go @@ -0,0 +1,37 @@ +package leetcode + +import ( + "github.com/halfrost/LeetCode-Go/structures" +) + +// ListNode define +type ListNode = structures.ListNode + +/** + * Definition for singly-linked list. + * type ListNode struct { + * Val int + * Next *ListNode + * } + */ + +func mergeInBetween(list1 *ListNode, a int, b int, list2 *ListNode) *ListNode { + n := list1 + var startRef, endRef *ListNode + for i := 0; i <= b; i++ { + if i == a-1 { + startRef = n + } + if i == b { + endRef = n + } + n = n.Next + } + startRef.Next = list2 + n = list2 + for n.Next != nil { + n = n.Next + } + n.Next = endRef.Next + return list1 +} diff --git a/leetcode/1669.Merge-In-Between-Linked-Lists/1669. Merge In Between Linked Lists_test.go b/leetcode/1669.Merge-In-Between-Linked-Lists/1669. Merge In Between Linked Lists_test.go new file mode 100644 index 00000000..b7d63a0e --- /dev/null +++ b/leetcode/1669.Merge-In-Between-Linked-Lists/1669. Merge In Between Linked Lists_test.go @@ -0,0 +1,62 @@ +package leetcode + +import ( + "fmt" + "testing" + + "github.com/halfrost/LeetCode-Go/structures" +) + +type question1669 struct { + para1669 + ans1669 +} + +// para 是参数 +// one 代表第一个参数 +type para1669 struct { + one []int + a int + b int + another []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1669 struct { + one []int +} + +func Test_Problem1669(t *testing.T) { + + qs := []question1669{ + + { + para1669{[]int{0, 1, 2, 3, 4, 5}, 3, 4, []int{1000000, 1000001, 1000002}}, + ans1669{[]int{0, 1, 2, 1000000, 1000001, 1000002, 5}}, + }, + + { + para1669{[]int{0, 1, 2, 3, 4, 5, 6}, 2, 5, []int{1000000, 1000001, 1000002, 1000003, 1000004}}, + ans1669{[]int{0, 1, 1000000, 1000001, 1000002, 1000003, 1000004, 6}}, + }, + + { + para1669{[]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, 3, 5, []int{1000000, 1000001, 1000002, 1000003, 1000004, 1000005, 1000006}}, + ans1669{[]int{0, 1, 2, 1000000, 1000001, 1000002, 1000003, 1000004, 1000005, 1000006, 6, 7, 8, 9}}, + }, + + { + para1669{[]int{0, 1, 2}, 1, 1, []int{1000000, 1000001, 1000002, 1000003}}, + ans1669{[]int{0, 1000000, 1000001, 1000002, 1000003, 2}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1669------------------------\n") + + for _, q := range qs { + _, p := q.ans1669, q.para1669 + fmt.Printf("【input】:%v 【output】:%v\n", p, structures.List2Ints(mergeInBetween(structures.Ints2List(p.one), p.a, p.b, structures.Ints2List(p.another)))) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1669.Merge-In-Between-Linked-Lists/README.md b/leetcode/1669.Merge-In-Between-Linked-Lists/README.md new file mode 100644 index 00000000..3b221b0f --- /dev/null +++ b/leetcode/1669.Merge-In-Between-Linked-Lists/README.md @@ -0,0 +1,75 @@ +# [1669. Merge In Between Linked Lists](https://leetcode.com/problems/merge-in-between-linked-lists/) + + +## 题目 + +You are given two linked lists: `list1` and `list2` of sizes `n` and `m` respectively. + +Remove `list1`'s nodes from the `ath` node to the `bth` node, and put `list2` in their place. + +The blue edges and nodes in the following figure incidate the result: + +![https://assets.leetcode.com/uploads/2020/11/05/fig1.png](https://assets.leetcode.com/uploads/2020/11/05/fig1.png) + +*Build the result list and return its head.* + +**Example 1:** + +![https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex1.png](https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex1.png) + +``` +Input: list1 = [0,1,2,3,4,5], a = 3, b = 4, list2 = [1000000,1000001,1000002] +Output: [0,1,2,1000000,1000001,1000002,5] +Explanation: We remove the nodes 3 and 4 and put the entire list2 in their place. The blue edges and nodes in the above figure indicate the result. + +``` + +**Example 2:** + +![https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex2.png](https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex2.png) + +``` +Input: list1 = [0,1,2,3,4,5,6], a = 2, b = 5, list2 = [1000000,1000001,1000002,1000003,1000004] +Output: [0,1,1000000,1000001,1000002,1000003,1000004,6] +Explanation: The blue edges and nodes in the above figure indicate the result. + +``` + +**Constraints:** + +- `3 <= list1.length <= 104` +- `1 <= a <= b < list1.length - 1` +- `1 <= list2.length <= 104` + +## 题目大意 + +给你两个链表 list1 和 list2 ,它们包含的元素分别为 n 个和 m 个。请你将 list1 中第 a 个节点到第 b 个节点删除,并将list2 接在被删除节点的位置。 + +## 解题思路 + +- 简单题,考查链表的基本操作。此题注意 a == b 的情况。 + +## 代码 + +```go +func mergeInBetween(list1 *ListNode, a int, b int, list2 *ListNode) *ListNode { + n := list1 + var startRef, endRef *ListNode + for i := 0; i <= b; i++ { + if i == a-1 { + startRef = n + } + if i == b { + endRef = n + } + n = n.Next + } + startRef.Next = list2 + n = list2 + for n.Next != nil { + n = n.Next + } + n.Next = endRef.Next + return list1 +} +``` \ No newline at end of file diff --git a/leetcode/1670.Design-Front-Middle-Back-Queue/1670. Design Front Middle Back Queue.go b/leetcode/1670.Design-Front-Middle-Back-Queue/1670. Design Front Middle Back Queue.go new file mode 100644 index 00000000..63e8326b --- /dev/null +++ b/leetcode/1670.Design-Front-Middle-Back-Queue/1670. Design Front Middle Back Queue.go @@ -0,0 +1,94 @@ +package leetcode + +import ( + "container/list" +) + +type FrontMiddleBackQueue struct { + list *list.List + middle *list.Element +} + +func Constructor() FrontMiddleBackQueue { + return FrontMiddleBackQueue{list: list.New()} +} + +func (this *FrontMiddleBackQueue) PushFront(val int) { + e := this.list.PushFront(val) + if this.middle == nil { + this.middle = e + } else if this.list.Len()%2 == 0 && this.middle.Prev() != nil { + this.middle = this.middle.Prev() + } +} + +func (this *FrontMiddleBackQueue) PushMiddle(val int) { + if this.middle == nil { + this.PushFront(val) + } else { + if this.list.Len()%2 != 0 { + this.middle = this.list.InsertBefore(val, this.middle) + } else { + this.middle = this.list.InsertAfter(val, this.middle) + } + } +} + +func (this *FrontMiddleBackQueue) PushBack(val int) { + e := this.list.PushBack(val) + if this.middle == nil { + this.middle = e + } else if this.list.Len()%2 != 0 && this.middle.Next() != nil { + this.middle = this.middle.Next() + } +} + +func (this *FrontMiddleBackQueue) PopFront() int { + if this.list.Len() == 0 { + return -1 + } + e := this.list.Front() + if this.list.Len() == 1 { + this.middle = nil + } else if this.list.Len()%2 == 0 && this.middle.Next() != nil { + this.middle = this.middle.Next() + } + return this.list.Remove(e).(int) +} + +func (this *FrontMiddleBackQueue) PopMiddle() int { + if this.middle == nil { + return -1 + } + e := this.middle + if this.list.Len()%2 != 0 { + this.middle = e.Prev() + } else { + this.middle = e.Next() + } + return this.list.Remove(e).(int) +} + +func (this *FrontMiddleBackQueue) PopBack() int { + if this.list.Len() == 0 { + return -1 + } + e := this.list.Back() + if this.list.Len() == 1 { + this.middle = nil + } else if this.list.Len()%2 != 0 && this.middle.Prev() != nil { + this.middle = this.middle.Prev() + } + return this.list.Remove(e).(int) +} + +/** + * Your FrontMiddleBackQueue object will be instantiated and called as such: + * obj := Constructor(); + * obj.PushFront(val); + * obj.PushMiddle(val); + * obj.PushBack(val); + * param_4 := obj.PopFront(); + * param_5 := obj.PopMiddle(); + * param_6 := obj.PopBack(); + */ diff --git a/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue_test.go b/leetcode/1670.Design-Front-Middle-Back-Queue/1670. Design Front Middle Back Queue_test.go similarity index 94% rename from leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue_test.go rename to leetcode/1670.Design-Front-Middle-Back-Queue/1670. Design Front Middle Back Queue_test.go index 23cd5886..e2b30c0e 100644 --- a/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue_test.go +++ b/leetcode/1670.Design-Front-Middle-Back-Queue/1670. Design Front Middle Back Queue_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -func Test_Problem707(t *testing.T) { +func Test_Problem1670(t *testing.T) { obj := Constructor() fmt.Printf("obj = %v %v\n", MList2Ints(&obj), obj) obj.PushFront(1) @@ -102,6 +102,11 @@ func Test_Problem707(t *testing.T) { // [[],[],[3],[6],[6],[3],[],[7],[],[8]] } -func MList2Ints(head *FrontMiddleBackQueue) []int { - return head.Queue +func MList2Ints(this *FrontMiddleBackQueue) []int { + array := []int{} + for e := this.list.Front(); e != nil; e = e.Next() { + value, _ := e.Value.(int) + array = append(array, value) + } + return array } diff --git a/leetcode/1670.Design-Front-Middle-Back-Queue/README.md b/leetcode/1670.Design-Front-Middle-Back-Queue/README.md new file mode 100644 index 00000000..2046abf8 --- /dev/null +++ b/leetcode/1670.Design-Front-Middle-Back-Queue/README.md @@ -0,0 +1,172 @@ +# [1670. Design Front Middle Back Queue](https://leetcode.com/problems/design-front-middle-back-queue/) + + +## 题目 + +Design a queue that supports `push` and `pop` operations in the front, middle, and back. + +Implement the `FrontMiddleBack` class: + +- `FrontMiddleBack()` Initializes the queue. +- `void pushFront(int val)` Adds `val` to the **front** of the queue. +- `void pushMiddle(int val)` Adds `val` to the **middle** of the queue. +- `void pushBack(int val)` Adds `val` to the **back** of the queue. +- `int popFront()` Removes the **front** element of the queue and returns it. If the queue is empty, return `1`. +- `int popMiddle()` Removes the **middle** element of the queue and returns it. If the queue is empty, return `1`. +- `int popBack()` Removes the **back** element of the queue and returns it. If the queue is empty, return `1`. + +**Notice** that when there are **two** middle position choices, the operation is performed on the **frontmost** middle position choice. For example: + +- Pushing `6` into the middle of `[1, 2, 3, 4, 5]` results in `[1, 2, 6, 3, 4, 5]`. +- Popping the middle from `[1, 2, 3, 4, 5, 6]` returns `3` and results in `[1, 2, 4, 5, 6]`. + +**Example 1:** + +``` +Input: +["FrontMiddleBackQueue", "pushFront", "pushBack", "pushMiddle", "pushMiddle", "popFront", "popMiddle", "popMiddle", "popBack", "popFront"] +[[], [1], [2], [3], [4], [], [], [], [], []] +Output: +[null, null, null, null, null, 1, 3, 4, 2, -1] + +Explanation: +FrontMiddleBackQueue q = new FrontMiddleBackQueue(); +q.pushFront(1); // [1] +q.pushBack(2); // [1, 2] +q.pushMiddle(3); // [1, 3, 2] +q.pushMiddle(4); // [1, 4, 3, 2] +q.popFront(); // return 1 -> [4, 3, 2] +q.popMiddle(); // return 3 -> [4, 2] +q.popMiddle(); // return 4 -> [2] +q.popBack(); // return 2 -> [] +q.popFront(); // return -1 -> [] (The queue is empty) + +``` + +**Constraints:** + +- `1 <= val <= 109` +- At most `1000` calls will be made to `pushFront`, `pushMiddle`, `pushBack`, `popFront`, `popMiddle`, and `popBack`. + +## 题目大意 + +请你设计一个队列,支持在前,中,后三个位置的 push 和 pop 操作。 + +请你完成 FrontMiddleBack 类: + +- FrontMiddleBack() 初始化队列。 +- void pushFront(int val) 将 val 添加到队列的 最前面 。 +- void pushMiddle(int val) 将 val 添加到队列的 正中间 。 +- void pushBack(int val) 将 val 添加到队里的 最后面 。 +- int popFront() 将 最前面 的元素从队列中删除并返回值,如果删除之前队列为空,那么返回 -1 。 +- int popMiddle() 将 正中间 的元素从队列中删除并返回值,如果删除之前队列为空,那么返回 -1 。 +- int popBack() 将 最后面 的元素从队列中删除并返回值,如果删除之前队列为空,那么返回 -1 。 + +请注意当有 两个 中间位置的时候,选择靠前面的位置进行操作。比方说: + +- 将 6 添加到 [1, 2, 3, 4, 5] 的中间位置,结果数组为 [1, 2, 6, 3, 4, 5] 。 +- 从 [1, 2, 3, 4, 5, 6] 的中间位置弹出元素,返回 3 ,数组变为 [1, 2, 4, 5, 6] 。 + +## 解题思路 + +- 简单题,利用 go 原生的双向队列 list 的实现,可以轻松实现这个“前中后队列”。 +- 具体实现见代码,几组特殊测试用例见测试文件。 + +## 代码 + +```go +package leetcode + +import ( + "container/list" +) + +type FrontMiddleBackQueue struct { + list *list.List + middle *list.Element +} + +func Constructor() FrontMiddleBackQueue { + return FrontMiddleBackQueue{list: list.New()} +} + +func (this *FrontMiddleBackQueue) PushFront(val int) { + e := this.list.PushFront(val) + if this.middle == nil { + this.middle = e + } else if this.list.Len()%2 == 0 && this.middle.Prev() != nil { + this.middle = this.middle.Prev() + } +} + +func (this *FrontMiddleBackQueue) PushMiddle(val int) { + if this.middle == nil { + this.PushFront(val) + } else { + if this.list.Len()%2 != 0 { + this.middle = this.list.InsertBefore(val, this.middle) + } else { + this.middle = this.list.InsertAfter(val, this.middle) + } + } +} + +func (this *FrontMiddleBackQueue) PushBack(val int) { + e := this.list.PushBack(val) + if this.middle == nil { + this.middle = e + } else if this.list.Len()%2 != 0 && this.middle.Next() != nil { + this.middle = this.middle.Next() + } +} + +func (this *FrontMiddleBackQueue) PopFront() int { + if this.list.Len() == 0 { + return -1 + } + e := this.list.Front() + if this.list.Len() == 1 { + this.middle = nil + } else if this.list.Len()%2 == 0 && this.middle.Next() != nil { + this.middle = this.middle.Next() + } + return this.list.Remove(e).(int) +} + +func (this *FrontMiddleBackQueue) PopMiddle() int { + if this.middle == nil { + return -1 + } + e := this.middle + if this.list.Len()%2 != 0 { + this.middle = e.Prev() + } else { + this.middle = e.Next() + } + return this.list.Remove(e).(int) +} + +func (this *FrontMiddleBackQueue) PopBack() int { + if this.list.Len() == 0 { + return -1 + } + e := this.list.Back() + if this.list.Len() == 1 { + this.middle = nil + } else if this.list.Len()%2 != 0 && this.middle.Prev() != nil { + this.middle = this.middle.Prev() + } + return this.list.Remove(e).(int) +} + +/** + * Your FrontMiddleBackQueue object will be instantiated and called as such: + * obj := Constructor(); + * obj.PushFront(val); + * obj.PushMiddle(val); + * obj.PushBack(val); + * param_4 := obj.PopFront(); + * param_5 := obj.PopMiddle(); + * param_6 := obj.PopBack(); + */ +``` \ No newline at end of file diff --git a/leetcode/1672.Richest-Customer-Wealth/1672. Richest Customer Wealth.go b/leetcode/1672.Richest-Customer-Wealth/1672. Richest Customer Wealth.go new file mode 100644 index 00000000..3a851ad9 --- /dev/null +++ b/leetcode/1672.Richest-Customer-Wealth/1672. Richest Customer Wealth.go @@ -0,0 +1,15 @@ +package leetcode + +func maximumWealth(accounts [][]int) int { + res := 0 + for _, banks := range accounts { + sAmount := 0 + for _, amount := range banks { + sAmount += amount + } + if sAmount > res { + res = sAmount + } + } + return res +} diff --git a/leetcode/1672.Richest-Customer-Wealth/1672. Richest Customer Wealth_test.go b/leetcode/1672.Richest-Customer-Wealth/1672. Richest Customer Wealth_test.go new file mode 100644 index 00000000..7c6e689f --- /dev/null +++ b/leetcode/1672.Richest-Customer-Wealth/1672. Richest Customer Wealth_test.go @@ -0,0 +1,52 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1672 struct { + para1672 + ans1672 +} + +// para 是参数 +// one 代表第一个参数 +type para1672 struct { + accounts [][]int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1672 struct { + one int +} + +func Test_Problem1672(t *testing.T) { + + qs := []question1672{ + + { + para1672{[][]int{{1, 2, 3}, {3, 2, 1}}}, + ans1672{6}, + }, + + { + para1672{[][]int{{1, 5}, {7, 3}, {3, 5}}}, + ans1672{10}, + }, + + { + para1672{[][]int{{2, 8, 7}, {7, 1, 3}, {1, 9, 5}}}, + ans1672{17}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1672------------------------\n") + + for _, q := range qs { + _, p := q.ans1672, q.para1672 + fmt.Printf("【input】:%v 【output】:%v\n", p, maximumWealth(p.accounts)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1672.Richest-Customer-Wealth/README.md b/leetcode/1672.Richest-Customer-Wealth/README.md new file mode 100644 index 00000000..250cf480 --- /dev/null +++ b/leetcode/1672.Richest-Customer-Wealth/README.md @@ -0,0 +1,72 @@ +# [1672. Richest Customer Wealth](https://leetcode.com/problems/richest-customer-wealth/) + + +## 题目 + +You are given an `m x n` integer grid `accounts` where `accounts[i][j]` is the amount of money the `ith` customer has in the `jth` bank. Return *the **wealth** that the richest customer has.* + +A customer's **wealth** is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum **wealth**. + +**Example 1:** + +``` +Input: accounts = [[1,2,3],[3,2,1]] +Output: 6 +Explanation:1st customer has wealth = 1 + 2 + 3 = 6 +2nd customer has wealth = 3 + 2 + 1 = 6 +Both customers are considered the richest with a wealth of 6 each, so return 6. +``` + +**Example 2:** + +``` +Input: accounts = [[1,5],[7,3],[3,5]] +Output: 10 +Explanation: +1st customer has wealth = 6 +2nd customer has wealth = 10 +3rd customer has wealth = 8 +The 2nd customer is the richest with a wealth of 10. +``` + +**Example 3:** + +``` +Input: accounts = [[2,8,7],[7,1,3],[1,9,5]] +Output: 17 +``` + +**Constraints:** + +- `m == accounts.length` +- `n == accounts[i].length` +- `1 <= m, n <= 50` +- `1 <= accounts[i][j] <= 100` + +## 题目大意 + +给你一个 m x n 的整数网格 accounts ,其中 accounts[i][j] 是第 i 位客户在第 j 家银行托管的资产数量。返回最富有客户所拥有的 资产总量 。客户的 资产总量 就是他们在各家银行托管的资产数量之和。最富有客户就是 资产总量 最大的客户。 + +## 解题思路 + +- 简单题。计算二维数组中每个一位数组的元素总和,然后动态维护这些一位数组和的最大值即可。 + +## 代码 + +```go +package leetcode + +func maximumWealth(accounts [][]int) int { + res := 0 + for _, banks := range accounts { + sAmount := 0 + for _, amount := range banks { + sAmount += amount + } + if sAmount > res { + res = sAmount + } + } + return res +} +``` \ No newline at end of file diff --git a/leetcode/1673.Find-the-Most-Competitive-Subsequence/1673. Find the Most Competitive Subsequence.go b/leetcode/1673.Find-the-Most-Competitive-Subsequence/1673. Find the Most Competitive Subsequence.go new file mode 100644 index 00000000..04f8fb52 --- /dev/null +++ b/leetcode/1673.Find-the-Most-Competitive-Subsequence/1673. Find the Most Competitive Subsequence.go @@ -0,0 +1,13 @@ +package leetcode + +// 单调栈 +func mostCompetitive(nums []int, k int) []int { + stack := make([]int, 0, len(nums)) + for i := 0; i < len(nums); i++ { + for len(stack)+len(nums)-i > k && len(stack) > 0 && nums[i] < stack[len(stack)-1] { + stack = stack[:len(stack)-1] + } + stack = append(stack, nums[i]) + } + return stack[:k] +} diff --git a/leetcode/1673.Find-the-Most-Competitive-Subsequence/1673. Find the Most Competitive Subsequence_test.go b/leetcode/1673.Find-the-Most-Competitive-Subsequence/1673. Find the Most Competitive Subsequence_test.go new file mode 100644 index 00000000..33f2724d --- /dev/null +++ b/leetcode/1673.Find-the-Most-Competitive-Subsequence/1673. Find the Most Competitive Subsequence_test.go @@ -0,0 +1,63 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1673 struct { + para1673 + ans1673 +} + +// para 是参数 +// one 代表第一个参数 +type para1673 struct { + nums []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1673 struct { + one []int +} + +func Test_Problem1673(t *testing.T) { + + qs := []question1673{ + + { + para1673{[]int{3, 5, 2, 6}, 2}, + ans1673{[]int{2, 6}}, + }, + + { + para1673{[]int{2, 4, 3, 3, 5, 4, 9, 6}, 4}, + ans1673{[]int{2, 3, 3, 4}}, + }, + + { + para1673{[]int{2, 4, 3, 3, 5, 4, 9, 6}, 4}, + ans1673{[]int{2, 3, 3, 4}}, + }, + + { + para1673{[]int{71, 18, 52, 29, 55, 73, 24, 42, 66, 8, 80, 2}, 3}, + ans1673{[]int{8, 80, 2}}, + }, + + { + para1673{[]int{84, 10, 71, 23, 66, 61, 62, 64, 34, 41, 80, 25, 91, 43, 4, 75, 65, 13, 37, 41, 46, 90, 55, 8, 85, 61, 95, 71}, 24}, + ans1673{[]int{10, 23, 61, 62, 34, 41, 80, 25, 91, 43, 4, 75, 65, 13, 37, 41, 46, 90, 55, 8, 85, 61, 95, 71}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1673------------------------\n") + + for _, q := range qs { + _, p := q.ans1673, q.para1673 + fmt.Printf("【input】:%v 【output】:%v\n", p, mostCompetitive(p.nums, p.k)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1673.Find-the-Most-Competitive-Subsequence/README.md b/leetcode/1673.Find-the-Most-Competitive-Subsequence/README.md new file mode 100644 index 00000000..74ced398 --- /dev/null +++ b/leetcode/1673.Find-the-Most-Competitive-Subsequence/README.md @@ -0,0 +1,62 @@ +# [1673. Find the Most Competitive Subsequence](https://leetcode.com/problems/find-the-most-competitive-subsequence/) + + +## 题目 + +Given an integer array `nums` and a positive integer `k`, return *the most **competitive** subsequence of* `nums` *of size* `k`. + +An array's subsequence is a resulting sequence obtained by erasing some (possibly zero) elements from the array. + +We define that a subsequence `a` is more **competitive** than a subsequence `b` (of the same length) if in the first position where `a` and `b` differ, subsequence `a` has a number **less** than the corresponding number in `b`. For example, `[1,3,4]` is more competitive than `[1,3,5]` because the first position they differ is at the final number, and `4` is less than `5`. + +**Example 1:** + +``` +Input: nums = [3,5,2,6], k = 2 +Output: [2,6] +Explanation: Among the set of every possible subsequence: {[3,5], [3,2], [3,6], [5,2], [5,6], [2,6]}, [2,6] is the most competitive. + +``` + +**Example 2:** + +``` +Input: nums = [2,4,3,3,5,4,9,6], k = 4 +Output: [2,3,3,4] + +``` + +**Constraints:** + +- `1 <= nums.length <= 105` +- `0 <= nums[i] <= 109` +- `1 <= k <= nums.length` + +## 题目大意 + +给你一个整数数组 nums 和一个正整数 k ,返回长度为 k 且最具 竞争力 的 nums 子序列。数组的子序列是从数组中删除一些元素(可能不删除元素)得到的序列。 + +在子序列 a 和子序列 b 第一个不相同的位置上,如果 a 中的数字小于 b 中对应的数字,那么我们称子序列 a 比子序列 b(相同长度下)更具 竞争力 。 例如,[1,3,4] 比 [1,3,5] 更具竞争力,在第一个不相同的位置,也就是最后一个位置上, 4 小于 5 。 + +## 解题思路 + +- 这一题是单调栈的典型题型。利用单调栈,可以保证原数组中元素相对位置不变,这满足题意中删除元素但不移动元素的要求。单调栈又能保证每次进栈,元素是最小的。 +- 类似的题目还有第 42 题,第 84 题,第 496 题,第 503 题,第 856 题,第 901 题,第 907 题,第 1130 题,第 1425 题,第 1673 题。 + +## 代码 + +```go +package leetcode + +// 单调栈 +func mostCompetitive(nums []int, k int) []int { + stack := make([]int, 0, len(nums)) + for i := 0; i < len(nums); i++ { + for len(stack)+len(nums)-i > k && len(stack) > 0 && nums[i] < stack[len(stack)-1] { + stack = stack[:len(stack)-1] + } + stack = append(stack, nums[i]) + } + return stack[:k] +} +``` \ No newline at end of file diff --git a/leetcode/1681.Minimum-Incompatibility/README.md b/leetcode/1681.Minimum-Incompatibility/README.md index a46fd91e..e2f5dc1d 100644 --- a/leetcode/1681.Minimum-Incompatibility/README.md +++ b/leetcode/1681.Minimum-Incompatibility/README.md @@ -56,7 +56,7 @@ Explanation: It is impossible to distribute nums into 3 subsets where no two ele - 读完题最直白的思路就是 DFS。做法类似第 77 题。这里就不赘述了。可以见第 77 题题解。 - 这一题还需要用到贪心的思想。每次取数都取最小的数。这样可以不会让最大数和最小数在一个集合中。由于每次取数都是取最小的,那么能保证不兼容性每次都尽量最小。于是在 order 数组中定义取数的顺序。然后再把数组从小到大排列。这样每次按照 order 顺序取数,都是取的最小值。 -- 正常的 DFS 写完提交,耗时是很长的。大概是 1532ms。如何优化到极致呢?这里需要加上 2 个剪枝条件。第一个剪枝条件比较简单,如果累计 sum 比之前存储的 res 大,那么直接 return,不需要继续递归了。第二个剪枝条件就非常重要了,可以一下子减少很多次递归。每次取数产生新的集合的时候,要从第一个最小数开始取,一旦取了,后面就不需要再循环递归了。举个例子,[1,2,3,4],第一个数如果取 2,集合可以是 [[2,3],[1,4]] 或 [[2,4], [1,3]], 这个集合和[[1,3],[2,4]]、[[1,4], [2,3]] 情况一样。可以看到如果取出第一个最小值以后,后面的循环是不必要的了。所以在取下标为 0 的数的时候,递归到底层以后,返回就可以直接 break,不用接下去的循环了,接下去的循环和递归是不必要的。加了这 2 个剪枝条件以后,耗时就变成了 0ms 了。beats 100% +- 正常的 DFS 写完提交,耗时是很长的。大概是 1532ms。如何优化到极致呢?这里需要加上 2 个剪枝条件。第一个剪枝条件比较简单,如果累计 sum 比之前存储的 res 大,那么直接 return,不需要继续递归了。第二个剪枝条件就非常重要了,可以一下子减少很多次递归。每次取数产生新的集合的时候,要从第一个最小数开始取,一旦取了,后面就不需要再循环递归了。举个例子,[1,2,3,4],第一个数如果取 2,集合可以是 [[2,3],[1,4]] 或 [[2,4], [1,3]], 这个集合和[[1,3],[2,4]]、[[1,4], [2,3]] 情况一样。可以看到如果取出第一个最小值以后,后面的循环是不必要的了。所以在取下标为 0 的数的时候,递归到底层以后,返回就可以直接 break,不用接下去的循环了,接下去的循环和递归是不必要的。每组组内的顺序我们并不关心,只要最大值和最小值在分组内即可。另外组间顺序我们也不关心。所以可以把排列问题 O(n!) 时间复杂度降低到组合问题 O(2^n)。加了这 2 个剪枝条件以后,耗时就变成了 0ms 了。beats 100% ## 代码 diff --git a/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists.go b/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists.go deleted file mode 100644 index 76f1f0cf..00000000 --- a/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists.go +++ /dev/null @@ -1,46 +0,0 @@ -package leetcode - -import ( - "github.com/halfrost/LeetCode-Go/structures" -) - -// ListNode define -type ListNode = structures.ListNode - -/** - * Definition for singly-linked list. - * type ListNode struct { - * Val int - * Next *ListNode - * } - */ - -func mergeInBetween(list1 *ListNode, a int, b int, list2 *ListNode) *ListNode { - pre, cur, list2Cur := list1, list1.Next, list2 - for cur.Next != nil { - if cur.Val == a { - pre.Next = list2 - pre = cur - break - } - pre = cur - cur = cur.Next - } - cur = cur.Next - for list2Cur.Next != nil { - list2Cur = list2Cur.Next - } - if a == b { - list2Cur.Next = cur - return list1 - } - for cur.Next != nil { - if cur.Val == b { - list2Cur.Next = cur.Next - break - } - pre = cur - cur = cur.Next - } - return list1 -} diff --git a/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists_test.go b/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists_test.go deleted file mode 100644 index 91c898ae..00000000 --- a/leetcode/5558.Merge-In-Between-Linked-Lists/5558. Merge In Between Linked Lists_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" - - "github.com/halfrost/LeetCode-Go/structures" -) - -type question2 struct { - para2 - ans2 -} - -// para 是参数 -// one 代表第一个参数 -type para2 struct { - one []int - a int - b int - another []int -} - -// ans 是答案 -// one 代表第一个答案 -type ans2 struct { - one []int -} - -func Test_Problem2(t *testing.T) { - - qs := []question2{ - - { - para2{[]int{0, 1, 2, 3, 4, 5}, 3, 4, []int{1000000, 1000001, 1000002}}, - ans2{[]int{0, 1, 2, 1000000, 1000001, 1000002, 5}}, - }, - - { - para2{[]int{0, 1, 2, 3, 4, 5, 6}, 2, 5, []int{1000000, 1000001, 1000002, 1000003, 1000004}}, - ans2{[]int{0, 1, 1000000, 1000001, 1000002, 1000003, 1000004, 6}}, - }, - - { - para2{[]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, 3, 5, []int{1000000, 1000001, 1000002, 1000003, 1000004, 1000005, 1000006}}, - ans2{[]int{0, 1, 2, 1000000, 1000001, 1000002, 1000003, 1000004, 1000005, 1000006, 6, 7, 8, 9}}, - }, - - { - para2{[]int{0, 1, 2}, 1, 1, []int{1000000, 1000001, 1000002, 1000003}}, - ans2{[]int{0, 1000000, 1000001, 1000002, 1000003, 2}}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 2------------------------\n") - - for _, q := range qs { - _, p := q.ans2, q.para2 - fmt.Printf("【input】:%v 【output】:%v\n", p, structures.List2Ints(mergeInBetween(structures.Ints2List(p.one), p.a, p.b, structures.Ints2List(p.another)))) - } - fmt.Printf("\n\n\n") -} diff --git a/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue.go b/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue.go deleted file mode 100644 index 64e7bec8..00000000 --- a/leetcode/5560.Design-Front-Middle-Back-Queue/5560. Design Front Middle Back Queue.go +++ /dev/null @@ -1,78 +0,0 @@ -package leetcode - -type FrontMiddleBackQueue struct { - Queue []int - Length int -} - -func Constructor() FrontMiddleBackQueue { - return FrontMiddleBackQueue{Queue: make([]int, 0), Length: 0} -} - -func (this *FrontMiddleBackQueue) PushFront(val int) { - tmp := make([]int, this.Length+1) - copy(tmp[1:], this.Queue) - tmp[0] = val - this.Queue = tmp - this.Length++ -} - -func (this *FrontMiddleBackQueue) PushMiddle(val int) { - tmp := make([]int, this.Length+1) - idx := this.Length / 2 - copy(tmp[:idx], this.Queue[:idx]) - tmp[idx] = val - copy(tmp[idx+1:], this.Queue[idx:]) - this.Queue = tmp - this.Length++ -} - -func (this *FrontMiddleBackQueue) PushBack(val int) { - this.Queue = append(this.Queue, val) - this.Length++ -} - -func (this *FrontMiddleBackQueue) PopFront() int { - if this.Length == 0 { - return -1 - } - res := this.Queue[0] - this.Queue = this.Queue[1:] - this.Length-- - return res -} - -func (this *FrontMiddleBackQueue) PopMiddle() int { - if this.Length == 0 { - return -1 - } - mid := (this.Length - 1) / 2 - res := this.Queue[mid] - tmp := make([]int, len(this.Queue)-1) - copy(tmp[:mid], this.Queue[:mid]) - copy(tmp[mid:], this.Queue[mid+1:]) - this.Queue = tmp - this.Length-- - return res -} - -func (this *FrontMiddleBackQueue) PopBack() int { - if this.Length == 0 { - return -1 - } - res := this.Queue[this.Length-1] - this.Queue = this.Queue[:this.Length-1] - this.Length-- - return res -} - -/** - * Your FrontMiddleBackQueue object will be instantiated and called as such: - * obj := Constructor(); - * obj.PushFront(val); - * obj.PushMiddle(val); - * obj.PushBack(val); - * param_4 := obj.PopFront(); - * param_5 := obj.PopMiddle(); - * param_6 := obj.PopBack(); - */ diff --git a/leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth.go b/leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth.go deleted file mode 100644 index 6792948d..00000000 --- a/leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth.go +++ /dev/null @@ -1,20 +0,0 @@ -package leetcode - -func maximumWealth(accounts [][]int) int { - res := 0 - for i := 0; i < len(accounts); i++ { - sum := 0 - for j := 0; j < len(accounts[i]); j++ { - sum += accounts[i][j] - } - res = max(res, sum) - } - return res -} - -func max(a int, b int) int { - if a > b { - return a - } - return b -} diff --git a/leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth_test.go b/leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth_test.go deleted file mode 100644 index 862ef0e0..00000000 --- a/leetcode/5613.Richest-Customer-Wealth/5613. Richest Customer Wealth_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question491 struct { - para491 - ans491 -} - -// para 是参数 -// one 代表第一个参数 -type para491 struct { - accounts [][]int -} - -// ans 是答案 -// one 代表第一个答案 -type ans491 struct { - one int -} - -func Test_Problem491(t *testing.T) { - - qs := []question491{ - - { - para491{[][]int{{1, 2, 3}, {3, 2, 1}}}, - ans491{6}, - }, - - { - para491{[][]int{{1, 5}, {7, 3}, {3, 5}}}, - ans491{10}, - }, - - { - para491{[][]int{{2, 8, 7}, {7, 1, 3}, {1, 9, 5}}}, - ans491{17}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 491------------------------\n") - - for _, q := range qs { - _, p := q.ans491, q.para491 - fmt.Printf("【input】:%v 【output】:%v\n", p, maximumWealth(p.accounts)) - } - fmt.Printf("\n\n\n") -} diff --git a/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence.go b/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence.go deleted file mode 100644 index 441c84b0..00000000 --- a/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence.go +++ /dev/null @@ -1,87 +0,0 @@ -package leetcode - -import ( - "fmt" -) - -// 解法一 单调栈 -func mostCompetitive(nums []int, k int) []int { - stack := make([]int, 0, len(nums)) - for i := 0; i < len(nums); i++ { - for len(stack)+len(nums)-i > k && len(stack) > 0 && nums[i] < stack[len(stack)-1] { - stack = stack[:len(stack)-1] - } - stack = append(stack, nums[i]) - } - return stack[:k] -} - -// 解法二 DFS 超时 -func mostCompetitive1(nums []int, k int) []int { - c, visited, res := []int{}, map[int]bool{}, []int{} - for i := 0; i < len(nums)-1; i++ { - if _, ok := visited[nums[i]]; ok { - continue - } else { - visited[nums[i]] = true - generateIncSubsets(nums, i, k, c, &res) - } - } - return res -} - -func generateIncSubsets(nums []int, current, k int, c []int, res *[]int) { - c = append(c, nums[current]) - fmt.Printf("c = %v res = %v\n", c, *res) - if len(c) > k { - return - } - if len(c) < k && len(*res) != 0 { - b, flag := make([]int, len(c)), false - copy(b, c) - for i := 0; i < len(b); i++ { - if b[i] < (*res)[i] { - flag = true - break - } - } - if !flag { - return - } - } - // if len(*res) != 0 && len(c) <= len(*res) && c[len(c)-1] > (*res)[len(c)-1] { - // return - // } - if len(c) == k { - //fmt.Printf("c = %v\n", c) - b, flag := make([]int, len(c)), false - copy(b, c) - if len(*res) == 0 { - *res = b - } else { - for i := 0; i < len(b); i++ { - if b[i] < (*res)[i] { - flag = true - break - } - } - if flag { - *res = b - } - } - fmt.Printf("tmp = %v min = %v\n", b, *res) - } - visited := map[int]bool{} - for i := current + 1; i < len(nums); i++ { - // if nums[current] <= nums[i] { - if _, ok := visited[nums[i]]; ok { - continue - } else { - visited[nums[i]] = true - generateIncSubsets(nums, i, k, c, res) - } - //} - } - c = c[:len(c)-1] - return -} diff --git a/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence_test.go b/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence_test.go deleted file mode 100644 index 9d70531c..00000000 --- a/leetcode/5614.Find-the-Most-Competitive-Subsequence/5614. Find the Most Competitive Subsequence_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question491 struct { - para491 - ans491 -} - -// para 是参数 -// one 代表第一个参数 -type para491 struct { - nums []int - k int -} - -// ans 是答案 -// one 代表第一个答案 -type ans491 struct { - one []int -} - -func Test_Problem491(t *testing.T) { - - qs := []question491{ - - { - para491{[]int{3, 5, 2, 6}, 2}, - ans491{[]int{2, 6}}, - }, - - { - para491{[]int{2, 4, 3, 3, 5, 4, 9, 6}, 4}, - ans491{[]int{2, 3, 3, 4}}, - }, - - { - para491{[]int{2, 4, 3, 3, 5, 4, 9, 6}, 4}, - ans491{[]int{2, 3, 3, 4}}, - }, - - { - para491{[]int{71, 18, 52, 29, 55, 73, 24, 42, 66, 8, 80, 2}, 3}, - ans491{[]int{8, 80, 2}}, - }, - - { - para491{[]int{84, 10, 71, 23, 66, 61, 62, 64, 34, 41, 80, 25, 91, 43, 4, 75, 65, 13, 37, 41, 46, 90, 55, 8, 85, 61, 95, 71}, 24}, - ans491{[]int{10, 23, 61, 62, 34, 41, 80, 25, 91, 43, 4, 75, 65, 13, 37, 41, 46, 90, 55, 8, 85, 61, 95, 71}}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 491------------------------\n") - - for _, q := range qs { - _, p := q.ans491, q.para491 - fmt.Printf("【input】:%v 【output】:%v\n", p, mostCompetitive(p.nums, p.k)) - } - fmt.Printf("\n\n\n") -} diff --git a/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md b/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md new file mode 100644 index 00000000..b25e75de --- /dev/null +++ b/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md @@ -0,0 +1,69 @@ +# [1668. Maximum Repeating Substring](https://leetcode.com/problems/maximum-repeating-substring/) + + +## 题目 + +For a string `sequence`, a string `word` is **`k`-repeating** if `word` concatenated `k` times is a substring of `sequence`. The `word`'s **maximum `k`-repeating value** is the highest value `k` where `word` is `k`-repeating in `sequence`. If `word` is not a substring of `sequence`, `word`'s maximum `k`-repeating value is `0`. + +Given strings `sequence` and `word`, return *the **maximum `k`-repeating value** of `word` in `sequence`*. + +**Example 1:** + +``` +Input: sequence = "ababc", word = "ab" +Output: 2 +Explanation: "abab" is a substring in "ababc". +``` + +**Example 2:** + +``` +Input: sequence = "ababc", word = "ba" +Output: 1 +Explanation: "ba" is a substring in "ababc". "baba" is not a substring in "ababc". +``` + +**Example 3:** + +``` +Input: sequence = "ababc", word = "ac" +Output: 0 +Explanation: "ac" is not a substring in "ababc". +``` + +**Constraints:** + +- `1 <= sequence.length <= 100` +- `1 <= word.length <= 100` +- `sequence` and `word` contains only lowercase English letters. + +## 题目大意 + +给你一个字符串 sequence ,如果字符串 word 连续重复 k 次形成的字符串是 sequence 的一个子字符串,那么单词 word 的 重复值为 k 。单词 word 的 最大重复值 是单词 word 在 sequence 中最大的重复值。如果 word 不是 sequence 的子串,那么重复值 k 为 0 。给你一个字符串 sequence 和 word ,请你返回 最大重复值 k 。 + +## 解题思路 + +- 循环叠加构造 `word`,每次构造出新的 `word` 都在 `sequence` 查找一次,如果找到就输出叠加次数,否则继续叠加构造,直到字符串长度和 `sequence` 一样长,最终都没有找到则输出 0 。 + +## 代码 + +```go +package leetcode + +import ( + "strings" +) + +func maxRepeating(sequence string, word string) int { + for i := len(sequence) / len(word); i >= 0; i-- { + tmp := "" + for j := 0; j < i; j++ { + tmp += word + } + if strings.Contains(sequence, tmp) { + return i + } + } + return 0 +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md b/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md new file mode 100644 index 00000000..3b221b0f --- /dev/null +++ b/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md @@ -0,0 +1,75 @@ +# [1669. Merge In Between Linked Lists](https://leetcode.com/problems/merge-in-between-linked-lists/) + + +## 题目 + +You are given two linked lists: `list1` and `list2` of sizes `n` and `m` respectively. + +Remove `list1`'s nodes from the `ath` node to the `bth` node, and put `list2` in their place. + +The blue edges and nodes in the following figure incidate the result: + +![https://assets.leetcode.com/uploads/2020/11/05/fig1.png](https://assets.leetcode.com/uploads/2020/11/05/fig1.png) + +*Build the result list and return its head.* + +**Example 1:** + +![https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex1.png](https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex1.png) + +``` +Input: list1 = [0,1,2,3,4,5], a = 3, b = 4, list2 = [1000000,1000001,1000002] +Output: [0,1,2,1000000,1000001,1000002,5] +Explanation: We remove the nodes 3 and 4 and put the entire list2 in their place. The blue edges and nodes in the above figure indicate the result. + +``` + +**Example 2:** + +![https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex2.png](https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex2.png) + +``` +Input: list1 = [0,1,2,3,4,5,6], a = 2, b = 5, list2 = [1000000,1000001,1000002,1000003,1000004] +Output: [0,1,1000000,1000001,1000002,1000003,1000004,6] +Explanation: The blue edges and nodes in the above figure indicate the result. + +``` + +**Constraints:** + +- `3 <= list1.length <= 104` +- `1 <= a <= b < list1.length - 1` +- `1 <= list2.length <= 104` + +## 题目大意 + +给你两个链表 list1 和 list2 ,它们包含的元素分别为 n 个和 m 个。请你将 list1 中第 a 个节点到第 b 个节点删除,并将list2 接在被删除节点的位置。 + +## 解题思路 + +- 简单题,考查链表的基本操作。此题注意 a == b 的情况。 + +## 代码 + +```go +func mergeInBetween(list1 *ListNode, a int, b int, list2 *ListNode) *ListNode { + n := list1 + var startRef, endRef *ListNode + for i := 0; i <= b; i++ { + if i == a-1 { + startRef = n + } + if i == b { + endRef = n + } + n = n.Next + } + startRef.Next = list2 + n = list2 + for n.Next != nil { + n = n.Next + } + n.Next = endRef.Next + return list1 +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md b/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md new file mode 100644 index 00000000..2046abf8 --- /dev/null +++ b/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md @@ -0,0 +1,172 @@ +# [1670. Design Front Middle Back Queue](https://leetcode.com/problems/design-front-middle-back-queue/) + + +## 题目 + +Design a queue that supports `push` and `pop` operations in the front, middle, and back. + +Implement the `FrontMiddleBack` class: + +- `FrontMiddleBack()` Initializes the queue. +- `void pushFront(int val)` Adds `val` to the **front** of the queue. +- `void pushMiddle(int val)` Adds `val` to the **middle** of the queue. +- `void pushBack(int val)` Adds `val` to the **back** of the queue. +- `int popFront()` Removes the **front** element of the queue and returns it. If the queue is empty, return `1`. +- `int popMiddle()` Removes the **middle** element of the queue and returns it. If the queue is empty, return `1`. +- `int popBack()` Removes the **back** element of the queue and returns it. If the queue is empty, return `1`. + +**Notice** that when there are **two** middle position choices, the operation is performed on the **frontmost** middle position choice. For example: + +- Pushing `6` into the middle of `[1, 2, 3, 4, 5]` results in `[1, 2, 6, 3, 4, 5]`. +- Popping the middle from `[1, 2, 3, 4, 5, 6]` returns `3` and results in `[1, 2, 4, 5, 6]`. + +**Example 1:** + +``` +Input: +["FrontMiddleBackQueue", "pushFront", "pushBack", "pushMiddle", "pushMiddle", "popFront", "popMiddle", "popMiddle", "popBack", "popFront"] +[[], [1], [2], [3], [4], [], [], [], [], []] +Output: +[null, null, null, null, null, 1, 3, 4, 2, -1] + +Explanation: +FrontMiddleBackQueue q = new FrontMiddleBackQueue(); +q.pushFront(1); // [1] +q.pushBack(2); // [1, 2] +q.pushMiddle(3); // [1, 3, 2] +q.pushMiddle(4); // [1, 4, 3, 2] +q.popFront(); // return 1 -> [4, 3, 2] +q.popMiddle(); // return 3 -> [4, 2] +q.popMiddle(); // return 4 -> [2] +q.popBack(); // return 2 -> [] +q.popFront(); // return -1 -> [] (The queue is empty) + +``` + +**Constraints:** + +- `1 <= val <= 109` +- At most `1000` calls will be made to `pushFront`, `pushMiddle`, `pushBack`, `popFront`, `popMiddle`, and `popBack`. + +## 题目大意 + +请你设计一个队列,支持在前,中,后三个位置的 push 和 pop 操作。 + +请你完成 FrontMiddleBack 类: + +- FrontMiddleBack() 初始化队列。 +- void pushFront(int val) 将 val 添加到队列的 最前面 。 +- void pushMiddle(int val) 将 val 添加到队列的 正中间 。 +- void pushBack(int val) 将 val 添加到队里的 最后面 。 +- int popFront() 将 最前面 的元素从队列中删除并返回值,如果删除之前队列为空,那么返回 -1 。 +- int popMiddle() 将 正中间 的元素从队列中删除并返回值,如果删除之前队列为空,那么返回 -1 。 +- int popBack() 将 最后面 的元素从队列中删除并返回值,如果删除之前队列为空,那么返回 -1 。 + +请注意当有 两个 中间位置的时候,选择靠前面的位置进行操作。比方说: + +- 将 6 添加到 [1, 2, 3, 4, 5] 的中间位置,结果数组为 [1, 2, 6, 3, 4, 5] 。 +- 从 [1, 2, 3, 4, 5, 6] 的中间位置弹出元素,返回 3 ,数组变为 [1, 2, 4, 5, 6] 。 + +## 解题思路 + +- 简单题,利用 go 原生的双向队列 list 的实现,可以轻松实现这个“前中后队列”。 +- 具体实现见代码,几组特殊测试用例见测试文件。 + +## 代码 + +```go +package leetcode + +import ( + "container/list" +) + +type FrontMiddleBackQueue struct { + list *list.List + middle *list.Element +} + +func Constructor() FrontMiddleBackQueue { + return FrontMiddleBackQueue{list: list.New()} +} + +func (this *FrontMiddleBackQueue) PushFront(val int) { + e := this.list.PushFront(val) + if this.middle == nil { + this.middle = e + } else if this.list.Len()%2 == 0 && this.middle.Prev() != nil { + this.middle = this.middle.Prev() + } +} + +func (this *FrontMiddleBackQueue) PushMiddle(val int) { + if this.middle == nil { + this.PushFront(val) + } else { + if this.list.Len()%2 != 0 { + this.middle = this.list.InsertBefore(val, this.middle) + } else { + this.middle = this.list.InsertAfter(val, this.middle) + } + } +} + +func (this *FrontMiddleBackQueue) PushBack(val int) { + e := this.list.PushBack(val) + if this.middle == nil { + this.middle = e + } else if this.list.Len()%2 != 0 && this.middle.Next() != nil { + this.middle = this.middle.Next() + } +} + +func (this *FrontMiddleBackQueue) PopFront() int { + if this.list.Len() == 0 { + return -1 + } + e := this.list.Front() + if this.list.Len() == 1 { + this.middle = nil + } else if this.list.Len()%2 == 0 && this.middle.Next() != nil { + this.middle = this.middle.Next() + } + return this.list.Remove(e).(int) +} + +func (this *FrontMiddleBackQueue) PopMiddle() int { + if this.middle == nil { + return -1 + } + e := this.middle + if this.list.Len()%2 != 0 { + this.middle = e.Prev() + } else { + this.middle = e.Next() + } + return this.list.Remove(e).(int) +} + +func (this *FrontMiddleBackQueue) PopBack() int { + if this.list.Len() == 0 { + return -1 + } + e := this.list.Back() + if this.list.Len() == 1 { + this.middle = nil + } else if this.list.Len()%2 != 0 && this.middle.Prev() != nil { + this.middle = this.middle.Prev() + } + return this.list.Remove(e).(int) +} + +/** + * Your FrontMiddleBackQueue object will be instantiated and called as such: + * obj := Constructor(); + * obj.PushFront(val); + * obj.PushMiddle(val); + * obj.PushBack(val); + * param_4 := obj.PopFront(); + * param_5 := obj.PopMiddle(); + * param_6 := obj.PopBack(); + */ +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1672.Richest-Customer-Wealth.md b/website/content/ChapterFour/1672.Richest-Customer-Wealth.md new file mode 100644 index 00000000..250cf480 --- /dev/null +++ b/website/content/ChapterFour/1672.Richest-Customer-Wealth.md @@ -0,0 +1,72 @@ +# [1672. Richest Customer Wealth](https://leetcode.com/problems/richest-customer-wealth/) + + +## 题目 + +You are given an `m x n` integer grid `accounts` where `accounts[i][j]` is the amount of money the `ith` customer has in the `jth` bank. Return *the **wealth** that the richest customer has.* + +A customer's **wealth** is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum **wealth**. + +**Example 1:** + +``` +Input: accounts = [[1,2,3],[3,2,1]] +Output: 6 +Explanation:1st customer has wealth = 1 + 2 + 3 = 6 +2nd customer has wealth = 3 + 2 + 1 = 6 +Both customers are considered the richest with a wealth of 6 each, so return 6. +``` + +**Example 2:** + +``` +Input: accounts = [[1,5],[7,3],[3,5]] +Output: 10 +Explanation: +1st customer has wealth = 6 +2nd customer has wealth = 10 +3rd customer has wealth = 8 +The 2nd customer is the richest with a wealth of 10. +``` + +**Example 3:** + +``` +Input: accounts = [[2,8,7],[7,1,3],[1,9,5]] +Output: 17 +``` + +**Constraints:** + +- `m == accounts.length` +- `n == accounts[i].length` +- `1 <= m, n <= 50` +- `1 <= accounts[i][j] <= 100` + +## 题目大意 + +给你一个 m x n 的整数网格 accounts ,其中 accounts[i][j] 是第 i 位客户在第 j 家银行托管的资产数量。返回最富有客户所拥有的 资产总量 。客户的 资产总量 就是他们在各家银行托管的资产数量之和。最富有客户就是 资产总量 最大的客户。 + +## 解题思路 + +- 简单题。计算二维数组中每个一位数组的元素总和,然后动态维护这些一位数组和的最大值即可。 + +## 代码 + +```go +package leetcode + +func maximumWealth(accounts [][]int) int { + res := 0 + for _, banks := range accounts { + sAmount := 0 + for _, amount := range banks { + sAmount += amount + } + if sAmount > res { + res = sAmount + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md b/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md new file mode 100644 index 00000000..74ced398 --- /dev/null +++ b/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md @@ -0,0 +1,62 @@ +# [1673. Find the Most Competitive Subsequence](https://leetcode.com/problems/find-the-most-competitive-subsequence/) + + +## 题目 + +Given an integer array `nums` and a positive integer `k`, return *the most **competitive** subsequence of* `nums` *of size* `k`. + +An array's subsequence is a resulting sequence obtained by erasing some (possibly zero) elements from the array. + +We define that a subsequence `a` is more **competitive** than a subsequence `b` (of the same length) if in the first position where `a` and `b` differ, subsequence `a` has a number **less** than the corresponding number in `b`. For example, `[1,3,4]` is more competitive than `[1,3,5]` because the first position they differ is at the final number, and `4` is less than `5`. + +**Example 1:** + +``` +Input: nums = [3,5,2,6], k = 2 +Output: [2,6] +Explanation: Among the set of every possible subsequence: {[3,5], [3,2], [3,6], [5,2], [5,6], [2,6]}, [2,6] is the most competitive. + +``` + +**Example 2:** + +``` +Input: nums = [2,4,3,3,5,4,9,6], k = 4 +Output: [2,3,3,4] + +``` + +**Constraints:** + +- `1 <= nums.length <= 105` +- `0 <= nums[i] <= 109` +- `1 <= k <= nums.length` + +## 题目大意 + +给你一个整数数组 nums 和一个正整数 k ,返回长度为 k 且最具 竞争力 的 nums 子序列。数组的子序列是从数组中删除一些元素(可能不删除元素)得到的序列。 + +在子序列 a 和子序列 b 第一个不相同的位置上,如果 a 中的数字小于 b 中对应的数字,那么我们称子序列 a 比子序列 b(相同长度下)更具 竞争力 。 例如,[1,3,4] 比 [1,3,5] 更具竞争力,在第一个不相同的位置,也就是最后一个位置上, 4 小于 5 。 + +## 解题思路 + +- 这一题是单调栈的典型题型。利用单调栈,可以保证原数组中元素相对位置不变,这满足题意中删除元素但不移动元素的要求。单调栈又能保证每次进栈,元素是最小的。 +- 类似的题目还有第 42 题,第 84 题,第 496 题,第 503 题,第 856 题,第 901 题,第 907 题,第 1130 题,第 1425 题,第 1673 题。 + +## 代码 + +```go +package leetcode + +// 单调栈 +func mostCompetitive(nums []int, k int) []int { + stack := make([]int, 0, len(nums)) + for i := 0; i < len(nums); i++ { + for len(stack)+len(nums)-i > k && len(stack) > 0 && nums[i] < stack[len(stack)-1] { + stack = stack[:len(stack)-1] + } + stack = append(stack, nums[i]) + } + return stack[:k] +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1681.Minimum-Incompatibility.md b/website/content/ChapterFour/1681.Minimum-Incompatibility.md index a46fd91e..e2f5dc1d 100644 --- a/website/content/ChapterFour/1681.Minimum-Incompatibility.md +++ b/website/content/ChapterFour/1681.Minimum-Incompatibility.md @@ -56,7 +56,7 @@ Explanation: It is impossible to distribute nums into 3 subsets where no two ele - 读完题最直白的思路就是 DFS。做法类似第 77 题。这里就不赘述了。可以见第 77 题题解。 - 这一题还需要用到贪心的思想。每次取数都取最小的数。这样可以不会让最大数和最小数在一个集合中。由于每次取数都是取最小的,那么能保证不兼容性每次都尽量最小。于是在 order 数组中定义取数的顺序。然后再把数组从小到大排列。这样每次按照 order 顺序取数,都是取的最小值。 -- 正常的 DFS 写完提交,耗时是很长的。大概是 1532ms。如何优化到极致呢?这里需要加上 2 个剪枝条件。第一个剪枝条件比较简单,如果累计 sum 比之前存储的 res 大,那么直接 return,不需要继续递归了。第二个剪枝条件就非常重要了,可以一下子减少很多次递归。每次取数产生新的集合的时候,要从第一个最小数开始取,一旦取了,后面就不需要再循环递归了。举个例子,[1,2,3,4],第一个数如果取 2,集合可以是 [[2,3],[1,4]] 或 [[2,4], [1,3]], 这个集合和[[1,3],[2,4]]、[[1,4], [2,3]] 情况一样。可以看到如果取出第一个最小值以后,后面的循环是不必要的了。所以在取下标为 0 的数的时候,递归到底层以后,返回就可以直接 break,不用接下去的循环了,接下去的循环和递归是不必要的。加了这 2 个剪枝条件以后,耗时就变成了 0ms 了。beats 100% +- 正常的 DFS 写完提交,耗时是很长的。大概是 1532ms。如何优化到极致呢?这里需要加上 2 个剪枝条件。第一个剪枝条件比较简单,如果累计 sum 比之前存储的 res 大,那么直接 return,不需要继续递归了。第二个剪枝条件就非常重要了,可以一下子减少很多次递归。每次取数产生新的集合的时候,要从第一个最小数开始取,一旦取了,后面就不需要再循环递归了。举个例子,[1,2,3,4],第一个数如果取 2,集合可以是 [[2,3],[1,4]] 或 [[2,4], [1,3]], 这个集合和[[1,3],[2,4]]、[[1,4], [2,3]] 情况一样。可以看到如果取出第一个最小值以后,后面的循环是不必要的了。所以在取下标为 0 的数的时候,递归到底层以后,返回就可以直接 break,不用接下去的循环了,接下去的循环和递归是不必要的。每组组内的顺序我们并不关心,只要最大值和最小值在分组内即可。另外组间顺序我们也不关心。所以可以把排列问题 O(n!) 时间复杂度降低到组合问题 O(2^n)。加了这 2 个剪枝条件以后,耗时就变成了 0ms 了。beats 100% ## 代码 diff --git a/website/content/menu/index.md b/website/content/menu/index.md index eb670ca6..f7be9094 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -565,6 +565,11 @@ headless: true - [1663.Smallest-String-With-A-Given-Numeric-Value]({{< relref "/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md" >}}) - [1664.Ways-to-Make-a-Fair-Array]({{< relref "/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md" >}}) - [1665.Minimum-Initial-Energy-to-Finish-Tasks]({{< relref "/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md" >}}) + - [1668.Maximum-Repeating-Substring]({{< relref "/ChapterFour/1668.Maximum-Repeating-Substring.md" >}}) + - [1669.Merge-In-Between-Linked-Lists]({{< relref "/ChapterFour/1669.Merge-In-Between-Linked-Lists.md" >}}) + - [1670.Design-Front-Middle-Back-Queue]({{< relref "/ChapterFour/1670.Design-Front-Middle-Back-Queue.md" >}}) + - [1672.Richest-Customer-Wealth]({{< relref "/ChapterFour/1672.Richest-Customer-Wealth.md" >}}) + - [1673.Find-the-Most-Competitive-Subsequence]({{< relref "/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md" >}}) - [1678.Goal-Parser-Interpretation]({{< relref "/ChapterFour/1678.Goal-Parser-Interpretation.md" >}}) - [1679.Max-Number-of-K-Sum-Pairs]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}}) - [1680.Concatenation-of-Consecutive-Binary-Numbers]({{< relref "/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md" >}}) From e3fd0d26710652d108be3a62c7fcd311e313bd39 Mon Sep 17 00:00:00 2001 From: YDZ Date: Thu, 17 Dec 2020 12:57:54 +0800 Subject: [PATCH 49/82] =?UTF-8?q?Add=20solution=201674=E3=80=811690?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nimum Moves to Make Array Complementary.go | 34 +++++ ... Moves to Make Array Complementary_test.go | 53 +++++++ .../README.md | 97 +++++++++++++ .../1690. Stone Game VII.go | 65 +++++++++ .../1690. Stone Game VII_test.go | 47 +++++++ leetcode/1690.Stone-Game-VII/README.md | 130 ++++++++++++++++++ ...nimum-Moves-to-Make-Array-Complementary.md | 97 +++++++++++++ .../ChapterFour/1690.Stone-Game-VII.md | 130 ++++++++++++++++++ website/content/menu/index.md | 2 + 9 files changed, 655 insertions(+) create mode 100644 leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/1674. Minimum Moves to Make Array Complementary.go create mode 100644 leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/1674. Minimum Moves to Make Array Complementary_test.go create mode 100644 leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/README.md create mode 100644 leetcode/1690.Stone-Game-VII/1690. Stone Game VII.go create mode 100644 leetcode/1690.Stone-Game-VII/1690. Stone Game VII_test.go create mode 100644 leetcode/1690.Stone-Game-VII/README.md create mode 100644 website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md create mode 100644 website/content/ChapterFour/1690.Stone-Game-VII.md diff --git a/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/1674. Minimum Moves to Make Array Complementary.go b/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/1674. Minimum Moves to Make Array Complementary.go new file mode 100644 index 00000000..cd8ef3b4 --- /dev/null +++ b/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/1674. Minimum Moves to Make Array Complementary.go @@ -0,0 +1,34 @@ +package leetcode + +func minMoves(nums []int, limit int) int { + diff := make([]int, limit*2+2) // nums[i] <= limit, b+limit+1 is maximum limit+limit+1 + for j := 0; j < len(nums)/2; j++ { + a, b := min(nums[j], nums[len(nums)-j-1]), max(nums[j], nums[len(nums)-j-1]) + // using prefix sum: most interesting point, and is the key to reduce complexity + diff[2] += 2 + diff[a+1]-- + diff[a+b]-- + diff[a+b+1]++ + diff[b+limit+1]++ + } + cur, res := 0, len(nums) + for i := 2; i <= 2*limit; i++ { + cur += diff[i] + res = min(res, cur) + } + return res +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} diff --git a/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/1674. Minimum Moves to Make Array Complementary_test.go b/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/1674. Minimum Moves to Make Array Complementary_test.go new file mode 100644 index 00000000..c111bf14 --- /dev/null +++ b/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/1674. Minimum Moves to Make Array Complementary_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1674 struct { + para1674 + ans1674 +} + +// para 是参数 +// one 代表第一个参数 +type para1674 struct { + nums []int + limit int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1674 struct { + one int +} + +func Test_Problem1674(t *testing.T) { + + qs := []question1674{ + + { + para1674{[]int{1, 2, 4, 3}, 4}, + ans1674{1}, + }, + + { + para1674{[]int{1, 2, 2, 1}, 2}, + ans1674{2}, + }, + + { + para1674{[]int{1, 2, 1, 2}, 2}, + ans1674{0}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1674------------------------\n") + + for _, q := range qs { + _, p := q.ans1674, q.para1674 + fmt.Printf("【input】:%v 【output】:%v\n", p, minMoves(p.nums, p.limit)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/README.md b/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/README.md new file mode 100644 index 00000000..8e565e10 --- /dev/null +++ b/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary/README.md @@ -0,0 +1,97 @@ +# [1674. Minimum Moves to Make Array Complementary](https://leetcode.com/problems/minimum-moves-to-make-array-complementary/) + +## 题目 + +You are given an integer array `nums` of **even** length `n` and an integer `limit`. In one move, you can replace any integer from `nums` with another integer between `1` and `limit`, inclusive. + +The array `nums` is **complementary** if for all indices `i` (**0-indexed**), `nums[i] + nums[n - 1 - i]` equals the same number. For example, the array `[1,2,3,4]` is complementary because for all indices `i`, `nums[i] + nums[n - 1 - i] = 5`. + +Return the ***minimum** number of moves required to make* `nums` ***complementary***. + +**Example 1:** + +``` +Input: nums = [1,2,4,3], limit = 4 +Output: 1 +Explanation: In 1 move, you can change nums to [1,2,2,3] (underlined elements are changed). +nums[0] + nums[3] = 1 + 3 = 4. +nums[1] + nums[2] = 2 + 2 = 4. +nums[2] + nums[1] = 2 + 2 = 4. +nums[3] + nums[0] = 3 + 1 = 4. +Therefore, nums[i] + nums[n-1-i] = 4 for every i, so nums is complementary. +``` + +**Example 2:** + +``` +Input: nums = [1,2,2,1], limit = 2 +Output: 2 +Explanation: In 2 moves, you can change nums to [2,2,2,2]. You cannot change any number to 3 since 3 > limit. +``` + +**Example 3:** + +``` +Input: nums = [1,2,1,2], limit = 2 +Output: 0 +Explanation: nums is already complementary. +``` + +**Constraints:** + +- `n == nums.length` +- `2 <= n <= 105` +- `1 <= nums[i] <= limit <= 105` +- `n` is even. + +## 题目大意 + +给你一个长度为 偶数 n 的整数数组 nums 和一个整数 limit 。每一次操作,你可以将 nums 中的任何整数替换为 1 到 limit 之间的另一个整数。 + +如果对于所有下标 i(下标从 0 开始),nums[i] + nums[n - 1 - i] 都等于同一个数,则数组 nums 是 互补的 。例如,数组 [1,2,3,4] 是互补的,因为对于所有下标 i ,nums[i] + nums[n - 1 - i] = 5 。 + +返回使数组 互补 的 最少 操作次数。 + +## 解题思路 + +- 这一题考察的是差分数组。通过分析题意,可以得出,针对每一个 `sum` 的取值范围是 `[2, 2* limt]`,定义 `a = min(nums[i], nums[n - i - 1])`,`b = max(nums[i], nums[n - i - 1])`,在这个区间内,又可以细分成 5 个区间,`[2, a + 1)`,`[a + 1, a + b)`,`[a + b + 1, a + b + 1)`,`[a + b + 1, b + limit + 1)`,`[b + limit + 1, 2 * limit)`,在这 5 个区间内使得数组互补的最小操作次数分别是 `2(减少 a, 减少 b)`,`1(减少 b)`,`0(不用操作)`,`1(增大 a)`,`+2(增大 a, 增大 b)`,换个表达方式,按照扫描线从左往右扫描,在这 5 个区间内使得数组互补的最小操作次数叠加变化分别是 `+2(减少 a, 减少 b)`,`-1(减少 a)`,`-1(不用操作)`,`+1(增大 a)`,`+1(增大 a, 增大 b)`,利用这前后两个区间的关系,就可以构造一个差分数组。差分数组反应的是前后两者的关系。如果想求得 0 ~ n 的总关系,只需要求一次前缀和即可。 +- 这道题要求输出最少的操作次数,所以利用差分数组 + 前缀和,累加前缀和的同时维护最小值。从左往右扫描完一遍以后,输出最小值即可。 + +## 代码 + +```go +package leetcode + +func minMoves(nums []int, limit int) int { + diff := make([]int, limit*2+2) // nums[i] <= limit, b+limit+1 is maximum limit+limit+1 + for j := 0; j < len(nums)/2; j++ { + a, b := min(nums[j], nums[len(nums)-j-1]), max(nums[j], nums[len(nums)-j-1]) + // using prefix sum: most interesting point, and is the key to reduce complexity + diff[2] += 2 + diff[a+1]-- + diff[a+b]-- + diff[a+b+1]++ + diff[b+limit+1]++ + } + cur, res := 0, len(nums) + for i := 2; i <= 2*limit; i++ { + cur += diff[i] + res = min(res, cur) + } + return res +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/leetcode/1690.Stone-Game-VII/1690. Stone Game VII.go b/leetcode/1690.Stone-Game-VII/1690. Stone Game VII.go new file mode 100644 index 00000000..c2ad93b4 --- /dev/null +++ b/leetcode/1690.Stone-Game-VII/1690. Stone Game VII.go @@ -0,0 +1,65 @@ +package leetcode + +// 解法一 优化空间版 DP +func stoneGameVII(stones []int) int { + n := len(stones) + sum := make([]int, n) + dp := make([]int, n) + for i, d := range stones { + sum[i] = d + } + for i := 1; i < n; i++ { + for j := 0; j+i < n; j++ { + if (n-i)%2 == 1 { + d0 := dp[j] + sum[j] + d1 := dp[j+1] + sum[j+1] + if d0 > d1 { + dp[j] = d0 + } else { + dp[j] = d1 + } + } else { + d0 := dp[j] - sum[j] + d1 := dp[j+1] - sum[j+1] + if d0 < d1 { + dp[j] = d0 + } else { + dp[j] = d1 + } + } + sum[j] = sum[j] + stones[i+j] + } + } + return dp[0] +} + +// 解法二 常规 DP +func stoneGameVII1(stones []int) int { + prefixSum := make([]int, len(stones)) + for i := 0; i < len(stones); i++ { + if i == 0 { + prefixSum[i] = stones[i] + } else { + prefixSum[i] = prefixSum[i-1] + stones[i] + } + } + dp := make([][]int, len(stones)) + for i := range dp { + dp[i] = make([]int, len(stones)) + dp[i][i] = 0 + } + n := len(stones) + for l := 2; l <= n; l++ { + for i := 0; i+l <= n; i++ { + dp[i][i+l-1] = max(prefixSum[i+l-1]-prefixSum[i+1]+stones[i+1]-dp[i+1][i+l-1], prefixSum[i+l-2]-prefixSum[i]+stones[i]-dp[i][i+l-2]) + } + } + return dp[0][n-1] +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} diff --git a/leetcode/1690.Stone-Game-VII/1690. Stone Game VII_test.go b/leetcode/1690.Stone-Game-VII/1690. Stone Game VII_test.go new file mode 100644 index 00000000..60656ac9 --- /dev/null +++ b/leetcode/1690.Stone-Game-VII/1690. Stone Game VII_test.go @@ -0,0 +1,47 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1690 struct { + para1690 + ans1690 +} + +// para 是参数 +// one 代表第一个参数 +type para1690 struct { + stones []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1690 struct { + one int +} + +func Test_Problem1690(t *testing.T) { + + qs := []question1690{ + + { + para1690{[]int{5, 3, 1, 4, 2}}, + ans1690{6}, + }, + + { + para1690{[]int{7, 90, 5, 1, 100, 10, 10, 2}}, + ans1690{122}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1690------------------------\n") + + for _, q := range qs { + _, p := q.ans1690, q.para1690 + fmt.Printf("【input】:%v 【output】:%v\n", p, stoneGameVII(p.stones)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1690.Stone-Game-VII/README.md b/leetcode/1690.Stone-Game-VII/README.md new file mode 100644 index 00000000..c7b618ac --- /dev/null +++ b/leetcode/1690.Stone-Game-VII/README.md @@ -0,0 +1,130 @@ +# [1690. Stone Game VII](https://leetcode.com/problems/stone-game-vii/) + +## 题目 + +Alice and Bob take turns playing a game, with **Alice starting first**. + +There are `n` stones arranged in a row. On each player's turn, they can **remove** either the leftmost stone or the rightmost stone from the row and receive points equal to the **sum** of the remaining stones' values in the row. The winner is the one with the higher score when there are no stones left to remove. + +Bob found that he will always lose this game (poor Bob, he always loses), so he decided to **minimize the score's difference**. Alice's goal is to **maximize the difference** in the score. + +Given an array of integers `stones` where `stones[i]` represents the value of the `ith` stone **from the left**, return *the **difference** in Alice and Bob's score if they both play **optimally**.* + +**Example 1:** + +``` +Input: stones = [5,3,1,4,2] +Output: 6 +Explanation: +- Alice removes 2 and gets 5 + 3 + 1 + 4 = 13 points. Alice = 13, Bob = 0, stones = [5,3,1,4]. +- Bob removes 5 and gets 3 + 1 + 4 = 8 points. Alice = 13, Bob = 8, stones = [3,1,4]. +- Alice removes 3 and gets 1 + 4 = 5 points. Alice = 18, Bob = 8, stones = [1,4]. +- Bob removes 1 and gets 4 points. Alice = 18, Bob = 12, stones = [4]. +- Alice removes 4 and gets 0 points. Alice = 18, Bob = 12, stones = []. +The score difference is 18 - 12 = 6. +``` + +**Example 2:** + +``` +Input: stones = [7,90,5,1,100,10,10,2] +Output: 122 +``` + +**Constraints:** + +- `n == stones.length` +- `2 <= n <= 1000` +- `1 <= stones[i] <= 1000` + +## 题目大意 + +石子游戏中,爱丽丝和鲍勃轮流进行自己的回合,爱丽丝先开始 。有 n 块石子排成一排。每个玩家的回合中,可以从行中 移除 最左边的石头或最右边的石头,并获得与该行中剩余石头值之 和 相等的得分。当没有石头可移除时,得分较高者获胜。鲍勃发现他总是输掉游戏(可怜的鲍勃,他总是输),所以他决定尽力 减小得分的差值 。爱丽丝的目标是最大限度地 扩大得分的差值 。 + +给你一个整数数组 stones ,其中 stones[i] 表示 从左边开始 的第 i 个石头的值,如果爱丽丝和鲍勃都 发挥出最佳水平 ,请返回他们 得分的差值 。 + +## 解题思路 + +- 首先考虑 Bob 缩小分值差距意味着什么,意味着他想让他和 Alice 相对分数最小。Bob 已经明确肯定是输,所以他的分数一定比 Alice 小,那么 Bob - Alice 分数相减一定是负数。相对分数越小,意味着差值越大。负数越大,差值越小。-50 和 -10,-10 数值大,相差小。所以 Bob 的操作是让相对分数越大。Alice 的目的也是这样,要让 Alice - Bob 的相对分数越大,这里是正数的越大。综上,两者的目的相同,都是让相对分数最大化。 +- 定义 `dp[i][j]` 代表在当前 `stone[i ~ j]` 区间内能获得的最大分差。状态转移方程为: + + ```go + dp[i][j] = max( + sum(i + 1, j) - dp[i + 1][j], // 这一局取走 `stone[i]`,获得 sum(i + 1, j) 分数,再减去剩下对手能获得的分数,即是此局能获得的最大分差。 + sum(i, j - 1) - dp[i][j - 1] // 这一局取走 `stone[j]`,获得 sum(i, j - 1) 分数,再减去剩下对手能获得的分数,即是此局能获得的最大分差。 + ) + ``` + + 计算 `sum(i + 1, j) = stone[i + 1] + stone[i + 2] + …… + stone[j]` 利用前缀和计算区间和。 + +- 解法二是正常思路解答出来的代码。解法一是压缩了 DP 数组,在 DP 状态转移的时候,生成下一个 `dp[j]` 实际上是有规律的。利用这个规律可以少存一维数据,压缩空间。解法一的代码直接写出来,比较难想。先写出解法二的代码,然后找到递推规律,优化空间压缩一维,再写出解法一的代码。 + +## 代码 + +```go +package leetcode + +// 解法一 优化空间版 DP +func stoneGameVII(stones []int) int { + n := len(stones) + sum := make([]int, n) + dp := make([]int, n) + for i, d := range stones { + sum[i] = d + } + for i := 1; i < n; i++ { + for j := 0; j+i < n; j++ { + if (n-i)%2 == 1 { + d0 := dp[j] + sum[j] + d1 := dp[j+1] + sum[j+1] + if d0 > d1 { + dp[j] = d0 + } else { + dp[j] = d1 + } + } else { + d0 := dp[j] - sum[j] + d1 := dp[j+1] - sum[j+1] + if d0 < d1 { + dp[j] = d0 + } else { + dp[j] = d1 + } + } + sum[j] = sum[j] + stones[i+j] + } + } + return dp[0] +} + +// 解法二 常规 DP +func stoneGameVII1(stones []int) int { + prefixSum := make([]int, len(stones)) + for i := 0; i < len(stones); i++ { + if i == 0 { + prefixSum[i] = stones[i] + } else { + prefixSum[i] = prefixSum[i-1] + stones[i] + } + } + dp := make([][]int, len(stones)) + for i := range dp { + dp[i] = make([]int, len(stones)) + dp[i][i] = 0 + } + n := len(stones) + for l := 2; l <= n; l++ { + for i := 0; i+l <= n; i++ { + dp[i][i+l-1] = max(prefixSum[i+l-1]-prefixSum[i+1]+stones[i+1]-dp[i+1][i+l-1], prefixSum[i+l-2]-prefixSum[i]+stones[i]-dp[i][i+l-2]) + } + } + return dp[0][n-1] +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md b/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md new file mode 100644 index 00000000..8e565e10 --- /dev/null +++ b/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md @@ -0,0 +1,97 @@ +# [1674. Minimum Moves to Make Array Complementary](https://leetcode.com/problems/minimum-moves-to-make-array-complementary/) + +## 题目 + +You are given an integer array `nums` of **even** length `n` and an integer `limit`. In one move, you can replace any integer from `nums` with another integer between `1` and `limit`, inclusive. + +The array `nums` is **complementary** if for all indices `i` (**0-indexed**), `nums[i] + nums[n - 1 - i]` equals the same number. For example, the array `[1,2,3,4]` is complementary because for all indices `i`, `nums[i] + nums[n - 1 - i] = 5`. + +Return the ***minimum** number of moves required to make* `nums` ***complementary***. + +**Example 1:** + +``` +Input: nums = [1,2,4,3], limit = 4 +Output: 1 +Explanation: In 1 move, you can change nums to [1,2,2,3] (underlined elements are changed). +nums[0] + nums[3] = 1 + 3 = 4. +nums[1] + nums[2] = 2 + 2 = 4. +nums[2] + nums[1] = 2 + 2 = 4. +nums[3] + nums[0] = 3 + 1 = 4. +Therefore, nums[i] + nums[n-1-i] = 4 for every i, so nums is complementary. +``` + +**Example 2:** + +``` +Input: nums = [1,2,2,1], limit = 2 +Output: 2 +Explanation: In 2 moves, you can change nums to [2,2,2,2]. You cannot change any number to 3 since 3 > limit. +``` + +**Example 3:** + +``` +Input: nums = [1,2,1,2], limit = 2 +Output: 0 +Explanation: nums is already complementary. +``` + +**Constraints:** + +- `n == nums.length` +- `2 <= n <= 105` +- `1 <= nums[i] <= limit <= 105` +- `n` is even. + +## 题目大意 + +给你一个长度为 偶数 n 的整数数组 nums 和一个整数 limit 。每一次操作,你可以将 nums 中的任何整数替换为 1 到 limit 之间的另一个整数。 + +如果对于所有下标 i(下标从 0 开始),nums[i] + nums[n - 1 - i] 都等于同一个数,则数组 nums 是 互补的 。例如,数组 [1,2,3,4] 是互补的,因为对于所有下标 i ,nums[i] + nums[n - 1 - i] = 5 。 + +返回使数组 互补 的 最少 操作次数。 + +## 解题思路 + +- 这一题考察的是差分数组。通过分析题意,可以得出,针对每一个 `sum` 的取值范围是 `[2, 2* limt]`,定义 `a = min(nums[i], nums[n - i - 1])`,`b = max(nums[i], nums[n - i - 1])`,在这个区间内,又可以细分成 5 个区间,`[2, a + 1)`,`[a + 1, a + b)`,`[a + b + 1, a + b + 1)`,`[a + b + 1, b + limit + 1)`,`[b + limit + 1, 2 * limit)`,在这 5 个区间内使得数组互补的最小操作次数分别是 `2(减少 a, 减少 b)`,`1(减少 b)`,`0(不用操作)`,`1(增大 a)`,`+2(增大 a, 增大 b)`,换个表达方式,按照扫描线从左往右扫描,在这 5 个区间内使得数组互补的最小操作次数叠加变化分别是 `+2(减少 a, 减少 b)`,`-1(减少 a)`,`-1(不用操作)`,`+1(增大 a)`,`+1(增大 a, 增大 b)`,利用这前后两个区间的关系,就可以构造一个差分数组。差分数组反应的是前后两者的关系。如果想求得 0 ~ n 的总关系,只需要求一次前缀和即可。 +- 这道题要求输出最少的操作次数,所以利用差分数组 + 前缀和,累加前缀和的同时维护最小值。从左往右扫描完一遍以后,输出最小值即可。 + +## 代码 + +```go +package leetcode + +func minMoves(nums []int, limit int) int { + diff := make([]int, limit*2+2) // nums[i] <= limit, b+limit+1 is maximum limit+limit+1 + for j := 0; j < len(nums)/2; j++ { + a, b := min(nums[j], nums[len(nums)-j-1]), max(nums[j], nums[len(nums)-j-1]) + // using prefix sum: most interesting point, and is the key to reduce complexity + diff[2] += 2 + diff[a+1]-- + diff[a+b]-- + diff[a+b+1]++ + diff[b+limit+1]++ + } + cur, res := 0, len(nums) + for i := 2; i <= 2*limit; i++ { + cur += diff[i] + res = min(res, cur) + } + return res +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1690.Stone-Game-VII.md b/website/content/ChapterFour/1690.Stone-Game-VII.md new file mode 100644 index 00000000..c7b618ac --- /dev/null +++ b/website/content/ChapterFour/1690.Stone-Game-VII.md @@ -0,0 +1,130 @@ +# [1690. Stone Game VII](https://leetcode.com/problems/stone-game-vii/) + +## 题目 + +Alice and Bob take turns playing a game, with **Alice starting first**. + +There are `n` stones arranged in a row. On each player's turn, they can **remove** either the leftmost stone or the rightmost stone from the row and receive points equal to the **sum** of the remaining stones' values in the row. The winner is the one with the higher score when there are no stones left to remove. + +Bob found that he will always lose this game (poor Bob, he always loses), so he decided to **minimize the score's difference**. Alice's goal is to **maximize the difference** in the score. + +Given an array of integers `stones` where `stones[i]` represents the value of the `ith` stone **from the left**, return *the **difference** in Alice and Bob's score if they both play **optimally**.* + +**Example 1:** + +``` +Input: stones = [5,3,1,4,2] +Output: 6 +Explanation: +- Alice removes 2 and gets 5 + 3 + 1 + 4 = 13 points. Alice = 13, Bob = 0, stones = [5,3,1,4]. +- Bob removes 5 and gets 3 + 1 + 4 = 8 points. Alice = 13, Bob = 8, stones = [3,1,4]. +- Alice removes 3 and gets 1 + 4 = 5 points. Alice = 18, Bob = 8, stones = [1,4]. +- Bob removes 1 and gets 4 points. Alice = 18, Bob = 12, stones = [4]. +- Alice removes 4 and gets 0 points. Alice = 18, Bob = 12, stones = []. +The score difference is 18 - 12 = 6. +``` + +**Example 2:** + +``` +Input: stones = [7,90,5,1,100,10,10,2] +Output: 122 +``` + +**Constraints:** + +- `n == stones.length` +- `2 <= n <= 1000` +- `1 <= stones[i] <= 1000` + +## 题目大意 + +石子游戏中,爱丽丝和鲍勃轮流进行自己的回合,爱丽丝先开始 。有 n 块石子排成一排。每个玩家的回合中,可以从行中 移除 最左边的石头或最右边的石头,并获得与该行中剩余石头值之 和 相等的得分。当没有石头可移除时,得分较高者获胜。鲍勃发现他总是输掉游戏(可怜的鲍勃,他总是输),所以他决定尽力 减小得分的差值 。爱丽丝的目标是最大限度地 扩大得分的差值 。 + +给你一个整数数组 stones ,其中 stones[i] 表示 从左边开始 的第 i 个石头的值,如果爱丽丝和鲍勃都 发挥出最佳水平 ,请返回他们 得分的差值 。 + +## 解题思路 + +- 首先考虑 Bob 缩小分值差距意味着什么,意味着他想让他和 Alice 相对分数最小。Bob 已经明确肯定是输,所以他的分数一定比 Alice 小,那么 Bob - Alice 分数相减一定是负数。相对分数越小,意味着差值越大。负数越大,差值越小。-50 和 -10,-10 数值大,相差小。所以 Bob 的操作是让相对分数越大。Alice 的目的也是这样,要让 Alice - Bob 的相对分数越大,这里是正数的越大。综上,两者的目的相同,都是让相对分数最大化。 +- 定义 `dp[i][j]` 代表在当前 `stone[i ~ j]` 区间内能获得的最大分差。状态转移方程为: + + ```go + dp[i][j] = max( + sum(i + 1, j) - dp[i + 1][j], // 这一局取走 `stone[i]`,获得 sum(i + 1, j) 分数,再减去剩下对手能获得的分数,即是此局能获得的最大分差。 + sum(i, j - 1) - dp[i][j - 1] // 这一局取走 `stone[j]`,获得 sum(i, j - 1) 分数,再减去剩下对手能获得的分数,即是此局能获得的最大分差。 + ) + ``` + + 计算 `sum(i + 1, j) = stone[i + 1] + stone[i + 2] + …… + stone[j]` 利用前缀和计算区间和。 + +- 解法二是正常思路解答出来的代码。解法一是压缩了 DP 数组,在 DP 状态转移的时候,生成下一个 `dp[j]` 实际上是有规律的。利用这个规律可以少存一维数据,压缩空间。解法一的代码直接写出来,比较难想。先写出解法二的代码,然后找到递推规律,优化空间压缩一维,再写出解法一的代码。 + +## 代码 + +```go +package leetcode + +// 解法一 优化空间版 DP +func stoneGameVII(stones []int) int { + n := len(stones) + sum := make([]int, n) + dp := make([]int, n) + for i, d := range stones { + sum[i] = d + } + for i := 1; i < n; i++ { + for j := 0; j+i < n; j++ { + if (n-i)%2 == 1 { + d0 := dp[j] + sum[j] + d1 := dp[j+1] + sum[j+1] + if d0 > d1 { + dp[j] = d0 + } else { + dp[j] = d1 + } + } else { + d0 := dp[j] - sum[j] + d1 := dp[j+1] - sum[j+1] + if d0 < d1 { + dp[j] = d0 + } else { + dp[j] = d1 + } + } + sum[j] = sum[j] + stones[i+j] + } + } + return dp[0] +} + +// 解法二 常规 DP +func stoneGameVII1(stones []int) int { + prefixSum := make([]int, len(stones)) + for i := 0; i < len(stones); i++ { + if i == 0 { + prefixSum[i] = stones[i] + } else { + prefixSum[i] = prefixSum[i-1] + stones[i] + } + } + dp := make([][]int, len(stones)) + for i := range dp { + dp[i] = make([]int, len(stones)) + dp[i][i] = 0 + } + n := len(stones) + for l := 2; l <= n; l++ { + for i := 0; i+l <= n; i++ { + dp[i][i+l-1] = max(prefixSum[i+l-1]-prefixSum[i+1]+stones[i+1]-dp[i+1][i+l-1], prefixSum[i+l-2]-prefixSum[i]+stones[i]-dp[i][i+l-2]) + } + } + return dp[0][n-1] +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index f7be9094..78ca8d48 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -570,6 +570,7 @@ headless: true - [1670.Design-Front-Middle-Back-Queue]({{< relref "/ChapterFour/1670.Design-Front-Middle-Back-Queue.md" >}}) - [1672.Richest-Customer-Wealth]({{< relref "/ChapterFour/1672.Richest-Customer-Wealth.md" >}}) - [1673.Find-the-Most-Competitive-Subsequence]({{< relref "/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md" >}}) + - [1674.Minimum-Moves-to-Make-Array-Complementary]({{< relref "/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md" >}}) - [1678.Goal-Parser-Interpretation]({{< relref "/ChapterFour/1678.Goal-Parser-Interpretation.md" >}}) - [1679.Max-Number-of-K-Sum-Pairs]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}}) - [1680.Concatenation-of-Consecutive-Binary-Numbers]({{< relref "/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md" >}}) @@ -578,4 +579,5 @@ headless: true - [1685.Sum-of-Absolute-Differences-in-a-Sorted-Array]({{< relref "/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md" >}}) - [1688.Count-of-Matches-in-Tournament]({{< relref "/ChapterFour/1688.Count-of-Matches-in-Tournament.md" >}}) - [1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers]({{< relref "/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md" >}}) + - [1690.Stone-Game-VII]({{< relref "/ChapterFour/1690.Stone-Game-VII.md" >}})
From 65d2fd668b31735a7d6735d079ae295694e39cfd Mon Sep 17 00:00:00 2001 From: Alexander Chernikov Date: Mon, 21 Dec 2020 13:58:49 +0300 Subject: [PATCH 50/82] add 0910 smallest-range-ii --- .../910.Smallest Range II.go | 31 ++++++++++++ .../910.Smallest Range II_test.go | 47 +++++++++++++++++++ leetcode/0910-Smallest-Range-II/README.md | 34 ++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 leetcode/0910-Smallest-Range-II/910.Smallest Range II.go create mode 100644 leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go create mode 100644 leetcode/0910-Smallest-Range-II/README.md diff --git a/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go b/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go new file mode 100644 index 00000000..1082b451 --- /dev/null +++ b/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go @@ -0,0 +1,31 @@ +package leetcode + +import "sort" + +func SmallestRangeII(A []int, K int) int { + n := len(A) + sort.Ints(A) + var ans int = A[n-1] - A[0] + for i := 0; i < n-1; i++ { + a, b := A[i], A[i+1] + high := max(A[n-1]-K, a+K) + low := min(A[0]+K, b-K) + ans = min(ans, high-low) + } + + return ans +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} diff --git a/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go b/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go new file mode 100644 index 00000000..420c8fba --- /dev/null +++ b/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go @@ -0,0 +1,47 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question910 struct { + para910 + ans910 +} + +type para910 struct { + A []int + K int +} + +type ans910 struct { + one int +} + +func Test_Problem910(t *testing.T) { + + qs := []question910{ + + { + para910{[]int{1}, 0}, + ans910{0}, + }, + { + para910{[]int{0, 10}, 2}, + ans910{6}, + }, + { + para910{[]int{1, 3, 6}, 3}, + ans910{3}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 910------------------------\n") + + for _, q := range qs { + _, p := q.ans910, q.para910 + fmt.Printf("【input】:%v 【output】:%v\n", p, SmallestRangeII(p.A, p.K)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/0910-Smallest-Range-II/README.md b/leetcode/0910-Smallest-Range-II/README.md new file mode 100644 index 00000000..aaa0e90c --- /dev/null +++ b/leetcode/0910-Smallest-Range-II/README.md @@ -0,0 +1,34 @@ +Given an array A of integers, for each integer A[i] we need to choose either x = -K or x = K, and add x to A[i] (only once). + +After this process, we have some array B. + +Return the smallest possible difference between the maximum value of B and the minimum value of B. + + + +Example 1: +``` +Input: A = [1], K = 0 +Output: 0 +Explanation: B = [1] +``` +Example 2: +``` +Input: A = [0,10], K = 2 +Output: 6 +Explanation: B = [2,8] +``` +Example 3: +``` +Input: A = [1,3,6], K = 3 +Output: 3 +Explanation: B = [4,6,3] +``` + + +Note: + + 1 <= A.length <= 10000 + 0 <= A[i] <= 10000 + 0 <= K <= 10000 + From c18739f26280cacce4fbfb53c77e071d8133084e Mon Sep 17 00:00:00 2001 From: Alexander Chernikov Date: Mon, 21 Dec 2020 14:14:13 +0300 Subject: [PATCH 51/82] add dummy-comments --- leetcode/0910-Smallest-Range-II/910.Smallest Range II.go | 1 + leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go b/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go index 1082b451..9442c3de 100644 --- a/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go +++ b/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go @@ -2,6 +2,7 @@ package leetcode import "sort" +// SmallestRangeII ... func SmallestRangeII(A []int, K int) int { n := len(A) sort.Ints(A) diff --git a/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go b/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go index 420c8fba..acb50360 100644 --- a/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go +++ b/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go @@ -19,6 +19,7 @@ type ans910 struct { one int } +// Test_Problem910 ... func Test_Problem910(t *testing.T) { qs := []question910{ From fcd2655a4aa4db8f82e5dc175e3c03f0e9d87f08 Mon Sep 17 00:00:00 2001 From: Alexander Chernikov Date: Mon, 21 Dec 2020 17:55:24 +0300 Subject: [PATCH 52/82] edit mainFunc name --- leetcode/0910-Smallest-Range-II/910.Smallest Range II.go | 4 ++-- leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go b/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go index 9442c3de..19e5a32e 100644 --- a/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go +++ b/leetcode/0910-Smallest-Range-II/910.Smallest Range II.go @@ -2,8 +2,8 @@ package leetcode import "sort" -// SmallestRangeII ... -func SmallestRangeII(A []int, K int) int { +// smallestRangeII ... +func smallestRangeII(A []int, K int) int { n := len(A) sort.Ints(A) var ans int = A[n-1] - A[0] diff --git a/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go b/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go index acb50360..f1a83a99 100644 --- a/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go +++ b/leetcode/0910-Smallest-Range-II/910.Smallest Range II_test.go @@ -42,7 +42,7 @@ func Test_Problem910(t *testing.T) { for _, q := range qs { _, p := q.ans910, q.para910 - fmt.Printf("【input】:%v 【output】:%v\n", p, SmallestRangeII(p.A, p.K)) + fmt.Printf("【input】:%v 【output】:%v\n", p, smallestRangeII(p.A, p.K)) } fmt.Printf("\n\n\n") } From 2c41ea320fc8d65e8b2501a611d9ca2fbe75f6e1 Mon Sep 17 00:00:00 2001 From: kingeasternsun Date: Wed, 23 Dec 2020 12:53:01 +0800 Subject: [PATCH 53/82] Update 0387.First-Unique-Character-in-a-String.md --- ...0387.First-Unique-Character-in-a-String.md | 55 ++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/website/content/ChapterFour/0387.First-Unique-Character-in-a-String.md b/website/content/ChapterFour/0387.First-Unique-Character-in-a-String.md index b3ccff4c..6f65a982 100755 --- a/website/content/ChapterFour/0387.First-Unique-Character-in-a-String.md +++ b/website/content/ChapterFour/0387.First-Unique-Character-in-a-String.md @@ -45,4 +45,57 @@ func firstUniqChar(s string) int { return -1 } -``` \ No newline at end of file +``` + +## 思路2 +这个思路只超过81%的用户,但是如果测试样例中s的字符串很长,但是满足条件的字符都在靠后的位置的话,这个思路应该会更有优势 +- 通过记录每个字符的第一次出现的位置和最后一次出现的位置 +- 第一次对s进行一次遍历 +- 第二次仅仅对数组进行遍历就可以了 + +## 代码 + +执行用时: 8 ms +内存消耗: 5.2 MB + + +```go + + +func firstUniqChar(s string) int { + + charMap := make([][2]int, 26) + for i := 0; i < 26; i++ { + charMap[i][0] = -1 + charMap[i][1] = -1 + } + + for i := 0; i < len(s); i++ { + if charMap[s[i]-'a'][0] == -1 { + charMap[s[i]-'a'][0] = i + } else { //已经出现过 + charMap[s[i]-'a'][1] = i + } + + } + + res := len(s) + + for i := 0; i < 26; i++ { + + //只出现了一次 + if charMap[i][0] >= 0 && charMap[i][1] == -1 { + if charMap[i][0] < res { + res = charMap[i][0] + } + } + + } + + if res == len(s) { + return -1 + } + return res +} + +``` From b9c64a10571ec88eb410bdd67f5af3c3822501a1 Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 30 Dec 2020 23:15:10 +0800 Subject: [PATCH 54/82] Add 5629 --- .../777777/5629. Reformat Phone Number.go | 51 ++++++++++++++ .../5629. Reformat Phone Number_test.go | 67 +++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 leetcode/777777/5629. Reformat Phone Number.go create mode 100644 leetcode/777777/5629. Reformat Phone Number_test.go diff --git a/leetcode/777777/5629. Reformat Phone Number.go b/leetcode/777777/5629. Reformat Phone Number.go new file mode 100644 index 00000000..70795214 --- /dev/null +++ b/leetcode/777777/5629. Reformat Phone Number.go @@ -0,0 +1,51 @@ +package leetcode + +func reformatNumber(number string) string { + str, count := "", 0 + for i := 0; i < len(number); i++ { + if number[i] != '-' && number[i] != ' ' { + str += string(number[i]) + // str = append(str, number[i]) + } + } + if len(str) == 4 { + str = str[:2] + "-" + str[2:] + return str + } + if len(str) > 3 { + if (len(str)-4)%3 == 0 { + for i := len(str) - 5; i >= 0; i-- { + count++ + if count%3 == 0 && i != 0 { + str = str[:i] + "-" + str[i:] + } + } + str = str[:len(str)-2] + "-" + str[len(str)-2:] + str = str[:len(str)-5] + "-" + str[len(str)-5:] + return str + } + if (len(str)-2)%3 == 0 { + for i := len(str) - 3; i >= 0; i-- { + count++ + if count%3 == 0 && i != 0 { + str = str[:i] + "-" + str[i:] + } + } + str = str[:len(str)-2] + "-" + str[len(str)-2:] + return str + } + length := len(str) + count = 0 + for j := 0; j < len(str); j++ { + count++ + if count%3 == 0 && count != length { + // head := + // tail := + str = str[:j+1] + "-" + str[j+1:] + j++ + } + } + + } + return str +} diff --git a/leetcode/777777/5629. Reformat Phone Number_test.go b/leetcode/777777/5629. Reformat Phone Number_test.go new file mode 100644 index 00000000..8aba62c9 --- /dev/null +++ b/leetcode/777777/5629. Reformat Phone Number_test.go @@ -0,0 +1,67 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1690 struct { + para1690 + ans1690 +} + +// para 是参数 +// one 代表第一个参数 +type para1690 struct { + number string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1690 struct { + one string +} + +func Test_Problem1690(t *testing.T) { + + qs := []question1690{ + + { + para1690{"1-23-45 6"}, + ans1690{"123-456"}, + }, + + { + para1690{"123 4-567"}, + ans1690{"123-45-67"}, + }, + + { + para1690{"123 4-5678"}, + ans1690{"123-456-78"}, + }, + + { + para1690{"12"}, + ans1690{"12"}, + }, + + { + para1690{"--17-5 229 35-39475 "}, + ans1690{"175-229-353-94-75"}, + }, + + { + para1690{"9964-"}, + ans1690{"99-64"}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1690------------------------\n") + + for _, q := range qs { + _, p := q.ans1690, q.para1690 + fmt.Printf("【input】:%v 【output】:%v\n", p, reformatNumber(p.number)) + } + fmt.Printf("\n\n\n") +} From 5cb2ded45c5eb994990514d16883d671d17d062e Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 1 Jan 2021 21:21:21 +0800 Subject: [PATCH 55/82] Add 5629 --- .../777777/5629. Reformat Phone Number.go | 51 ++++++++++++++ .../5629. Reformat Phone Number_test.go | 67 +++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 leetcode/777777/5629. Reformat Phone Number.go create mode 100644 leetcode/777777/5629. Reformat Phone Number_test.go diff --git a/leetcode/777777/5629. Reformat Phone Number.go b/leetcode/777777/5629. Reformat Phone Number.go new file mode 100644 index 00000000..70795214 --- /dev/null +++ b/leetcode/777777/5629. Reformat Phone Number.go @@ -0,0 +1,51 @@ +package leetcode + +func reformatNumber(number string) string { + str, count := "", 0 + for i := 0; i < len(number); i++ { + if number[i] != '-' && number[i] != ' ' { + str += string(number[i]) + // str = append(str, number[i]) + } + } + if len(str) == 4 { + str = str[:2] + "-" + str[2:] + return str + } + if len(str) > 3 { + if (len(str)-4)%3 == 0 { + for i := len(str) - 5; i >= 0; i-- { + count++ + if count%3 == 0 && i != 0 { + str = str[:i] + "-" + str[i:] + } + } + str = str[:len(str)-2] + "-" + str[len(str)-2:] + str = str[:len(str)-5] + "-" + str[len(str)-5:] + return str + } + if (len(str)-2)%3 == 0 { + for i := len(str) - 3; i >= 0; i-- { + count++ + if count%3 == 0 && i != 0 { + str = str[:i] + "-" + str[i:] + } + } + str = str[:len(str)-2] + "-" + str[len(str)-2:] + return str + } + length := len(str) + count = 0 + for j := 0; j < len(str); j++ { + count++ + if count%3 == 0 && count != length { + // head := + // tail := + str = str[:j+1] + "-" + str[j+1:] + j++ + } + } + + } + return str +} diff --git a/leetcode/777777/5629. Reformat Phone Number_test.go b/leetcode/777777/5629. Reformat Phone Number_test.go new file mode 100644 index 00000000..8aba62c9 --- /dev/null +++ b/leetcode/777777/5629. Reformat Phone Number_test.go @@ -0,0 +1,67 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1690 struct { + para1690 + ans1690 +} + +// para 是参数 +// one 代表第一个参数 +type para1690 struct { + number string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1690 struct { + one string +} + +func Test_Problem1690(t *testing.T) { + + qs := []question1690{ + + { + para1690{"1-23-45 6"}, + ans1690{"123-456"}, + }, + + { + para1690{"123 4-567"}, + ans1690{"123-45-67"}, + }, + + { + para1690{"123 4-5678"}, + ans1690{"123-456-78"}, + }, + + { + para1690{"12"}, + ans1690{"12"}, + }, + + { + para1690{"--17-5 229 35-39475 "}, + ans1690{"175-229-353-94-75"}, + }, + + { + para1690{"9964-"}, + ans1690{"99-64"}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1690------------------------\n") + + for _, q := range qs { + _, p := q.ans1690, q.para1690 + fmt.Printf("【input】:%v 【output】:%v\n", p, reformatNumber(p.number)) + } + fmt.Printf("\n\n\n") +} From 88a0452f2622ca23fec627ad48db5a433eec8395 Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 1 Jan 2021 21:21:21 +0800 Subject: [PATCH 56/82] Add solution 605 --- .../605. Can Place Flowers.go | 18 +++++ .../605. Can Place Flowers_test.go | 68 +++++++++++++++++++ leetcode/0605.Can-Place-Flowers/README.md | 60 ++++++++++++++++ leetcode/0910.Smallest-Range-II/README.md | 6 +- .../ChapterFour/0605.Can-Place-Flowers.md | 60 ++++++++++++++++ website/content/menu/index.md | 1 + 6 files changed, 210 insertions(+), 3 deletions(-) create mode 100644 leetcode/0605.Can-Place-Flowers/605. Can Place Flowers.go create mode 100644 leetcode/0605.Can-Place-Flowers/605. Can Place Flowers_test.go create mode 100644 leetcode/0605.Can-Place-Flowers/README.md create mode 100644 website/content/ChapterFour/0605.Can-Place-Flowers.md diff --git a/leetcode/0605.Can-Place-Flowers/605. Can Place Flowers.go b/leetcode/0605.Can-Place-Flowers/605. Can Place Flowers.go new file mode 100644 index 00000000..0b598096 --- /dev/null +++ b/leetcode/0605.Can-Place-Flowers/605. Can Place Flowers.go @@ -0,0 +1,18 @@ +package leetcode + +func canPlaceFlowers(flowerbed []int, n int) bool { + lenth := len(flowerbed) + for i := 0; i < lenth && n > 0; i += 2 { + if flowerbed[i] == 0 { + if i+1 == lenth || flowerbed[i+1] == 0 { + n-- + } else { + i++ + } + } + } + if n == 0 { + return true + } + return false +} diff --git a/leetcode/0605.Can-Place-Flowers/605. Can Place Flowers_test.go b/leetcode/0605.Can-Place-Flowers/605. Can Place Flowers_test.go new file mode 100644 index 00000000..0b7ce7f2 --- /dev/null +++ b/leetcode/0605.Can-Place-Flowers/605. Can Place Flowers_test.go @@ -0,0 +1,68 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question605 struct { + para605 + ans605 +} + +// para 是参数 +// one 代表第一个参数 +type para605 struct { + flowerbed []int + n int +} + +// ans 是答案 +// one 代表第一个答案 +type ans605 struct { + one bool +} + +func Test_Problem605(t *testing.T) { + + qs := []question605{ + + { + para605{[]int{1, 0, 0, 0, 1}, 1}, + ans605{true}, + }, + + { + para605{[]int{1, 0, 0, 0, 1}, 2}, + ans605{false}, + }, + + { + para605{[]int{1, 0, 0, 0, 0, 1}, 2}, + ans605{false}, + }, + + { + para605{[]int{0, 0, 1, 0}, 1}, + ans605{true}, + }, + + { + para605{[]int{0, 0, 1, 0, 0}, 1}, + ans605{true}, + }, + + { + para605{[]int{1, 0, 0, 1, 0}, 2}, + ans605{false}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 605------------------------\n") + + for _, q := range qs { + _, p := q.ans605, q.para605 + fmt.Printf("【input】:%v 【output】:%v\n", p, canPlaceFlowers(p.flowerbed, p.n)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/0605.Can-Place-Flowers/README.md b/leetcode/0605.Can-Place-Flowers/README.md new file mode 100644 index 00000000..746817ad --- /dev/null +++ b/leetcode/0605.Can-Place-Flowers/README.md @@ -0,0 +1,60 @@ +# [605. Can Place Flowers](https://leetcode.com/problems/can-place-flowers/) + +## 题目 + +You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in **adjacent** plots. + +Given an integer array `flowerbed` containing `0`'s and `1`'s, where `0` means empty and `1` means not empty, and an integer `n`, return *if* `n` new flowers can be planted in the `flowerbed` without violating the no-adjacent-flowers rule. + +**Example 1:** + +``` +Input: flowerbed = [1,0,0,0,1], n = 1 +Output: true +``` + +**Example 2:** + +``` +Input: flowerbed = [1,0,0,0,1], n = 2 +Output: false +``` + +**Constraints:** + +- `1 <= flowerbed.length <= 2 * 104` +- `flowerbed[i]` is `0` or `1`. +- There are no two adjacent flowers in `flowerbed`. +- `0 <= n <= flowerbed.length` + +## 题目大意 + +假设你有一个很长的花坛,一部分地块种植了花,另一部分却没有。可是,花卉不能种植在相邻的地块上,它们会争夺水源,两者都会死去。给定一个花坛(表示为一个数组包含0和1,其中0表示没种植花,1表示种植了花),和一个数 n 。能否在不打破种植规则的情况下种入 n 朵花?能则返回True,不能则返回False。 + +## 解题思路 + +- 这一题最容易想到的解法是步长为 2 遍历数组,依次计数 0 的个数。有 2 种特殊情况需要单独判断,第一种情况是首尾连续多个 0,例如,00001 和 10000,第二种情况是 2 个 1 中间存在的 0 不足以种花,例如,1001 和 100001,1001 不能种任何花,100001 只能种一种花。单独判断出这 2 种情况,这一题就可以 AC 了。 +- 换个思路,找到可以种花的基本单元是 00,那么上面那 2 种特殊情况都可以统一成一种情况。判断是否当前存在 00 的组合,如果存在 00 的组合,都可以种花。末尾的情况需要单独判断,如果末尾为 0,也可以种花。这个时候不需要再找 00 组合,因为会越界。代码实现如下,思路很简洁明了。 + +## 代码 + +```go +package leetcode + +func canPlaceFlowers(flowerbed []int, n int) bool { + lenth := len(flowerbed) + for i := 0; i < lenth && n > 0; i += 2 { + if flowerbed[i] == 0 { + if i+1 == lenth || flowerbed[i+1] == 0 { + n-- + } else { + i++ + } + } + } + if n == 0 { + return true + } + return false +} +``` \ No newline at end of file diff --git a/leetcode/0910.Smallest-Range-II/README.md b/leetcode/0910.Smallest-Range-II/README.md index 5aea9e54..e8a3d8ff 100644 --- a/leetcode/0910.Smallest-Range-II/README.md +++ b/leetcode/0910.Smallest-Range-II/README.md @@ -10,7 +10,7 @@ Return the smallest possible difference between the maximum value of `B` and t **Example 1:** -``` +```c Input: A = [1], K = 0 Output: 0 Explanation: B = [1] @@ -18,7 +18,7 @@ Explanation: B = [1] **Example 2:** -``` +```c Input: A = [0,10], K = 2 Output: 6 Explanation: B = [2,8] @@ -26,7 +26,7 @@ Explanation: B = [2,8] **Example 3:** -``` +```c Input: A = [1,3,6], K = 3 Output: 3 Explanation: B = [4,6,3] diff --git a/website/content/ChapterFour/0605.Can-Place-Flowers.md b/website/content/ChapterFour/0605.Can-Place-Flowers.md new file mode 100644 index 00000000..746817ad --- /dev/null +++ b/website/content/ChapterFour/0605.Can-Place-Flowers.md @@ -0,0 +1,60 @@ +# [605. Can Place Flowers](https://leetcode.com/problems/can-place-flowers/) + +## 题目 + +You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in **adjacent** plots. + +Given an integer array `flowerbed` containing `0`'s and `1`'s, where `0` means empty and `1` means not empty, and an integer `n`, return *if* `n` new flowers can be planted in the `flowerbed` without violating the no-adjacent-flowers rule. + +**Example 1:** + +``` +Input: flowerbed = [1,0,0,0,1], n = 1 +Output: true +``` + +**Example 2:** + +``` +Input: flowerbed = [1,0,0,0,1], n = 2 +Output: false +``` + +**Constraints:** + +- `1 <= flowerbed.length <= 2 * 104` +- `flowerbed[i]` is `0` or `1`. +- There are no two adjacent flowers in `flowerbed`. +- `0 <= n <= flowerbed.length` + +## 题目大意 + +假设你有一个很长的花坛,一部分地块种植了花,另一部分却没有。可是,花卉不能种植在相邻的地块上,它们会争夺水源,两者都会死去。给定一个花坛(表示为一个数组包含0和1,其中0表示没种植花,1表示种植了花),和一个数 n 。能否在不打破种植规则的情况下种入 n 朵花?能则返回True,不能则返回False。 + +## 解题思路 + +- 这一题最容易想到的解法是步长为 2 遍历数组,依次计数 0 的个数。有 2 种特殊情况需要单独判断,第一种情况是首尾连续多个 0,例如,00001 和 10000,第二种情况是 2 个 1 中间存在的 0 不足以种花,例如,1001 和 100001,1001 不能种任何花,100001 只能种一种花。单独判断出这 2 种情况,这一题就可以 AC 了。 +- 换个思路,找到可以种花的基本单元是 00,那么上面那 2 种特殊情况都可以统一成一种情况。判断是否当前存在 00 的组合,如果存在 00 的组合,都可以种花。末尾的情况需要单独判断,如果末尾为 0,也可以种花。这个时候不需要再找 00 组合,因为会越界。代码实现如下,思路很简洁明了。 + +## 代码 + +```go +package leetcode + +func canPlaceFlowers(flowerbed []int, n int) bool { + lenth := len(flowerbed) + for i := 0; i < lenth && n > 0; i += 2 { + if flowerbed[i] == 0 { + if i+1 == lenth || flowerbed[i+1] == 0 { + n-- + } else { + i++ + } + } + } + if n == 0 { + return true + } + return false +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 307775be..71a9c59c 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -322,6 +322,7 @@ headless: true - [0594.Longest-Harmonious-Subsequence]({{< relref "/ChapterFour/0594.Longest-Harmonious-Subsequence.md" >}}) - [0598.Range-Addition-II]({{< relref "/ChapterFour/0598.Range-Addition-II.md" >}}) - [0599.Minimum-Index-Sum-of-Two-Lists]({{< relref "/ChapterFour/0599.Minimum-Index-Sum-of-Two-Lists.md" >}}) + - [0605.Can-Place-Flowers]({{< relref "/ChapterFour/0605.Can-Place-Flowers.md" >}}) - [0628.Maximum-Product-of-Three-Numbers]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}}) - [0632.Smallest-Range-Covering-Elements-from-K-Lists]({{< relref "/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md" >}}) - [0633.Sum-of-Square-Numbers]({{< relref "/ChapterFour/0633.Sum-of-Square-Numbers.md" >}}) From bbb448d3beb3c669d983e2a8652625209e24342c Mon Sep 17 00:00:00 2001 From: YDZ Date: Sat, 2 Jan 2021 00:53:28 +0800 Subject: [PATCH 57/82] Add solution 1640 --- ...k Array Formation Through Concatenation.go | 26 +++++ ...ay Formation Through Concatenation_test.go | 63 ++++++++++++ .../README.md | 95 +++++++++++++++++++ ...k-Array-Formation-Through-Concatenation.md | 95 +++++++++++++++++++ website/content/menu/index.md | 1 + 5 files changed, 280 insertions(+) create mode 100644 leetcode/1640.Check-Array-Formation-Through-Concatenation/1640. Check Array Formation Through Concatenation.go create mode 100644 leetcode/1640.Check-Array-Formation-Through-Concatenation/1640. Check Array Formation Through Concatenation_test.go create mode 100644 leetcode/1640.Check-Array-Formation-Through-Concatenation/README.md create mode 100644 website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md diff --git a/leetcode/1640.Check-Array-Formation-Through-Concatenation/1640. Check Array Formation Through Concatenation.go b/leetcode/1640.Check-Array-Formation-Through-Concatenation/1640. Check Array Formation Through Concatenation.go new file mode 100644 index 00000000..384022e2 --- /dev/null +++ b/leetcode/1640.Check-Array-Formation-Through-Concatenation/1640. Check Array Formation Through Concatenation.go @@ -0,0 +1,26 @@ +package leetcode + +func canFormArray(arr []int, pieces [][]int) bool { + arrMap := map[int]int{} + for i, v := range arr { + arrMap[v] = i + } + for i := 0; i < len(pieces); i++ { + order := -1 + for j := 0; j < len(pieces[i]); j++ { + if _, ok := arrMap[pieces[i][j]]; !ok { + return false + } + if order == -1 { + order = arrMap[pieces[i][j]] + } else { + if arrMap[pieces[i][j]] == order+1 { + order = arrMap[pieces[i][j]] + } else { + return false + } + } + } + } + return true +} diff --git a/leetcode/1640.Check-Array-Formation-Through-Concatenation/1640. Check Array Formation Through Concatenation_test.go b/leetcode/1640.Check-Array-Formation-Through-Concatenation/1640. Check Array Formation Through Concatenation_test.go new file mode 100644 index 00000000..39b3a717 --- /dev/null +++ b/leetcode/1640.Check-Array-Formation-Through-Concatenation/1640. Check Array Formation Through Concatenation_test.go @@ -0,0 +1,63 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1640 struct { + para1640 + ans1640 +} + +// para 是参数 +// one 代表第一个参数 +type para1640 struct { + arr []int + pieces [][]int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1640 struct { + one bool +} + +func Test_Problem1640(t *testing.T) { + + qs := []question1640{ + + { + para1640{[]int{85}, [][]int{{85}}}, + ans1640{true}, + }, + + { + para1640{[]int{15, 88}, [][]int{{88}, {15}}}, + ans1640{true}, + }, + + { + para1640{[]int{49, 18, 16}, [][]int{{16, 18, 49}}}, + ans1640{false}, + }, + + { + para1640{[]int{91, 4, 64, 78}, [][]int{{78}, {4, 64}, {91}}}, + ans1640{true}, + }, + + { + para1640{[]int{1, 3, 5, 7}, [][]int{{2, 4, 6, 8}}}, + ans1640{false}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1640------------------------\n") + + for _, q := range qs { + _, p := q.ans1640, q.para1640 + fmt.Printf("【input】:%v 【output】:%v \n", p, canFormArray(p.arr, p.pieces)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1640.Check-Array-Formation-Through-Concatenation/README.md b/leetcode/1640.Check-Array-Formation-Through-Concatenation/README.md new file mode 100644 index 00000000..86498177 --- /dev/null +++ b/leetcode/1640.Check-Array-Formation-Through-Concatenation/README.md @@ -0,0 +1,95 @@ +# [1640. Check Array Formation Through Concatenation](https://leetcode.com/problems/check-array-formation-through-concatenation/) + + +## 题目 + +You are given an array of **distinct** integers `arr` and an array of integer arrays `pieces`, where the integers in `pieces` are **distinct**. Your goal is to form `arr` by concatenating the arrays in `pieces` **in any order**. However, you are **not** allowed to reorder the integers in each array `pieces[i]`. + +Return `true` *if it is possible to form the array* `arr` *from* `pieces`. Otherwise, return `false`. + +**Example 1:** + +``` +Input: arr = [85], pieces = [[85]] +Output: true +``` + +**Example 2:** + +``` +Input: arr = [15,88], pieces = [[88],[15]] +Output: true +Explanation: Concatenate [15] then [88] +``` + +**Example 3:** + +``` +Input: arr = [49,18,16], pieces = [[16,18,49]] +Output: false +Explanation: Even though the numbers match, we cannot reorder pieces[0]. +``` + +**Example 4:** + +``` +Input: arr = [91,4,64,78], pieces = [[78],[4,64],[91]] +Output: true +Explanation: Concatenate [91] then [4,64] then [78] +``` + +**Example 5:** + +``` +Input: arr = [1,3,5,7], pieces = [[2,4,6,8]] +Output: false + +``` + +**Constraints:** + +- `1 <= pieces.length <= arr.length <= 100` +- `sum(pieces[i].length) == arr.length` +- `1 <= pieces[i].length <= arr.length` +- `1 <= arr[i], pieces[i][j] <= 100` +- The integers in `arr` are **distinct**. +- The integers in `pieces` are **distinct** (i.e., If we flatten pieces in a 1D array, all the integers in this array are distinct). + +## 题目大意 + +给你一个整数数组 arr ,数组中的每个整数 互不相同 。另有一个由整数数组构成的数组 pieces,其中的整数也 互不相同 。请你以 任意顺序 连接 pieces 中的数组以形成 arr 。但是,不允许 对每个数组 pieces[i] 中的整数重新排序。如果可以连接 pieces 中的数组形成 arr ,返回 true ;否则,返回 false 。 + +## 解题思路 + +- 简单题。题目保证了 arr 中的元素唯一,所以可以用 map 把每个元素的 index 存起来,方便查找。遍历 pieces 数组,在每个一维数组中判断元素顺序是否和原 arr 元素相对顺序一致。这个时候就用 map 查找,如果顺序是一一相连的,那么就是正确的。有一个顺序不是一一相连,或者出现了 arr 不存在的元素,都返回 false。 + +## 代码 + +```go +package leetcode + +func canFormArray(arr []int, pieces [][]int) bool { + arrMap := map[int]int{} + for i, v := range arr { + arrMap[v] = i + } + for i := 0; i < len(pieces); i++ { + order := -1 + for j := 0; j < len(pieces[i]); j++ { + if _, ok := arrMap[pieces[i][j]]; !ok { + return false + } + if order == -1 { + order = arrMap[pieces[i][j]] + } else { + if arrMap[pieces[i][j]] == order+1 { + order = arrMap[pieces[i][j]] + } else { + return false + } + } + } + } + return true +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md b/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md new file mode 100644 index 00000000..86498177 --- /dev/null +++ b/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md @@ -0,0 +1,95 @@ +# [1640. Check Array Formation Through Concatenation](https://leetcode.com/problems/check-array-formation-through-concatenation/) + + +## 题目 + +You are given an array of **distinct** integers `arr` and an array of integer arrays `pieces`, where the integers in `pieces` are **distinct**. Your goal is to form `arr` by concatenating the arrays in `pieces` **in any order**. However, you are **not** allowed to reorder the integers in each array `pieces[i]`. + +Return `true` *if it is possible to form the array* `arr` *from* `pieces`. Otherwise, return `false`. + +**Example 1:** + +``` +Input: arr = [85], pieces = [[85]] +Output: true +``` + +**Example 2:** + +``` +Input: arr = [15,88], pieces = [[88],[15]] +Output: true +Explanation: Concatenate [15] then [88] +``` + +**Example 3:** + +``` +Input: arr = [49,18,16], pieces = [[16,18,49]] +Output: false +Explanation: Even though the numbers match, we cannot reorder pieces[0]. +``` + +**Example 4:** + +``` +Input: arr = [91,4,64,78], pieces = [[78],[4,64],[91]] +Output: true +Explanation: Concatenate [91] then [4,64] then [78] +``` + +**Example 5:** + +``` +Input: arr = [1,3,5,7], pieces = [[2,4,6,8]] +Output: false + +``` + +**Constraints:** + +- `1 <= pieces.length <= arr.length <= 100` +- `sum(pieces[i].length) == arr.length` +- `1 <= pieces[i].length <= arr.length` +- `1 <= arr[i], pieces[i][j] <= 100` +- The integers in `arr` are **distinct**. +- The integers in `pieces` are **distinct** (i.e., If we flatten pieces in a 1D array, all the integers in this array are distinct). + +## 题目大意 + +给你一个整数数组 arr ,数组中的每个整数 互不相同 。另有一个由整数数组构成的数组 pieces,其中的整数也 互不相同 。请你以 任意顺序 连接 pieces 中的数组以形成 arr 。但是,不允许 对每个数组 pieces[i] 中的整数重新排序。如果可以连接 pieces 中的数组形成 arr ,返回 true ;否则,返回 false 。 + +## 解题思路 + +- 简单题。题目保证了 arr 中的元素唯一,所以可以用 map 把每个元素的 index 存起来,方便查找。遍历 pieces 数组,在每个一维数组中判断元素顺序是否和原 arr 元素相对顺序一致。这个时候就用 map 查找,如果顺序是一一相连的,那么就是正确的。有一个顺序不是一一相连,或者出现了 arr 不存在的元素,都返回 false。 + +## 代码 + +```go +package leetcode + +func canFormArray(arr []int, pieces [][]int) bool { + arrMap := map[int]int{} + for i, v := range arr { + arrMap[v] = i + } + for i := 0; i < len(pieces); i++ { + order := -1 + for j := 0; j < len(pieces[i]); j++ { + if _, ok := arrMap[pieces[i][j]]; !ok { + return false + } + if order == -1 { + order = arrMap[pieces[i][j]] + } else { + if arrMap[pieces[i][j]] == order+1 { + order = arrMap[pieces[i][j]] + } else { + return false + } + } + } + } + return true +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 71a9c59c..6072a543 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -551,6 +551,7 @@ headless: true - [1480.Running-Sum-of-1d-Array]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}}) - [1512.Number-of-Good-Pairs]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}}) - [1573.Number-of-Ways-to-Split-a-String]({{< relref "/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md" >}}) + - [1640.Check-Array-Formation-Through-Concatenation]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}}) - [1646.Get-Maximum-in-Generated-Array]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}}) - [1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}}) - [1648.Sell-Diminishing-Valued-Colored-Balls]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}}) From 3e2d511c6b73783bd5600483819cec2c044b2087 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sat, 2 Jan 2021 01:04:43 +0800 Subject: [PATCH 58/82] Optimization solution 0015 --- leetcode/0015.3Sum/15. 3Sum.go | 37 +++++++++++++++++++++++ website/content/ChapterFour/0015.3Sum.md | 38 ++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/leetcode/0015.3Sum/15. 3Sum.go b/leetcode/0015.3Sum/15. 3Sum.go index ea643c8c..7b6bd93e 100644 --- a/leetcode/0015.3Sum/15. 3Sum.go +++ b/leetcode/0015.3Sum/15. 3Sum.go @@ -4,7 +4,44 @@ import ( "sort" ) +// 解法一 最优解,双指针 + 排序 func threeSum(nums []int) [][]int { + sort.Ints(nums) + result, start, end, index, addNum, length := make([][]int, 0), 0, 0, 0, 0, len(nums) + if length > 0 && (nums[0] > 0 || nums[length-1] < 0) { + return result + } + for index = 1; index < length-1; index++ { + start, end = 0, length-1 + if index > 1 && nums[index] == nums[index-1] { + start = index - 1 + } + for start < index && end > index { + if start > 0 && nums[start] == nums[start-1] { + start++ + continue + } + if end < length-1 && nums[end] == nums[end+1] { + end-- + continue + } + addNum = nums[start] + nums[end] + nums[index] + if addNum == 0 { + result = append(result, []int{nums[start], nums[index], nums[end]}) + start++ + end-- + } else if addNum > 0 { + end-- + } else { + start++ + } + } + } + return result +} + +// 解法二 +func threeSum1(nums []int) [][]int { res := [][]int{} counter := map[int]int{} for _, value := range nums { diff --git a/website/content/ChapterFour/0015.3Sum.md b/website/content/ChapterFour/0015.3Sum.md index 454f3aee..e2d9af95 100644 --- a/website/content/ChapterFour/0015.3Sum.md +++ b/website/content/ChapterFour/0015.3Sum.md @@ -42,7 +42,44 @@ import ( "sort" ) +// 解法一 最优解,双指针 + 排序 func threeSum(nums []int) [][]int { + sort.Ints(nums) + result, start, end, index, addNum, length := make([][]int, 0), 0, 0, 0, 0, len(nums) + if length > 0 && (nums[0] > 0 || nums[length-1] < 0) { + return result + } + for index = 1; index < length-1; index++ { + start, end = 0, length-1 + if index > 1 && nums[index] == nums[index-1] { + start = index - 1 + } + for start < index && end > index { + if start > 0 && nums[start] == nums[start-1] { + start++ + continue + } + if end < length-1 && nums[end] == nums[end+1] { + end-- + continue + } + addNum = nums[start] + nums[end] + nums[index] + if addNum == 0 { + result = append(result, []int{nums[start], nums[index], nums[end]}) + start++ + end-- + } else if addNum > 0 { + end-- + } else { + start++ + } + } + } + return result +} + +// 解法二 +func threeSum1(nums []int) [][]int { res := [][]int{} counter := map[int]int{} for _, value := range nums { @@ -76,6 +113,7 @@ func threeSum(nums []int) [][]int { } + ``` From fb72c855ee2bd647508c59e507c40f46e6f80345 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sat, 2 Jan 2021 01:14:29 +0800 Subject: [PATCH 59/82] Modify solution 0164 --- leetcode/0164.Maximum-Gap/164. Maximum Gap.go | 17 +++---------- .../0164.Maximum-Gap/164. Maximum Gap_test.go | 5 ++++ .../content/ChapterFour/0164.Maximum-Gap.md | 25 ++++++++----------- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/leetcode/0164.Maximum-Gap/164. Maximum Gap.go b/leetcode/0164.Maximum-Gap/164. Maximum Gap.go index bfe40b51..120334ff 100644 --- a/leetcode/0164.Maximum-Gap/164. Maximum Gap.go +++ b/leetcode/0164.Maximum-Gap/164. Maximum Gap.go @@ -1,12 +1,11 @@ package leetcode -// 解法一 +// 解法一 快排 func maximumGap(nums []int) int { if len(nums) < 2 { return 0 } quickSort164(nums, 0, len(nums)-1) - res := 0 for i := 0; i < len(nums)-1; i++ { if (nums[i+1] - nums[i]) > res { @@ -37,52 +36,42 @@ func quickSort164(a []int, lo, hi int) { quickSort164(a, p+1, hi) } -// 解法二 +// 解法二 基数排序 func maximumGap1(nums []int) int { - if nums == nil || len(nums) < 2 { return 0 } - // m is the maximal number in nums m := nums[0] for i := 1; i < len(nums); i++ { m = max(m, nums[i]) } - exp := 1 // 1, 10, 100, 1000 ... R := 10 // 10 digits - aux := make([]int, len(nums)) - for (m / exp) > 0 { // Go through all digits from LSB to MSB count := make([]int, R) - for i := 0; i < len(nums); i++ { count[(nums[i]/exp)%10]++ } - for i := 1; i < len(count); i++ { count[i] += count[i-1] } - for i := len(nums) - 1; i >= 0; i-- { tmp := count[(nums[i]/exp)%10] tmp-- aux[tmp] = nums[i] + count[(nums[i]/exp)%10] = tmp } - for i := 0; i < len(nums); i++ { nums[i] = aux[i] } exp *= 10 } - maxValue := 0 for i := 1; i < len(aux); i++ { maxValue = max(maxValue, aux[i]-aux[i-1]) } - return maxValue } diff --git a/leetcode/0164.Maximum-Gap/164. Maximum Gap_test.go b/leetcode/0164.Maximum-Gap/164. Maximum Gap_test.go index 6030dfe2..db38fb38 100644 --- a/leetcode/0164.Maximum-Gap/164. Maximum Gap_test.go +++ b/leetcode/0164.Maximum-Gap/164. Maximum Gap_test.go @@ -49,6 +49,11 @@ func Test_Problem164(t *testing.T) { para164{[]int{2, 435, 214, 64321, 643, 7234, 7, 436523, 7856, 8}}, ans164{372202}, }, + + { + para164{[]int{1, 10000000}}, + ans164{9999999}, + }, } fmt.Printf("------------------------Leetcode Problem 164------------------------\n") diff --git a/website/content/ChapterFour/0164.Maximum-Gap.md b/website/content/ChapterFour/0164.Maximum-Gap.md index e1579e67..b830a74c 100644 --- a/website/content/ChapterFour/0164.Maximum-Gap.md +++ b/website/content/ChapterFour/0164.Maximum-Gap.md @@ -51,13 +51,12 @@ Explanation: The array contains less than 2 elements, therefore return 0. package leetcode -// 解法一 +// 解法一 快排 func maximumGap(nums []int) int { if len(nums) < 2 { return 0 } quickSort164(nums, 0, len(nums)-1) - res := 0 for i := 0; i < len(nums)-1; i++ { if (nums[i+1] - nums[i]) > res { @@ -88,53 +87,51 @@ func quickSort164(a []int, lo, hi int) { quickSort164(a, p+1, hi) } -// 解法二 +// 解法二 基数排序 func maximumGap1(nums []int) int { - if nums == nil || len(nums) < 2 { return 0 } - // m is the maximal number in nums m := nums[0] for i := 1; i < len(nums); i++ { m = max(m, nums[i]) } - exp := 1 // 1, 10, 100, 1000 ... R := 10 // 10 digits - aux := make([]int, len(nums)) - for (m / exp) > 0 { // Go through all digits from LSB to MSB count := make([]int, R) - for i := 0; i < len(nums); i++ { count[(nums[i]/exp)%10]++ } - for i := 1; i < len(count); i++ { count[i] += count[i-1] } - for i := len(nums) - 1; i >= 0; i-- { tmp := count[(nums[i]/exp)%10] tmp-- aux[tmp] = nums[i] + count[(nums[i]/exp)%10] = tmp } - for i := 0; i < len(nums); i++ { nums[i] = aux[i] } exp *= 10 } - maxValue := 0 for i := 1; i < len(aux); i++ { maxValue = max(maxValue, aux[i]-aux[i-1]) } - return maxValue } +func max(a int, b int) int { + if a > b { + return a + } + return b +} + + ``` \ No newline at end of file From 38aa0acb0dd552f196b49f089a56d20a0aa42c19 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 3 Jan 2021 23:48:14 +0800 Subject: [PATCH 60/82] Add LFU/LRU template --- template/LFUCache.go | 196 +++++++++++++++++++++++++++++++++++++++++++ template/LRUCache.go | 139 ++++++++++++++++++++++++++++++ 2 files changed, 335 insertions(+) create mode 100644 template/LFUCache.go create mode 100644 template/LRUCache.go diff --git a/template/LFUCache.go b/template/LFUCache.go new file mode 100644 index 00000000..74a8a9a9 --- /dev/null +++ b/template/LFUCache.go @@ -0,0 +1,196 @@ +package template + +import "container/list" + +// LFUCache define +type LFUCache struct { + nodes map[int]*list.Element + lists map[int]*list.List + capacity int + min int +} + +type node struct { + key int + value int + frequency int +} + +// Constructor define +func Constructor(capacity int) LFUCache { + return LFUCache{nodes: make(map[int]*list.Element), + lists: make(map[int]*list.List), + capacity: capacity, + min: 0, + } +} + +// Get define +func (lfuCache *LFUCache) Get(key int) int { + value, ok := lfuCache.nodes[key] + if !ok { + return -1 + } + currentNode := value.Value.(*node) + lfuCache.lists[currentNode.frequency].Remove(value) + currentNode.frequency++ + if _, ok := lfuCache.lists[currentNode.frequency]; !ok { + lfuCache.lists[currentNode.frequency] = list.New() + } + newList := lfuCache.lists[currentNode.frequency] + newNode := newList.PushFront(currentNode) + lfuCache.nodes[key] = newNode + if currentNode.frequency-1 == lfuCache.min && lfuCache.lists[currentNode.frequency-1].Len() == 0 { + lfuCache.min++ + } + return currentNode.value +} + +// Put define +func (lfuCache *LFUCache) Put(key int, value int) { + if lfuCache.capacity == 0 { + return + } + if currentValue, ok := lfuCache.nodes[key]; ok { + currentNode := currentValue.Value.(*node) + currentNode.value = value + lfuCache.Get(key) + return + } + if lfuCache.capacity == len(lfuCache.nodes) { + currentList := lfuCache.lists[lfuCache.min] + backNode := currentList.Back() + delete(lfuCache.nodes, backNode.Value.(*node).key) + currentList.Remove(backNode) + } + lfuCache.min = 1 + currentNode := &node{ + key: key, + value: value, + frequency: 1, + } + if _, ok := lfuCache.lists[1]; !ok { + lfuCache.lists[1] = list.New() + } + newList := lfuCache.lists[1] + newNode := newList.PushFront(currentNode) + lfuCache.nodes[key] = newNode +} + +/** + * Your LFUCache object will be instantiated and called as such: + * obj := Constructor(capacity); + * param_1 := obj.Get(key); + * obj.Put(key,value); + */ + +// Index Priority Queue +// import "container/heap" + +// type LFUCache struct { +// capacity int +// pq PriorityQueue +// hash map[int]*Item +// counter int +// } + +// func Constructor(capacity int) LFUCache { +// lfu := LFUCache{ +// pq: PriorityQueue{}, +// hash: make(map[int]*Item, capacity), +// capacity: capacity, +// } +// return lfu +// } + +// func (this *LFUCache) Get(key int) int { +// if this.capacity == 0 { +// return -1 +// } +// if item, ok := this.hash[key]; ok { +// this.counter++ +// this.pq.update(item, item.value, item.frequency+1, this.counter) +// return item.value +// } +// return -1 +// } + +// func (this *LFUCache) Put(key int, value int) { +// if this.capacity == 0 { +// return +// } +// // fmt.Printf("Put %d\n", key) +// this.counter++ +// // 如果存在,增加 frequency,再调整堆 +// if item, ok := this.hash[key]; ok { +// this.pq.update(item, value, item.frequency+1, this.counter) +// return +// } +// // 如果不存在且缓存满了,需要删除。在 hashmap 和 pq 中删除。 +// if len(this.pq) == this.capacity { +// item := heap.Pop(&this.pq).(*Item) +// delete(this.hash, item.key) +// } +// // 新建结点,在 hashmap 和 pq 中添加。 +// item := &Item{ +// value: value, +// key: key, +// count: this.counter, +// } +// heap.Push(&this.pq, item) +// this.hash[key] = item +// } + +// // An Item is something we manage in a priority queue. +// type Item struct { +// value int // The value of the item; arbitrary. +// key int +// frequency int // The priority of the item in the queue. +// count int // use for evicting the oldest element +// // The index is needed by update and is maintained by the heap.Interface methods. +// index int // The index of the item in the heap. +// } + +// // A PriorityQueue implements heap.Interface and holds Items. +// type PriorityQueue []*Item + +// func (pq PriorityQueue) Len() int { return len(pq) } + +// func (pq PriorityQueue) Less(i, j int) bool { +// // We want Pop to give us the highest, not lowest, priority so we use greater than here. +// if pq[i].frequency == pq[j].frequency { +// return pq[i].count < pq[j].count +// } +// return pq[i].frequency < pq[j].frequency +// } + +// func (pq PriorityQueue) Swap(i, j int) { +// pq[i], pq[j] = pq[j], pq[i] +// pq[i].index = i +// pq[j].index = j +// } + +// func (pq *PriorityQueue) Push(x interface{}) { +// n := len(*pq) +// item := x.(*Item) +// item.index = n +// *pq = append(*pq, item) +// } + +// func (pq *PriorityQueue) Pop() interface{} { +// old := *pq +// n := len(old) +// item := old[n-1] +// old[n-1] = nil // avoid memory leak +// item.index = -1 // for safety +// *pq = old[0 : n-1] +// return item +// } + +// // update modifies the priority and value of an Item in the queue. +// func (pq *PriorityQueue) update(item *Item, value int, frequency int, count int) { +// item.value = value +// item.count = count +// item.frequency = frequency +// heap.Fix(pq, item.index) +// } diff --git a/template/LRUCache.go b/template/LRUCache.go new file mode 100644 index 00000000..581f42a8 --- /dev/null +++ b/template/LRUCache.go @@ -0,0 +1,139 @@ +package template + +// LRUCache define +type LRUCache struct { + head, tail *Node + keys map[int]*Node + capacity int +} + +// Node define +type Node struct { + key, val int + prev, next *Node +} + +// ConstructorLRU define +func ConstructorLRU(capacity int) LRUCache { + return LRUCache{keys: make(map[int]*Node), capacity: capacity} +} + +// Get define +func (lruCache *LRUCache) Get(key int) int { + if node, ok := lruCache.keys[key]; ok { + lruCache.Remove(node) + lruCache.Add(node) + return node.val + } + return -1 +} + +// Put define +func (lruCache *LRUCache) Put(key int, value int) { + node, ok := lruCache.keys[key] + if ok { + node.val = value + lruCache.Remove(node) + lruCache.Add(node) + return + } + node = &Node{key: key, val: value} + lruCache.keys[key] = node + lruCache.Add(node) + if len(lruCache.keys) > lruCache.capacity { + delete(lruCache.keys, lruCache.tail.key) + lruCache.Remove(lruCache.tail) + } +} + +// Add define +func (lruCache *LRUCache) Add(node *Node) { + node.prev = nil + node.next = lruCache.head + if lruCache.head != nil { + lruCache.head.prev = node + } + lruCache.head = node + if lruCache.tail == nil { + lruCache.tail = node + lruCache.tail.next = nil + } +} + +// Remove define +func (lruCache *LRUCache) Remove(node *Node) { + if node == lruCache.head { + lruCache.head = node.next + if node.next != nil { + node.next.prev = nil + } + node.next = nil + return + } + if node == lruCache.tail { + lruCache.tail = node.prev + node.prev.next = nil + node.prev = nil + return + } + node.prev.next = node.next + node.next.prev = node.prev +} + +/** + * Your LRUCache object will be instantiated and called as such: + * obj := Constructor(capacity); + * param_1 := obj.Get(key); + * obj.Put(key,value); + */ + +// 22% +// import "container/list" + +// type LRUCache struct { +// Cap int +// Keys map[int]*list.Element +// List *list.List +// } + +// type pair struct { +// K, V int +// } + +// func Constructor(capacity int) LRUCache { +// return LRUCache{ +// Cap: capacity, +// Keys: make(map[int]*list.Element), +// List: list.New(), +// } +// } + +// func (c *LRUCache) Get(key int) int { +// if el, ok := c.Keys[key]; ok { +// c.List.MoveToFront(el) +// return el.Value.(pair).V +// } +// return -1 +// } + +// func (c *LRUCache) Put(key int, value int) { +// if el, ok := c.Keys[key]; ok { +// el.Value = pair{K: key, V: value} +// c.List.MoveToFront(el) +// } else { +// el := c.List.PushFront(pair{K: key, V: value}) +// c.Keys[key] = el +// } +// if c.List.Len() > c.Cap { +// el := c.List.Back() +// c.List.Remove(el) +// delete(c.Keys, el.Value.(pair).K) +// } +// } + +/** + * Your LRUCache object will be instantiated and called as such: + * obj := Constructor(capacity); + * param_1 := obj.Get(key); + * obj.Put(key,value); + */ From 7bc6c9d9a00c5914235c7e86b7f36dfe808744cb Mon Sep 17 00:00:00 2001 From: YDZ Date: Mon, 4 Jan 2021 00:13:00 +0800 Subject: [PATCH 61/82] =?UTF-8?q?Add=20solution=20146=E3=80=81460?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- leetcode/0146.LRU-Cache/146. LRU Cache.go | 71 +++++++++ .../0146.LRU-Cache/146. LRU Cache_test.go | 40 +++++ leetcode/0146.LRU-Cache/README.md | 134 +++++++++++++++++ leetcode/0460.LFU-Cache/460. LFU Cache.go | 74 +++++++++ .../0460.LFU-Cache/460. LFU Cache_test.go | 64 ++++++++ leetcode/0460.LFU-Cache/README.md | 142 ++++++++++++++++++ website/content/ChapterFour/0146.LRU-Cache.md | 134 +++++++++++++++++ website/content/ChapterFour/0460.LFU-Cache.md | 142 ++++++++++++++++++ website/content/menu/index.md | 2 + 9 files changed, 803 insertions(+) create mode 100644 leetcode/0146.LRU-Cache/146. LRU Cache.go create mode 100644 leetcode/0146.LRU-Cache/146. LRU Cache_test.go create mode 100644 leetcode/0146.LRU-Cache/README.md create mode 100644 leetcode/0460.LFU-Cache/460. LFU Cache.go create mode 100644 leetcode/0460.LFU-Cache/460. LFU Cache_test.go create mode 100644 leetcode/0460.LFU-Cache/README.md create mode 100644 website/content/ChapterFour/0146.LRU-Cache.md create mode 100644 website/content/ChapterFour/0460.LFU-Cache.md diff --git a/leetcode/0146.LRU-Cache/146. LRU Cache.go b/leetcode/0146.LRU-Cache/146. LRU Cache.go new file mode 100644 index 00000000..f7a1ae05 --- /dev/null +++ b/leetcode/0146.LRU-Cache/146. LRU Cache.go @@ -0,0 +1,71 @@ +package leetcode + +type LRUCache struct { + head, tail *Node + Keys map[int]*Node + Cap int +} + +type Node struct { + Key, Val int + Prev, Next *Node +} + +func Constructor(capacity int) LRUCache { + return LRUCache{Keys: make(map[int]*Node), Cap: capacity} +} + +func (this *LRUCache) Get(key int) int { + if node, ok := this.Keys[key]; ok { + this.Remove(node) + this.Add(node) + return node.Val + } + return -1 +} + +func (this *LRUCache) Put(key int, value int) { + if node, ok := this.Keys[key]; ok { + node.Val = value + this.Remove(node) + this.Add(node) + return + } else { + node = &Node{Key: key, Val: value} + this.Keys[key] = node + this.Add(node) + } + if len(this.Keys) > this.Cap { + delete(this.Keys, this.tail.Key) + this.Remove(this.tail) + } +} + +func (this *LRUCache) Add(node *Node) { + node.Prev = nil + node.Next = this.head + if this.head != nil { + this.head.Prev = node + } + this.head = node + if this.tail == nil { + this.tail = node + this.tail.Next = nil + } +} + +func (this *LRUCache) Remove(node *Node) { + if node == this.head { + this.head = node.Next + node.Next = nil + return + } + if node == this.tail { + this.tail = node.Prev + node.Prev.Next = nil + node.Prev = nil + return + } + node.Prev.Next = node.Next + node.Next.Prev = node.Prev +} diff --git a/leetcode/0146.LRU-Cache/146. LRU Cache_test.go b/leetcode/0146.LRU-Cache/146. LRU Cache_test.go new file mode 100644 index 00000000..27747f8c --- /dev/null +++ b/leetcode/0146.LRU-Cache/146. LRU Cache_test.go @@ -0,0 +1,40 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +func Test_Problem147(t *testing.T) { + obj := Constructor(2) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + obj.Put(1, 1) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + obj.Put(2, 2) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + param1 := obj.Get(1) + fmt.Printf("param_1 = %v obj = %v\n", param1, MList2Ints(&obj)) + obj.Put(3, 3) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + param1 = obj.Get(2) + fmt.Printf("param_1 = %v obj = %v\n", param1, MList2Ints(&obj)) + obj.Put(4, 4) + fmt.Printf("obj = %v\n", MList2Ints(&obj)) + param1 = obj.Get(1) + fmt.Printf("param_1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.Get(3) + fmt.Printf("param_1 = %v obj = %v\n", param1, MList2Ints(&obj)) + param1 = obj.Get(4) + fmt.Printf("param_1 = %v obj = %v\n", param1, MList2Ints(&obj)) +} + +func MList2Ints(lru *LRUCache) [][]int { + res := [][]int{} + head := lru.head + for head != nil { + tmp := []int{head.Key, head.Val} + res = append(res, tmp) + head = head.Next + } + return res +} diff --git a/leetcode/0146.LRU-Cache/README.md b/leetcode/0146.LRU-Cache/README.md new file mode 100644 index 00000000..4f252945 --- /dev/null +++ b/leetcode/0146.LRU-Cache/README.md @@ -0,0 +1,134 @@ +# [146. LRU Cache](https://leetcode.com/problems/lru-cache/) + +## 题目 + +Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**. + +Implement the `LRUCache` class: + +- `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`. +- `int get(int key)` Return the value of the `key` if the key exists, otherwise return `1`. +- `void put(int key, int value)` Update the value of the `key` if the `key` exists. Otherwise, add the `key-value` pair to the cache. If the number of keys exceeds the `capacity` from this operation, **evict** the least recently used key. + +**Follow up:**Could you do `get` and `put` in `O(1)` time complexity? + +**Example 1:** + +``` +Input +["LRUCache", "put", "put", "get", "put", "get", "put", "get", "get", "get"] +[[2], [1, 1], [2, 2], [1], [3, 3], [2], [4, 4], [1], [3], [4]] +Output +[null, null, null, 1, null, -1, null, -1, 3, 4] + +Explanation +LRUCache lRUCache = new LRUCache(2); +lRUCache.put(1, 1); // cache is {1=1} +lRUCache.put(2, 2); // cache is {1=1, 2=2} +lRUCache.get(1); // return 1 +lRUCache.put(3, 3); // LRU key was 2, evicts key 2, cache is {1=1, 3=3} +lRUCache.get(2); // returns -1 (not found) +lRUCache.put(4, 4); // LRU key was 1, evicts key 1, cache is {4=4, 3=3} +lRUCache.get(1); // return -1 (not found) +lRUCache.get(3); // return 3 +lRUCache.get(4); // return 4 + +``` + +**Constraints:** + +- `1 <= capacity <= 3000` +- `0 <= key <= 3000` +- `0 <= value <= 104` +- At most `3 * 104` calls will be made to `get` and `put`. + +## 题目大意 + +运用你所掌握的数据结构,设计和实现一个  LRU (最近最少使用) 缓存机制 。 +实现 LRUCache 类: + +- LRUCache(int capacity) 以正整数作为容量 capacity 初始化 LRU 缓存 +- int get(int key) 如果关键字 key 存在于缓存中,则返回关键字的值,否则返回 -1 。 +- void put(int key, int value) 如果关键字已经存在,则变更其数据值;如果关键字不存在,则插入该组「关键字-值」。当缓存容量达到上限时,它应该在写入新数据之前删除最久未使用的数据值,从而为新的数据值留出空间。 + +进阶:你是否可以在 O(1) 时间复杂度内完成这两种操作? + +## 解题思路 + +- 这一题是 LRU 经典面试题,详细解释见第三章模板。 + +## 代码 + +```go +package leetcode + +type LRUCache struct { + head, tail *Node + Keys map[int]*Node + Cap int +} + +type Node struct { + Key, Val int + Prev, Next *Node +} + +func Constructor(capacity int) LRUCache { + return LRUCache{Keys: make(map[int]*Node), Cap: capacity} +} + +func (this *LRUCache) Get(key int) int { + if node, ok := this.Keys[key]; ok { + this.Remove(node) + this.Add(node) + return node.Val + } + return -1 +} + +func (this *LRUCache) Put(key int, value int) { + if node, ok := this.Keys[key]; ok { + node.Val = value + this.Remove(node) + this.Add(node) + return + } else { + node = &Node{Key: key, Val: value} + this.Keys[key] = node + this.Add(node) + } + if len(this.Keys) > this.Cap { + delete(this.Keys, this.tail.Key) + this.Remove(this.tail) + } +} + +func (this *LRUCache) Add(node *Node) { + node.Prev = nil + node.Next = this.head + if this.head != nil { + this.head.Prev = node + } + this.head = node + if this.tail == nil { + this.tail = node + this.tail.Next = nil + } +} + +func (this *LRUCache) Remove(node *Node) { + if node == this.head { + this.head = node.Next + node.Next = nil + return + } + if node == this.tail { + this.tail = node.Prev + node.Prev.Next = nil + node.Prev = nil + return + } + node.Prev.Next = node.Next + node.Next.Prev = node.Prev +} +``` \ No newline at end of file diff --git a/leetcode/0460.LFU-Cache/460. LFU Cache.go b/leetcode/0460.LFU-Cache/460. LFU Cache.go new file mode 100644 index 00000000..e2a29f53 --- /dev/null +++ b/leetcode/0460.LFU-Cache/460. LFU Cache.go @@ -0,0 +1,74 @@ +package leetcode + +import "container/list" + +type LFUCache struct { + nodes map[int]*list.Element + lists map[int]*list.List + capacity int + min int +} + +type node struct { + key int + value int + frequency int +} + +func Constructor(capacity int) LFUCache { + return LFUCache{nodes: make(map[int]*list.Element), + lists: make(map[int]*list.List), + capacity: capacity, + min: 0, + } +} + +func (this *LFUCache) Get(key int) int { + value, ok := this.nodes[key] + if !ok { + return -1 + } + currentNode := value.Value.(*node) + this.lists[currentNode.frequency].Remove(value) + currentNode.frequency++ + if _, ok := this.lists[currentNode.frequency]; !ok { + this.lists[currentNode.frequency] = list.New() + } + newList := this.lists[currentNode.frequency] + newNode := newList.PushBack(currentNode) + this.nodes[key] = newNode + if currentNode.frequency-1 == this.min && this.lists[currentNode.frequency-1].Len() == 0 { + this.min++ + } + return currentNode.value +} + +func (this *LFUCache) Put(key int, value int) { + if this.capacity == 0 { + return + } + if currentValue, ok := this.nodes[key]; ok { + currentNode := currentValue.Value.(*node) + currentNode.value = value + this.Get(key) + return + } + if this.capacity == len(this.nodes) { + currentList := this.lists[this.min] + frontNode := currentList.Front() + delete(this.nodes, frontNode.Value.(*node).key) + currentList.Remove(frontNode) + } + this.min = 1 + currentNode := &node{ + key: key, + value: value, + frequency: 1, + } + if _, ok := this.lists[1]; !ok { + this.lists[1] = list.New() + } + newList := this.lists[1] + newNode := newList.PushBack(currentNode) + this.nodes[key] = newNode +} diff --git a/leetcode/0460.LFU-Cache/460. LFU Cache_test.go b/leetcode/0460.LFU-Cache/460. LFU Cache_test.go new file mode 100644 index 00000000..12205d94 --- /dev/null +++ b/leetcode/0460.LFU-Cache/460. LFU Cache_test.go @@ -0,0 +1,64 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +func Test_Problem460(t *testing.T) { + obj := Constructor(5) + fmt.Printf("obj.list = %v obj.map = %v obj.min = %v\n", MLists2Ints(&obj), MList2Ints(&obj), obj.min) + obj.Put(1, 1) + fmt.Printf("obj.list = %v obj.map = %v obj.min = %v\n", MLists2Ints(&obj), MList2Ints(&obj), obj.min) + obj.Put(2, 2) + fmt.Printf("obj.list = %v obj.map = %v obj.min = %v\n", MLists2Ints(&obj), MList2Ints(&obj), obj.min) + obj.Put(3, 3) + fmt.Printf("obj.list = %v obj.map = %v obj.min = %v\n", MLists2Ints(&obj), MList2Ints(&obj), obj.min) + obj.Put(4, 4) + fmt.Printf("obj.list = %v obj.map = %v obj.min = %v\n", MLists2Ints(&obj), MList2Ints(&obj), obj.min) + obj.Put(5, 5) + fmt.Printf("obj.list = %v obj.map = %v obj.min = %v\n", MLists2Ints(&obj), MList2Ints(&obj), obj.min) + + param1 := obj.Get(4) + fmt.Printf("param_1 = %v obj.list = %v obj.map = %v obj.min = %v\n", param1, MLists2Ints(&obj), MList2Ints(&obj), obj.min) + param1 = obj.Get(4) + fmt.Printf("param_1 = %v obj.list = %v obj.map = %v obj.min = %v\n", param1, MLists2Ints(&obj), MList2Ints(&obj), obj.min) + param1 = obj.Get(4) + fmt.Printf("param_1 = %v obj.list = %v obj.map = %v obj.min = %v\n", param1, MLists2Ints(&obj), MList2Ints(&obj), obj.min) + param1 = obj.Get(5) + fmt.Printf("param_1 = %v obj.list = %v obj.map = %v obj.min = %v\n", param1, MLists2Ints(&obj), MList2Ints(&obj), obj.min) + param1 = obj.Get(5) + fmt.Printf("param_1 = %v obj.list = %v obj.map = %v obj.min = %v\n", param1, MLists2Ints(&obj), MList2Ints(&obj), obj.min) + param1 = obj.Get(5) + fmt.Printf("param_1 = %v obj.list = %v obj.map = %v obj.min = %v\n", param1, MLists2Ints(&obj), MList2Ints(&obj), obj.min) + obj.Put(6, 6) + fmt.Printf("obj.list = %v obj.map = %v obj.min = %v\n", MLists2Ints(&obj), MList2Ints(&obj), obj.min) + obj.Put(7, 7) + fmt.Printf("obj.list = %v obj.map = %v obj.min = %v\n", MLists2Ints(&obj), MList2Ints(&obj), obj.min) + obj.Put(8, 8) + fmt.Printf("obj.list = %v obj.map = %v obj.min = %v\n", MLists2Ints(&obj), MList2Ints(&obj), obj.min) +} + +func MList2Ints(lfu *LFUCache) map[int][][]int { + res := map[int][][]int{} + for k, v := range lfu.nodes { + node := v.Value.(*node) + arr := [][]int{} + tmp := []int{node.key, node.value, node.frequency} + arr = append(arr, tmp) + res[k] = arr + } + return res +} + +func MLists2Ints(lfu *LFUCache) map[int][]int { + res := map[int][]int{} + for k, v := range lfu.lists { + tmp := []int{} + for head := v.Front(); head != nil; head = head.Next() { + tmp = append(tmp, head.Value.(*node).value) + } + res[k] = tmp + } + return res +} diff --git a/leetcode/0460.LFU-Cache/README.md b/leetcode/0460.LFU-Cache/README.md new file mode 100644 index 00000000..d47b03e9 --- /dev/null +++ b/leetcode/0460.LFU-Cache/README.md @@ -0,0 +1,142 @@ +# [460. LFU Cache](https://leetcode.com/problems/lfu-cache/) + + +## 题目 + +Design and implement a data structure for [Least Frequently Used (LFU)](https://en.wikipedia.org/wiki/Least_frequently_used) cache. + +Implement the `LFUCache` class: + +- `LFUCache(int capacity)` Initializes the object with the `capacity` of the data structure. +- `int get(int key)` Gets the value of the `key` if the `key` exists in the cache. Otherwise, returns `1`. +- `void put(int key, int value)` Sets or inserts the value if the `key` is not already present. When the cache reaches its `capacity`, it should invalidate the least frequently used item before inserting a new item. For this problem, when there is a tie (i.e., two or more keys with the same frequency), **the least recently** used `key` would be evicted. + +**Notice that** the number of times an item is used is the number of calls to the `get` and `put` functions for that item since it was inserted. This number is set to zero when the item is removed. + +**Example 1:** + +``` +Input +["LFUCache", "put", "put", "get", "put", "get", "get", "put", "get", "get", "get"] +[[2], [1, 1], [2, 2], [1], [3, 3], [2], [3], [4, 4], [1], [3], [4]] +Output +[null, null, null, 1, null, -1, 3, null, -1, 3, 4] + +Explanation +LFUCache lfu = new LFUCache(2); +lfu.put(1, 1); +lfu.put(2, 2); +lfu.get(1); // return 1 +lfu.put(3, 3); // evicts key 2 +lfu.get(2); // return -1 (not found) +lfu.get(3); // return 3 +lfu.put(4, 4); // evicts key 1. +lfu.get(1); // return -1 (not found) +lfu.get(3); // return 3 +lfu.get(4); // return 4 + +``` + +**Constraints:** + +- `0 <= capacity, key, value <= 104` +- At most `10^5` calls will be made to `get` and `put`. + +**Follow up:** Could you do both operations in `O(1)` time complexity? + +## 题目大意 + +请你为 最不经常使用(LFU)缓存算法设计并实现数据结构。 + +实现 LFUCache 类: + +- LFUCache(int capacity) - 用数据结构的容量 capacity 初始化对象 +- int get(int key) - 如果键存在于缓存中,则获取键的值,否则返回 -1。 +- void put(int key, int value) - 如果键已存在,则变更其值;如果键不存在,请插入键值对。当缓存达到其容量时,则应该在插入新项之前,使最不经常使用的项无效。在此问题中,当存在平局(即两个或更多个键具有相同使用频率)时,应该去除 最久未使用 的键。 + +注意「项的使用次数」就是自插入该项以来对其调用 get 和 put 函数的次数之和。使用次数会在对应项被移除后置为 0 。 + +进阶:你是否可以在 O(1) 时间复杂度内执行两项操作? + +## 解题思路 + +- 这一题是 LFU 经典面试题,详细解释见第三章模板。 + +## 代码 + +```go +package leetcode + +import "container/list" + +type LFUCache struct { + nodes map[int]*list.Element + lists map[int]*list.List + capacity int + min int +} + +type node struct { + key int + value int + frequency int +} + +func Constructor(capacity int) LFUCache { + return LFUCache{nodes: make(map[int]*list.Element), + lists: make(map[int]*list.List), + capacity: capacity, + min: 0, + } +} + +func (this *LFUCache) Get(key int) int { + value, ok := this.nodes[key] + if !ok { + return -1 + } + currentNode := value.Value.(*node) + this.lists[currentNode.frequency].Remove(value) + currentNode.frequency++ + if _, ok := this.lists[currentNode.frequency]; !ok { + this.lists[currentNode.frequency] = list.New() + } + newList := this.lists[currentNode.frequency] + newNode := newList.PushBack(currentNode) + this.nodes[key] = newNode + if currentNode.frequency-1 == this.min && this.lists[currentNode.frequency-1].Len() == 0 { + this.min++ + } + return currentNode.value +} + +func (this *LFUCache) Put(key int, value int) { + if this.capacity == 0 { + return + } + if currentValue, ok := this.nodes[key]; ok { + currentNode := currentValue.Value.(*node) + currentNode.value = value + this.Get(key) + return + } + if this.capacity == len(this.nodes) { + currentList := this.lists[this.min] + frontNode := currentList.Front() + delete(this.nodes, frontNode.Value.(*node).key) + currentList.Remove(frontNode) + } + this.min = 1 + currentNode := &node{ + key: key, + value: value, + frequency: 1, + } + if _, ok := this.lists[1]; !ok { + this.lists[1] = list.New() + } + newList := this.lists[1] + newNode := newList.PushBack(currentNode) + this.nodes[key] = newNode +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/0146.LRU-Cache.md b/website/content/ChapterFour/0146.LRU-Cache.md new file mode 100644 index 00000000..4f252945 --- /dev/null +++ b/website/content/ChapterFour/0146.LRU-Cache.md @@ -0,0 +1,134 @@ +# [146. LRU Cache](https://leetcode.com/problems/lru-cache/) + +## 题目 + +Design a data structure that follows the constraints of a **[Least Recently Used (LRU) cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU)**. + +Implement the `LRUCache` class: + +- `LRUCache(int capacity)` Initialize the LRU cache with **positive** size `capacity`. +- `int get(int key)` Return the value of the `key` if the key exists, otherwise return `1`. +- `void put(int key, int value)` Update the value of the `key` if the `key` exists. Otherwise, add the `key-value` pair to the cache. If the number of keys exceeds the `capacity` from this operation, **evict** the least recently used key. + +**Follow up:**Could you do `get` and `put` in `O(1)` time complexity? + +**Example 1:** + +``` +Input +["LRUCache", "put", "put", "get", "put", "get", "put", "get", "get", "get"] +[[2], [1, 1], [2, 2], [1], [3, 3], [2], [4, 4], [1], [3], [4]] +Output +[null, null, null, 1, null, -1, null, -1, 3, 4] + +Explanation +LRUCache lRUCache = new LRUCache(2); +lRUCache.put(1, 1); // cache is {1=1} +lRUCache.put(2, 2); // cache is {1=1, 2=2} +lRUCache.get(1); // return 1 +lRUCache.put(3, 3); // LRU key was 2, evicts key 2, cache is {1=1, 3=3} +lRUCache.get(2); // returns -1 (not found) +lRUCache.put(4, 4); // LRU key was 1, evicts key 1, cache is {4=4, 3=3} +lRUCache.get(1); // return -1 (not found) +lRUCache.get(3); // return 3 +lRUCache.get(4); // return 4 + +``` + +**Constraints:** + +- `1 <= capacity <= 3000` +- `0 <= key <= 3000` +- `0 <= value <= 104` +- At most `3 * 104` calls will be made to `get` and `put`. + +## 题目大意 + +运用你所掌握的数据结构,设计和实现一个  LRU (最近最少使用) 缓存机制 。 +实现 LRUCache 类: + +- LRUCache(int capacity) 以正整数作为容量 capacity 初始化 LRU 缓存 +- int get(int key) 如果关键字 key 存在于缓存中,则返回关键字的值,否则返回 -1 。 +- void put(int key, int value) 如果关键字已经存在,则变更其数据值;如果关键字不存在,则插入该组「关键字-值」。当缓存容量达到上限时,它应该在写入新数据之前删除最久未使用的数据值,从而为新的数据值留出空间。 + +进阶:你是否可以在 O(1) 时间复杂度内完成这两种操作? + +## 解题思路 + +- 这一题是 LRU 经典面试题,详细解释见第三章模板。 + +## 代码 + +```go +package leetcode + +type LRUCache struct { + head, tail *Node + Keys map[int]*Node + Cap int +} + +type Node struct { + Key, Val int + Prev, Next *Node +} + +func Constructor(capacity int) LRUCache { + return LRUCache{Keys: make(map[int]*Node), Cap: capacity} +} + +func (this *LRUCache) Get(key int) int { + if node, ok := this.Keys[key]; ok { + this.Remove(node) + this.Add(node) + return node.Val + } + return -1 +} + +func (this *LRUCache) Put(key int, value int) { + if node, ok := this.Keys[key]; ok { + node.Val = value + this.Remove(node) + this.Add(node) + return + } else { + node = &Node{Key: key, Val: value} + this.Keys[key] = node + this.Add(node) + } + if len(this.Keys) > this.Cap { + delete(this.Keys, this.tail.Key) + this.Remove(this.tail) + } +} + +func (this *LRUCache) Add(node *Node) { + node.Prev = nil + node.Next = this.head + if this.head != nil { + this.head.Prev = node + } + this.head = node + if this.tail == nil { + this.tail = node + this.tail.Next = nil + } +} + +func (this *LRUCache) Remove(node *Node) { + if node == this.head { + this.head = node.Next + node.Next = nil + return + } + if node == this.tail { + this.tail = node.Prev + node.Prev.Next = nil + node.Prev = nil + return + } + node.Prev.Next = node.Next + node.Next.Prev = node.Prev +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/0460.LFU-Cache.md b/website/content/ChapterFour/0460.LFU-Cache.md new file mode 100644 index 00000000..d47b03e9 --- /dev/null +++ b/website/content/ChapterFour/0460.LFU-Cache.md @@ -0,0 +1,142 @@ +# [460. LFU Cache](https://leetcode.com/problems/lfu-cache/) + + +## 题目 + +Design and implement a data structure for [Least Frequently Used (LFU)](https://en.wikipedia.org/wiki/Least_frequently_used) cache. + +Implement the `LFUCache` class: + +- `LFUCache(int capacity)` Initializes the object with the `capacity` of the data structure. +- `int get(int key)` Gets the value of the `key` if the `key` exists in the cache. Otherwise, returns `1`. +- `void put(int key, int value)` Sets or inserts the value if the `key` is not already present. When the cache reaches its `capacity`, it should invalidate the least frequently used item before inserting a new item. For this problem, when there is a tie (i.e., two or more keys with the same frequency), **the least recently** used `key` would be evicted. + +**Notice that** the number of times an item is used is the number of calls to the `get` and `put` functions for that item since it was inserted. This number is set to zero when the item is removed. + +**Example 1:** + +``` +Input +["LFUCache", "put", "put", "get", "put", "get", "get", "put", "get", "get", "get"] +[[2], [1, 1], [2, 2], [1], [3, 3], [2], [3], [4, 4], [1], [3], [4]] +Output +[null, null, null, 1, null, -1, 3, null, -1, 3, 4] + +Explanation +LFUCache lfu = new LFUCache(2); +lfu.put(1, 1); +lfu.put(2, 2); +lfu.get(1); // return 1 +lfu.put(3, 3); // evicts key 2 +lfu.get(2); // return -1 (not found) +lfu.get(3); // return 3 +lfu.put(4, 4); // evicts key 1. +lfu.get(1); // return -1 (not found) +lfu.get(3); // return 3 +lfu.get(4); // return 4 + +``` + +**Constraints:** + +- `0 <= capacity, key, value <= 104` +- At most `10^5` calls will be made to `get` and `put`. + +**Follow up:** Could you do both operations in `O(1)` time complexity? + +## 题目大意 + +请你为 最不经常使用(LFU)缓存算法设计并实现数据结构。 + +实现 LFUCache 类: + +- LFUCache(int capacity) - 用数据结构的容量 capacity 初始化对象 +- int get(int key) - 如果键存在于缓存中,则获取键的值,否则返回 -1。 +- void put(int key, int value) - 如果键已存在,则变更其值;如果键不存在,请插入键值对。当缓存达到其容量时,则应该在插入新项之前,使最不经常使用的项无效。在此问题中,当存在平局(即两个或更多个键具有相同使用频率)时,应该去除 最久未使用 的键。 + +注意「项的使用次数」就是自插入该项以来对其调用 get 和 put 函数的次数之和。使用次数会在对应项被移除后置为 0 。 + +进阶:你是否可以在 O(1) 时间复杂度内执行两项操作? + +## 解题思路 + +- 这一题是 LFU 经典面试题,详细解释见第三章模板。 + +## 代码 + +```go +package leetcode + +import "container/list" + +type LFUCache struct { + nodes map[int]*list.Element + lists map[int]*list.List + capacity int + min int +} + +type node struct { + key int + value int + frequency int +} + +func Constructor(capacity int) LFUCache { + return LFUCache{nodes: make(map[int]*list.Element), + lists: make(map[int]*list.List), + capacity: capacity, + min: 0, + } +} + +func (this *LFUCache) Get(key int) int { + value, ok := this.nodes[key] + if !ok { + return -1 + } + currentNode := value.Value.(*node) + this.lists[currentNode.frequency].Remove(value) + currentNode.frequency++ + if _, ok := this.lists[currentNode.frequency]; !ok { + this.lists[currentNode.frequency] = list.New() + } + newList := this.lists[currentNode.frequency] + newNode := newList.PushBack(currentNode) + this.nodes[key] = newNode + if currentNode.frequency-1 == this.min && this.lists[currentNode.frequency-1].Len() == 0 { + this.min++ + } + return currentNode.value +} + +func (this *LFUCache) Put(key int, value int) { + if this.capacity == 0 { + return + } + if currentValue, ok := this.nodes[key]; ok { + currentNode := currentValue.Value.(*node) + currentNode.value = value + this.Get(key) + return + } + if this.capacity == len(this.nodes) { + currentList := this.lists[this.min] + frontNode := currentList.Front() + delete(this.nodes, frontNode.Value.(*node).key) + currentList.Remove(frontNode) + } + this.min = 1 + currentNode := &node{ + key: key, + value: value, + frequency: 1, + } + if _, ok := this.lists[1]; !ok { + this.lists[1] = list.New() + } + newList := this.lists[1] + newNode := newList.PushBack(currentNode) + this.nodes[key] = newNode +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 6072a543..befac8a0 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -145,6 +145,7 @@ headless: true - [0143.Reorder-List]({{< relref "/ChapterFour/0143.Reorder-List.md" >}}) - [0144.Binary-Tree-Preorder-Traversal]({{< relref "/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md" >}}) - [0145.Binary-Tree-Postorder-Traversal]({{< relref "/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md" >}}) + - [0146.LRU-Cache]({{< relref "/ChapterFour/0146.LRU-Cache.md" >}}) - [0147.Insertion-Sort-List]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}}) - [0148.Sort-List]({{< relref "/ChapterFour/0148.Sort-List.md" >}}) - [0150.Evaluate-Reverse-Polish-Notation]({{< relref "/ChapterFour/0150.Evaluate-Reverse-Polish-Notation.md" >}}) @@ -280,6 +281,7 @@ headless: true - [0455.Assign-Cookies]({{< relref "/ChapterFour/0455.Assign-Cookies.md" >}}) - [0456.132-Pattern]({{< relref "/ChapterFour/0456.132-Pattern.md" >}}) - [0457.Circular-Array-Loop]({{< relref "/ChapterFour/0457.Circular-Array-Loop.md" >}}) + - [0460.LFU-Cache]({{< relref "/ChapterFour/0460.LFU-Cache.md" >}}) - [0461.Hamming-Distance]({{< relref "/ChapterFour/0461.Hamming-Distance.md" >}}) - [0463.Island-Perimeter]({{< relref "/ChapterFour/0463.Island-Perimeter.md" >}}) - [0470.Implement-Rand10-Using-Rand7]({{< relref "/ChapterFour/0470.Implement-Rand10-Using-Rand7.md" >}}) From 0735a68bc9e9590d731211cf4ecda697003266c4 Mon Sep 17 00:00:00 2001 From: YDZ Date: Mon, 4 Jan 2021 00:22:14 +0800 Subject: [PATCH 62/82] ChapterThree Add LFUCache/LRUCache --- leetcode/0146.LRU-Cache/README.md | 2 +- leetcode/0460.LFU-Cache/README.md | 2 +- website/content/ChapterThree/LFUCache.md | 360 +++++++++++++++++++++++ website/content/ChapterThree/LRUCache.md | 272 +++++++++++++++++ website/content/menu/index.md | 2 + 5 files changed, 636 insertions(+), 2 deletions(-) create mode 100644 website/content/ChapterThree/LFUCache.md create mode 100644 website/content/ChapterThree/LRUCache.md diff --git a/leetcode/0146.LRU-Cache/README.md b/leetcode/0146.LRU-Cache/README.md index 4f252945..3e5ac858 100644 --- a/leetcode/0146.LRU-Cache/README.md +++ b/leetcode/0146.LRU-Cache/README.md @@ -55,7 +55,7 @@ lRUCache.get(4); // return 4 ## 解题思路 -- 这一题是 LRU 经典面试题,详细解释见第三章模板。 +- 这一题是 LRU 经典面试题,详细解释见[第三章 LRUCache 模板](https://books.halfrost.com/leetcode/ChapterThree/LRUCache/)。 ## 代码 diff --git a/leetcode/0460.LFU-Cache/README.md b/leetcode/0460.LFU-Cache/README.md index d47b03e9..f4a07c44 100644 --- a/leetcode/0460.LFU-Cache/README.md +++ b/leetcode/0460.LFU-Cache/README.md @@ -60,7 +60,7 @@ lfu.get(4); // return 4 ## 解题思路 -- 这一题是 LFU 经典面试题,详细解释见第三章模板。 +- 这一题是 LFU 经典面试题,详细解释见[第三章 LFUCache 模板](https://books.halfrost.com/leetcode/ChapterThree/LFUCache/)。 ## 代码 diff --git a/website/content/ChapterThree/LFUCache.md b/website/content/ChapterThree/LFUCache.md new file mode 100644 index 00000000..22212967 --- /dev/null +++ b/website/content/ChapterThree/LFUCache.md @@ -0,0 +1,360 @@ +--- +title: LFUCache +type: docs +--- + +# 最不经常最少使用 LFUCache + +![](https://img.halfrost.com/Blog/ArticleImage/146_1_.png) + +LFU 是 Least Frequently Used 的缩写,即最不经常最少使用,也是一种常用的页面置换算法,选择访问计数器最小的页面予以淘汰。如下图,缓存中每个页面带一个访问计数器。 + + +![](https://img.halfrost.com/Blog/ArticleImage/146_3.png) + +根据 LFU 的策略,每访问一次都要更新访问计数器。当插入 B 的时候,发现缓存中有 B,所以增加访问计数器的计数,并把 B 移动到访问计数器从大到小排序的地方。再插入 D,同理先更新计数器,再移动到它排序以后的位置。当插入 F 的时候,缓存中不存在 F,所以淘汰计数器最小的页面的页面,所以淘汰 A 页面。此时 F 排在最下面,计数为 1。 + +![](https://img.halfrost.com/Blog/ArticleImage/146_8_.png) + +这里有一个比 LRU 特别的地方。如果淘汰的页面访问次数有多个相同的访问次数,选择最靠尾部的。如上图中,A、B、C 三者的访问次数相同,都是 1 次。要插入 F,F 不在缓存中,此时要淘汰 A 页面。F 是新插入的页面,访问次数为 1,排在 C 的前面。也就是说相同的访问次数,按照新旧顺序排列,淘汰掉最旧的页面。这一点是和 LRU 最大的不同的地方。 + +可以发现,**LFU 更新和插入新页面可以发生在链表中任意位置,删除页面都发生在表尾**。 + + +## 解法一 Get O(1) / Put O(1) + +LFU 同样要求查询尽量高效,O(1) 内查询。依旧选用 map 查询。修改和删除也需要 O(1) 完成,依旧选用双向链表,继续复用 container 包中的 list 数据结构。LFU 需要记录访问次数,所以每个结点除了存储 key,value,需要再多存储 frequency 访问次数。 + +还有 1 个问题需要考虑,一个是如何按频次排序?相同频次,按照先后顺序排序。如果你开始考虑排序算法的话,思考方向就偏离最佳答案了。排序至少 O(nlogn)。重新回看 LFU 的工作原理,会发现它只关心最小频次。其他频次之间的顺序并不关心。所以不需要排序。用一个 min 变量保存最小频次,淘汰时读取这个最小值能找到要删除的结点。相同频次按照先后顺序排列,这个需求还是用双向链表实现,双向链表插入的顺序体现了结点的先后顺序。相同频次对应一个双向链表,可能有多个相同频次,所以可能有多个双向链表。用一个 map 维护访问频次和双向链表的对应关系。删除最小频次时,通过 min 找到最小频次,然后再这个 map 中找到这个频次对应的双向链表,在双向链表中找到最旧的那个结点删除。这就解决了 LFU 删除操作。 + +LFU 的更新操作和 LRU 类似,也需要用一个 map 保存 key 和双向链表结点的映射关系。这个双向链表结点中存储的是 key-value-frequency 三个元素的元组。这样通过结点中的 key 和 frequency 可以反过来删除 map 中的 key。 + +定义 LFUCache 的数据结构如下: + +```go + +import "container/list" + +type LFUCache struct { + nodes map[int]*list.Element + lists map[int]*list.List + capacity int + min int +} + +type node struct { + key int + value int + frequency int +} + +func Constructor(capacity int) LFUCache { + return LFUCache{nodes: make(map[int]*list.Element), + lists: make(map[int]*list.List), + capacity: capacity, + min: 0, + } +} + +``` + +LFUCache 的 Get 操作涉及更新 frequency 值和 2 个 map。在 nodes map 中通过 key 获取到结点信息。在 lists 删除结点当前 frequency 结点。删完以后 frequency ++。新的 frequency 如果在 lists 中存在,添加到双向链表表首,如果不存在,需要新建一个双向链表并把当前结点加到表首。再更新双向链表结点作为 value 的 map。最后更新 min 值,判断老的 frequency 对应的双向链表中是否已经为空,如果空了,min++。 + +```go +func (this *LFUCache) Get(key int) int { + value, ok := this.nodes[key] + if !ok { + return -1 + } + currentNode := value.Value.(*node) + this.lists[currentNode.frequency].Remove(value) + currentNode.frequency++ + if _, ok := this.lists[currentNode.frequency]; !ok { + this.lists[currentNode.frequency] = list.New() + } + newList := this.lists[currentNode.frequency] + newNode := newList.PushFront(currentNode) + this.nodes[key] = newNode + if currentNode.frequency-1 == this.min && this.lists[currentNode.frequency-1].Len() == 0 { + this.min++ + } + return currentNode.value +} + +``` + +LFU 的 Put 操作逻辑稍微多一点。先在 nodes map 中查询 key 是否存在,如果存在,获取这个结点,更新它的 value 值,然后手动调用一次 Get 操作,因为下面的更新逻辑和 Get 操作一致。如果 map 中不存在,接下来进行插入或者删除操作。判断 capacity 是否装满,如果装满,执行删除操作。在 min 对应的双向链表中删除表尾的结点,对应的也要删除 nodes map 中的键值。 + +由于新插入的页面访问次数一定为 1,所以 min 此时置为 1。新建结点,插入到 2 个 map 中。 + +```go + +func (this *LFUCache) Put(key int, value int) { + if this.capacity == 0 { + return + } + // 如果存在,更新访问次数 + if currentValue, ok := this.nodes[key]; ok { + currentNode := currentValue.Value.(*node) + currentNode.value = value + this.Get(key) + return + } + // 如果不存在且缓存满了,需要删除 + if this.capacity == len(this.nodes) { + currentList := this.lists[this.min] + backNode := currentList.Back() + delete(this.nodes, backNode.Value.(*node).key) + currentList.Remove(backNode) + } + // 新建结点,插入到 2 个 map 中 + this.min = 1 + currentNode := &node{ + key: key, + value: value, + frequency: 1, + } + if _, ok := this.lists[1]; !ok { + this.lists[1] = list.New() + } + newList := this.lists[1] + newNode := newList.PushFront(currentNode) + this.nodes[key] = newNode +} + +``` + +总结,LFU 是由两个 map 和一个 min 指针组成的数据结构。一个 map 中 key 存的是访问次数,对应的 value 是一个个的双向链表,此处双向链表的作用是在相同频次的情况下,淘汰表尾最旧的那个页面。另一个 map 中 key 对应的 value 是双向链表的结点,结点中比 LRU 多存储了一个访问次数的值,即结点中存储 key-value-frequency 的元组。此处双向链表的作用和 LRU 是类似的,可以根据 map 中的 key 更新双向链表结点中的 value 和 frequency 的值,也可以根据双向链表结点中的 key 和 frequency 反向更新 map 中的对应关系。如下图: + +![](https://img.halfrost.com/Blog/ArticleImage/146_10_0.png) + +提交代码以后,成功通过所有测试用例。 + + +![](https://img.halfrost.com/Blog/ArticleImage/146_5.png) + + +## 解法二 Get O(capacity) / Put O(capacity) + +LFU 的另外一个思路是利用 [Index Priority Queue](https://algs4.cs.princeton.edu/24pq/) 这个数据结构。别被名字吓到,Index Priority Queue = map + Priority Queue,仅此而已。 + +利用 Priority Queue 维护一个最小堆,堆顶是访问次数最小的元素。map 中的 value 存储的是优先队列中结点。 + +```go +import "container/heap" + +type LFUCache struct { + capacity int + pq PriorityQueue + hash map[int]*Item + counter int +} + +func Constructor(capacity int) LFUCache { + lfu := LFUCache{ + pq: PriorityQueue{}, + hash: make(map[int]*Item, capacity), + capacity: capacity, + } + return lfu +} + +``` + +Get 和 Put 操作要尽量的快,有 2 个问题需要解决。当访问次数相同时,如何删除掉最久的元素?当元素的访问次数发生变化时,如何快速调整堆?为了解决这 2 个问题,定义如下的数据结构: + +```go +// An Item is something we manage in a priority queue. +type Item struct { + value int // The value of the item; arbitrary. + key int + frequency int // The priority of the item in the queue. + count int // use for evicting the oldest element + // The index is needed by update and is maintained by the heap.Interface methods. + index int // The index of the item in the heap. +} + +``` + +堆中的结点存储这 5 个值。count 值用来决定哪个是最老的元素,类似一个操作时间戳。index 值用来 re-heapify 调整堆的。接下来实现 PriorityQueue 的方法。 + +```go +// A PriorityQueue implements heap.Interface and holds Items. +type PriorityQueue []*Item + +func (pq PriorityQueue) Len() int { return len(pq) } + +func (pq PriorityQueue) Less(i, j int) bool { + // We want Pop to give us the highest, not lowest, priority so we use greater than here. + if pq[i].frequency == pq[j].frequency { + return pq[i].count < pq[j].count + } + return pq[i].frequency < pq[j].frequency +} + +func (pq PriorityQueue) Swap(i, j int) { + pq[i], pq[j] = pq[j], pq[i] + pq[i].index = i + pq[j].index = j +} + +func (pq *PriorityQueue) Push(x interface{}) { + n := len(*pq) + item := x.(*Item) + item.index = n + *pq = append(*pq, item) +} + +func (pq *PriorityQueue) Pop() interface{} { + old := *pq + n := len(old) + item := old[n-1] + old[n-1] = nil // avoid memory leak + item.index = -1 // for safety + *pq = old[0 : n-1] + return item +} + +// update modifies the priority and value of an Item in the queue. +func (pq *PriorityQueue) update(item *Item, value int, frequency int, count int) { + item.value = value + item.count = count + item.frequency = frequency + heap.Fix(pq, item.index) +} +``` + +在 Less() 方法中,frequency 从小到大排序,frequency 相同的,按 count 从小到大排序。按照优先队列建堆规则,可以得到,frequency 最小的在堆顶,相同的 frequency,count 最小的越靠近堆顶。 + +在 Swap() 方法中,记得要更新 index 值。在 Push() 方法中,插入时队列的长度即是该元素的 index 值,此处也要记得更新 index 值。update() 方法调用 Fix() 函数。Fix() 函数比先 Remove() 再 Push() 一个新的值,花销要小。所以此处调用 Fix() 函数,这个操作的时间复杂度是 O(log n)。 + +这样就维护了最小 Index Priority Queue。Get 操作非常简单: + +```go +func (this *LFUCache) Get(key int) int { + if this.capacity == 0 { + return -1 + } + if item, ok := this.hash[key]; ok { + this.counter++ + this.pq.update(item, item.value, item.frequency+1, this.counter) + return item.value + } + return -1 +} + +``` + +在 hashmap 中查询 key,如果存在,counter 时间戳累加,调用 Priority Queue 的 update 方法,调整堆。 + +```go +func (this *LFUCache) Put(key int, value int) { + if this.capacity == 0 { + return + } + this.counter++ + // 如果存在,增加 frequency,再调整堆 + if item, ok := this.hash[key]; ok { + this.pq.update(item, value, item.frequency+1, this.counter) + return + } + // 如果不存在且缓存满了,需要删除。在 hashmap 和 pq 中删除。 + if len(this.pq) == this.capacity { + item := heap.Pop(&this.pq).(*Item) + delete(this.hash, item.key) + } + // 新建结点,在 hashmap 和 pq 中添加。 + item := &Item{ + value: value, + key: key, + count: this.counter, + } + heap.Push(&this.pq, item) + this.hash[key] = item +} +``` + + +用最小堆实现的 LFU,Put 时间复杂度是 O(capacity),Get 时间复杂度是 O(capacity),不及 2 个 map 实现的版本。巧的是最小堆的版本居然打败了 100%。 + +![](https://img.halfrost.com/Blog/ArticleImage/146_7.png) + + +## 模板 + + +```go +import "container/list" + +type LFUCache struct { + nodes map[int]*list.Element + lists map[int]*list.List + capacity int + min int +} + +type node struct { + key int + value int + frequency int +} + +func Constructor(capacity int) LFUCache { + return LFUCache{nodes: make(map[int]*list.Element), + lists: make(map[int]*list.List), + capacity: capacity, + min: 0, + } +} + +func (this *LFUCache) Get(key int) int { + value, ok := this.nodes[key] + if !ok { + return -1 + } + currentNode := value.Value.(*node) + this.lists[currentNode.frequency].Remove(value) + currentNode.frequency++ + if _, ok := this.lists[currentNode.frequency]; !ok { + this.lists[currentNode.frequency] = list.New() + } + newList := this.lists[currentNode.frequency] + newNode := newList.PushBack(currentNode) + this.nodes[key] = newNode + if currentNode.frequency-1 == this.min && this.lists[currentNode.frequency-1].Len() == 0 { + this.min++ + } + return currentNode.value +} + +func (this *LFUCache) Put(key int, value int) { + if this.capacity == 0 { + return + } + if currentValue, ok := this.nodes[key]; ok { + currentNode := currentValue.Value.(*node) + currentNode.value = value + this.Get(key) + return + } + if this.capacity == len(this.nodes) { + currentList := this.lists[this.min] + frontNode := currentList.Front() + delete(this.nodes, frontNode.Value.(*node).key) + currentList.Remove(frontNode) + } + this.min = 1 + currentNode := &node{ + key: key, + value: value, + frequency: 1, + } + if _, ok := this.lists[1]; !ok { + this.lists[1] = list.New() + } + newList := this.lists[1] + newNode := newList.PushBack(currentNode) + this.nodes[key] = newNode +} + +``` \ No newline at end of file diff --git a/website/content/ChapterThree/LRUCache.md b/website/content/ChapterThree/LRUCache.md new file mode 100644 index 00000000..3cbecaa4 --- /dev/null +++ b/website/content/ChapterThree/LRUCache.md @@ -0,0 +1,272 @@ +--- +title: LRUCache +type: docs +--- + +# 最近最少使用 LRUCache + +![](https://img.halfrost.com/Blog/ArticleImage/146_1_.png) + +LRU 是 Least Recently Used 的缩写,即最近最少使用,是一种常用的页面置换算法,选择最近最久未使用的页面予以淘汰。如上图,要插入 F 的时候,此时需要淘汰掉原来的一个页面。 + +![](https://img.halfrost.com/Blog/ArticleImage/146_2_0.png) + +根据 LRU 的策略,每次都淘汰最近最久未使用的页面,所以先淘汰 A 页面。再插入 C 的时候,发现缓存中有 C 页面,这个时候需要把 C 页面放到首位,因为它被使用了。以此类推,插入 G 页面,G 页面是新页面,不在缓存中,所以淘汰掉 B 页面。插入 H 页面,H 页面是新页面,不在缓存中,所以淘汰掉 D 页面。插入 E 的时候,发现缓存中有 E 页面,这个时候需要把 E 页面放到首位。插入 I 页面,I 页面是新页面,不在缓存中,所以淘汰掉 F 页面。 + +可以发现,**LRU 更新和插入新页面都发生在链表首,删除页面都发生在链表尾**。 + +## 解法一 Get O(1) / Put O(1) + +LRU 要求查询尽量高效,O(1) 内查询。那肯定选用 map 查询。修改,删除也要尽量 O(1) 完成。搜寻常见的数据结构,链表,栈,队列,树,图。树和图排除,栈和队列无法任意查询中间的元素,也排除。所以选用链表来实现。但是如果选用单链表,删除这个结点,需要 O(n) 遍历一遍找到前驱结点。所以选用双向链表,在删除的时候也能 O(1) 完成。 + +由于 Go 的 container 包中的 list 底层实现是双向链表,所以可以直接复用这个数据结构。定义 LRUCache 的数据结构如下: + +```go +import "container/list" + +type LRUCache struct { + Cap int + Keys map[int]*list.Element + List *list.List +} + +type pair struct { + K, V int +} + +func Constructor(capacity int) LRUCache { + return LRUCache{ + Cap: capacity, + Keys: make(map[int]*list.Element), + List: list.New(), + } +} + +``` + +这里需要解释 2 个问题,list 中的值存的是什么?pair 这个结构体有什么用? + +```go +type Element struct { + // Next and previous pointers in the doubly-linked list of elements. + // To simplify the implementation, internally a list l is implemented + // as a ring, such that &l.root is both the next element of the last + // list element (l.Back()) and the previous element of the first list + // element (l.Front()). + next, prev *Element + + // The list to which this element belongs. + list *List + + // The value stored with this element. + Value interface{} +} +``` + +在 container/list 中,这个双向链表的每个结点的类型是 Element。Element 中存了 4 个值,前驱和后继结点,双向链表的头结点,value 值。这里的 value 是 interface 类型。笔者在这个 value 里面存了 pair 这个结构体。这就解释了 list 里面存的是什么数据。 + +为什么要存 pair 呢?单单指存 v 不行么,为什么还要存一份 key ?原因是在 LRUCache 执行删除操作的时候,需要维护 2 个数据结构,一个是 map,一个是双向链表。在双向链表中删除淘汰出去的 value,在 map 中删除淘汰出去 value 对应的 key。如果在双向链表的 value 中不存储 key,那么再删除 map 中的 key 的时候有点麻烦。如果硬要实现,需要先获取到双向链表这个结点 Element 的地址。然后遍历 map,在 map 中找到存有这个 Element 元素地址对应的 key,再删除。这样做时间复杂度是 O(n),做不到 O(1)。所以双向链表中的 Value 需要存储这个 pair。 + +LRUCache 的 Get 操作很简单,在 map 中直接读取双向链表的结点。如果 map 中存在,将它移动到双向链表的表头,并返回它的 value 值,如果 map 中不存在,返回 -1。 + +```go +func (c *LRUCache) Get(key int) int { + if el, ok := c.Keys[key]; ok { + c.List.MoveToFront(el) + return el.Value.(pair).V + } + return -1 +} +``` + +LRUCache 的 Put 操作也不难。先查询 map 中是否存在 key,如果存在,更新它的 value,并且把该结点移到双向链表的表头。如果 map 中不存在,新建这个结点加入到双向链表和 map 中。最后别忘记还需要维护双向链表的 cap,如果超过 cap,需要淘汰最后一个结点,双向链表中删除这个结点,map 中删掉这个结点对应的 key。 + +```go +func (c *LRUCache) Put(key int, value int) { + if el, ok := c.Keys[key]; ok { + el.Value = pair{K: key, V: value} + c.List.MoveToFront(el) + } else { + el := c.List.PushFront(pair{K: key, V: value}) + c.Keys[key] = el + } + if c.List.Len() > c.Cap { + el := c.List.Back() + c.List.Remove(el) + delete(c.Keys, el.Value.(pair).K) + } +} + +``` + +总结,LRU 是由一个 map 和一个双向链表组成的数据结构。map 中 key 对应的 value 是双向链表的结点。双向链表中存储 key-value 的 pair。双向链表表首更新缓存,表尾淘汰缓存。如下图: + +![](https://img.halfrost.com/Blog/ArticleImage/146_9.png) + +提交代码以后,成功通过所有测试用例。 + +![](https://img.halfrost.com/Blog/ArticleImage/146_4_.png) + + +## 解法二 Get O(1) / Put O(1) + +数据结构上想不到其他解法了,但从打败的百分比上,看似还有常数的优化空间。笔者反复思考,觉得可能导致运行时间变长的地方是在 interface{} 类型推断,其他地方已无优化的空间。手写一个双向链表提交试试,代码如下: + +```go + +type LRUCache struct { + head, tail *Node + keys map[int]*Node + capacity int +} + +type Node struct { + key, val int + prev, next *Node +} + +func ConstructorLRU(capacity int) LRUCache { + return LRUCache{keys: make(map[int]*Node), capacity: capacity} +} + +func (this *LRUCache) Get(key int) int { + if node, ok := this.keys[key]; ok { + this.Remove(node) + this.Add(node) + return node.val + } + return -1 +} + +func (this *LRUCache) Put(key int, value int) { + if node, ok := this.keys[key]; ok { + node.val = value + this.Remove(node) + this.Add(node) + return + } else { + node = &Node{key: key, val: value} + this.keys[key] = node + this.Add(node) + } + if len(this.keys) > this.capacity { + delete(this.keys, this.tail.key) + this.Remove(this.tail) + } +} + +func (this *LRUCache) Add(node *Node) { + node.prev = nil + node.next = this.head + if this.head != nil { + this.head.prev = node + } + this.head = node + if this.tail == nil { + this.tail = node + this.tail.next = nil + } +} + +func (this *LRUCache) Remove(node *Node) { + if node == this.head { + this.head = node.next + if node.next != nil { + node.next.prev = nil + } + node.next = nil + return + } + if node == this.tail { + this.tail = node.prev + node.prev.next = nil + node.prev = nil + return + } + node.prev.next = node.next + node.next.prev = node.prev +} + +``` + +提交以后还真的 100% 了。 + +![](https://img.halfrost.com/Blog/ArticleImage/146_6.png) + +上述代码实现的 LRU 本质并没有优化,只是换了一个写法,没有用 container 包而已。 + + +## 模板 + +```go +type LRUCache struct { + head, tail *Node + Keys map[int]*Node + Cap int +} + +type Node struct { + Key, Val int + Prev, Next *Node +} + +func Constructor(capacity int) LRUCache { + return LRUCache{Keys: make(map[int]*Node), Cap: capacity} +} + +func (this *LRUCache) Get(key int) int { + if node, ok := this.Keys[key]; ok { + this.Remove(node) + this.Add(node) + return node.Val + } + return -1 +} + +func (this *LRUCache) Put(key int, value int) { + if node, ok := this.Keys[key]; ok { + node.Val = value + this.Remove(node) + this.Add(node) + return + } else { + node = &Node{Key: key, Val: value} + this.Keys[key] = node + this.Add(node) + } + if len(this.Keys) > this.Cap { + delete(this.Keys, this.tail.Key) + this.Remove(this.tail) + } +} + +func (this *LRUCache) Add(node *Node) { + node.Prev = nil + node.Next = this.head + if this.head != nil { + this.head.Prev = node + } + this.head = node + if this.tail == nil { + this.tail = node + this.tail.Next = nil + } +} + +func (this *LRUCache) Remove(node *Node) { + if node == this.head { + this.head = node.Next + node.Next = nil + return + } + if node == this.tail { + this.tail = node.Prev + node.Prev.Next = nil + node.Prev = nil + return + } + node.Prev.Next = node.Next + node.Next.Prev = node.Prev +} + +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index befac8a0..807ff8b8 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -31,6 +31,8 @@ headless: true - [第三章 一些模板]({{< relref "/ChapterThree/_index.md" >}}) - [3.1 Segment Tree]({{< relref "/ChapterThree/Segment_Tree.md" >}}) - [3.2 UnionFind]({{< relref "/ChapterThree/UnionFind.md" >}}) + - [3.3 LRUCache]({{< relref "/ChapterThree/LRUCache.md" >}}) + - [3.4 LFUCache]({{< relref "/ChapterThree/LFUCache.md" >}}) - [第四章 Leetcode 题解]({{< relref "/ChapterFour/_index.md" >}}) - [0001.Two-Sum]({{< relref "/ChapterFour/0001.Two-Sum.md" >}}) - [0002.Add-Two-Numbers]({{< relref "/ChapterFour/0002.Add-Two-Numbers.md" >}}) From 71b030cf637506c1e4bcd69da36262cc0e891eca Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 5 Jan 2021 12:01:21 +0800 Subject: [PATCH 63/82] Add solution 830 --- .../0146.LRU-Cache/146. LRU Cache_test.go | 2 +- .../830. Positions of Large Groups.go | 15 ++++ .../830. Positions of Large Groups_test.go | 57 +++++++++++++ .../0830.Positions-of-Large-Groups/README.md | 80 +++++++++++++++++++ .../0830.Positions-of-Large-Groups.md | 80 +++++++++++++++++++ website/content/menu/index.md | 1 + 6 files changed, 234 insertions(+), 1 deletion(-) create mode 100644 leetcode/0830.Positions-of-Large-Groups/830. Positions of Large Groups.go create mode 100644 leetcode/0830.Positions-of-Large-Groups/830. Positions of Large Groups_test.go create mode 100644 leetcode/0830.Positions-of-Large-Groups/README.md create mode 100644 website/content/ChapterFour/0830.Positions-of-Large-Groups.md diff --git a/leetcode/0146.LRU-Cache/146. LRU Cache_test.go b/leetcode/0146.LRU-Cache/146. LRU Cache_test.go index 27747f8c..9d8d1604 100644 --- a/leetcode/0146.LRU-Cache/146. LRU Cache_test.go +++ b/leetcode/0146.LRU-Cache/146. LRU Cache_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -func Test_Problem147(t *testing.T) { +func Test_Problem146(t *testing.T) { obj := Constructor(2) fmt.Printf("obj = %v\n", MList2Ints(&obj)) obj.Put(1, 1) diff --git a/leetcode/0830.Positions-of-Large-Groups/830. Positions of Large Groups.go b/leetcode/0830.Positions-of-Large-Groups/830. Positions of Large Groups.go new file mode 100644 index 00000000..8b61b338 --- /dev/null +++ b/leetcode/0830.Positions-of-Large-Groups/830. Positions of Large Groups.go @@ -0,0 +1,15 @@ +package leetcode + +func largeGroupPositions(S string) [][]int { + res, end := [][]int{}, 0 + for end < len(S) { + start, str := end, S[end] + for end < len(S) && S[end] == str { + end++ + } + if end-start >= 3 { + res = append(res, []int{start, end - 1}) + } + } + return res +} diff --git a/leetcode/0830.Positions-of-Large-Groups/830. Positions of Large Groups_test.go b/leetcode/0830.Positions-of-Large-Groups/830. Positions of Large Groups_test.go new file mode 100644 index 00000000..ed74b05a --- /dev/null +++ b/leetcode/0830.Positions-of-Large-Groups/830. Positions of Large Groups_test.go @@ -0,0 +1,57 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question830 struct { + para830 + ans830 +} + +// para 是参数 +// one 代表第一个参数 +type para830 struct { + S string +} + +// ans 是答案 +// one 代表第一个答案 +type ans830 struct { + one [][]int +} + +func Test_Problem830(t *testing.T) { + + qs := []question830{ + + { + para830{"abbxxxxzzy"}, + ans830{[][]int{{3, 6}}}, + }, + + { + para830{"abc"}, + ans830{[][]int{{}}}, + }, + + { + para830{"abcdddeeeeaabbbcd"}, + ans830{[][]int{{3, 5}, {6, 9}, {12, 14}}}, + }, + + { + para830{"aba"}, + ans830{[][]int{{}}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 830------------------------\n") + + for _, q := range qs { + _, p := q.ans830, q.para830 + fmt.Printf("【input】:%v 【output】:%v\n", p, largeGroupPositions(p.S)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/0830.Positions-of-Large-Groups/README.md b/leetcode/0830.Positions-of-Large-Groups/README.md new file mode 100644 index 00000000..5323f2e0 --- /dev/null +++ b/leetcode/0830.Positions-of-Large-Groups/README.md @@ -0,0 +1,80 @@ +# [830. Positions of Large Groups](https://leetcode.com/problems/positions-of-large-groups/) + + +## 题目 + +In a string `s` of lowercase letters, these letters form consecutive groups of the same character. + +For example, a string like `s = "abbxxxxzyy"` has the groups `"a"`, `"bb"`, `"xxxx"`, `"z"`, and `"yy"`. + +A group is identified by an interval `[start, end]`, where `start` and `end` denote the start and end indices (inclusive) of the group. In the above example, `"xxxx"` has the interval `[3,6]`. + +A group is considered **large** if it has 3 or more characters. + +Return *the intervals of every **large** group sorted in **increasing order by start index***. + +**Example 1:** + +``` +Input: s = "abbxxxxzzy" +Output: [[3,6]] +Explanation: "xxxx" is the only large group with start index 3 and end index 6. +``` + +**Example 2:** + +``` +Input: s = "abc" +Output: [] +Explanation: We have groups "a", "b", and "c", none of which are large groups. +``` + +**Example 3:** + +``` +Input: s = "abcdddeeeeaabbbcd" +Output: [[3,5],[6,9],[12,14]] +Explanation: The large groups are "ddd", "eeee", and "bbb". +``` + +**Example 4:** + +``` +Input: s = "aba" +Output: [] +``` + +**Constraints:** + +- `1 <= s.length <= 1000` +- `s` contains lower-case English letters only. + +## 题目大意 + +在一个由小写字母构成的字符串 s 中,包含由一些连续的相同字符所构成的分组。例如,在字符串 s = "abbxxxxzyy" 中,就含有 "a", "bb", "xxxx", "z" 和 "yy" 这样的一些分组。分组可以用区间 [start, end] 表示,其中 start 和 end 分别表示该分组的起始和终止位置的下标。上例中的 "xxxx" 分组用区间表示为 [3,6] 。我们称所有包含大于或等于三个连续字符的分组为 较大分组 。 + +找到每一个 较大分组 的区间,按起始位置下标递增顺序排序后,返回结果。 + +## 解题思路 + +- 简单题。利用滑动窗口的思想,先扩大窗口的右边界,找到能相同字母且能到达的最右边。记录左右边界。再将窗口的左边界移动到上一次的右边界处。以此类推,重复扩大窗口的右边界,直至扫完整个字符串。最终所有满足题意的较大分组区间都在数组中了。 + +## 代码 + +```go +package leetcode + +func largeGroupPositions(S string) [][]int { + res, end := [][]int{}, 0 + for end < len(S) { + start, str := end, S[end] + for end < len(S) && S[end] == str { + end++ + } + if end-start >= 3 { + res = append(res, []int{start, end - 1}) + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/0830.Positions-of-Large-Groups.md b/website/content/ChapterFour/0830.Positions-of-Large-Groups.md new file mode 100644 index 00000000..5323f2e0 --- /dev/null +++ b/website/content/ChapterFour/0830.Positions-of-Large-Groups.md @@ -0,0 +1,80 @@ +# [830. Positions of Large Groups](https://leetcode.com/problems/positions-of-large-groups/) + + +## 题目 + +In a string `s` of lowercase letters, these letters form consecutive groups of the same character. + +For example, a string like `s = "abbxxxxzyy"` has the groups `"a"`, `"bb"`, `"xxxx"`, `"z"`, and `"yy"`. + +A group is identified by an interval `[start, end]`, where `start` and `end` denote the start and end indices (inclusive) of the group. In the above example, `"xxxx"` has the interval `[3,6]`. + +A group is considered **large** if it has 3 or more characters. + +Return *the intervals of every **large** group sorted in **increasing order by start index***. + +**Example 1:** + +``` +Input: s = "abbxxxxzzy" +Output: [[3,6]] +Explanation: "xxxx" is the only large group with start index 3 and end index 6. +``` + +**Example 2:** + +``` +Input: s = "abc" +Output: [] +Explanation: We have groups "a", "b", and "c", none of which are large groups. +``` + +**Example 3:** + +``` +Input: s = "abcdddeeeeaabbbcd" +Output: [[3,5],[6,9],[12,14]] +Explanation: The large groups are "ddd", "eeee", and "bbb". +``` + +**Example 4:** + +``` +Input: s = "aba" +Output: [] +``` + +**Constraints:** + +- `1 <= s.length <= 1000` +- `s` contains lower-case English letters only. + +## 题目大意 + +在一个由小写字母构成的字符串 s 中,包含由一些连续的相同字符所构成的分组。例如,在字符串 s = "abbxxxxzyy" 中,就含有 "a", "bb", "xxxx", "z" 和 "yy" 这样的一些分组。分组可以用区间 [start, end] 表示,其中 start 和 end 分别表示该分组的起始和终止位置的下标。上例中的 "xxxx" 分组用区间表示为 [3,6] 。我们称所有包含大于或等于三个连续字符的分组为 较大分组 。 + +找到每一个 较大分组 的区间,按起始位置下标递增顺序排序后,返回结果。 + +## 解题思路 + +- 简单题。利用滑动窗口的思想,先扩大窗口的右边界,找到能相同字母且能到达的最右边。记录左右边界。再将窗口的左边界移动到上一次的右边界处。以此类推,重复扩大窗口的右边界,直至扫完整个字符串。最终所有满足题意的较大分组区间都在数组中了。 + +## 代码 + +```go +package leetcode + +func largeGroupPositions(S string) [][]int { + res, end := [][]int{}, 0 + for end < len(S) { + start, str := end, S[end] + for end < len(S) && S[end] == str { + end++ + } + if end-start >= 3 { + res = append(res, []int{start, end - 1}) + } + } + return res +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 807ff8b8..f45c90a7 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -396,6 +396,7 @@ headless: true - [0819.Most-Common-Word]({{< relref "/ChapterFour/0819.Most-Common-Word.md" >}}) - [0826.Most-Profit-Assigning-Work]({{< relref "/ChapterFour/0826.Most-Profit-Assigning-Work.md" >}}) - [0828.COPYRIGHT-PROBLEM-XXX]({{< relref "/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md" >}}) + - [0830.Positions-of-Large-Groups]({{< relref "/ChapterFour/0830.Positions-of-Large-Groups.md" >}}) - [0832.Flipping-an-Image]({{< relref "/ChapterFour/0832.Flipping-an-Image.md" >}}) - [0834.Sum-of-Distances-in-Tree]({{< relref "/ChapterFour/0834.Sum-of-Distances-in-Tree.md" >}}) - [0836.Rectangle-Overlap]({{< relref "/ChapterFour/0836.Rectangle-Overlap.md" >}}) From 88f0a1d9e17b3f8f56ccc40280fe6141879bb7ab Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 5 Jan 2021 14:50:29 +0800 Subject: [PATCH 64/82] Add wechat-qr-code --- README.md | 2 ++ website/static/wechat-qr-code.png | Bin 0 -> 4268298 bytes 2 files changed, 2 insertions(+) create mode 100644 website/static/wechat-qr-code.png diff --git a/README.md b/README.md index 5388fc4e..cd61e336 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@

+![](./website/static/wechat-qr-code.png) +

GitHub All Releases diff --git a/website/static/wechat-qr-code.png b/website/static/wechat-qr-code.png new file mode 100644 index 0000000000000000000000000000000000000000..c604e7331e733d2e632e5bfcf158819bd03ca19f GIT binary patch literal 4268298 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

KP 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℘yg0_Mg>0=*eR}Z2tgYC4Bape-i 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 LQ}UegDYK?O4St^d literal 0 HcmV?d00001 From fd9d3fd9e1d764aa554c2fd338d4e4c28af05274 Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 6 Jan 2021 20:11:25 +0800 Subject: [PATCH 65/82] Add solution 1539 --- .../1539. Kth Missing Positive Number.go | 20 ++++++ .../1539. Kth Missing Positive Number_test.go | 48 ++++++++++++++ .../README.md | 63 +++++++++++++++++++ .../1539.Kth-Missing-Positive-Number.md | 63 +++++++++++++++++++ website/content/menu/index.md | 1 + 5 files changed, 195 insertions(+) create mode 100644 leetcode/1539.Kth-Missing-Positive-Number/1539. Kth Missing Positive Number.go create mode 100644 leetcode/1539.Kth-Missing-Positive-Number/1539. Kth Missing Positive Number_test.go create mode 100644 leetcode/1539.Kth-Missing-Positive-Number/README.md create mode 100644 website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md diff --git a/leetcode/1539.Kth-Missing-Positive-Number/1539. Kth Missing Positive Number.go b/leetcode/1539.Kth-Missing-Positive-Number/1539. Kth Missing Positive Number.go new file mode 100644 index 00000000..667a3b70 --- /dev/null +++ b/leetcode/1539.Kth-Missing-Positive-Number/1539. Kth Missing Positive Number.go @@ -0,0 +1,20 @@ +package leetcode + +func findKthPositive(arr []int, k int) int { + positive, index := 1, 0 + for index < len(arr) { + if arr[index] != positive { + k-- + } else { + index++ + } + if k == 0 { + break + } + positive++ + } + if k != 0 { + positive += k - 1 + } + return positive +} diff --git a/leetcode/1539.Kth-Missing-Positive-Number/1539. Kth Missing Positive Number_test.go b/leetcode/1539.Kth-Missing-Positive-Number/1539. Kth Missing Positive Number_test.go new file mode 100644 index 00000000..ffd93841 --- /dev/null +++ b/leetcode/1539.Kth-Missing-Positive-Number/1539. Kth Missing Positive Number_test.go @@ -0,0 +1,48 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1539 struct { + para1539 + ans1539 +} + +// para 是参数 +// one 代表第一个参数 +type para1539 struct { + arr []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1539 struct { + one int +} + +func Test_Problem1539(t *testing.T) { + + qs := []question1539{ + + { + para1539{[]int{2, 3, 4, 7, 11}, 5}, + ans1539{9}, + }, + + { + para1539{[]int{1, 2, 3, 4}, 2}, + ans1539{6}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1539------------------------\n") + + for _, q := range qs { + _, p := q.ans1539, q.para1539 + fmt.Printf("【input】:%v 【output】:%v \n", p, findKthPositive(p.arr, p.k)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1539.Kth-Missing-Positive-Number/README.md b/leetcode/1539.Kth-Missing-Positive-Number/README.md new file mode 100644 index 00000000..ba13a085 --- /dev/null +++ b/leetcode/1539.Kth-Missing-Positive-Number/README.md @@ -0,0 +1,63 @@ +# [1539. Kth Missing Positive Number](https://leetcode.com/problems/kth-missing-positive-number/) + +## 题目 + +Given an array `arr` of positive integers sorted in a **strictly increasing order**, and an integer `k`. + +*Find the* `kth` *positive integer that is missing from this array.* + +**Example 1:** + +``` +Input: arr = [2,3,4,7,11], k = 5 +Output: 9 +Explanation: The missing positive integers are [1,5,6,8,9,10,12,13,...]. The 5th missing positive integer is 9. +``` + +**Example 2:** + +``` +Input: arr = [1,2,3,4], k = 2 +Output: 6 +Explanation: The missing positive integers are [5,6,7,...]. The 2nd missing positive integer is 6. +``` + +**Constraints:** + +- `1 <= arr.length <= 1000` +- `1 <= arr[i] <= 1000` +- `1 <= k <= 1000` +- `arr[i] < arr[j]` for `1 <= i < j <= arr.length` + +## 题目大意 + +给你一个 **严格升序排列** 的正整数数组 `arr` 和一个整数 `k` 。请你找到这个数组里第 `k` 个缺失的正整数。 + +## 解题思路 + +- 简单题。用一个变量从 1 开始累加,依次比对数组中是否存在,不存在的话就把 k - -,直到 k 为 0 的时候即是要输出的值。特殊情况,missing positive 都在数组之外,如例子 2 。 + +## 代码 + +```go +package leetcode + +func findKthPositive(arr []int, k int) int { + positive, index := 1, 0 + for index < len(arr) { + if arr[index] != positive { + k-- + } else { + index++ + } + if k == 0 { + break + } + positive++ + } + if k != 0 { + positive += k - 1 + } + return positive +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md b/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md new file mode 100644 index 00000000..ba13a085 --- /dev/null +++ b/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md @@ -0,0 +1,63 @@ +# [1539. Kth Missing Positive Number](https://leetcode.com/problems/kth-missing-positive-number/) + +## 题目 + +Given an array `arr` of positive integers sorted in a **strictly increasing order**, and an integer `k`. + +*Find the* `kth` *positive integer that is missing from this array.* + +**Example 1:** + +``` +Input: arr = [2,3,4,7,11], k = 5 +Output: 9 +Explanation: The missing positive integers are [1,5,6,8,9,10,12,13,...]. The 5th missing positive integer is 9. +``` + +**Example 2:** + +``` +Input: arr = [1,2,3,4], k = 2 +Output: 6 +Explanation: The missing positive integers are [5,6,7,...]. The 2nd missing positive integer is 6. +``` + +**Constraints:** + +- `1 <= arr.length <= 1000` +- `1 <= arr[i] <= 1000` +- `1 <= k <= 1000` +- `arr[i] < arr[j]` for `1 <= i < j <= arr.length` + +## 题目大意 + +给你一个 **严格升序排列** 的正整数数组 `arr` 和一个整数 `k` 。请你找到这个数组里第 `k` 个缺失的正整数。 + +## 解题思路 + +- 简单题。用一个变量从 1 开始累加,依次比对数组中是否存在,不存在的话就把 k - -,直到 k 为 0 的时候即是要输出的值。特殊情况,missing positive 都在数组之外,如例子 2 。 + +## 代码 + +```go +package leetcode + +func findKthPositive(arr []int, k int) int { + positive, index := 1, 0 + for index < len(arr) { + if arr[index] != positive { + k-- + } else { + index++ + } + if k == 0 { + break + } + positive++ + } + if k != 0 { + positive += k - 1 + } + return positive +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index f45c90a7..78ee4b1d 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -555,6 +555,7 @@ headless: true - [1470.Shuffle-the-Array]({{< relref "/ChapterFour/1470.Shuffle-the-Array.md" >}}) - [1480.Running-Sum-of-1d-Array]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}}) - [1512.Number-of-Good-Pairs]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}}) + - [1539.Kth-Missing-Positive-Number]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}}) - [1573.Number-of-Ways-to-Split-a-String]({{< relref "/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md" >}}) - [1640.Check-Array-Formation-Through-Concatenation]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}}) - [1646.Get-Maximum-in-Generated-Array]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}}) From b7cc898a6a924ae1fa5a94100016bd34c018d827 Mon Sep 17 00:00:00 2001 From: YDZ Date: Thu, 7 Jan 2021 17:30:12 +0800 Subject: [PATCH 66/82] Add robot --- automation/models/lcproblems.go | 43 +++++++++++++++++++ automation/models/mdrow.go | 26 ++++++++++++ automation/render.go | 75 +++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 automation/models/lcproblems.go create mode 100644 automation/models/mdrow.go create mode 100644 automation/render.go diff --git a/automation/models/lcproblems.go b/automation/models/lcproblems.go new file mode 100644 index 00000000..5efb9962 --- /dev/null +++ b/automation/models/lcproblems.go @@ -0,0 +1,43 @@ +package models + +type LeetCodeProblemAll struct { + UserName string `json:"user_name"` + NumSolved int32 `json:"num_solved"` + NumTotal int32 `json:"num_total"` + AcEasy int32 `json:"ac_easy"` + AcMedium int32 `json:"ac_medium"` + AcHard int32 `json:"ac_hard"` + StatStatusPairs []StatStatusPairs `json:"stat_status_pairs"` + FrequencyHigh int32 `json:"frequency_high"` + FrequencyMid int32 `json:"frequency_mid"` + CategorySlug string `json:"category_slug"` +} + +type StatStatusPairs struct { + Stat Stat `json:"stat"` + Difficulty Difficulty `json:"difficulty"` + PaidOnly bool `json:"paid_only"` + IsFavor bool `json:"is_favor"` + Frequency float64 `json:"frequency"` + Progress float64 `json:"progress"` +} + +type Stat struct { + QuestionTitle string `json:"question__title"` + QuestionTitleSlug string `json:"question__title_slug"` + TotalAcs float64 `json:"total_acs"` + TotalSubmitted float64 `json:"total_submitted"` + Acceptance string + Difficulty string + FrontendQuestionId int32 `json:"frontend_question_id"` +} + +type Difficulty struct { + Level int32 `json:"level"` +} + +var DifficultyMap = map[int32]string{ + 1: "Easy", + 2: "Medium", + 3: "Hard", +} diff --git a/automation/models/mdrow.go b/automation/models/mdrow.go new file mode 100644 index 00000000..91e65ed0 --- /dev/null +++ b/automation/models/mdrow.go @@ -0,0 +1,26 @@ +package models + +import ( + "strconv" +) + +type Mdrow struct { + FrontendQuestionId string `json:"question_id"` + QuestionTitle string `json:"question__title"` + QuestionTitleSlug string `json:"question__title_slug"` + SolutionPath string `json:"solution_path"` + Acceptance string `json:"acceptance"` + Difficulty string `json:"difficulty"` + Frequency string `json:"frequency"` +} + +// SortByQuestionId define +type SortByQuestionId []Mdrow + +func (a SortByQuestionId) Len() int { return len(a) } +func (a SortByQuestionId) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a SortByQuestionId) Less(i, j int) bool { + first, _ := strconv.Atoi(a[i].FrontendQuestionId) + second, _ := strconv.Atoi(a[j].FrontendQuestionId) + return first < second +} diff --git a/automation/render.go b/automation/render.go new file mode 100644 index 00000000..869f4f3b --- /dev/null +++ b/automation/render.go @@ -0,0 +1,75 @@ +package main + +import ( + "encoding/json" + "fmt" + m "github.com/halfrost/LeetCode-Go/automation/models" + "io/ioutil" + "net/http" + "os" + "sort" + "strconv" +) + +func main() { + resp, err := http.Get("https://leetcode.com/api/problems/all/") + if err != nil { + fmt.Println(err) + return + } + defer resp.Body.Close() + + var result []m.StatStatusPairs + var lpa m.LeetCodeProblemAll + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + fmt.Println(err) + return + } + + err = json.Unmarshal(body, &lpa) + if err != nil { + fmt.Println(err) + return + } + result = lpa.StatStatusPairs + //fmt.Println(result) + mdrows := []m.Mdrow{} + for i := 0; i < len(result); i++ { + mdrows = append(mdrows, convertModel(result[i])) + } + sort.Sort(m.SortByQuestionId(mdrows)) + res, _ := json.Marshal(mdrows) + write(res) + //fmt.Println(resp.StatusCode) + + if resp.StatusCode == 200 { + fmt.Println("ok") + } +} + +func write(content []byte) { + file, err := os.OpenFile("leetcode_problem", os.O_RDWR|os.O_CREATE, 0777) + if err != nil { + fmt.Println(err) + } + defer file.Close() + + _, err = file.Write(content) + if err != nil { + fmt.Println(err) + } + fmt.Println("write file successful") +} + +func convertModel(ssp m.StatStatusPairs) m.Mdrow { + res := m.Mdrow{} + res.FrontendQuestionId = strconv.FormatInt(int64(ssp.Stat.FrontendQuestionId), 10) + res.QuestionTitle = ssp.Stat.QuestionTitle + res.QuestionTitleSlug = ssp.Stat.QuestionTitleSlug + // res.SolutionPath + res.Acceptance = fmt.Sprintf("%.1f%%", (ssp.Stat.TotalAcs/ssp.Stat.TotalSubmitted)*100) + res.Difficulty = m.DifficultyMap[ssp.Difficulty.Level] + res.Frequency = fmt.Sprintf("%f", ssp.Frequency) + return res +} From c700a335cc0263fadc4fea7e938f70e95f15389c Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 8 Jan 2021 00:47:11 +0800 Subject: [PATCH 67/82] rengder README.md from template.markdown --- README.md | 3254 ++++++++++++++++++---------------- automation/models/mdrow.go | 34 +- automation/render.go | 154 +- automation/template.markdown | 635 +++++++ 4 files changed, 2509 insertions(+), 1568 deletions(-) mode change 100644 => 100755 README.md create mode 100644 automation/template.markdown diff --git a/README.md b/README.md old mode 100644 new mode 100755 index cd61e336..0127aa5a --- a/README.md +++ b/README.md @@ -120,1549 +120,1723 @@ ## 一. 目录 -| # | Title | Solution | Acceptance | Difficulty | Frequency | +| No. | Title | Solution | Acceptance | Difficulty | Frequency | |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| -| 0001 | Two Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum) | 45.6% | Easy | | -| 0002 | Add Two Numbers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0002.Add-Two-Numbers) | 33.9% | Medium | | -| 0003 | Longest Substring Without Repeating Characters | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0003.Longest-Substring-Without-Repeating-Characters) | 30.4% | Medium | | -| 0004 | Median of Two Sorted Arrays | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0004.Median-of-Two-Sorted-Arrays) | 29.6% | Hard | | -| 0005 | Longest Palindromic Substring | | 29.4% | Medium | | -| 0006 | ZigZag Conversion | | 36.3% | Medium | | -| 0007 | Reverse Integer | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0007.Reverse-Integer) | 25.8% | Easy | | -| 0008 | String to Integer (atoi) | | 15.4% | Medium | | -| 0009 | Palindrome Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0009.Palindrome-Number) | 48.4% | Easy | | -| 0010 | Regular Expression Matching | | 26.8% | Hard | | -| 0011 | Container With Most Water | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0011.Container-With-Most-Water) | 50.8% | Medium | | -| 0012 | Integer to Roman | | 55.0% | Medium | | -| 0013 | Roman to Integer | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0013.Roman-to-Integer) | 55.7% | Easy | | -| 0014 | Longest Common Prefix | | 35.4% | Easy | | -| 0015 | 3Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0015.3Sum) | 26.8% | Medium | | -| 0016 | 3Sum Closest | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0016.3Sum-Closest) | 46.0% | Medium | | -| 0017 | Letter Combinations of a Phone Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0017.Letter-Combinations-of-a-Phone-Number) | 46.8% | Medium | | -| 0018 | 4Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0018.4Sum) | 33.6% | Medium | | -| 0019 | Remove Nth Node From End of List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0019.Remove-Nth-Node-From-End-of-List) | 35.2% | Medium | | -| 0020 | Valid Parentheses | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0020.Valid-Parentheses) | 38.9% | Easy | | -| 0021 | Merge Two Sorted Lists | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0021.Merge-Two-Sorted-Lists) | 53.5% | Easy | | -| 0022 | Generate Parentheses | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0022.Generate-Parentheses) | 62.6% | Medium | | -| 0023 | Merge k Sorted Lists | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0023.Merge-k-Sorted-Lists) | 40.2% | Hard | | -| 0024 | Swap Nodes in Pairs | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0024.Swap-Nodes-in-Pairs) | 50.3% | Medium | | -| 0025 | Reverse Nodes in k-Group | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0025.Reverse-Nodes-in-k-Group) | 42.0% | Hard | | -| 0026 | Remove Duplicates from Sorted Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0026.Remove-Duplicates-from-Sorted-Array) | 45.1% | Easy | | -| 0027 | Remove Element | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0027.Remove-Element) | 48.2% | Easy | | -| 0028 | Implement strStr() | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0028.Implement-strStr) | 34.5% | Easy | | -| 0029 | Divide Two Integers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0029.Divide-Two-Integers) | 16.4% | Medium | | -| 0030 | Substring with Concatenation of All Words | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0030.Substring-with-Concatenation-of-All-Words)(是否还有更优解) | 25.4% | Hard | | -| 0031 | Next Permutation | | 32.6% | Medium | | -| 0032 | Longest Valid Parentheses | | 28.4% | Hard | | -| 0033 | Search in Rotated Sorted Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0033.Search-in-Rotated-Sorted-Array) | 34.5% | Medium | | -| 0034 | Find First and Last Position of Element in Sorted Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array) | 36.1% | Medium | | -| 0035 | Search Insert Position | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0035.Search-Insert-Position) | 42.6% | Easy | | -| 0036 | Valid Sudoku | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0036.Valid-Sudoku) | 48.7% | Medium | | -| 0037 | Sudoku Solver | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0037.Sudoku-Solver) | 43.5% | Hard | | -| 0038 | Count and Say | | 44.6% | Easy | | -| 0039 | Combination Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0039.Combination-Sum) | 56.0% | Medium | | -| 0040 | Combination Sum II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0040.Combination-Sum-II) | 48.1% | Medium | | -| 0041 | First Missing Positive | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0041.First-Missing-Positive) | 32.0% | Hard | | -| 0042 | Trapping Rain Water | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0042.Trapping-Rain-Water) | 48.8% | Hard | | -| 0043 | Multiply Strings | | 33.9% | Medium | | -| 0044 | Wildcard Matching | | 24.7% | Hard | | -| 0045 | Jump Game II | | 30.5% | Hard | | -| 0046 | Permutations | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0046.Permutations) | 63.5% | Medium | | -| 0047 | Permutations II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0047.Permutations-II) | 46.4% | Medium | | -| 0048 | Rotate Image | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0048.Rotate-Image) | 56.6% | Medium | | -| 0049 | Group Anagrams | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams) | 56.8% | Medium | | -| 0050 | Pow(x, n) | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0050.Powx-n) | 30.3% | Medium | | -| 0051 | N-Queens | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0051.N-Queens) | 46.6% | Hard | | -| 0052 | N-Queens II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0052.N-Queens-II) | 57.8% | Hard | | -| 0053 | Maximum Subarray | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0053.Maximum-Subarray) | 46.5% | Easy | | -| 0054 | Spiral Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0054.Spiral-Matrix) | 34.1% | Medium | | -| 0055 | Jump Game | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0055.Jump-Game) | 34.6% | Medium | | -| 0056 | Merge Intervals | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0056.Merge-Intervals) | 39.3% | Medium | | -| 0057 | Insert Interval | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0057.Insert-Interval) | 33.5% | Hard | | -| 0058 | Length of Last Word | | 32.6% | Easy | | -| 0059 | Spiral Matrix II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0059.Spiral-Matrix-II) | 53.8% | Medium | | -| 0060 | Permutation Sequence | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0060.Permutation-Sequence) | 38.4% | Hard | | -| 0061 | Rotate List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0061.Rotate-List) | 30.0% | Medium | | -| 0062 | Unique Paths | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0062.Unique-Paths) | 54.1% | Medium | | -| 0063 | Unique Paths II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0063.Unique-Paths-II) | 34.5% | Medium | | -| 0064 | Minimum Path Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0064.Minimum-Path-Sum) | 54.4% | Medium | | -| 0065 | Valid Number | | 15.3% | Hard | | -| 0066 | Plus One | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0066.Plus-One) | 43.0% | Easy | | -| 0067 | Add Binary | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0067.Add-Binary) | 45.2% | Easy | | -| 0068 | Text Justification | | 27.7% | Hard | | -| 0069 | Sqrt(x) | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0069.Sqrtx) | 33.9% | Easy | | -| 0070 | Climbing Stairs | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0070.Climbing-Stairs) | 47.8% | Easy | | -| 0071 | Simplify Path | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0071.Simplify-Path) | 32.6% | Medium | | -| 0072 | Edit Distance | | 44.8% | Hard | | -| 0073 | Set Matrix Zeroes | | 43.1% | Medium | | -| 0074 | Search a 2D Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0074.Search-a-2D-Matrix) | 36.5% | Medium | | -| 0075 | Sort Colors | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0075.Sort-Colors) | 47.3% | Medium | | -| 0076 | Minimum Window Substring | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0076.Minimum-Window-Substring) | 34.6% | Hard | | -| 0077 | Combinations | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0077.Combinations) | 54.7% | Medium | | -| 0078 | Subsets | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0078.Subsets) | 61.9% | Medium | | -| 0079 | Word Search | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0079.Word-Search) | 35.6% | Medium | | -| 0080 | Remove Duplicates from Sorted Array II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II) | 43.9% | Medium | | -| 0081 | Search in Rotated Sorted Array II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0081.Search-in-Rotated-Sorted-Array-II) | 33.0% | Medium | | -| 0082 | Remove Duplicates from Sorted List II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II) | 36.8% | Medium | | -| 0083 | Remove Duplicates from Sorted List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0083.Remove-Duplicates-from-Sorted-List) | 45.4% | Easy | | -| 0084 | Largest Rectangle in Histogram | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0084.Largest-Rectangle-in-Histogram) | 35.1% | Hard | | -| 0085 | Maximal Rectangle | | 37.7% | Hard | | -| 0086 | Partition List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0086.Partition-List) | 41.4% | Medium | | -| 0087 | Scramble String | | 33.7% | Hard | | -| 0088 | Merge Sorted Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0088.Merge-Sorted-Array) | 39.4% | Easy | | -| 0089 | Gray Code | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0089.Gray-Code) | 49.1% | Medium | | -| 0090 | Subsets II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0090.Subsets-II) | 47.1% | Medium | | -| 0091 | Decode Ways | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0091.Decode-Ways) | 24.6% | Medium | | -| 0092 | Reverse Linked List II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0092.Reverse-Linked-List-II) | 38.8% | Medium | | -| 0093 | Restore IP Addresses | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0093.Restore-IP-Addresses) | 35.6% | Medium | | -| 0094 | Binary Tree Inorder Traversal | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0094.Binary-Tree-Inorder-Traversal) | 63.3% | Medium | | -| 0095 | Unique Binary Search Trees II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0095.Unique-Binary-Search-Trees-II) | 40.6% | Medium | | -| 0096 | Unique Binary Search Trees | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0096.Unique-Binary-Search-Trees) | 52.9% | Medium | | -| 0097 | Interleaving String | | 31.5% | Hard | | -| 0098 | Validate Binary Search Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0098.Validate-Binary-Search-Tree) | 27.8% | Medium | | -| 0099 | Recover Binary Search Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0099.Recover-Binary-Search-Tree) | 39.6% | Hard | | -| 0100 | Same Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0100.Same-Tree) | 53.4% | Easy | | -| 0101 | Symmetric Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0101.Symmetric-Tree) | 46.8% | Easy | | -| 0102 | Binary Tree Level Order Traversal | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0102.Binary-Tree-Level-Order-Traversal) | 54.5% | Medium | | -| 0103 | Binary Tree Zigzag Level Order Traversal | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal) | 48.3% | Medium | | -| 0104 | Maximum Depth of Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0104.Maximum-Depth-of-Binary-Tree) | 66.0% | 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) | 48.8% | 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) | 47.1% | 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) | 53.5% | Easy | | -| 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) | 57.9% | 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) | 47.6% | Medium | | -| 0110 | Balanced Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0110.Balanced-Binary-Tree) | 43.5% | Easy | | -| 0111 | Minimum Depth of Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0111.Minimum-Depth-of-Binary-Tree) | 37.4% | Easy | | -| 0112 | Path Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0112.Path-Sum) | 41.1% | Easy | | -| 0113 | Path Sum II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0113.Path-Sum-II) | 46.6% | Medium | | -| 0114 | Flatten Binary Tree to Linked List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0114.Flatten-Binary-Tree-to-Linked-List) | 49.2% | Medium | | -| 0115 | Distinct Subsequences | | 38.2% | Hard | | -| 0116 | Populating Next Right Pointers in Each Node | | 45.2% | Medium | | -| 0117 | Populating Next Right Pointers in Each Node II | | 39.1% | Medium | | -| 0118 | Pascal's Triangle | | 52.4% | Easy | | -| 0119 | Pascal's Triangle II | | 49.0% | Easy | | -| 0120 | Triangle | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0120.Triangle) | 44.1% | Medium | | -| 0121 | Best Time to Buy and Sell Stock | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock) | 50.4% | Easy | | -| 0122 | Best Time to Buy and Sell Stock II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II) | 56.9% | Easy | | -| 0123 | Best Time to Buy and Sell Stock III | | 37.4% | Hard | | -| 0124 | Binary Tree Maximum Path Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0124.Binary-Tree-Maximum-Path-Sum) | 34.3% | Hard | | -| 0125 | Valid Palindrome | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0125.Valid-Palindrome) | 36.7% | Easy | | -| 0126 | Word Ladder II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0126.Word-Ladder-II) | 22.1% | Hard | | -| 0127 | Word Ladder | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0127.Word-Ladder) | 29.5% | Medium | | -| 0128 | Longest Consecutive Sequence | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0128.Longest-Consecutive-Sequence) | 45.1% | Hard | | -| 0129 | Sum Root to Leaf Numbers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0129.Sum-Root-to-Leaf-Numbers) | 49.0% | Medium | | -| 0130 | Surrounded Regions | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0130.Surrounded-Regions) | 28.1% | Medium | | -| 0131 | Palindrome Partitioning | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0131.Palindrome-Partitioning) | 47.5% | Medium | | -| 0132 | Palindrome Partitioning II | | 30.2% | Hard | | -| 0133 | Clone Graph | | 34.7% | Medium | | -| 0134 | Gas Station | | 38.5% | Medium | | -| 0135 | Candy | | 31.6% | Hard | | -| 0136 | Single Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0136.Single-Number) | 65.5% | Easy | | -| 0137 | Single Number II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0137.Single-Number-II) | 52.4% | Medium | | -| 0138 | Copy List with Random Pointer | | 36.3% | Medium | | -| 0139 | Word Break | | 40.0% | Medium | | -| 0140 | Word Break II | | 32.6% | Hard | | -| 0141 | Linked List Cycle | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0141.Linked-List-Cycle) | 41.1% | Easy | | -| 0142 | Linked List Cycle II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0142.Linked-List-Cycle-II) | 37.3% | Medium | | -| 0143 | Reorder List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0143.Reorder-List) | 37.0% | Medium | | -| 0144 | Binary Tree Preorder Traversal | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0144.Binary-Tree-Preorder-Traversal) | 55.6% | Medium | | -| 0145 | Binary Tree Postorder Traversal | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0145.Binary-Tree-Postorder-Traversal) | 54.9% | Hard | | -| 0146 | LRU Cache | | 33.1% | Medium | | -| 0147 | Insertion Sort List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0147.Insertion-Sort-List) | 41.1% | Medium | | -| 0148 | Sort List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0148.Sort-List) | 42.3% | Medium | | -| 0149 | Max Points on a Line | | 16.9% | Hard | | -| 0150 | Evaluate Reverse Polish Notation | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0150.Evaluate-Reverse-Polish-Notation) | 36.3% | Medium | | -| 0151 | Reverse Words in a String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0151.Reverse-Words-in-a-String) | 21.9% | Medium | | -| 0152 | Maximum Product Subarray | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0152.Maximum-Product-Subarray) | 31.7% | Medium | | -| 0153 | Find Minimum in Rotated Sorted Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0153.Find-Minimum-in-Rotated-Sorted-Array) | 45.1% | Medium | | -| 0154 | Find Minimum in Rotated Sorted Array II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0154.Find-Minimum-in-Rotated-Sorted-Array-II) | 41.6% | Hard | | -| 0155 | Min Stack | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0155.Min-Stack) | 44.4% | Easy | | -| 0156 | Binary Tree Upside Down | | 55.0% | Medium | | -| 0157 | Read N Characters Given Read4 | | 34.2% | Easy | | -| 0158 | Read N Characters Given Read4 II - Call multiple times | | 33.7% | Hard | | -| 0159 | Longest Substring with At Most Two Distinct Characters | | 49.4% | Medium | | -| 0160 | Intersection of Two Linked Lists | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0160.Intersection-of-Two-Linked-Lists) | 40.5% | Easy | | -| 0161 | One Edit Distance | | 32.3% | Medium | | -| 0162 | Find Peak Element | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0162.Find-Peak-Element) | 43.3% | Medium | | -| 0163 | Missing Ranges | | 24.3% | Medium | | -| 0164 | Maximum Gap | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0164.Maximum-Gap) | 35.4% | Hard | | -| 0165 | Compare Version Numbers | | 27.4% | Medium | | -| 0166 | Fraction to Recurring Decimal | | 21.6% | Medium | | -| 0167 | Two Sum II - Input array is sorted | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0167.Two-Sum-II---Input-array-is-sorted) | 54.0% | Easy | | -| 0168 | Excel Sheet Column Title | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0168.Excel-Sheet-Column-Title) | 31.0% | Easy | | -| 0169 | Majority Element | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0169.Majority-Element) | 58.7% | Easy | | -| 0170 | Two Sum III - Data structure design | | 33.5% | Easy | | -| 0171 | Excel Sheet Column Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0171.Excel-Sheet-Column-Number) | 54.6% | Easy | | -| 0172 | Factorial Trailing Zeroes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0172.Factorial-Trailing-Zeroes) | 37.8% | Easy | | -| 0173 | Binary Search Tree Iterator | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0173.Binary-Search-Tree-Iterator) | 56.5% | Medium | | -| 0174 | Dungeon Game | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0174.Dungeon-Game) | 32.3% | Hard | | -| 0175 | Combine Two Tables | | 60.7% | Easy | | -| 0176 | Second Highest Salary | | 31.6% | Easy | | -| 0177 | Nth Highest Salary | | 31.3% | Medium | | -| 0178 | Rank Scores | | 45.8% | Medium | | -| 0179 | Largest Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0179.Largest-Number) | 28.7% | Medium | | -| 0180 | Consecutive Numbers | | 39.7% | Medium | | -| 0181 | Employees Earning More Than Their Managers | | 56.8% | Easy | | -| 0182 | Duplicate Emails | | 62.0% | Easy | | -| 0183 | Customers Who Never Order | | 53.4% | Easy | | -| 0184 | Department Highest Salary | | 36.6% | Medium | | -| 0185 | Department Top Three Salaries | | 34.5% | Hard | | -| 0186 | Reverse Words in a String II | | 43.3% | Medium | | -| 0187 | Repeated DNA Sequences | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0187.Repeated-DNA-Sequences) | 38.9% | Medium | | -| 0188 | Best Time to Buy and Sell Stock IV | | 28.0% | Hard | | -| 0189 | Rotate Array | | 34.7% | Easy | | -| 0190 | Reverse Bits | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0190.Reverse-Bits) | 39.7% | Easy | | -| 0191 | Number of 1 Bits | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0191.Number-of-1-Bits) | 49.8% | Easy | | -| 0192 | Word Frequency | | 25.8% | Medium | | -| 0193 | Valid Phone Numbers | | 25.3% | Easy | | -| 0194 | Transpose File | | 24.1% | Medium | | -| 0195 | Tenth Line | | 33.0% | Easy | | -| 0196 | Delete Duplicate Emails | | 41.0% | Easy | | -| 0197 | Rising Temperature | | 38.4% | Easy | | -| 0198 | House Robber | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0198.House-Robber) | 42.0% | Easy | | -| 0199 | Binary Tree Right Side View | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0199.Binary-Tree-Right-Side-View) | 54.0% | Medium | | -| 0200 | Number of Islands | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0200.Number-of-Islands) | 46.8% | Medium | | -| 0201 | Bitwise AND of Numbers Range | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0201.Bitwise-AND-of-Numbers-Range) | 39.3% | Medium | | -| 0202 | Happy Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0202.Happy-Number) | 50.4% | Easy | | -| 0203 | Remove Linked List Elements | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0203.Remove-Linked-List-Elements) | 38.6% | Easy | | -| 0204 | Count Primes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0204.Count-Primes) | 31.5% | Easy | | -| 0205 | Isomorphic Strings | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0205.Isomorphic-Strings) | 39.8% | Easy | | -| 0206 | Reverse Linked List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0206.Reverse-Linked-List) | 62.5% | Easy | | -| 0207 | Course Schedule | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0207.Course-Schedule) | 43.1% | Medium | | -| 0208 | Implement Trie (Prefix Tree) | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0208.Implement-Trie-Prefix-Tree) | 49.3% | Medium | | -| 0209 | Minimum Size Subarray Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0209.Minimum-Size-Subarray-Sum) | 38.1% | Medium | | -| 0210 | Course Schedule II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0210.Course-Schedule-II) | 40.7% | Medium | | -| 0211 | Add and Search Word - Data structure design | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0211.Add-and-Search-Word---Data-structure-design) | 38.1% | Medium | | -| 0212 | Word Search II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0212.Word-Search-II) | 34.8% | Hard | | -| 0213 | House Robber II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0213.House-Robber-II) | 36.5% | Medium | | -| 0214 | Shortest Palindrome | | 29.8% | Hard | | -| 0215 | Kth Largest Element in an Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0215.Kth-Largest-Element-in-an-Array) | 55.3% | Medium | | -| 0216 | Combination Sum III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0216.Combination-Sum-III) | 56.5% | Medium | | -| 0217 | Contains Duplicate | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0217.Contains-Duplicate) | 56.0% | Easy | | -| 0218 | The Skyline Problem | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0218.The-Skyline-Problem) | 34.5% | Hard | | -| 0219 | Contains Duplicate II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0219.Contains-Duplicate-II) | 37.7% | Easy | | -| 0220 | Contains Duplicate III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0220.Contains-Duplicate-III) | 20.9% | Medium | | -| 0221 | Maximal Square | | 37.7% | Medium | | -| 0222 | Count Complete Tree Nodes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0222.Count-Complete-Tree-Nodes) | 46.7% | Medium | | -| 0223 | Rectangle Area | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0223.Rectangle-Area) | 37.8% | Medium | | -| 0224 | Basic Calculator | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0224.Basic-Calculator) | 36.8% | Hard | | -| 0225 | Implement Stack using Queues | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0225.Implement-Stack-using-Queues) | 45.1% | Easy | | -| 0226 | Invert Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0226.Invert-Binary-Tree) | 64.9% | Easy | | -| 0227 | Basic Calculator II | | 36.9% | Medium | | -| 0228 | Summary Ranges | | 39.5% | Medium | | -| 0229 | Majority Element II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0229.Majority-Element-II) | 35.6% | Medium | | -| 0230 | Kth Smallest Element in a BST | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0230.Kth-Smallest-Element-in-a-BST) | 60.2% | Medium | | -| 0231 | Power of Two | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0231.Power-of-Two) | 43.7% | Easy | | -| 0232 | Implement Queue using Stacks | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0232.Implement-Queue-using-Stacks) | 49.5% | Easy | | -| 0233 | Number of Digit One | | 31.3% | Hard | | -| 0234 | Palindrome Linked List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0234.Palindrome-Linked-List) | 39.2% | Easy | | -| 0235 | Lowest Common Ancestor of a Binary Search Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree) | 49.9% | Easy | | -| 0236 | Lowest Common Ancestor of a Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree) | 45.6% | Medium | | -| 0237 | Delete Node in a Linked List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0237.Delete-Node-in-a-Linked-List) | 63.7% | Easy | | -| 0238 | Product of Array Except Self | | 60.1% | Medium | | -| 0239 | Sliding Window Maximum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0239.Sliding-Window-Maximum) | 43.0% | Hard | | -| 0240 | Search a 2D Matrix II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0240.Search-a-2D-Matrix-II) | 43.1% | Medium | | -| 0241 | Different Ways to Add Parentheses | | 55.2% | Medium | | -| 0242 | Valid Anagram | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0242.Valid-Anagram) | 56.8% | Easy | | -| 0243 | Shortest Word Distance | | 61.0% | Easy | | -| 0244 | Shortest Word Distance II | | 52.3% | Medium | | -| 0245 | Shortest Word Distance III | | 55.3% | Medium | | -| 0246 | Strobogrammatic Number | | 45.0% | Easy | | -| 0247 | Strobogrammatic Number II | | 47.6% | Medium | | -| 0248 | Strobogrammatic Number III | | 39.6% | Hard | | -| 0249 | Group Shifted Strings | | 55.0% | Medium | | -| 0250 | Count Univalue Subtrees | | 51.9% | Medium | | -| 0251 | Flatten 2D Vector | | 45.7% | Medium | | -| 0252 | Meeting Rooms | | 54.6% | Easy | | -| 0253 | Meeting Rooms II | | 45.7% | Medium | | -| 0254 | Factor Combinations | | 46.7% | Medium | | -| 0255 | Verify Preorder Sequence in Binary Search Tree | | 45.7% | Medium | | -| 0256 | Paint House | | 52.1% | Easy | | -| 0257 | Binary Tree Paths | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0257.Binary-Tree-Paths) | 51.4% | Easy | | -| 0258 | Add Digits | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0258.Add-Digits) | 57.6% | Easy | | -| 0259 | 3Sum Smaller | | 47.6% | Medium | | -| 0260 | Single Number III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0260.Single-Number-III) | 64.3% | Medium | | -| 0261 | Graph Valid Tree | | 42.2% | Medium | | -| 0262 | Trips and Users | | 32.6% | Hard | | -| 0263 | Ugly Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0263.Ugly-Number) | 41.6% | Easy | | -| 0264 | Ugly Number II | | 42.0% | Medium | | -| 0265 | Paint House II | | 44.6% | Hard | | -| 0266 | Palindrome Permutation | | 61.9% | Easy | | -| 0267 | Palindrome Permutation II | | 36.4% | Medium | | -| 0268 | Missing Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0268.Missing-Number) | 51.7% | Easy | | -| 0269 | Alien Dictionary | | 33.3% | Hard | | -| 0270 | Closest Binary Search Tree Value | | 48.1% | Easy | | -| 0271 | Encode and Decode Strings | | 31.5% | Medium | | -| 0272 | Closest Binary Search Tree Value II | | 50.5% | Hard | | -| 0273 | Integer to English Words | | 27.0% | Hard | | -| 0274 | H-Index | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0274.H-Index) | 35.9% | Medium | | -| 0275 | H-Index II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0275.H-Index-II) | 35.9% | Medium | | -| 0276 | Paint Fence | | 38.3% | Easy | | -| 0277 | Find the Celebrity | | 41.8% | Medium | | -| 0278 | First Bad Version | | 35.7% | Easy | | -| 0279 | Perfect Squares | | 47.3% | Medium | | -| 0280 | Wiggle Sort | | 63.8% | Medium | | -| 0281 | Zigzag Iterator | | 58.4% | Medium | | -| 0282 | Expression Add Operators | | 35.5% | Hard | | -| 0283 | Move Zeroes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0283.Move-Zeroes) | 57.8% | Easy | | -| 0284 | Peeking Iterator | | 45.6% | Medium | | -| 0285 | Inorder Successor in BST | | 40.3% | Medium | | -| 0286 | Walls and Gates | | 54.5% | Medium | | -| 0287 | Find the Duplicate Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0287.Find-the-Duplicate-Number) | 55.5% | Medium | | -| 0288 | Unique Word Abbreviation | | 21.9% | Medium | | -| 0289 | Game of Life | | 54.4% | Medium | | -| 0290 | Word Pattern | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0290.Word-Pattern) | 37.0% | Easy | | -| 0291 | Word Pattern II | | 43.4% | Hard | | -| 0292 | Nim Game | | 54.9% | Easy | | -| 0293 | Flip Game | | 60.6% | Easy | | -| 0294 | Flip Game II | | 50.0% | Medium | | -| 0295 | Find Median from Data Stream | | 44.3% | Hard | | -| 0296 | Best Meeting Point | | 57.5% | Hard | | -| 0297 | Serialize and Deserialize Binary Tree | | 47.4% | Hard | | -| 0298 | Binary Tree Longest Consecutive Sequence | | 47.1% | Medium | | -| 0299 | Bulls and Cows | | 42.4% | Easy | | -| 0300 | Longest Increasing Subsequence | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0300.Longest-Increasing-Subsequence) | 42.6% | Medium | | -| 0301 | Remove Invalid Parentheses | | 43.3% | Hard | | -| 0302 | Smallest Rectangle Enclosing Black Pixels | | 51.6% | Hard | | -| 0303 | Range Sum Query - Immutable | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0303.Range-Sum-Query---Immutable) | 44.7% | Easy | | -| 0304 | Range Sum Query 2D - Immutable | | 38.5% | Medium | | -| 0305 | Number of Islands II | | 40.1% | Hard | | -| 0306 | Additive Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0306.Additive-Number) | 29.3% | Medium | | -| 0307 | Range Sum Query - Mutable | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0307.Range-Sum-Query---Mutable) | 34.6% | Medium | | -| 0308 | Range Sum Query 2D - Mutable | | 35.6% | Hard | | -| 0309 | Best Time to Buy and Sell Stock with Cooldown | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown) | 47.4% | Medium | | -| 0310 | Minimum Height Trees | | 32.3% | Medium | | -| 0311 | Sparse Matrix Multiplication | | 61.8% | Medium | | -| 0312 | Burst Balloons | | 51.7% | Hard | | -| 0313 | Super Ugly Number | | 45.0% | Medium | | -| 0314 | Binary Tree Vertical Order Traversal | | 45.2% | Medium | | -| 0315 | Count of Smaller Numbers After Self | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0315.Count-of-Smaller-Numbers-After-Self) | 41.5% | Hard | | -| 0316 | Remove Duplicate Letters | | 35.8% | Hard | | -| 0317 | Shortest Distance from All Buildings | | 41.4% | Hard | | -| 0318 | Maximum Product of Word Lengths | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0318.Maximum-Product-of-Word-Lengths) | 51.2% | Medium | | -| 0319 | Bulb Switcher | | 45.4% | Medium | | -| 0320 | Generalized Abbreviation | | 52.0% | Medium | | -| 0321 | Create Maximum Number | | 27.0% | Hard | | -| 0322 | Coin Change | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0322.Coin-Change) | 35.4% | Medium | | -| 0323 | Number of Connected Components in an Undirected Graph | | 56.0% | Medium | | -| 0324 | Wiggle Sort II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0324.Wiggle-Sort-II) | 29.9% | Medium | | -| 0325 | Maximum Size Subarray Sum Equals k | | 46.8% | Medium | | -| 0326 | Power of Three | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0326.Power-of-Three) | 42.1% | Easy | | -| 0327 | Count of Range Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0327.Count-of-Range-Sum) | 35.1% | Hard | | -| 0328 | Odd Even Linked List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0328.Odd-Even-Linked-List) | 55.7% | Medium | | -| 0329 | Longest Increasing Path in a Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0329.Longest-Increasing-Path-in-a-Matrix) | 43.4% | Hard | | -| 0330 | Patching Array | | 34.5% | Hard | | -| 0331 | Verify Preorder Serialization of a Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree) | 40.4% | Medium | | -| 0332 | Reconstruct Itinerary | | 36.7% | Medium | | -| 0333 | Largest BST Subtree | | 35.8% | Medium | | -| 0334 | Increasing Triplet Subsequence | | 40.0% | Medium | | -| 0335 | Self Crossing | | 28.0% | Hard | | -| 0336 | Palindrome Pairs | | 33.7% | Hard | | -| 0337 | House Robber III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0337.House-Robber-III) | 50.6% | Medium | | -| 0338 | Counting Bits | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0338.Counting-Bits) | 69.5% | Medium | | -| 0339 | Nested List Weight Sum | | 73.9% | Easy | | -| 0340 | Longest Substring with At Most K Distinct Characters | | 44.0% | Hard | | -| 0341 | Flatten Nested List Iterator | | 52.9% | Medium | | -| 0342 | Power of Four | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0342.Power-of-Four) | 41.7% | Easy | | -| 0343 | Integer Break | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0343.Integer-Break) | 50.4% | Medium | | -| 0344 | Reverse String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0344.Reverse-String) | 68.5% | Easy | | -| 0345 | Reverse Vowels of a String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0345.Reverse-Vowels-of-a-String) | 44.2% | Easy | | -| 0346 | Moving Average from Data Stream | | 70.9% | Easy | | -| 0347 | Top K Frequent Elements | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0347.Top-K-Frequent-Elements) | 61.2% | Medium | | -| 0348 | Design Tic-Tac-Toe | | 54.3% | Medium | | -| 0349 | Intersection of Two Arrays | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0349.Intersection-of-Two-Arrays) | 62.5% | Easy | | -| 0350 | Intersection of Two Arrays II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0350.Intersection-of-Two-Arrays-II) | 51.3% | Easy | | -| 0351 | Android Unlock Patterns | | 48.4% | Medium | | -| 0352 | Data Stream as Disjoint Intervals | | 47.3% | Hard | | -| 0353 | Design Snake Game | | 34.1% | Medium | | -| 0354 | Russian Doll Envelopes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0354.Russian-Doll-Envelopes) | 35.6% | Hard | | -| 0355 | Design Twitter | | 30.3% | Medium | | -| 0356 | Line Reflection | | 31.8% | Medium | | -| 0357 | Count Numbers with Unique Digits | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0357.Count-Numbers-with-Unique-Digits) | 48.4% | Medium | | -| 0358 | Rearrange String k Distance Apart | | 34.9% | Hard | | -| 0359 | Logger Rate Limiter | | 70.8% | Easy | | -| 0360 | Sort Transformed Array | | 48.8% | Medium | | -| 0361 | Bomb Enemy | | 46.0% | Medium | | -| 0362 | Design Hit Counter | | 63.6% | Medium | | -| 0363 | Max Sum of Rectangle No Larger Than K | | 37.3% | Hard | | -| 0364 | Nested List Weight Sum II | | 62.7% | Medium | | -| 0365 | Water and Jug Problem | | 30.6% | Medium | | -| 0366 | Find Leaves of Binary Tree | | 70.6% | Medium | | -| 0367 | Valid Perfect Square | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0367.Valid-Perfect-Square) | 41.7% | Easy | | -| 0368 | Largest Divisible Subset | | 38.1% | Medium | | -| 0369 | Plus One Linked List | | 58.2% | Medium | | -| 0370 | Range Addition | | 62.8% | Medium | | -| 0371 | Sum of Two Integers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0371.Sum-of-Two-Integers) | 50.7% | Medium | | -| 0372 | Super Pow | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0372.Super-Pow) | 36.4% | Medium | | -| 0373 | Find K Pairs with Smallest Sums | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0373.Find-K-Pairs-with-Smallest-Sums) | 36.7% | Medium | | -| 0374 | Guess Number Higher or Lower | | 43.0% | Easy | | -| 0375 | Guess Number Higher or Lower II | | 40.3% | Medium | | -| 0376 | Wiggle Subsequence | | 39.6% | Medium | | -| 0377 | Combination Sum IV | | 45.3% | Medium | | -| 0378 | Kth Smallest Element in a Sorted Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0378.Kth-Smallest-Element-in-a-Sorted-Matrix) | 54.3% | Medium | | -| 0379 | Design Phone Directory | | 46.8% | Medium | | -| 0380 | Insert Delete GetRandom O(1) | | 47.5% | Medium | | -| 0381 | Insert Delete GetRandom O(1) - Duplicates allowed | | 34.1% | Hard | | -| 0382 | Linked List Random Node | | 52.1% | Medium | | -| 0383 | Ransom Note | | 53.1% | Easy | | -| 0384 | Shuffle an Array | | 52.8% | Medium | | -| 0385 | Mini Parser | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0385.Mini-Parser) | 33.8% | Medium | | -| 0386 | Lexicographical Numbers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0386.Lexicographical-Numbers) | 51.6% | Medium | | -| 0387 | First Unique Character in a String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0387.First-Unique-Character-in-a-String) | 53.3% | Easy | | -| 0388 | Longest Absolute File Path | | 41.7% | Medium | | -| 0389 | Find the Difference | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0389.Find-the-Difference) | 55.3% | Easy | | -| 0390 | Elimination Game | | 44.5% | Medium | | -| 0391 | Perfect Rectangle | | 30.4% | Hard | | -| 0392 | Is Subsequence | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0392.Is-Subsequence) | 49.2% | Easy | | -| 0393 | UTF-8 Validation | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0393.UTF-8-Validation) | 37.5% | Medium | | -| 0394 | Decode String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0394.Decode-String) | 49.9% | Medium | | -| 0395 | Longest Substring with At Least K Repeating Characters | | 41.4% | Medium | | -| 0396 | Rotate Function | | 36.3% | Medium | | -| 0397 | Integer Replacement | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0397.Integer-Replacement) | 32.9% | Medium | | -| 0398 | Random Pick Index | | 55.9% | Medium | | -| 0399 | Evaluate Division | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0399.Evaluate-Division) | 51.6% | Medium | | -| 0400 | Nth Digit | | 31.7% | Medium | | -| 0401 | Binary Watch | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0401.Binary-Watch) | 47.5% | Easy | | -| 0402 | Remove K Digits | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0402.Remove-K-Digits) | 28.4% | Medium | | -| 0403 | Frog Jump | | 39.7% | Hard | | -| 0404 | Sum of Left Leaves | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0404.Sum-of-Left-Leaves) | 50.9% | Easy | | -| 0405 | Convert a Number to Hexadecimal | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0405.Convert-a-Number-to-Hexadecimal) | 43.9% | Easy | | -| 0406 | Queue Reconstruction by Height | | 66.8% | Medium | | -| 0407 | Trapping Rain Water II | | 42.4% | Hard | | -| 0408 | Valid Word Abbreviation | | 30.6% | Easy | | -| 0409 | Longest Palindrome | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome) | 50.3% | Easy | | -| 0410 | Split Array Largest Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0410.Split-Array-Largest-Sum) | 44.5% | Hard | | -| 0411 | Minimum Unique Word Abbreviation | | 36.3% | Hard | | -| 0412 | Fizz Buzz | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0412.Fizz-Buzz) | 62.3% | Easy | | -| 0413 | Arithmetic Slices | | 57.9% | Medium | | -| 0414 | Third Maximum Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0414.Third-Maximum-Number) | 30.5% | Easy | | -| 0415 | Add Strings | | 47.5% | Easy | | -| 0416 | Partition Equal Subset Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0416.Partition-Equal-Subset-Sum) | 43.7% | Medium | | -| 0417 | Pacific Atlantic Water Flow | | 41.1% | Medium | | -| 0418 | Sentence Screen Fitting | | 32.6% | Medium | | -| 0419 | Battleships in a Board | | 70.0% | Medium | | -| 0420 | Strong Password Checker | | 14.1% | Hard | | -| 0421 | Maximum XOR of Two Numbers in an Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0421.Maximum-XOR-of-Two-Numbers-in-an-Array) | 53.5% | Medium | | -| 0422 | Valid Word Square | | 37.7% | Easy | | -| 0423 | Reconstruct Original Digits from English | | 46.9% | Medium | | -| 0424 | Longest Repeating Character Replacement | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0424.Longest-Repeating-Character-Replacement) | 47.0% | Medium | | -| 0425 | Word Squares | | 47.6% | Hard | | -| 0426 | Convert Binary Search Tree to Sorted Doubly Linked List | | 59.1% | Medium | | -| 0427 | Construct Quad Tree | | 61.4% | Medium | | -| 0428 | Serialize and Deserialize N-ary Tree | | 59.4% | Hard | | -| 0429 | N-ary Tree Level Order Traversal | | 65.0% | Medium | | -| 0430 | Flatten a Multilevel Doubly Linked List | | 55.1% | Medium | | -| 0431 | Encode N-ary Tree to Binary Tree | | 70.8% | Hard | | -| 0432 | All O`one Data Structure | | 32.4% | Hard | | -| 0433 | Minimum Genetic Mutation | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0433.Minimum-Genetic-Mutation) | 41.8% | Medium | | -| 0434 | Number of Segments in a String | | 37.7% | Easy | | -| 0435 | Non-overlapping Intervals | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0435.Non-overlapping-Intervals) | 42.9% | Medium | | -| 0436 | Find Right Interval | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0436.Find-Right-Interval) | 45.4% | Medium | | -| 0437 | Path Sum III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0437.Path-Sum-III) | 46.5% | Medium | | -| 0438 | Find All Anagrams in a String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0438.Find-All-Anagrams-in-a-String) | 43.3% | Medium | | -| 0439 | Ternary Expression Parser | | 55.9% | Medium | | -| 0440 | K-th Smallest in Lexicographical Order | | 29.1% | Hard | | -| 0441 | Arranging Coins | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0441.Arranging-Coins) | 41.8% | Easy | | -| 0442 | Find All Duplicates in an Array | | 67.7% | Medium | | -| 0443 | String Compression | | 41.3% | Easy | | -| 0444 | Sequence Reconstruction | | 22.2% | Medium | | -| 0445 | Add Two Numbers II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0445.Add-Two-Numbers-II) | 54.5% | Medium | | -| 0446 | Arithmetic Slices II - Subsequence | | 32.7% | Hard | | -| 0447 | Number of Boomerangs | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0447.Number-of-Boomerangs) | 51.8% | Easy | | -| 0448 | Find All Numbers Disappeared in an Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array) | 55.9% | Easy | | -| 0449 | Serialize and Deserialize BST | | 52.0% | Medium | | -| 0450 | Delete Node in a BST | | 43.1% | Medium | | -| 0451 | Sort Characters By Frequency | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0451.Sort-Characters-By-Frequency) | 63.0% | Medium | | -| 0452 | Minimum Number of Arrows to Burst Balloons | | 49.6% | Medium | | -| 0453 | Minimum Moves to Equal Array Elements | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0453.Minimum-Moves-to-Equal-Array-Elements) | 50.2% | Easy | | -| 0454 | 4Sum II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0454.4Sum-II) | 53.1% | Medium | | -| 0455 | Assign Cookies | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0455.Assign-Cookies) | 49.9% | Easy | | -| 0456 | 132 Pattern | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0456.132-Pattern) | 28.9% | Medium | | -| 0457 | Circular Array Loop | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0457.Circular-Array-Loop) | 29.4% | Medium | | -| 0458 | Poor Pigs | | 47.4% | Hard | | -| 0459 | Repeated Substring Pattern | | 42.2% | Easy | | -| 0460 | LFU Cache | | 34.2% | Hard | | -| 0461 | Hamming Distance | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0461.Hamming-Distance) | 72.8% | Easy | | -| 0462 | Minimum Moves to Equal Array Elements II | | 53.8% | Medium | | -| 0463 | Island Perimeter | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0463.Island-Perimeter) | 65.7% | Easy | | -| 0464 | Can I Win | | 28.8% | Medium | | -| 0465 | Optimal Account Balancing | | 46.8% | Hard | | -| 0466 | Count The Repetitions | | 28.2% | Hard | | -| 0467 | Unique Substrings in Wraparound String | | 35.6% | Medium | | -| 0468 | Validate IP Address | | 24.0% | Medium | | -| 0469 | Convex Polygon | | 37.0% | Medium | | -| 0470 | Implement Rand10() Using Rand7() | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0470.Implement-Rand10-Using-Rand7) | 46.3% | Medium | | -| 0471 | Encode String with Shortest Length | | 47.1% | Hard | | -| 0472 | Concatenated Words | | 43.6% | Hard | | -| 0473 | Matchsticks to Square | | 37.7% | Medium | | -| 0474 | Ones and Zeroes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0474.Ones-and-Zeroes) | 42.8% | Medium | | -| 0475 | Heaters | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0475.Heaters) | 33.1% | Easy | | -| 0476 | Number Complement | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0476.Number-Complement) | 64.8% | Easy | | -| 0477 | Total Hamming Distance | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0477.Total-Hamming-Distance) | 50.5% | Medium | | -| 0478 | Generate Random Point in a Circle | | 38.5% | Medium | | -| 0479 | Largest Palindrome Product | | 29.0% | Hard | | -| 0480 | Sliding Window Median | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0480.Sliding-Window-Median) | 37.2% | Hard | | -| 0481 | Magical String | | 47.5% | Medium | | -| 0482 | License Key Formatting | | 43.1% | Easy | | -| 0483 | Smallest Good Base | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0483.Smallest-Good-Base) | 35.7% | Hard | | -| 0484 | Find Permutation | | 60.5% | Medium | | -| 0485 | Max Consecutive Ones | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0485.Max-Consecutive-Ones) | 54.7% | Easy | | -| 0486 | Predict the Winner | | 47.9% | Medium | | -| 0487 | Max Consecutive Ones II | | 48.5% | Medium | | -| 0488 | Zuma Game | | 39.8% | Hard | | -| 0489 | Robot Room Cleaner | | 69.7% | Hard | | -| 0490 | The Maze | | 51.4% | Medium | | -| 0491 | Increasing Subsequences | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0491.Increasing-Subsequences) | 46.1% | Medium | | -| 0492 | Construct the Rectangle | | 49.6% | Easy | | -| 0493 | Reverse Pairs | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0493.Reverse-Pairs) | 25.2% | Hard | | -| 0494 | Target Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0494.Target-Sum) | 46.3% | Medium | | -| 0495 | Teemo Attacking | | 53.6% | Medium | | -| 0496 | Next Greater Element I | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0496.Next-Greater-Element-I) | 63.8% | Easy | | -| 0497 | Random Point in Non-overlapping Rectangles | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles) | 37.8% | Medium | | -| 0498 | Diagonal Traverse | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0498.Diagonal-Traverse) | 48.2% | Medium | | -| 0499 | The Maze III | | 41.0% | Hard | | -| 0500 | Keyboard Row | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0500.Keyboard-Row) | 64.7% | Easy | | -| 0501 | Find Mode in Binary Search Tree | | 42.3% | Easy | | -| 0502 | IPO | | 40.4% | Hard | | -| 0503 | Next Greater Element II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0503.Next-Greater-Element-II) | 56.5% | Medium | | -| 0504 | Base 7 | | 46.2% | Easy | | -| 0505 | The Maze II | | 47.7% | Medium | | -| 0506 | Relative Ranks | | 50.5% | Easy | | -| 0507 | Perfect Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0507.Perfect-Number) | 35.5% | Easy | | -| 0508 | Most Frequent Subtree Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0508.Most-Frequent-Subtree-Sum) | 57.9% | Medium | | -| 0509 | Fibonacci Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0509.Fibonacci-Number) | 67.2% | Easy | | -| 0510 | Inorder Successor in BST II | | 58.0% | Medium | | -| 0511 | Game Play Analysis I | | 80.8% | Easy | | -| 0512 | Game Play Analysis II | | 55.5% | Easy | | -| 0513 | Find Bottom Left Tree Value | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0513.Find-Bottom-Left-Tree-Value) | 61.5% | Medium | | -| 0514 | Freedom Trail | | 43.0% | Hard | | -| 0515 | Find Largest Value in Each Tree Row | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0515.Find-Largest-Value-in-Each-Tree-Row) | 61.1% | Medium | | -| 0516 | Longest Palindromic Subsequence | | 53.2% | Medium | | -| 0517 | Super Washing Machines | | 38.3% | Hard | | -| 0518 | Coin Change 2 | | 50.2% | Medium | | -| 0519 | Random Flip Matrix | | 36.7% | Medium | | -| 0520 | Detect Capital | | 54.4% | Easy | | -| 0521 | Longest Uncommon Subsequence I | | 57.6% | Easy | | -| 0522 | Longest Uncommon Subsequence II | | 34.0% | Medium | | -| 0523 | Continuous Subarray Sum | | 24.6% | Medium | | -| 0524 | Longest Word in Dictionary through Deleting | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0524.Longest-Word-in-Dictionary-through-Deleting) | 48.4% | Medium | | -| 0525 | Contiguous Array | | 42.8% | Medium | | -| 0526 | Beautiful Arrangement | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0526.Beautiful-Arrangement) | 57.8% | Medium | | -| 0527 | Word Abbreviation | | 54.2% | Hard | | -| 0528 | Random Pick with Weight | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0528.Random-Pick-with-Weight) | 43.9% | Medium | | -| 0529 | Minesweeper | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0529.Minesweeper) | 59.1% | Medium | | -| 0530 | Minimum Absolute Difference in BST | | 53.7% | Easy | | -| 0531 | Lonely Pixel I | | 59.0% | Medium | | -| 0532 | K-diff Pairs in an Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0532.K-diff-Pairs-in-an-Array) | 31.5% | Easy | | -| 0533 | Lonely Pixel II | | 47.9% | Medium | | -| 0534 | Game Play Analysis III | | 75.9% | Medium | | -| 0535 | Encode and Decode TinyURL | | 79.9% | Medium | | -| 0536 | Construct Binary Tree from String | | 48.3% | Medium | | -| 0537 | Complex Number Multiplication | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0537.Complex-Number-Multiplication) | 67.4% | Medium | | -| 0538 | Convert BST to Greater Tree | | 55.3% | Easy | | -| 0539 | Minimum Time Difference | | 51.5% | Medium | | -| 0540 | Single Element in a Sorted Array | | 57.9% | Medium | | -| 0541 | Reverse String II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0541.Reverse-String-II) | 48.4% | Easy | | -| 0542 | 01 Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0542.01-Matrix) | 39.8% | Medium | | -| 0543 | Diameter of Binary Tree | | 48.4% | Easy | | -| 0544 | Output Contest Matches | | 75.2% | Medium | | -| 0545 | Boundary of Binary Tree | | 38.9% | Medium | | -| 0546 | Remove Boxes | | 42.7% | Hard | | -| 0547 | Friend Circles | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0547.Friend-Circles) | 58.5% | Medium | | -| 0548 | Split Array with Equal Sum | | 46.4% | Medium | | -| 0549 | Binary Tree Longest Consecutive Sequence II | | 47.0% | Medium | | -| 0550 | Game Play Analysis IV | | 45.2% | Medium | | -| 0551 | Student Attendance Record I | | 46.0% | Easy | | -| 0552 | Student Attendance Record II | | 36.7% | Hard | | -| 0553 | Optimal Division | | 56.7% | Medium | | -| 0554 | Brick Wall | | 50.0% | Medium | | -| 0555 | Split Concatenated Strings | | 42.2% | Medium | | -| 0556 | Next Greater Element III | | 31.7% | Medium | | -| 0557 | Reverse Words in a String III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0557.Reverse-Words-in-a-String-III) | 69.8% | Easy | | -| 0558 | Logical OR of Two Binary Grids Represented as Quad-Trees | | 44.6% | Medium | | -| 0559 | Maximum Depth of N-ary Tree | | 68.6% | Easy | | -| 0560 | Subarray Sum Equals K | | 43.8% | Medium | | -| 0561 | Array Partition I | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0561.Array-Partition-I) | 72.0% | Easy | | -| 0562 | Longest Line of Consecutive One in Matrix | | 45.8% | Medium | | -| 0563 | Binary Tree Tilt | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0563.Binary-Tree-Tilt) | 48.7% | Easy | | -| 0564 | Find the Closest Palindrome | | 19.7% | Hard | | -| 0565 | Array Nesting | | 55.5% | Medium | | -| 0566 | Reshape the Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0566.Reshape-the-Matrix) | 60.5% | Easy | | -| 0567 | Permutation in String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0567.Permutation-in-String) | 44.4% | Medium | | -| 0568 | Maximum Vacation Days | | 40.8% | Hard | | -| 0569 | Median Employee Salary | | 57.6% | Hard | | -| 0570 | Managers with at Least 5 Direct Reports | | 66.0% | Medium | | -| 0571 | Find Median Given Frequency of Numbers | | 44.7% | Hard | | -| 0572 | Subtree of Another Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0572.Subtree-of-Another-Tree) | 44.1% | Easy | | -| 0573 | Squirrel Simulation | | 55.6% | Medium | | -| 0574 | Winning Candidate | | 47.5% | Medium | | -| 0575 | Distribute Candies | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0575.Distribute-Candies) | 61.4% | Easy | | -| 0576 | Out of Boundary Paths | | 35.1% | Medium | | -| 0577 | Employee Bonus | | 68.1% | Easy | | -| 0578 | Get Highest Answer Rate Question | | 39.3% | Medium | | -| 0579 | Find Cumulative Salary of an Employee | | 37.0% | Hard | | -| 0580 | Count Student Number in Departments | | 48.7% | Medium | | -| 0581 | Shortest Unsorted Continuous Subarray | | 31.1% | Easy | | -| 0582 | Kill Process | | 60.8% | Medium | | -| 0583 | Delete Operation for Two Strings | | 48.6% | Medium | | -| 0584 | Find Customer Referee | | 72.2% | Easy | | -| 0585 | Investments in 2016 | | 54.7% | Medium | | -| 0586 | Customer Placing the Largest Number of Orders | | 72.9% | Easy | | -| 0587 | Erect the Fence | | 35.9% | Hard | | -| 0588 | Design In-Memory File System | | 45.9% | Hard | | -| 0589 | N-ary Tree Preorder Traversal | | 72.0% | Easy | | -| 0590 | N-ary Tree Postorder Traversal | | 72.1% | Easy | | -| 0591 | Tag Validator | | 34.3% | Hard | | -| 0592 | Fraction Addition and Subtraction | | 49.0% | Medium | | -| 0593 | Valid Square | | 43.1% | Medium | | -| 0594 | Longest Harmonious Subsequence | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0594.Longest-Harmonious-Subsequence) | 46.6% | Easy | | -| 0595 | Big Countries | | 77.3% | Easy | | -| 0596 | Classes More Than 5 Students | | 38.0% | Easy | | -| 0597 | Friend Requests I: Overall Acceptance Rate | | 40.9% | Easy | | -| 0598 | Range Addition II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0598.Range-Addition-II) | 49.6% | Easy | | -| 0599 | Minimum Index Sum of Two Lists | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0599.Minimum-Index-Sum-of-Two-Lists) | 50.7% | Easy | | -| 0600 | Non-negative Integers without Consecutive Ones | | 34.1% | Hard | | -| 0601 | Human Traffic of Stadium | | 41.6% | Hard | | -| 0602 | Friend Requests II: Who Has the Most Friends | | 53.3% | Medium | | -| 0603 | Consecutive Available Seats | | 63.9% | Easy | | -| 0604 | Design Compressed String Iterator | | 37.5% | Easy | | -| 0605 | Can Place Flowers | | 31.6% | Easy | | -| 0606 | Construct String from Binary Tree | | 54.1% | Easy | | -| 0607 | Sales Person | | 62.9% | Easy | | -| 0608 | Tree Node | | 67.0% | Medium | | -| 0609 | Find Duplicate File in System | | 59.5% | Medium | | -| 0610 | Triangle Judgement | | 65.9% | Easy | | -| 0611 | Valid Triangle Number | | 48.4% | Medium | | -| 0612 | Shortest Distance in a Plane | | 59.5% | Medium | | -| 0613 | Shortest Distance in a Line | | 77.5% | Easy | | -| 0614 | Second Degree Follower | | 30.2% | Medium | | -| 0615 | Average Salary: Departments VS Company | | 46.8% | Hard | | -| 0616 | Add Bold Tag in String | | 43.0% | Medium | | -| 0617 | Merge Two Binary Trees | | 74.1% | Easy | | -| 0618 | Students Report By Geography | | 54.8% | Hard | | -| 0619 | Biggest Single Number | | 43.1% | Easy | | -| 0620 | Not Boring Movies | | 67.5% | Easy | | -| 0621 | Task Scheduler | | 50.0% | Medium | | -| 0622 | Design Circular Queue | | 43.7% | Medium | | -| 0623 | Add One Row to Tree | | 49.7% | Medium | | -| 0624 | Maximum Distance in Arrays | | 38.9% | Easy | | -| 0625 | Minimum Factorization | | 32.8% | Medium | | -| 0626 | Exchange Seats | | 62.2% | Medium | | -| 0627 | Swap Salary | | 75.2% | Easy | | -| 0628 | Maximum Product of Three Numbers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0628.Maximum-Product-of-Three-Numbers) | 47.1% | Easy | | -| 0629 | K Inverse Pairs Array | | 31.1% | Hard | | -| 0630 | Course Schedule III | | 33.5% | Hard | | -| 0631 | Design Excel Sum Formula | | 31.5% | Hard | | -| 0632 | Smallest Range Covering Elements from K Lists | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists) | 52.4% | Hard | | -| 0633 | Sum of Square Numbers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0633.Sum-of-Square-Numbers) | 32.2% | Easy | | -| 0634 | Find the Derangement of An Array | | 40.1% | Medium | | -| 0635 | Design Log Storage System | | 58.6% | Medium | | -| 0636 | Exclusive Time of Functions | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0636.Exclusive-Time-of-Functions) | 52.0% | Medium | | -| 0637 | Average of Levels in Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0637.Average-of-Levels-in-Binary-Tree) | 63.0% | Easy | | -| 0638 | Shopping Offers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0638.Shopping-Offers) | 51.5% | Medium | | -| 0639 | Decode Ways II | | 26.6% | Hard | | -| 0640 | Solve the Equation | | 42.0% | Medium | | -| 0641 | Design Circular Deque | | 52.7% | Medium | | -| 0642 | Design Search Autocomplete System | | 44.6% | Hard | | -| 0643 | Maximum Average Subarray I | | 41.5% | Easy | | -| 0644 | Maximum Average Subarray II | | 32.0% | Hard | | -| 0645 | Set Mismatch | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0645.Set-Mismatch) | 42.1% | Easy | | -| 0646 | Maximum Length of Pair Chain | | 51.8% | Medium | | -| 0647 | Palindromic Substrings | | 60.6% | Medium | | -| 0648 | Replace Words | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0648.Replace-Words) | 56.5% | Medium | | -| 0649 | Dota2 Senate | | 39.2% | Medium | | -| 0650 | 2 Keys Keyboard | | 49.2% | Medium | | -| 0651 | 4 Keys Keyboard | | 52.4% | Medium | | -| 0652 | Find Duplicate Subtrees | | 50.1% | Medium | | -| 0653 | Two Sum IV - Input is a BST | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0653.Two-Sum-IV---Input-is-a-BST) | 55.5% | Easy | | -| 0654 | Maximum Binary Tree | | 79.9% | Medium | | -| 0655 | Print Binary Tree | | 55.0% | Medium | | -| 0656 | Coin Path | | 29.0% | Hard | | -| 0657 | Robot Return to Origin | | 73.5% | Easy | | -| 0658 | Find K Closest Elements | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0658.Find-K-Closest-Elements) | 40.9% | Medium | | -| 0659 | Split Array into Consecutive Subsequences | | 43.7% | Medium | | -| 0660 | Remove 9 | | 53.3% | Hard | | -| 0661 | Image Smoother | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0661.Image-Smoother) | 51.5% | Easy | | -| 0662 | Maximum Width of Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0662.Maximum-Width-of-Binary-Tree) | 41.1% | Medium | | -| 0663 | Equal Tree Partition | | 39.5% | Medium | | -| 0664 | Strange Printer | | 40.2% | Hard | | -| 0665 | Non-decreasing Array | | 19.5% | Easy | | -| 0666 | Path Sum IV | | 54.7% | Medium | | -| 0667 | Beautiful Arrangement II | | 54.2% | Medium | | -| 0668 | Kth Smallest Number in Multiplication Table | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0668.Kth-Smallest-Number-in-Multiplication-Table) | 45.6% | Hard | | -| 0669 | Trim a Binary Search Tree | | 63.0% | Easy | | -| 0670 | Maximum Swap | | 43.6% | Medium | | -| 0671 | Second Minimum Node In a Binary Tree | | 42.7% | Easy | | -| 0672 | Bulb Switcher II | | 50.9% | Medium | | -| 0673 | Number of Longest Increasing Subsequence | | 35.7% | Medium | | -| 0674 | Longest Continuous Increasing Subsequence | | 45.9% | Easy | | -| 0675 | Cut Off Trees for Golf Event | | 34.6% | Hard | | -| 0676 | Implement Magic Dictionary | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0676.Implement-Magic-Dictionary) | 54.5% | Medium | | -| 0677 | Map Sum Pairs | | 53.5% | Medium | | -| 0678 | Valid Parenthesis String | | 31.0% | Medium | | -| 0679 | 24 Game | | 46.4% | Hard | | -| 0680 | Valid Palindrome II | | 36.6% | Easy | | -| 0681 | Next Closest Time | | 45.0% | Medium | | -| 0682 | Baseball Game | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0682.Baseball-Game) | 63.7% | Easy | | -| 0683 | K Empty Slots | | 35.7% | Hard | | -| 0684 | Redundant Connection | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0684.Redundant-Connection) | 57.3% | Medium | | -| 0685 | Redundant Connection II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0685.Redundant-Connection-II) | 32.4% | Hard | | -| 0686 | Repeated String Match | | 32.3% | Easy | | -| 0687 | Longest Univalue Path | | 36.2% | Easy | | -| 0688 | Knight Probability in Chessboard | | 48.9% | Medium | | -| 0689 | Maximum Sum of 3 Non-Overlapping Subarrays | | 46.3% | Hard | | -| 0690 | Employee Importance | | 57.3% | Easy | | -| 0691 | Stickers to Spell Word | | 43.0% | Hard | | -| 0692 | Top K Frequent Words | | 51.8% | Medium | | -| 0693 | Binary Number with Alternating Bits | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0693.Binary-Number-with-Alternating-Bits) | 59.4% | Easy | | -| 0694 | Number of Distinct Islands | | 56.0% | Medium | | -| 0695 | Max Area of Island | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0695.Max-Area-of-Island) | 62.7% | Medium | | -| 0696 | Count Binary Substrings | | 56.0% | Easy | | -| 0697 | Degree of an Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0697.Degree-of-an-Array) | 53.8% | Easy | | -| 0698 | Partition to K Equal Sum Subsets | | 44.9% | Medium | | -| 0699 | Falling Squares | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0699.Falling-Squares) | 41.8% | Hard | | -| 0700 | Search in a Binary Search Tree | | 73.1% | Easy | | -| 0701 | Insert into a Binary Search Tree | | 77.8% | Medium | | -| 0702 | Search in a Sorted Array of Unknown Size | | 66.7% | Medium | | -| 0703 | Kth Largest Element in a Stream | | 49.7% | Easy | | -| 0704 | Binary Search | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0704.Binary-Search) | 52.1% | Easy | | -| 0705 | Design HashSet | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0705.Design-HashSet) | 64.3% | Easy | | -| 0706 | Design HashMap | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0706.Design-HashMap) | 61.3% | Easy | | -| 0707 | Design Linked List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0707.Design-Linked-List) | 24.5% | Medium | | -| 0708 | Insert into a Sorted Circular Linked List | | 31.6% | Medium | | -| 0709 | To Lower Case | | 79.3% | Easy | | -| 0710 | Random Pick with Blacklist | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0710.Random-Pick-with-Blacklist) | 32.4% | Hard | | -| 0711 | Number of Distinct Islands II | | 47.3% | Hard | | -| 0712 | Minimum ASCII Delete Sum for Two Strings | | 58.5% | Medium | | -| 0713 | Subarray Product Less Than K | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0713.Subarray-Product-Less-Than-K) | 39.1% | Medium | | -| 0714 | Best Time to Buy and Sell Stock with Transaction Fee | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee) | 54.7% | Medium | | -| 0715 | Range Module | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0715.Range-Module) | 38.5% | Hard | | -| 0716 | Max Stack | | 42.6% | Easy | | -| 0717 | 1-bit and 2-bit Characters | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0717.1-bit-and-2-bit-Characters) | 48.8% | Easy | | -| 0718 | Maximum Length of Repeated Subarray | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0718.Maximum-Length-of-Repeated-Subarray) | 49.3% | Medium | | -| 0719 | Find K-th Smallest Pair Distance | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0719.Find-K-th-Smallest-Pair-Distance) | 31.5% | Hard | | -| 0720 | Longest Word in Dictionary | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0720.Longest-Word-in-Dictionary) | 48.2% | Easy | | -| 0721 | Accounts Merge | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0721.Accounts-Merge) | 48.7% | Medium | | -| 0722 | Remove Comments | | 34.6% | Medium | | -| 0723 | Candy Crush | | 69.3% | Medium | | -| 0724 | Find Pivot Index | | 44.0% | Easy | | -| 0725 | Split Linked List in Parts | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0725.Split-Linked-List-in-Parts) | 52.1% | Medium | | -| 0726 | Number of Atoms | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0726.Number-of-Atoms) | 48.9% | Hard | | -| 0727 | Minimum Window Subsequence | | 41.8% | Hard | | -| 0728 | Self Dividing Numbers | | 74.3% | Easy | | -| 0729 | My Calendar I | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0729.My-Calendar-I) | 51.8% | Medium | | -| 0730 | Count Different Palindromic Subsequences | | 41.7% | Hard | | -| 0731 | My Calendar II | | 49.1% | Medium | | -| 0732 | My Calendar III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0732.My-Calendar-III) | 59.9% | Hard | | -| 0733 | Flood Fill | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0733.Flood-Fill) | 55.3% | Easy | | -| 0734 | Sentence Similarity | | 42.1% | Easy | | -| 0735 | Asteroid Collision | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0735.Asteroid-Collision) | 41.1% | Medium | | -| 0736 | Parse Lisp Expression | | 47.5% | Hard | | -| 0737 | Sentence Similarity II | | 45.8% | Medium | | -| 0738 | Monotone Increasing Digits | | 44.3% | Medium | | -| 0739 | Daily Temperatures | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0739.Daily-Temperatures) | 63.3% | Medium | | -| 0740 | Delete and Earn | | 48.6% | Medium | | -| 0741 | Cherry Pickup | | 33.9% | Hard | | -| 0742 | Closest Leaf in a Binary Tree | | 43.5% | Medium | | -| 0743 | Network Delay Time | | 44.9% | Medium | | -| 0744 | Find Smallest Letter Greater Than Target | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0744.Find-Smallest-Letter-Greater-Than-Target) | 45.4% | Easy | | -| 0745 | Prefix and Suffix Search | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0745.Prefix-and-Suffix-Search) | 34.1% | Hard | | -| 0746 | Min Cost Climbing Stairs | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0746.Min-Cost-Climbing-Stairs) | 50.3% | Easy | | -| 0747 | Largest Number At Least Twice of Others | | 42.0% | Easy | | -| 0748 | Shortest Completing Word | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0748.Shortest-Completing-Word) | 56.7% | Easy | | -| 0749 | Contain Virus | | 44.5% | Hard | | -| 0750 | Number Of Corner Rectangles | | 66.4% | Medium | | -| 0751 | IP to CIDR | | 61.8% | Medium | | -| 0752 | Open the Lock | | 51.8% | Medium | | -| 0753 | Cracking the Safe | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0753.Cracking-the-Safe) | 50.5% | Hard | | -| 0754 | Reach a Number | | 34.7% | Medium | | -| 0755 | Pour Water | | 43.3% | Medium | | -| 0756 | Pyramid Transition Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0756.Pyramid-Transition-Matrix) | 54.6% | Medium | | -| 0757 | Set Intersection Size At Least Two | | 40.1% | Hard | | -| 0758 | Bold Words in String | | 45.9% | Easy | | -| 0759 | Employee Free Time | | 66.2% | Hard | | -| 0760 | Find Anagram Mappings | | 81.1% | Easy | | -| 0761 | Special Binary String | | 54.7% | Hard | | -| 0762 | Prime Number of Set Bits in Binary Representation | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation) | 63.2% | Easy | | -| 0763 | Partition Labels | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0763.Partition-Labels) | 76.0% | Medium | | -| 0764 | Largest Plus Sign | | 46.0% | Medium | | -| 0765 | Couples Holding Hands | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0765.Couples-Holding-Hands) | 54.3% | Hard | | -| 0766 | Toeplitz Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0766.Toeplitz-Matrix) | 65.0% | Easy | | -| 0767 | Reorganize String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0767.Reorganize-String) | 48.7% | Medium | | -| 0768 | Max Chunks To Make Sorted II | | 48.7% | Hard | | -| 0769 | Max Chunks To Make Sorted | | 54.7% | Medium | | -| 0770 | Basic Calculator IV | | 47.9% | Hard | | -| 0771 | Jewels and Stones | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0771.Jewels-and-Stones) | 86.3% | Easy | | -| 0772 | Basic Calculator III | | 41.2% | Hard | | -| 0773 | Sliding Puzzle | | 59.3% | Hard | | -| 0774 | Minimize Max Distance to Gas Station | | 46.9% | Hard | | -| 0775 | Global and Local Inversions | | 42.1% | Medium | | -| 0776 | Split BST | | 55.8% | Medium | | -| 0777 | Swap Adjacent in LR String | | 34.8% | Medium | | -| 0778 | Swim in Rising Water | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0778.Swim-in-Rising-Water) | 53.0% | Hard | | -| 0779 | K-th Symbol in Grammar | | 37.2% | Medium | | -| 0780 | Reaching Points | | 29.3% | Hard | | -| 0781 | Rabbits in Forest | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0781.Rabbits-in-Forest) | 54.5% | Medium | | -| 0782 | Transform to Chessboard | | 42.8% | Hard | | -| 0783 | Minimum Distance Between BST Nodes | | 52.6% | Easy | | -| 0784 | Letter Case Permutation | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0784.Letter-Case-Permutation) | 64.6% | Medium | | -| 0785 | Is Graph Bipartite? | | 47.5% | Medium | | -| 0786 | K-th Smallest Prime Fraction | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0786.K-th-Smallest-Prime-Fraction) | 41.0% | Hard | | -| 0787 | Cheapest Flights Within K Stops | | 39.3% | Medium | | -| 0788 | Rotated Digits | | 57.1% | Easy | | -| 0789 | Escape The Ghosts | | 57.4% | Medium | | -| 0790 | Domino and Tromino Tiling | | 39.2% | Medium | | -| 0791 | Custom Sort String | | 65.7% | Medium | | -| 0792 | Number of Matching Subsequences | | 47.4% | Medium | | -| 0793 | Preimage Size of Factorial Zeroes Function | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0793.Preimage-Size-of-Factorial-Zeroes-Function) | 40.2% | Hard | | -| 0794 | Valid Tic-Tac-Toe State | | 32.6% | Medium | | -| 0795 | Number of Subarrays with Bounded Maximum | | 46.3% | Medium | | -| 0796 | Rotate String | | 49.6% | Easy | | -| 0797 | All Paths From Source to Target | | 77.9% | Medium | | -| 0798 | Smallest Rotation with Highest Score | | 44.1% | Hard | | -| 0799 | Champagne Tower | | 35.7% | Medium | | -| 0800 | Similar RGB Color | | 61.4% | Easy | | -| 0801 | Minimum Swaps To Make Sequences Increasing | | 38.9% | Medium | | -| 0802 | Find Eventual Safe States | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0802.Find-Eventual-Safe-States) | 48.9% | Medium | | -| 0803 | Bricks Falling When Hit | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0803.Bricks-Falling-When-Hit) | 30.8% | Hard | | -| 0804 | Unique Morse Code Words | | 77.0% | Easy | | -| 0805 | Split Array With Same Average | | 26.3% | Hard | | -| 0806 | Number of Lines To Write String | | 64.9% | Easy | | -| 0807 | Max Increase to Keep City Skyline | | 83.7% | Medium | | -| 0808 | Soup Servings | | 39.9% | Medium | | -| 0809 | Expressive Words | | 47.0% | Medium | | -| 0810 | Chalkboard XOR Game | | 48.2% | Hard | | -| 0811 | Subdomain Visit Count | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0811.Subdomain-Visit-Count) | 69.8% | Easy | | -| 0812 | Largest Triangle Area | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0812.Largest-Triangle-Area) | 58.3% | Easy | | -| 0813 | Largest Sum of Averages | | 49.9% | Medium | | -| 0814 | Binary Tree Pruning | | 74.5% | Medium | | -| 0815 | Bus Routes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0815.Bus-Routes) | 42.6% | Hard | | -| 0816 | Ambiguous Coordinates | | 47.2% | Medium | | -| 0817 | Linked List Components | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0817.Linked-List-Components) | 57.3% | Medium | | -| 0818 | Race Car | | 39.0% | Hard | | -| 0819 | Most Common Word | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0819.Most-Common-Word) | 44.8% | Easy | | -| 0820 | Short Encoding of Words | | 50.7% | Medium | | -| 0821 | Shortest Distance to a Character | | 66.9% | Easy | | -| 0822 | Card Flipping Game | | 42.9% | Medium | | -| 0823 | Binary Trees With Factors | | 35.8% | Medium | | -| 0824 | Goat Latin | | 63.3% | Easy | | -| 0825 | Friends Of Appropriate Ages | | 42.6% | Medium | | -| 0826 | Most Profit Assigning Work | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0826.Most-Profit-Assigning-Work) | 38.5% | Medium | | -| 0827 | Making A Large Island | | 45.6% | Hard | | -| 0828 | Count Unique Characters of All Substrings of a Given String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0828.COPYRIGHT-PROBLEM-XXX) | 45.1% | Hard | | -| 0829 | Consecutive Numbers Sum | | 37.4% | Hard | | -| 0830 | Positions of Large Groups | | 49.6% | Easy | | -| 0831 | Masking Personal Information | | 44.1% | Medium | | -| 0832 | Flipping an Image | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0832.Flipping-an-Image) | 76.2% | Easy | | -| 0833 | Find And Replace in String | | 50.4% | Medium | | -| 0834 | Sum of Distances in Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0834.Sum-of-Distances-in-Tree) | 43.7% | Hard | | -| 0835 | Image Overlap | | 58.5% | Medium | | -| 0836 | Rectangle Overlap | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0836.Rectangle-Overlap) | 48.6% | Easy | | -| 0837 | New 21 Game | | 34.6% | Medium | | -| 0838 | Push Dominoes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0838.Push-Dominoes) | 48.4% | Medium | | -| 0839 | Similar String Groups | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0839.Similar-String-Groups) | 38.6% | Hard | | -| 0840 | Magic Squares In Grid | | 37.3% | Easy | | -| 0841 | Keys and Rooms | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0841.Keys-and-Rooms) | 64.3% | Medium | | -| 0842 | Split Array into Fibonacci Sequence | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0842.Split-Array-into-Fibonacci-Sequence) | 36.3% | Medium | | -| 0843 | Guess the Word | | 46.1% | Hard | | -| 0844 | Backspace String Compare | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0844.Backspace-String-Compare) | 46.4% | Easy | | -| 0845 | Longest Mountain in Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0845.Longest-Mountain-in-Array) | 37.2% | Medium | | -| 0846 | Hand of Straights | | 54.2% | Medium | | -| 0847 | Shortest Path Visiting All Nodes | | 52.0% | Hard | | -| 0848 | Shifting Letters | | 44.6% | Medium | | -| 0849 | Maximize Distance to Closest Person | | 42.6% | Easy | | -| 0850 | Rectangle Area II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0850.Rectangle-Area-II) | 47.5% | Hard | | -| 0851 | Loud and Rich | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0851.Loud-and-Rich) | 51.6% | Medium | | -| 0852 | Peak Index in a Mountain Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0852.Peak-Index-in-a-Mountain-Array) | 71.6% | Easy | | -| 0853 | Car Fleet | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0853.Car-Fleet) | 42.4% | Medium | | -| 0854 | K-Similar Strings | | 38.2% | Hard | | -| 0855 | Exam Room | | 43.1% | Medium | | -| 0856 | Score of Parentheses | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0856.Score-of-Parentheses) | 60.5% | Medium | | -| 0857 | Minimum Cost to Hire K Workers | | 49.6% | Hard | | -| 0858 | Mirror Reflection | | 53.7% | Medium | | -| 0859 | Buddy Strings | | 27.4% | Easy | | -| 0860 | Lemonade Change | | 51.6% | Easy | | -| 0861 | Score After Flipping Matrix | | 72.8% | Medium | | -| 0862 | Shortest Subarray with Sum at Least K | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K) | 24.6% | Hard | | -| 0863 | All Nodes Distance K in Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree) | 55.3% | Medium | | -| 0864 | Shortest Path to Get All Keys | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0864.Shortest-Path-to-Get-All-Keys) | 40.1% | Hard | | -| 0865 | Smallest Subtree with all the Deepest Nodes | | 60.8% | Medium | | -| 0866 | Prime Palindrome | | 24.9% | Medium | | -| 0867 | Transpose Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0867.Transpose-Matrix) | 62.8% | Easy | | -| 0868 | Binary Gap | | 60.6% | Easy | | -| 0869 | Reordered Power of 2 | | 53.3% | Medium | | -| 0870 | Advantage Shuffle | | 45.6% | Medium | | -| 0871 | Minimum Number of Refueling Stops | | 31.4% | Hard | | -| 0872 | Leaf-Similar Trees | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0872.Leaf-Similar-Trees) | 64.5% | Easy | | -| 0873 | Length of Longest Fibonacci Subsequence | | 48.0% | Medium | | -| 0874 | Walking Robot Simulation | | 35.3% | Easy | | -| 0875 | Koko Eating Bananas | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0875.Koko-Eating-Bananas) | 52.1% | Medium | | -| 0876 | Middle of the Linked List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0876.Middle-of-the-Linked-List) | 68.4% | Easy | | -| 0877 | Stone Game | | 64.8% | Medium | | -| 0878 | Nth Magical Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0878.Nth-Magical-Number) | 28.4% | Hard | | -| 0879 | Profitable Schemes | | 39.7% | Hard | | -| 0880 | Decoded String at Index | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0880.Decoded-String-at-Index) | 24.3% | Medium | | -| 0881 | Boats to Save People | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0881.Boats-to-Save-People) | 46.8% | Medium | | -| 0882 | Reachable Nodes In Subdivided Graph | | 41.3% | Hard | | -| 0883 | Projection Area of 3D Shapes | | 67.7% | Easy | | -| 0884 | Uncommon Words from Two Sentences | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0884.Uncommon-Words-from-Two-Sentences) | 63.3% | Easy | | -| 0885 | Spiral Matrix III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0885.Spiral-Matrix-III) | 69.3% | Medium | | -| 0886 | Possible Bipartition | | 44.1% | Medium | | -| 0887 | Super Egg Drop | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0887.Super-Egg-Drop) | 27.0% | Hard | | -| 0888 | Fair Candy Swap | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0888.Fair-Candy-Swap) | 58.3% | Easy | | -| 0889 | Construct Binary Tree from Preorder and Postorder Traversal | | 66.1% | Medium | | -| 0890 | Find and Replace Pattern | | 73.4% | Medium | | -| 0891 | Sum of Subsequence Widths | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0891.Sum-of-Subsequence-Widths) | 31.9% | Hard | | -| 0892 | Surface Area of 3D Shapes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0892.Surface-Area-of-3D-Shapes) | 58.9% | Easy | | -| 0893 | Groups of Special-Equivalent Strings | | 66.5% | Easy | | -| 0894 | All Possible Full Binary Trees | | 75.2% | Medium | | -| 0895 | Maximum Frequency Stack | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0895.Maximum-Frequency-Stack) | 60.6% | Hard | | -| 0896 | Monotonic Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0896.Monotonic-Array) | 57.9% | Easy | | -| 0897 | Increasing Order Search Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0897.Increasing-Order-Search-Tree) | 70.7% | Easy | | -| 0898 | Bitwise ORs of Subarrays | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0898.Bitwise-ORs-of-Subarrays) | 34.8% | Medium | | -| 0899 | Orderly Queue | | 52.2% | Hard | | -| 0900 | RLE Iterator | | 53.5% | Medium | | -| 0901 | Online Stock Span | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0901.Online-Stock-Span) | 60.1% | Medium | | -| 0902 | Numbers At Most N Given Digit Set | | 31.5% | Hard | | -| 0903 | Valid Permutations for DI Sequence | | 49.6% | Hard | | -| 0904 | Fruit Into Baskets | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets) | 42.5% | Medium | | -| 0905 | Sort Array By Parity | | 74.0% | Easy | | -| 0906 | Super Palindromes | | 32.7% | Hard | | -| 0907 | Sum of Subarray Minimums | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0907.Sum-of-Subarray-Minimums) | 32.3% | Medium | | -| 0908 | Smallest Range I | | 65.8% | Easy | | -| 0909 | Snakes and Ladders | | 38.4% | Medium | | -| 0910 | Smallest Range II | | 26.6% | Medium | | -| 0911 | Online Election | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0911.Online-Election) | 50.4% | Medium | | -| 0912 | Sort an Array | | 63.8% | Medium | | -| 0913 | Cat and Mouse | | 31.3% | Hard | | -| 0914 | X of a Kind in a Deck of Cards | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0914.X-of-a-Kind-in-a-Deck-of-Cards) | 34.9% | Easy | | -| 0915 | Partition Array into Disjoint Intervals | | 45.3% | Medium | | -| 0916 | Word Subsets | | 47.8% | Medium | | -| 0917 | Reverse Only Letters | | 57.9% | Easy | | -| 0918 | Maximum Sum Circular Subarray | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0918.Maximum-Sum-Circular-Subarray) | 33.6% | Medium | | -| 0919 | Complete Binary Tree Inserter | | 57.3% | Medium | | -| 0920 | Number of Music Playlists | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0920.Number-of-Music-Playlists) | 46.5% | Hard | | -| 0921 | Minimum Add to Make Parentheses Valid | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid) | 73.6% | Medium | | -| 0922 | Sort Array By Parity II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0922.Sort-Array-By-Parity-II) | 69.2% | Easy | | -| 0923 | 3Sum With Multiplicity | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0923.3Sum-With-Multiplicity) | 35.7% | Medium | | -| 0924 | Minimize Malware Spread | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0924.Minimize-Malware-Spread) | 42.0% | Hard | | -| 0925 | Long Pressed Name | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0925.Long-Pressed-Name) | 40.6% | Easy | | -| 0926 | Flip String to Monotone Increasing | | 52.3% | Medium | | -| 0927 | Three Equal Parts | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0927.Three-Equal-Parts) | 33.6% | Hard | | -| 0928 | Minimize Malware Spread II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0928.Minimize-Malware-Spread-II) | 40.5% | Hard | | -| 0929 | Unique Email Addresses | | 67.4% | Easy | | -| 0930 | Binary Subarrays With Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0930.Binary-Subarrays-With-Sum) | 43.0% | Medium | | -| 0931 | Minimum Falling Path Sum | | 62.4% | Medium | | -| 0932 | Beautiful Array | | 58.3% | Medium | | -| 0933 | Number of Recent Calls | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0933.Number-of-Recent-Calls) | 71.9% | Easy | | -| 0934 | Shortest Bridge | | 48.1% | Medium | | -| 0935 | Knight Dialer | | 45.1% | Medium | | -| 0936 | Stamping The Sequence | | 42.8% | Hard | | -| 0937 | Reorder Data in Log Files | | 54.4% | Easy | | -| 0938 | Range Sum of BST | | 81.3% | Easy | | -| 0939 | Minimum Area Rectangle | | 51.8% | Medium | | -| 0940 | Distinct Subsequences II | | 41.4% | Hard | | -| 0941 | Valid Mountain Array | | 33.3% | Easy | | -| 0942 | DI String Match | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0942.DI-String-Match) | 72.6% | Easy | | -| 0943 | Find the Shortest Superstring | | 42.8% | Hard | | -| 0944 | Delete Columns to Make Sorted | | 70.3% | Easy | | -| 0945 | Minimum Increment to Make Array Unique | | 46.3% | Medium | | -| 0946 | Validate Stack Sequences | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0946.Validate-Stack-Sequences) | 61.8% | Medium | | -| 0947 | Most Stones Removed with Same Row or Column | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0947.Most-Stones-Removed-with-Same-Row-or-Column) | 55.3% | Medium | | -| 0948 | Bag of Tokens | | 40.8% | Medium | | -| 0949 | Largest Time for Given Digits | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0949.Largest-Time-for-Given-Digits) | 35.9% | Easy | | -| 0950 | Reveal Cards In Increasing Order | | 74.6% | Medium | | -| 0951 | Flip Equivalent Binary Trees | | 65.7% | Medium | | -| 0952 | Largest Component Size by Common Factor | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0952.Largest-Component-Size-by-Common-Factor) | 30.3% | Hard | | -| 0953 | Verifying an Alien Dictionary | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0953.Verifying-an-Alien-Dictionary) | 54.1% | Easy | | -| 0954 | Array of Doubled Pairs | | 35.6% | Medium | | -| 0955 | Delete Columns to Make Sorted II | | 33.2% | Medium | | -| 0956 | Tallest Billboard | | 39.7% | Hard | | -| 0957 | Prison Cells After N Days | | 40.7% | Medium | | -| 0958 | Check Completeness of a Binary Tree | | 52.0% | Medium | | -| 0959 | Regions Cut By Slashes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0959.Regions-Cut-By-Slashes) | 66.1% | Medium | | -| 0960 | Delete Columns to Make Sorted III | | 53.6% | Hard | | -| 0961 | N-Repeated Element in Size 2N Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0961.N-Repeated-Element-in-Size-2N-Array) | 73.7% | Easy | | -| 0962 | Maximum Width Ramp | | 45.3% | Medium | | -| 0963 | Minimum Area Rectangle II | | 50.8% | Medium | | -| 0964 | Least Operators to Express Number | | 43.7% | Hard | | -| 0965 | Univalued Binary Tree | | 67.7% | Easy | | -| 0966 | Vowel Spellchecker | | 47.2% | Medium | | -| 0967 | Numbers With Same Consecutive Differences | | 39.4% | Medium | | -| 0968 | Binary Tree Cameras | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0968.Binary-Tree-Cameras) | 37.5% | Hard | | -| 0969 | Pancake Sorting | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0969.Pancake-Sorting) | 67.5% | Medium | | -| 0970 | Powerful Integers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0970.Powerful-Integers) | 39.8% | Easy | | -| 0971 | Flip Binary Tree To Match Preorder Traversal | | 45.6% | Medium | | -| 0972 | Equal Rational Numbers | | 41.6% | Hard | | -| 0973 | K Closest Points to Origin | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0973.K-Closest-Points-to-Origin) | 63.8% | Medium | | -| 0974 | Subarray Sums Divisible by K | | 48.9% | Medium | | -| 0975 | Odd Even Jump | | 42.3% | Hard | | -| 0976 | Largest Perimeter Triangle | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0976.Largest-Perimeter-Triangle) | 57.6% | Easy | | -| 0977 | Squares of a Sorted Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0977.Squares-of-a-Sorted-Array) | 72.2% | Easy | | -| 0978 | Longest Turbulent Subarray | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0978.Longest-Turbulent-Subarray) | 46.6% | Medium | | -| 0979 | Distribute Coins in Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0979.Distribute-Coins-in-Binary-Tree) | 68.8% | Medium | | -| 0980 | Unique Paths III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0980.Unique-Paths-III) | 73.3% | Hard | | -| 0981 | Time Based Key-Value Store | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0981.Time-Based-Key-Value-Store) | 53.1% | Medium | | -| 0982 | Triples with Bitwise AND Equal To Zero | | 55.5% | Hard | | -| 0983 | Minimum Cost For Tickets | | 60.5% | Medium | | -| 0984 | String Without AAA or BBB | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0984.String-Without-AAA-or-BBB) | 37.7% | Medium | | -| 0985 | Sum of Even Numbers After Queries | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0985.Sum-of-Even-Numbers-After-Queries) | 61.3% | Easy | | -| 0986 | Interval List Intersections | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0986.Interval-List-Intersections) | 67.3% | Medium | | -| 0987 | Vertical Order Traversal of a Binary Tree | | 36.6% | Medium | | -| 0988 | Smallest String Starting From Leaf | | 46.0% | Medium | | -| 0989 | Add to Array-Form of Integer | | 44.2% | Easy | | -| 0990 | Satisfiability of Equality Equations | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0990.Satisfiability-of-Equality-Equations) | 44.9% | Medium | | -| 0991 | Broken Calculator | | 45.5% | Medium | | -| 0992 | Subarrays with K Different Integers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0992.Subarrays-with-K-Different-Integers) | 48.6% | Hard | | -| 0993 | Cousins in Binary Tree | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0993.Cousins-in-Binary-Tree) | 52.0% | Easy | | -| 0994 | Rotting Oranges | | 47.8% | Medium | | -| 0995 | Minimum Number of K Consecutive Bit Flips | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0995.Minimum-Number-of-K-Consecutive-Bit-Flips) | 46.8% | Hard | | -| 0996 | Number of Squareful Arrays | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0996.Number-of-Squareful-Arrays) | 47.9% | Hard | | -| 0997 | Find the Town Judge | | 50.1% | Easy | | -| 0998 | Maximum Binary Tree II | | 62.9% | Medium | | -| 0999 | Available Captures for Rook | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0999.Available-Captures-for-Rook) | 66.7% | Easy | | -| 1000 | Minimum Cost to Merge Stones | | 39.6% | Hard | | -| 1001 | Grid Illumination | | 35.9% | Hard | | -| 1002 | Find Common Characters | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1002.Find-Common-Characters) | 67.7% | Easy | | -| 1003 | Check If Word Is Valid After Substitutions | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions) | 55.3% | Medium | | -| 1004 | Max Consecutive Ones III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1004.Max-Consecutive-Ones-III) | 59.1% | Medium | | -| 1005 | Maximize Sum Of Array After K Negations | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations) | 51.3% | Easy | | -| 1006 | Clumsy Factorial | | 53.3% | Medium | | -| 1007 | Minimum Domino Rotations For Equal Row | | 50.0% | Medium | | -| 1008 | Construct Binary Search Tree from Preorder Traversal | | 78.4% | Medium | | -| 1009 | Complement of Base 10 Integer | | 59.6% | Easy | | -| 1010 | Pairs of Songs With Total Durations Divisible by 60 | | 47.4% | Easy | | -| 1011 | Capacity To Ship Packages Within D Days | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1011.Capacity-To-Ship-Packages-Within-D-Days) | 58.1% | Medium | | -| 1012 | Numbers With Repeated Digits | | 37.5% | Hard | | -| 1013 | Partition Array Into Three Parts With Equal Sum | | 51.8% | Easy | | -| 1014 | Best Sightseeing Pair | | 52.5% | Medium | | -| 1015 | Smallest Integer Divisible by K | | 32.1% | Medium | | -| 1016 | Binary String With Substrings Representing 1 To N | | 58.9% | Medium | | -| 1017 | Convert to Base -2 | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1017.Convert-to-Base--2) | 59.0% | Medium | | -| 1018 | Binary Prefix Divisible By 5 | | 47.7% | Easy | | -| 1019 | Next Greater Node In Linked List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1019.Next-Greater-Node-In-Linked-List) | 57.4% | Medium | | -| 1020 | Number of Enclaves | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1020.Number-of-Enclaves) | 57.7% | Medium | | -| 1021 | Remove Outermost Parentheses | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1021.Remove-Outermost-Parentheses) | 77.9% | Easy | | -| 1022 | Sum of Root To Leaf Binary Numbers | | 67.2% | Easy | | -| 1023 | Camelcase Matching | | 57.0% | Medium | | -| 1024 | Video Stitching | | 49.2% | Medium | | -| 1025 | Divisor Game | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1025.Divisor-Game) | 66.3% | Easy | | -| 1026 | Maximum Difference Between Node and Ancestor | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor) | 65.9% | Medium | | -| 1027 | Longest Arithmetic Sequence | | 53.5% | Medium | | -| 1028 | Recover a Tree From Preorder Traversal | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1028.Recover-a-Tree-From-Preorder-Traversal) | 69.9% | Hard | | -| 1029 | Two City Scheduling | | 56.1% | Easy | | -| 1030 | Matrix Cells in Distance Order | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1030.Matrix-Cells-in-Distance-Order) | 65.7% | Easy | | -| 1031 | Maximum Sum of Two Non-Overlapping Subarrays | | 57.8% | Medium | | -| 1032 | Stream of Characters | | 48.3% | Hard | | -| 1033 | Moving Stones Until Consecutive | | 41.7% | Easy | | -| 1034 | Coloring A Border | | 44.7% | Medium | | -| 1035 | Uncrossed Lines | | 56.1% | Medium | | -| 1036 | Escape a Large Maze | | 35.4% | Hard | | -| 1037 | Valid Boomerang | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1037.Valid-Boomerang) | 37.9% | Easy | | -| 1038 | Binary Search Tree to Greater Sum Tree | | 80.8% | Medium | | -| 1039 | Minimum Score Triangulation of Polygon | | 49.1% | Medium | | -| 1040 | Moving Stones Until Consecutive II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1040.Moving-Stones-Until-Consecutive-II) | 52.9% | Medium | | -| 1041 | Robot Bounded In Circle | | 49.5% | Medium | | -| 1042 | Flower Planting With No Adjacent | | 48.5% | Easy | | -| 1043 | Partition Array for Maximum Sum | | 65.1% | Medium | | -| 1044 | Longest Duplicate Substring | | 32.0% | Hard | | -| 1045 | Customers Who Bought All Products | | 67.8% | Medium | | -| 1046 | Last Stone Weight | | 62.2% | Easy | | -| 1047 | Remove All Adjacent Duplicates In String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String) | 68.5% | Easy | | -| 1048 | Longest String Chain | | 54.7% | Medium | | -| 1049 | Last Stone Weight II | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II) | 44.1% | Medium | | -| 1050 | Actors and Directors Who Cooperated At Least Three Times | | 71.7% | Easy | | -| 1051 | Height Checker | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker) | 71.1% | Easy | | -| 1052 | Grumpy Bookstore Owner | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1052.Grumpy-Bookstore-Owner) | 55.4% | Medium | | -| 1053 | Previous Permutation With One Swap | | 48.5% | Medium | | -| 1054 | Distant Barcodes | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1054.Distant-Barcodes) | 43.2% | Medium | | -| 1055 | Shortest Way to Form String | | 56.9% | Medium | | -| 1056 | Confusing Number | | 48.7% | Easy | | -| 1057 | Campus Bikes | | 57.7% | Medium | | -| 1058 | Minimize Rounding Error to Meet Target | | 41.7% | Medium | | -| 1059 | All Paths from Source Lead to Destination | | 44.7% | Medium | | -| 1060 | Missing Element in Sorted Array | | 54.5% | Medium | | -| 1061 | Lexicographically Smallest Equivalent String | | 65.2% | Medium | | -| 1062 | Longest Repeating Substring | | 57.2% | Medium | | -| 1063 | Number of Valid Subarrays | | 71.1% | Hard | | -| 1064 | Fixed Point | | 66.5% | Easy | | -| 1065 | Index Pairs of a String | | 60.6% | Easy | | -| 1066 | Campus Bikes II | | 54.2% | Medium | | -| 1067 | Digit Count in Range | | 40.0% | Hard | | -| 1068 | Product Sales Analysis I | | 83.1% | Easy | | -| 1069 | Product Sales Analysis II | | 82.9% | Easy | | -| 1070 | Product Sales Analysis III | | 48.9% | Medium | | -| 1071 | Greatest Common Divisor of Strings | | 53.0% | Easy | | -| 1072 | Flip Columns For Maximum Number of Equal Rows | | 60.8% | Medium | | -| 1073 | Adding Two Negabinary Numbers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1073.Adding-Two-Negabinary-Numbers) | 34.0% | Medium | | -| 1074 | Number of Submatrices That Sum to Target | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1074.Number-of-Submatrices-That-Sum-to-Target) | 59.3% | Hard | | -| 1075 | Project Employees I | | 64.9% | Easy | | -| 1076 | Project Employees II | | 53.7% | Easy | | -| 1077 | Project Employees III | | 75.4% | Medium | | -| 1078 | Occurrences After Bigram | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1078.Occurrences-After-Bigram) | 64.7% | Easy | | -| 1079 | Letter Tile Possibilities | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1079.Letter-Tile-Possibilities) | 75.4% | Medium | | -| 1080 | Insufficient Nodes in Root to Leaf Paths | | 49.3% | Medium | | -| 1081 | Smallest Subsequence of Distinct Characters | | 50.4% | Medium | | -| 1082 | Sales Analysis I | | 71.7% | Easy | | -| 1083 | Sales Analysis II | | 50.6% | Easy | | -| 1084 | Sales Analysis III | | 54.2% | Easy | | -| 1085 | Sum of Digits in the Minimum Number | | 74.6% | Easy | | -| 1086 | High Five | | 79.6% | Easy | | -| 1087 | Brace Expansion | | 62.7% | Medium | | -| 1088 | Confusing Number II | | 43.9% | Hard | | -| 1089 | Duplicate Zeros | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1089.Duplicate-Zeros) | 53.0% | Easy | | -| 1090 | Largest Values From Labels | | 58.9% | Medium | | -| 1091 | Shortest Path in Binary Matrix | | 38.2% | Medium | | -| 1092 | Shortest Common Supersequence | | 51.6% | Hard | | -| 1093 | Statistics from a Large Sample | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1093.Statistics-from-a-Large-Sample) | 48.2% | Medium | | -| 1094 | Car Pooling | | 56.7% | Medium | | -| 1095 | Find in Mountain Array | | 35.7% | Hard | | -| 1096 | Brace Expansion II | | 62.1% | Hard | | -| 1097 | Game Play Analysis V | | 54.4% | Hard | | -| 1098 | Unpopular Books | | 44.4% | Medium | | -| 1099 | Two Sum Less Than K | | 60.6% | Easy | | -| 1100 | Find K-Length Substrings With No Repeated Characters | | 72.7% | Medium | | -| 1101 | The Earliest Moment When Everyone Become Friends | | 66.2% | Medium | | -| 1102 | Path With Maximum Minimum Value | | 49.2% | Medium | | -| 1103 | Distribute Candies to People | | 60.5% | Easy | | -| 1104 | Path In Zigzag Labelled Binary Tree | | 72.0% | Medium | | -| 1105 | Filling Bookcase Shelves | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1105.Filling-Bookcase-Shelves) | 58.1% | Medium | | -| 1106 | Parsing A Boolean Expression | | 58.5% | Hard | | -| 1107 | New Users Daily Count | | 45.1% | Medium | | -| 1108 | Defanging an IP Address | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1108.Defanging-an-IP-Address) | 87.5% | Easy | | -| 1109 | Corporate Flight Bookings | | 52.8% | Medium | | -| 1110 | Delete Nodes And Return Forest | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1110.Delete-Nodes-And-Return-Forest) | 67.0% | Medium | | -| 1111 | Maximum Nesting Depth of Two Valid Parentheses Strings | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings) | 70.4% | Medium | | -| 1112 | Highest Grade For Each Student | | 69.4% | Medium | | -| 1113 | Reported Posts | | 64.1% | Easy | | -| 1114 | Print in Order | | 65.7% | Easy | | -| 1115 | Print FooBar Alternately | | 58.5% | Medium | | -| 1116 | Print Zero Even Odd | | 56.0% | Medium | | -| 1117 | Building H2O | | 52.6% | Medium | | -| 1118 | Number of Days in a Month | | 57.4% | Easy | | -| 1119 | Remove Vowels from a String | | 89.9% | Easy | | -| 1120 | Maximum Average Subtree | | 62.0% | Medium | | -| 1121 | Divide Array Into Increasing Sequences | | 56.8% | Hard | | -| 1122 | Relative Sort Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1122.Relative-Sort-Array) | 67.7% | Easy | | -| 1123 | Lowest Common Ancestor of Deepest Leaves | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves) | 66.8% | Medium | | -| 1124 | Longest Well-Performing Interval | | 32.7% | Medium | | -| 1125 | Smallest Sufficient Team | | 46.5% | Hard | | -| 1126 | Active Businesses | | 68.5% | Medium | | -| 1127 | User Purchase Platform | | 48.9% | Hard | | -| 1128 | Number of Equivalent Domino Pairs | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1128.Number-of-Equivalent-Domino-Pairs) | 47.3% | Easy | | -| 1129 | Shortest Path with Alternating Colors | | 38.9% | Medium | | -| 1130 | Minimum Cost Tree From Leaf Values | | 66.1% | Medium | | -| 1131 | Maximum of Absolute Value Expression | | 53.1% | Medium | | -| 1132 | Reported Posts II | | 34.4% | Medium | | -| 1133 | Largest Unique Number | | 66.9% | Easy | | -| 1134 | Armstrong Number | | 78.3% | Easy | | -| 1135 | Connecting Cities With Minimum Cost | | 57.5% | Medium | | -| 1136 | Parallel Courses | | 61.1% | Hard | | -| 1137 | N-th Tribonacci Number | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1137.N-th-Tribonacci-Number) | 55.9% | Easy | | -| 1138 | Alphabet Board Path | | 48.4% | Medium | | -| 1139 | Largest 1-Bordered Square | | 47.5% | Medium | | -| 1140 | Stone Game II | | 63.3% | Medium | | -| 1141 | User Activity for the Past 30 Days I | | 54.1% | Easy | | -| 1142 | User Activity for the Past 30 Days II | | 34.5% | Easy | | -| 1143 | Longest Common Subsequence | | 58.4% | Medium | | -| 1144 | Decrease Elements To Make Array Zigzag | | 45.4% | Medium | | -| 1145 | Binary Tree Coloring Game | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1145.Binary-Tree-Coloring-Game) | 51.3% | Medium | | -| 1146 | Snapshot Array | | 37.1% | Medium | | -| 1147 | Longest Chunked Palindrome Decomposition | | 58.6% | Hard | | -| 1148 | Article Views I | | 75.8% | Easy | | -| 1149 | Article Views II | | 48.1% | Medium | | -| 1150 | Check If a Number Is Majority Element in a Sorted Array | | 59.2% | Easy | | -| 1151 | Minimum Swaps to Group All 1's Together | | 59.3% | Medium | | -| 1152 | Analyze User Website Visit Pattern | | 43.5% | Medium | | -| 1153 | String Transforms Into Another String | | 35.8% | Hard | | -| 1154 | Day of the Year | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1154.Day-of-the-Year) | 49.3% | Easy | | -| 1155 | Number of Dice Rolls With Target Sum | | 49.1% | Medium | | -| 1156 | Swap For Longest Repeated Character Substring | | 48.9% | Medium | | -| 1157 | Online Majority Element In Subarray | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1157.Online-Majority-Element-In-Subarray) | 38.9% | Hard | | -| 1158 | Market Analysis I | | 61.7% | Medium | | -| 1159 | Market Analysis II | | 52.9% | Hard | | -| 1160 | Find Words That Can Be Formed by Characters | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters) | 67.4% | Easy | | -| 1161 | Maximum Level Sum of a Binary Tree | | 72.2% | Medium | | -| 1162 | As Far from Land as Possible | | 43.4% | Medium | | -| 1163 | Last Substring in Lexicographical Order | | 33.8% | Hard | | -| 1164 | Product Price at a Given Date | | 65.8% | Medium | | -| 1165 | Single-Row Keyboard | | 84.8% | Easy | | -| 1166 | Design File System | | 56.8% | Medium | | -| 1167 | Minimum Cost to Connect Sticks | | 62.7% | Medium | | -| 1168 | Optimize Water Distribution in a Village | | 60.9% | Hard | | -| 1169 | Invalid Transactions | | 31.2% | Medium | | -| 1170 | Compare Strings by Frequency of the Smallest Character | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character) | 58.6% | Easy | | -| 1171 | Remove Zero Sum Consecutive Nodes from Linked List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List) | 41.4% | Medium | | -| 1172 | Dinner Plate Stacks | | 38.2% | Hard | | -| 1173 | Immediate Food Delivery I | | 80.4% | Easy | | -| 1174 | Immediate Food Delivery II | | 58.4% | Medium | | -| 1175 | Prime Arrangements | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1175.Prime-Arrangements) | 51.0% | Easy | | -| 1176 | Diet Plan Performance | | 53.9% | Easy | | -| 1177 | Can Make Palindrome from Substring | | 34.6% | Medium | | -| 1178 | Number of Valid Words for Each Puzzle | | 37.9% | Hard | | -| 1179 | Reformat Department Table | | 80.5% | Easy | | -| 1180 | Count Substrings with Only One Distinct Letter | | 77.0% | Easy | | -| 1181 | Before and After Puzzle | | 44.4% | Medium | | -| 1182 | Shortest Distance to Target Color | | 52.8% | Medium | | -| 1183 | Maximum Number of Ones | | 54.4% | Hard | | -| 1184 | Distance Between Bus Stops | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1184.Distance-Between-Bus-Stops) | 54.4% | Easy | | -| 1185 | Day of the Week | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week) | 64.0% | Easy | | -| 1186 | Maximum Subarray Sum with One Deletion | | 37.4% | Medium | | -| 1187 | Make Array Strictly Increasing | | 41.8% | Hard | | -| 1188 | Design Bounded Blocking Queue | | 70.5% | Medium | | -| 1189 | Maximum Number of Balloons | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1189.Maximum-Number-of-Balloons) | 61.2% | Easy | | -| 1190 | Reverse Substrings Between Each Pair of Parentheses | | 61.5% | Medium | | -| 1191 | K-Concatenation Maximum Sum | | 25.9% | Medium | | -| 1192 | Critical Connections in a Network | | 48.6% | Hard | | -| 1193 | Monthly Transactions I | | 68.2% | Medium | | -| 1194 | Tournament Winners | | 52.8% | Hard | | -| 1195 | Fizz Buzz Multithreaded | | 68.3% | Medium | | -| 1196 | How Many Apples Can You Put into the Basket | | 68.1% | Easy | | -| 1197 | Minimum Knight Moves | | 36.1% | Medium | | -| 1198 | Find Smallest Common Element in All Rows | | 74.9% | Medium | | -| 1199 | Minimum Time to Build Blocks | | 37.3% | Hard | | -| 1200 | Minimum Absolute Difference | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1200.Minimum-Absolute-Difference) | 66.6% | Easy | | -| 1201 | Ugly Number III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1201.Ugly-Number-III) | 25.9% | Medium | | -| 1202 | Smallest String With Swaps | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps) | 46.5% | Medium | | -| 1203 | Sort Items by Groups Respecting Dependencies | | 47.6% | Hard | | -| 1204 | Last Person to Fit in the Elevator | | 69.7% | Medium | | -| 1205 | Monthly Transactions II | | 45.1% | Medium | | -| 1206 | Design Skiplist | | 57.4% | Hard | | -| 1207 | Unique Number of Occurrences | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1207.Unique-Number-of-Occurrences) | 71.6% | Easy | | -| 1208 | Get Equal Substrings Within Budget | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1208.Get-Equal-Substrings-Within-Budget) | 41.9% | Medium | | -| 1209 | Remove All Adjacent Duplicates in String II | | 56.8% | Medium | | -| 1210 | Minimum Moves to Reach Target with Rotations | | 45.2% | Hard | | -| 1211 | Queries Quality and Percentage | | 68.3% | Easy | | -| 1212 | Team Scores in Football Tournament | | 55.7% | Medium | | -| 1213 | Intersection of Three Sorted Arrays | | 78.9% | Easy | | -| 1214 | Two Sum BSTs | | 67.6% | Medium | | -| 1215 | Stepping Numbers | | 41.6% | Medium | | -| 1216 | Valid Palindrome III | | 47.7% | Hard | | -| 1217 | Play with Chips | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1217.Play-with-Chips) | 64.3% | Easy | | -| 1218 | Longest Arithmetic Subsequence of Given Difference | | 44.5% | Medium | | -| 1219 | Path with Maximum Gold | | 65.1% | Medium | | -| 1220 | Count Vowels Permutation | | 53.9% | Hard | | -| 1221 | Split a String in Balanced Strings | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1221.Split-a-String-in-Balanced-Strings) | 83.2% | Easy | | -| 1222 | Queens That Can Attack the King | | 68.7% | Medium | | -| 1223 | Dice Roll Simulation | | 45.6% | Medium | | -| 1224 | Maximum Equal Frequency | | 33.5% | Hard | | -| 1225 | Report Contiguous Dates | | 61.2% | Hard | | -| 1226 | The Dining Philosophers | | 55.7% | Medium | | -| 1227 | Airplane Seat Assignment Probability | | 61.0% | Medium | | -| 1228 | Missing Number In Arithmetic Progression | | 52.6% | Easy | | -| 1229 | Meeting Scheduler | | 52.6% | Medium | | -| 1230 | Toss Strange Coins | | 48.7% | Medium | | -| 1231 | Divide Chocolate | | 52.3% | Hard | | -| 1232 | Check If It Is a Straight Line | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1232.Check-If-It-Is-a-Straight-Line) | 45.3% | Easy | | -| 1233 | Remove Sub-Folders from the Filesystem | | 59.5% | Medium | | -| 1234 | Replace the Substring for Balanced String | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1234.Replace-the-Substring-for-Balanced-String) | 33.3% | Medium | | -| 1235 | Maximum Profit in Job Scheduling | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling) | 44.1% | Hard | | -| 1236 | Web Crawler | | 64.3% | Medium | | -| 1237 | Find Positive Integer Solution for a Given Equation | | 69.6% | Easy | | -| 1238 | Circular Permutation in Binary Representation | | 64.9% | Medium | | -| 1239 | Maximum Length of a Concatenated String with Unique Characters | | 47.8% | Medium | | -| 1240 | Tiling a Rectangle with the Fewest Squares | | 50.1% | Hard | | -| 1241 | Number of Comments per Post | | 67.0% | Easy | | -| 1242 | Web Crawler Multithreaded | | 45.9% | Medium | | -| 1243 | Array Transformation | | 51.0% | Easy | | -| 1244 | Design A Leaderboard | | 60.7% | Medium | | -| 1245 | Tree Diameter | | 60.0% | Medium | | -| 1246 | Palindrome Removal | | 46.0% | Hard | | -| 1247 | Minimum Swaps to Make Strings Equal | | 60.0% | Medium | | -| 1248 | Count Number of Nice Subarrays | | 56.4% | Medium | | -| 1249 | Minimum Remove to Make Valid Parentheses | | 62.5% | Medium | | -| 1250 | Check If It Is a Good Array | | 55.7% | Hard | | -| 1251 | Average Selling Price | | 81.4% | Easy | | -| 1252 | Cells with Odd Values in a Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix) | 78.1% | Easy | | -| 1253 | Reconstruct a 2-Row Binary Matrix | | 40.4% | Medium | | -| 1254 | Number of Closed Islands | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands) | 60.3% | Medium | | -| 1255 | Maximum Score Words Formed by Letters | | 69.3% | Hard | | -| 1256 | Encode Number | | 66.0% | Medium | | -| 1257 | Smallest Common Region | | 58.8% | Medium | | -| 1258 | Synonymous Sentences | | 64.4% | Medium | | -| 1259 | Handshakes That Don't Cross | | 53.5% | Hard | | -| 1260 | Shift 2D Grid | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1260.Shift-2D-Grid) | 61.3% | Easy | | -| 1261 | Find Elements in a Contaminated Binary Tree | | 74.3% | Medium | | -| 1262 | Greatest Sum Divisible by Three | | 47.6% | Medium | | -| 1263 | Minimum Moves to Move a Box to Their Target Location | | 41.4% | Hard | | -| 1264 | Page Recommendations | | 67.5% | Medium | | -| 1265 | Print Immutable Linked List in Reverse | | 94.6% | Medium | | -| 1266 | Minimum Time Visiting All Points | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1266.Minimum-Time-Visiting-All-Points) | 79.6% | Easy | | -| 1267 | Count Servers that Communicate | | 57.9% | Medium | | -| 1268 | Search Suggestions System | | 63.3% | Medium | | -| 1269 | Number of Ways to Stay in the Same Place After Some Steps | | 43.2% | Hard | | -| 1270 | All People Report to the Given Manager | | 87.0% | Medium | | -| 1271 | Hexspeak | | 54.2% | Easy | | -| 1272 | Remove Interval | | 58.6% | Medium | | -| 1273 | Delete Tree Nodes | | 63.5% | Medium | | -| 1274 | Number of Ships in a Rectangle | | 66.5% | Hard | | -| 1275 | Find Winner on a Tic Tac Toe Game | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game) | 52.9% | Easy | | -| 1276 | Number of Burgers with No Waste of Ingredients | | 49.6% | Medium | | -| 1277 | Count Square Submatrices with All Ones | | 73.2% | Medium | | -| 1278 | Palindrome Partitioning III | | 59.9% | Hard | | -| 1279 | Traffic Light Controlled Intersection | | 74.3% | Easy | | -| 1280 | Students and Examinations | | 72.1% | Easy | | -| 1281 | Subtract the Product and Sum of Digits of an Integer | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer) | 85.2% | Easy | | -| 1282 | Group the People Given the Group Size They Belong To | | 83.9% | Medium | | -| 1283 | Find the Smallest Divisor Given a Threshold | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold) | 47.6% | Medium | | -| 1284 | Minimum Number of Flips to Convert Binary Matrix to Zero Matrix | | 69.5% | Hard | | -| 1285 | Find the Start and End Number of Continuous Ranges | | 83.7% | Medium | | -| 1286 | Iterator for Combination | | 68.1% | Medium | | -| 1287 | Element Appearing More Than 25% In Sorted Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1287.Element-Appearing-More-Than-In-Sorted-Array) | 60.2% | Easy | | -| 1288 | Remove Covered Intervals | | 58.0% | Medium | | -| 1289 | Minimum Falling Path Sum II | | 61.0% | Hard | | -| 1290 | Convert Binary Number in a Linked List to Integer | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer) | 80.2% | Easy | | -| 1291 | Sequential Digits | | 53.4% | Medium | | -| 1292 | Maximum Side Length of a Square with Sum Less than or Equal to Threshold | | 48.5% | Medium | | -| 1293 | Shortest Path in a Grid with Obstacles Elimination | | 42.7% | Hard | | -| 1294 | Weather Type in Each Country | | 63.1% | Easy | | -| 1295 | Find Numbers with Even Number of Digits | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits) | 81.6% | Easy | | -| 1296 | Divide Array in Sets of K Consecutive Numbers | | 53.7% | Medium | | -| 1297 | Maximum Number of Occurrences of a Substring | | 47.3% | Medium | | -| 1298 | Maximum Candies You Can Get from Boxes | | 58.9% | Hard | | -| 1299 | Replace Elements with Greatest Element on Right Side | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side) | 75.4% | Easy | | -| 1300 | Sum of Mutated Array Closest to Target | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target) | 44.2% | Medium | | -| 1301 | Number of Paths with Max Score | | 37.2% | Hard | | -| 1302 | Deepest Leaves Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1302.Deepest-Leaves-Sum) | 83.6% | Medium | | -| 1303 | Find the Team Size | | 87.8% | Easy | | -| 1304 | Find N Unique Integers Sum up to Zero | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero) | 76.3% | Easy | | -| 1305 | All Elements in Two Binary Search Trees | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1305.All-Elements-in-Two-Binary-Search-Trees) | 76.1% | Medium | | -| 1306 | Jump Game III | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1306.Jump-Game-III) | 60.5% | Medium | | -| 1307 | Verbal Arithmetic Puzzle | | 37.6% | Hard | | -| 1308 | Running Total for Different Genders | | 84.0% | Medium | | -| 1309 | Decrypt String from Alphabet to Integer Mapping | | 76.7% | Easy | | -| 1310 | XOR Queries of a Subarray | | 68.6% | Medium | | -| 1311 | Get Watched Videos by Your Friends | | 43.1% | Medium | | -| 1312 | Minimum Insertion Steps to Make a String Palindrome | | 58.1% | Hard | | -| 1313 | Decompress Run-Length Encoded List | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1313.Decompress-Run-Length-Encoded-List) | 85.1% | Easy | | -| 1314 | Matrix Block Sum | | 73.7% | Medium | | -| 1315 | Sum of Nodes with Even-Valued Grandparent | | 83.5% | Medium | | -| 1316 | Distinct Echo Substrings | | 46.4% | Hard | | -| 1317 | Convert Integer to the Sum of Two No-Zero Integers | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers) | 56.7% | Easy | | -| 1318 | Minimum Flips to Make a OR b Equal to c | | 62.8% | Medium | | -| 1319 | Number of Operations to Make Network Connected | | 53.1% | Medium | | -| 1320 | Minimum Distance to Type a Word Using Two Fingers | | 62.3% | Hard | | -| 1321 | Restaurant Growth | | 67.7% | Medium | | -| 1322 | Ads Performance | | 57.8% | Easy | | -| 1323 | Maximum 69 Number | | 77.9% | Easy | | -| 1324 | Print Words Vertically | | 58.0% | Medium | | -| 1325 | Delete Leaves With a Given Value | | 72.9% | Medium | | -| 1326 | Minimum Number of Taps to Open to Water a Garden | | 43.5% | Hard | | -| 1327 | List the Products Ordered in a Period | | 76.3% | Easy | | -| 1328 | Break a Palindrome | | 43.3% | Medium | | -| 1329 | Sort the Matrix Diagonally | | 78.4% | Medium | | -| 1330 | Reverse Subarray To Maximize Array Value | | 35.1% | Hard | | -| 1331 | Rank Transform of an Array | | 58.1% | Easy | | -| 1332 | Remove Palindromic Subsequences | | 60.0% | Easy | | -| 1333 | Filter Restaurants by Vegan-Friendly, Price and Distance | | 54.6% | Medium | | -| 1334 | Find the City With the Smallest Number of Neighbors at a Threshold Distance | | 44.5% | Medium | | -| 1335 | Minimum Difficulty of a Job Schedule | | 57.5% | Hard | | -| 1336 | Number of Transactions per Visit | | 43.5% | Hard | | -| 1337 | The K Weakest Rows in a Matrix | | 68.7% | Easy | | -| 1338 | Reduce Array Size to The Half | | 66.6% | Medium | | -| 1339 | Maximum Product of Splitted Binary Tree | | 37.2% | Medium | | -| 1340 | Jump Game V | | 57.5% | Hard | | -| 1341 | Movie Rating | | 56.6% | Medium | | -| 1342 | Number of Steps to Reduce a Number to Zero | | 86.3% | Easy | | -| 1343 | Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold | | 64.2% | Medium | | -| 1344 | Angle Between Hands of a Clock | | 61.4% | Medium | | -| 1345 | Jump Game IV | | 38.1% | Hard | | -| 1346 | Check If N and Its Double Exist | | 38.0% | Easy | | -| 1347 | Minimum Number of Steps to Make Two Strings Anagram | | 74.6% | Medium | | -| 1348 | Tweet Counts Per Frequency | | 29.0% | Medium | | -| 1349 | Maximum Students Taking Exam | | 41.9% | Hard | | -| 1350 | Students With Invalid Departments | | 89.4% | Easy | | -| 1351 | Count Negative Numbers in a Sorted Matrix | | 76.6% | Easy | | -| 1352 | Product of the Last K Numbers | | 43.6% | Medium | | -| 1353 | Maximum Number of Events That Can Be Attended | | 30.5% | Medium | | -| 1354 | Construct Target Array With Multiple Sums | | 31.9% | Hard | | -| 1355 | Activity Participants | | 69.2% | Medium | | -| 1356 | Sort Integers by The Number of 1 Bits | | 68.6% | Easy | | -| 1357 | Apply Discount Every n Orders | | 66.0% | Medium | | -| 1358 | Number of Substrings Containing All Three Characters | | 58.0% | Medium | | -| 1359 | Count All Valid Pickup and Delivery Options | | 57.9% | Hard | | -| 1360 | Number of Days Between Two Dates | | 48.8% | Easy | | -| 1361 | Validate Binary Tree Nodes | | 48.6% | Medium | | -| 1362 | Closest Divisors | | 56.7% | Medium | | -| 1363 | Largest Multiple of Three | | 33.5% | Hard | | -| 1364 | Number of Trusted Contacts of a Customer | | 75.3% | Medium | | -| 1365 | How Many Numbers Are Smaller Than the Current Number | | 85.6% | Easy | | -| 1366 | Rank Teams by Votes | | 52.4% | Medium | | -| 1367 | Linked List in Binary Tree | | 39.7% | Medium | | -| 1368 | Minimum Cost to Make at Least One Valid Path in a Grid | | 54.4% | Hard | | -| 1369 | Get the Second Most Recent Activity | | 64.7% | Hard | | -| 1370 | Increasing Decreasing String | | 75.6% | Easy | | -| 1371 | Find the Longest Substring Containing Vowels in Even Counts | | 57.3% | Medium | | -| 1372 | Longest ZigZag Path in a Binary Tree | | 54.0% | Medium | | -| 1373 | Maximum Sum BST in Binary Tree | | 40.2% | Hard | | -| 1374 | Generate a String With Characters That Have Odd Counts | | 75.4% | Easy | | -| 1375 | Bulb Switcher III | | 62.5% | Medium | | -| 1376 | Time Needed to Inform All Employees | | 55.5% | Medium | | -| 1377 | Frog Position After T Seconds | | 33.6% | Hard | | -| 1378 | Replace Employee ID With The Unique Identifier | | 87.4% | Easy | | -| 1379 | Find a Corresponding Node of a Binary Tree in a Clone of That Tree | | 83.8% | Medium | | -| 1380 | Lucky Numbers in a Matrix | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix) | 71.4% | Easy | | -| 1381 | Design a Stack With Increment Operation | | 74.7% | Medium | | -| 1382 | Balance a Binary Search Tree | | 74.8% | Medium | | -| 1383 | Maximum Performance of a Team | | 31.8% | Hard | | -| 1384 | Total Sales Amount by Year | | 62.8% | Hard | | -| 1385 | Find the Distance Value Between Two Arrays | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays) | 67.1% | Easy | | -| 1386 | Cinema Seat Allocation | | 34.8% | Medium | | -| 1387 | Sort Integers by The Power Value | | 70.1% | Medium | | -| 1388 | Pizza With 3n Slices | | 44.7% | Hard | | -| 1389 | Create Target Array in the Given Order | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1389.Create-Target-Array-in-the-Given-Order) | 84.1% | Easy | | -| 1390 | Four Divisors | | 38.1% | Medium | | -| 1391 | Check if There is a Valid Path in a Grid | | 44.5% | Medium | | -| 1392 | Longest Happy Prefix | | 40.0% | Hard | | -| 1393 | Capital Gain/Loss | | 89.2% | Medium | | -| 1394 | Find Lucky Integer in an Array | | 64.5% | Easy | | -| 1395 | Count Number of Teams | | 81.9% | Medium | | -| 1396 | Design Underground System | | 64.7% | Medium | | -| 1397 | Find All Good Strings | | 37.2% | Hard | | -| 1398 | Customers Who Bought Products A and B but Not C | | 80.6% | Medium | | -| 1399 | Count Largest Group | | 65.0% | Easy | | -| 1400 | Construct K Palindrome Strings | | 60.4% | Medium | | -| 1401 | Circle and Rectangle Overlapping | | 41.8% | Medium | | -| 1402 | Reducing Dishes | | 72.8% | Hard | | -| 1403 | Minimum Subsequence in Non-Increasing Order | | 70.8% | Easy | | -| 1404 | Number of Steps to Reduce a Number in Binary Representation to One | | 50.3% | Medium | | -| 1405 | Longest Happy String | | 49.0% | Medium | | -| 1406 | Stone Game III | | 56.0% | Hard | | -| 1407 | Top Travellers | | 82.1% | Easy | | -| 1408 | String Matching in an Array | | 61.4% | Easy | | -| 1409 | Queries on a Permutation With Key | | 81.6% | Medium | | -| 1410 | HTML Entity Parser | | 53.9% | Medium | | -| 1411 | Number of Ways to Paint N × 3 Grid | | 61.2% | Hard | | -| 1412 | Find the Quiet Students in All Exams | | 66.6% | Hard | | -| 1413 | Minimum Value to Get Positive Step by Step Sum | | 65.2% | Easy | | -| 1414 | Find the Minimum Number of Fibonacci Numbers Whose Sum Is K | | 62.4% | Medium | | -| 1415 | The k-th Lexicographical String of All Happy Strings of Length n | | 70.4% | Medium | | -| 1416 | Restore The Array | | 36.7% | Hard | | -| 1417 | Reformat The String | | 55.0% | Easy | | -| 1418 | Display Table of Food Orders in a Restaurant | | 65.6% | Medium | | -| 1419 | Minimum Number of Frogs Croaking | | 46.3% | Medium | | -| 1420 | Build Array Where You Can Find The Maximum Exactly K Comparisons | | 65.2% | Hard | | -| 1421 | NPV Queries | | 80.5% | Medium | | -| 1422 | Maximum Score After Splitting a String | | 54.7% | Easy | | -| 1423 | Maximum Points You Can Obtain from Cards | | 42.5% | Medium | | -| 1424 | Diagonal Traverse II | | 42.3% | Medium | | -| 1425 | Constrained Subsequence Sum | | 44.1% | Hard | | -| 1426 | Counting Elements | | 58.7% | Easy | | -| 1427 | Perform String Shifts | | 53.0% | Easy | | -| 1428 | Leftmost Column with at Least a One | | 46.8% | Medium | | -| 1429 | First Unique Number | | 47.0% | Medium | | -| 1430 | Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree | | 44.8% | Medium | | -| 1431 | Kids With the Greatest Number of Candies | | 88.9% | Easy | | -| 1432 | Max Difference You Can Get From Changing an Integer | | 42.8% | Medium | | -| 1433 | Check If a String Can Break Another String | | 65.7% | Medium | | -| 1434 | Number of Ways to Wear Different Hats to Each Other | | 38.0% | Hard | | -| 1435 | Create a Session Bar Chart | | 76.7% | Easy | | -| 1436 | Destination City | | 77.3% | Easy | | -| 1437 | Check If All 1's Are at Least Length K Places Away | | 63.3% | Medium | | -| 1438 | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | | 41.9% | Medium | | -| 1439 | Find the Kth Smallest Sum of a Matrix With Sorted Rows | | 59.4% | Hard | | -| 1440 | Evaluate Boolean Expression | | 70.1% | Medium | | -| 1441 | Build an Array With Stack Operations | | 68.8% | Easy | | -| 1442 | Count Triplets That Can Form Two Arrays of Equal XOR | | 69.4% | Medium | | -| 1443 | Minimum Time to Collect All Apples in a Tree | | 55.5% | Medium | | -| 1444 | Number of Ways of Cutting a Pizza | | 52.7% | Hard | | -| 1445 | Apples & Oranges | | 87.2% | Medium | | -| 1446 | Consecutive Characters | | 60.4% | Easy | | -| 1447 | Simplified Fractions | | 61.0% | Medium | | -| 1448 | Count Good Nodes in Binary Tree | | 70.6% | Medium | | -| 1449 | Form Largest Integer With Digits That Add up to Target | | 41.8% | Hard | | -| 1450 | Number of Students Doing Homework at a Given Time | | 78.1% | Easy | | -| 1451 | Rearrange Words in a Sentence | | 54.8% | Medium | | -| 1452 | People Whose List of Favorite Companies Is Not a Subset of Another List | | 53.3% | Medium | | -| 1453 | Maximum Number of Darts Inside of a Circular Dartboard | | 33.7% | Hard | | -| 1454 | Active Users | | 37.5% | Medium | | -| 1455 | Check If a Word Occurs As a Prefix of Any Word in a Sentence | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence) | 64.7% | Easy | | -| 1456 | Maximum Number of Vowels in a Substring of Given Length | | 52.4% | Medium | | -| 1457 | Pseudo-Palindromic Paths in a Binary Tree | | 67.2% | Medium | | -| 1458 | Max Dot Product of Two Subsequences | | 41.7% | Hard | | -| 1459 | Rectangles Area | | 61.5% | Medium | | -| 1460 | Make Two Arrays Equal by Reversing Sub-arrays | | 74.0% | Easy | | -| 1461 | Check If a String Contains All Binary Codes of Size K | | 44.6% | Medium | | -| 1462 | Course Schedule IV | | 41.7% | Medium | | -| 1463 | Cherry Pickup II | | 65.5% | Hard | | -| 1464 | Maximum Product of Two Elements in an Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array) | 78.1% | Easy | | -| 1465 | Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | | 30.8% | Medium | | -| 1466 | Reorder Routes to Make All Paths Lead to the City Zero | | 63.6% | Medium | | -| 1467 | Probability of a Two Boxes Having The Same Number of Distinct Balls | | 61.1% | Hard | | -| 1468 | Calculate Salaries | | 78.0% | Medium | | -| 1469 | Find All The Lonely Nodes | | 81.5% | Easy | | -| 1470 | Shuffle the Array | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1470.Shuffle-the-Array) | 89.0% | Easy | | -| 1471 | The k Strongest Values in an Array | | 57.0% | Medium | | -| 1472 | Design Browser History | | 64.5% | Medium | | -| 1473 | Paint House III | | 48.1% | Hard | | -| 1474 | Delete N Nodes After M Nodes of a Linked List | | 74.2% | Easy | | -| 1475 | Final Prices With a Special Discount in a Shop | | 75.7% | Easy | | -| 1476 | Subrectangle Queries | | 90.5% | Medium | | -| 1477 | Find Two Non-overlapping Sub-arrays Each With Target Sum | | 29.8% | Medium | | -| 1478 | Allocate Mailboxes | | 55.0% | Hard | | -| 1479 | Sales by Day of the Week | | 83.4% | Hard | | -| 1480 | Running Sum of 1d Array | | 90.6% | Easy | | -| 1481 | Least Number of Unique Integers after K Removals | | 53.7% | Medium | | -| 1482 | Minimum Number of Days to Make m Bouquets | | 45.7% | Medium | | -| 1483 | Kth Ancestor of a Tree Node | | 27.6% | Hard | | -| 1484 | Group Sold Products By The Date | | 86.0% | Easy | | -| 1485 | Clone Binary Tree With Random Pointer | | 81.4% | Medium | | -| 1486 | XOR Operation in an Array | | 85.1% | Easy | | -| 1487 | Making File Names Unique | | 29.2% | Medium | | -| 1488 | Avoid Flood in The City | | 25.3% | Medium | | -| 1489 | Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree | | 50.5% | Hard | | -| 1490 | Clone N-ary Tree | | 84.7% | Medium | | -| 1491 | Average Salary Excluding the Minimum and Maximum Salary | | 70.2% | Easy | | -| 1492 | The kth Factor of n | | 68.0% | Medium | | -| 1493 | Longest Subarray of 1's After Deleting One Element | | 58.4% | Medium | | -| 1494 | Parallel Courses II | | 32.2% | Hard | | -| 1495 | Friendly Movies Streamed Last Month | | 52.9% | Easy | | -| 1496 | Path Crossing | | 55.9% | Easy | | -| 1497 | Check If Array Pairs Are Divisible by k | | 41.2% | Medium | | -| 1498 | Number of Subsequences That Satisfy the Given Sum Condition | | 36.7% | Medium | | -| 1499 | Max Value of Equation | | 44.6% | Hard | | -| 1500 | Design a File Sharing System | | 46.4% | Medium | | -| 1501 | Countries You Can Safely Invest In | | 63.8% | Medium | | -| 1502 | Can Make Arithmetic Progression From Sequence | | 73.4% | Easy | | -| 1503 | Last Moment Before All Ants Fall Out of a Plank | | 51.5% | Medium | | -| 1504 | Count Submatrices With All Ones | | 61.6% | Medium | | -| 1505 | Minimum Possible Integer After at Most K Adjacent Swaps On Digits | | 36.1% | Hard | | -| 1506 | Find Root of N-Ary Tree | | 79.8% | Medium | | -| 1507 | Reformat Date | | 60.5% | Easy | | -| 1508 | Range Sum of Sorted Subarray Sums | | 68.6% | Medium | | -| 1509 | Minimum Difference Between Largest and Smallest Value in Three Moves | | 50.9% | Medium | | -| 1510 | Stone Game IV | | 50.2% | Hard | | -| 1511 | Customer Order Frequency | | 77.0% | Easy | | -| 1512 | Number of Good Pairs | | 88.7% | Easy | | -| 1513 | Number of Substrings With Only 1s | | 40.4% | Medium | | -| 1514 | Path with Maximum Probability | | 36.5% | Medium | | -| 1515 | Best Position for a Service Centre | | 35.8% | Hard | | -| 1516 | Move Sub-Tree of N-Ary Tree | | 60.2% | Hard | | -| 1517 | Find Users With Valid E-Mails | | 71.2% | Easy | | -| 1518 | Water Bottles | | 63.1% | Easy | | -| 1519 | Number of Nodes in the Sub-Tree With the Same Label | | 35.1% | Medium | | -| 1520 | Maximum Number of Non-Overlapping Substrings | | 32.7% | Hard | | -| 1521 | Find a Value of a Mysterious Function Closest to Target | | 43.3% | Hard | | -| 1522 | Diameter of N-Ary Tree | | 70.0% | Medium | | -| 1523 | Count Odd Numbers in an Interval Range | | 55.7% | Easy | | -| 1524 | Number of Sub-arrays With Odd Sum | | 36.3% | Medium | | -| 1525 | Number of Good Ways to Split a String | | 70.0% | Medium | | -| 1526 | Minimum Number of Increments on Subarrays to Form a Target Array | | 57.5% | Hard | | -| 1527 | Patients With a Condition | | 88.4% | Easy | | -| 1528 | Shuffle String | | 86.1% | Easy | | -| 1529 | Bulb Switcher IV | | 70.4% | Medium | | -| 1530 | Number of Good Leaf Nodes Pairs | | 53.4% | Medium | | -| 1531 | String Compression II | | 28.6% | Hard | | -| 1532 | The Most Recent Three Orders | | 75.1% | Medium | | -| 1533 | Find the Index of the Large Integer | | 57.7% | Medium | | -| 1534 | Count Good Triplets | | 79.4% | Easy | | -| 1535 | Find the Winner of an Array Game | | 45.5% | Medium | | -| 1536 | Minimum Swaps to Arrange a Binary Grid | | 41.5% | Medium | | -| 1537 | Get the Maximum Score | | 35.7% | Hard | | -| 1538 | Guess the Majority in a Hidden Array | | 56.9% | Medium | | +|0001|Two Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum)|46.1%|Easy|| +|0002|Add Two Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0002.Add-Two-Numbers)|34.9%|Medium|| +|0003|Longest Substring Without Repeating Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0003.Longest-Substring-Without-Repeating-Characters)|31.1%|Medium|| +|0004|Median of Two Sorted Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0004.Median-of-Two-Sorted-Arrays)|30.7%|Hard|| +|0005|Longest Palindromic Substring||30.1%|Medium|| +|0006|ZigZag Conversion||37.5%|Medium|| +|0007|Reverse Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0007.Reverse-Integer)|25.8%|Easy|| +|0008|String to Integer (atoi)||15.5%|Medium|| +|0009|Palindrome Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0009.Palindrome-Number)|49.4%|Easy|| +|0010|Regular Expression Matching||27.2%|Hard|| +|0011|Container With Most Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0011.Container-With-Most-Water)|52.1%|Medium|| +|0012|Integer to Roman||55.8%|Medium|| +|0013|Roman to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0013.Roman-to-Integer)|56.3%|Easy|| +|0014|Longest Common Prefix||36.0%|Easy|| +|0015|3Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0015.3Sum)|27.7%|Medium|| +|0016|3Sum Closest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0016.3Sum-Closest)|46.2%|Medium|| +|0017|Letter Combinations of a Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0017.Letter-Combinations-of-a-Phone-Number)|48.5%|Medium|| +|0018|4Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0018.4Sum)|34.6%|Medium|| +|0019|Remove Nth Node From End of List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0019.Remove-Nth-Node-From-End-of-List)|35.6%|Medium|| +|0020|Valid Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0020.Valid-Parentheses)|39.5%|Easy|| +|0021|Merge Two Sorted Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0021.Merge-Two-Sorted-Lists)|55.5%|Easy|| +|0022|Generate Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0022.Generate-Parentheses)|64.7%|Medium|| +|0023|Merge k Sorted Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0023.Merge-k-Sorted-Lists)|41.9%|Hard|| +|0024|Swap Nodes in Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0024.Swap-Nodes-in-Pairs)|52.5%|Medium|| +|0025|Reverse Nodes in k-Group|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0025.Reverse-Nodes-in-k-Group)|44.1%|Hard|| +|0026|Remove Duplicates from Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0026.Remove-Duplicates-from-Sorted-Array)|46.3%|Easy|| +|0027|Remove Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0027.Remove-Element)|49.0%|Easy|| +|0028|Implement strStr()|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0028.Implement-strStr())|35.0%|Easy|| +|0029|Divide Two Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0029.Divide-Two-Integers)|16.6%|Medium|| +|0030|Substring with Concatenation of All Words|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0030.Substring-with-Concatenation-of-All-Words)|26.0%|Hard|| +|0031|Next Permutation||33.2%|Medium|| +|0032|Longest Valid Parentheses||29.1%|Hard|| +|0033|Search in Rotated Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0033.Search-in-Rotated-Sorted-Array)|35.6%|Medium|| +|0034|Find First and Last Position of Element in Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array)|37.0%|Medium|| +|0035|Search Insert Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0035.Search-Insert-Position)|42.7%|Easy|| +|0036|Valid Sudoku|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0036.Valid-Sudoku)|50.1%|Medium|| +|0037|Sudoku Solver|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0037.Sudoku-Solver)|45.8%|Hard|| +|0038|Count and Say||45.7%|Easy|| +|0039|Combination Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0039.Combination-Sum)|58.6%|Medium|| +|0040|Combination Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0040.Combination-Sum-II)|49.7%|Medium|| +|0041|First Missing Positive|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0041.First-Missing-Positive)|33.4%|Hard|| +|0042|Trapping Rain Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0042.Trapping-Rain-Water)|50.6%|Hard|| +|0043|Multiply Strings||34.7%|Medium|| +|0044|Wildcard Matching||25.3%|Hard|| +|0045|Jump Game II||31.2%|Hard|| +|0046|Permutations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0046.Permutations)|65.9%|Medium|| +|0047|Permutations II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0047.Permutations-II)|48.9%|Medium|| +|0048|Rotate Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0048.Rotate-Image)|59.2%|Medium|| +|0049|Group Anagrams|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams)|58.7%|Medium|| +|0050|Pow(x, n)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0050.Pow(x,-n))|30.8%|Medium|| +|0051|N-Queens|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0051.N-Queens)|48.9%|Hard|| +|0052|N-Queens II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0052.N-Queens-II)|59.6%|Hard|| +|0053|Maximum Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0053.Maximum-Subarray)|47.5%|Easy|| +|0054|Spiral Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0054.Spiral-Matrix)|35.4%|Medium|| +|0055|Jump Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0055.Jump-Game)|35.0%|Medium|| +|0056|Merge Intervals|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0056.Merge-Intervals)|40.6%|Medium|| +|0057|Insert Interval|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0057.Insert-Interval)|34.8%|Medium|| +|0058|Length of Last Word||33.4%|Easy|| +|0059|Spiral Matrix II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0059.Spiral-Matrix-II)|57.3%|Medium|| +|0060|Permutation Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0060.Permutation-Sequence)|39.1%|Hard|| +|0061|Rotate List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0061.Rotate-List)|31.5%|Medium|| +|0062|Unique Paths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0062.Unique-Paths)|55.5%|Medium|| +|0063|Unique Paths II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0063.Unique-Paths-II)|35.1%|Medium|| +|0064|Minimum Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0064.Minimum-Path-Sum)|55.8%|Medium|| +|0065|Valid Number||15.7%|Hard|| +|0066|Plus One|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0066.Plus-One)|42.6%|Easy|| +|0067|Add Binary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0067.Add-Binary)|46.5%|Easy|| +|0068|Text Justification||29.1%|Hard|| +|0069|Sqrt(x)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0069.Sqrt(x))|34.8%|Easy|| +|0070|Climbing Stairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0070.Climbing-Stairs)|48.5%|Easy|| +|0071|Simplify Path|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0071.Simplify-Path)|33.5%|Medium|| +|0072|Edit Distance||46.3%|Hard|| +|0073|Set Matrix Zeroes||44.0%|Medium|| +|0074|Search a 2D Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0074.Search-a-2D-Matrix)|37.3%|Medium|| +|0075|Sort Colors|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0075.Sort-Colors)|48.8%|Medium|| +|0076|Minimum Window Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0076.Minimum-Window-Substring)|35.6%|Hard|| +|0077|Combinations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0077.Combinations)|56.8%|Medium|| +|0078|Subsets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0078.Subsets)|64.3%|Medium|| +|0079|Word Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0079.Word-Search)|36.5%|Medium|| +|0080|Remove Duplicates from Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II)|45.8%|Medium|| +|0081|Search in Rotated Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0081.Search-in-Rotated-Sorted-Array-II)|33.4%|Medium|| +|0082|Remove Duplicates from Sorted List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II)|38.8%|Medium|| +|0083|Remove Duplicates from Sorted List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0083.Remove-Duplicates-from-Sorted-List)|46.2%|Easy|| +|0084|Largest Rectangle in Histogram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0084.Largest-Rectangle-in-Histogram)|36.7%|Hard|| +|0085|Maximal Rectangle||39.1%|Hard|| +|0086|Partition List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0086.Partition-List)|42.9%|Medium|| +|0087|Scramble String||34.4%|Hard|| +|0088|Merge Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0088.Merge-Sorted-Array)|40.2%|Easy|| +|0089|Gray Code|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0089.Gray-Code)|50.0%|Medium|| +|0090|Subsets II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0090.Subsets-II)|48.4%|Medium|| +|0091|Decode Ways|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0091.Decode-Ways)|26.1%|Medium|| +|0092|Reverse Linked List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0092.Reverse-Linked-List-II)|40.1%|Medium|| +|0093|Restore IP Addresses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0093.Restore-IP-Addresses)|37.1%|Medium|| +|0094|Binary Tree Inorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0094.Binary-Tree-Inorder-Traversal)|65.3%|Medium|| +|0095|Unique Binary Search Trees II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0095.Unique-Binary-Search-Trees-II)|42.0%|Medium|| +|0096|Unique Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0096.Unique-Binary-Search-Trees)|54.1%|Medium|| +|0097|Interleaving String||32.3%|Hard|| +|0098|Validate Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0098.Validate-Binary-Search-Tree)|28.5%|Medium|| +|0099|Recover Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0099.Recover-Binary-Search-Tree)|42.1%|Hard|| +|0100|Same Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0100.Same-Tree)|54.0%|Easy|| +|0101|Symmetric Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0101.Symmetric-Tree)|47.8%|Easy|| +|0102|Binary Tree Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0102.Binary-Tree-Level-Order-Traversal)|56.1%|Medium|| +|0103|Binary Tree Zigzag Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal)|49.7%|Medium|| +|0104|Maximum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0104.Maximum-Depth-of-Binary-Tree)|67.6%|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)|51.1%|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)|49.0%|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)|54.8%|Easy|| +|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)|59.8%|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)|49.6%|Medium|| +|0110|Balanced Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0110.Balanced-Binary-Tree)|44.5%|Easy|| +|0111|Minimum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0111.Minimum-Depth-of-Binary-Tree)|39.1%|Easy|| +|0112|Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0112.Path-Sum)|42.1%|Easy|| +|0113|Path Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0113.Path-Sum-II)|48.5%|Medium|| +|0114|Flatten Binary Tree to Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0114.Flatten-Binary-Tree-to-Linked-List)|51.3%|Medium|| +|0115|Distinct Subsequences||39.3%|Hard|| +|0116|Populating Next Right Pointers in Each Node||48.3%|Medium|| +|0117|Populating Next Right Pointers in Each Node II||41.6%|Medium|| +|0118|Pascal's Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0118.Pascal's-Triangle)|54.3%|Easy|| +|0119|Pascal's Triangle II||51.8%|Easy|| +|0120|Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0120.Triangle)|45.4%|Medium|| +|0121|Best Time to Buy and Sell Stock|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock)|51.2%|Easy|| +|0122|Best Time to Buy and Sell Stock II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II)|58.2%|Easy|| +|0123|Best Time to Buy and Sell Stock III||39.6%|Hard|| +|0124|Binary Tree Maximum Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0124.Binary-Tree-Maximum-Path-Sum)|35.2%|Hard|| +|0125|Valid Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0125.Valid-Palindrome)|37.8%|Easy|| +|0126|Word Ladder II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0126.Word-Ladder-II)|23.3%|Hard|| +|0127|Word Ladder|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0127.Word-Ladder)|31.0%|Hard|| +|0128|Longest Consecutive Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0128.Longest-Consecutive-Sequence)|46.0%|Hard|| +|0129|Sum Root to Leaf Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0129.Sum-Root-to-Leaf-Numbers)|50.5%|Medium|| +|0130|Surrounded Regions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0130.Surrounded-Regions)|29.1%|Medium|| +|0131|Palindrome Partitioning|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0131.Palindrome-Partitioning)|51.2%|Medium|| +|0132|Palindrome Partitioning II||31.0%|Hard|| +|0133|Clone Graph||38.3%|Medium|| +|0134|Gas Station||40.9%|Medium|| +|0135|Candy||32.7%|Hard|| +|0136|Single Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0136.Single-Number)|66.3%|Easy|| +|0137|Single Number II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0137.Single-Number-II)|53.5%|Medium|| +|0138|Copy List with Random Pointer||39.3%|Medium|| +|0139|Word Break||41.4%|Medium|| +|0140|Word Break II||34.2%|Hard|| +|0141|Linked List Cycle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0141.Linked-List-Cycle)|42.1%|Easy|| +|0142|Linked List Cycle II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0142.Linked-List-Cycle-II)|39.2%|Medium|| +|0143|Reorder List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0143.Reorder-List)|40.1%|Medium|| +|0144|Binary Tree Preorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0144.Binary-Tree-Preorder-Traversal)|57.0%|Medium|| +|0145|Binary Tree Postorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0145.Binary-Tree-Postorder-Traversal)|56.9%|Medium|| +|0146|LRU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0146.LRU-Cache)|35.1%|Medium|| +|0147|Insertion Sort List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0147.Insertion-Sort-List)|44.1%|Medium|| +|0148|Sort List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0148.Sort-List)|45.7%|Medium|| +|0149|Max Points on a Line||17.2%|Hard|| +|0150|Evaluate Reverse Polish Notation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0150.Evaluate-Reverse-Polish-Notation)|37.5%|Medium|| +|0151|Reverse Words in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0151.Reverse-Words-in-a-String)|23.2%|Medium|| +|0152|Maximum Product Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0152.Maximum-Product-Subarray)|32.6%|Medium|| +|0153|Find Minimum in Rotated Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0153.Find-Minimum-in-Rotated-Sorted-Array)|45.8%|Medium|| +|0154|Find Minimum in Rotated Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0154.Find-Minimum-in-Rotated-Sorted-Array-II)|41.9%|Hard|| +|0155|Min Stack|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0155.Min-Stack)|45.9%|Easy|| +|0156|Binary Tree Upside Down||56.0%|Medium|| +|0157|Read N Characters Given Read4||36.8%|Easy|| +|0158|Read N Characters Given Read4 II - Call multiple times||36.2%|Hard|| +|0159|Longest Substring with At Most Two Distinct Characters||50.2%|Medium|| +|0160|Intersection of Two Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0160.Intersection-of-Two-Linked-Lists)|42.5%|Easy|| +|0161|One Edit Distance||32.7%|Medium|| +|0162|Find Peak Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0162.Find-Peak-Element)|43.8%|Medium|| +|0163|Missing Ranges||26.3%|Easy|| +|0164|Maximum Gap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0164.Maximum-Gap)|36.5%|Hard|| +|0165|Compare Version Numbers||30.0%|Medium|| +|0166|Fraction to Recurring Decimal||22.1%|Medium|| +|0167|Two Sum II - Input array is sorted|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0167.Two-Sum-II---Input-array-is-sorted)|55.3%|Easy|| +|0168|Excel Sheet Column Title|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0168.Excel-Sheet-Column-Title)|31.6%|Easy|| +|0169|Majority Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0169.Majority-Element)|59.8%|Easy|| +|0170|Two Sum III - Data structure design||34.7%|Easy|| +|0171|Excel Sheet Column Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0171.Excel-Sheet-Column-Number)|56.7%|Easy|| +|0172|Factorial Trailing Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0172.Factorial-Trailing-Zeroes)|38.3%|Easy|| +|0173|Binary Search Tree Iterator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0173.Binary-Search-Tree-Iterator)|59.5%|Medium|| +|0174|Dungeon Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0174.Dungeon-Game)|33.1%|Hard|| +|0175|Combine Two Tables||63.3%|Easy|| +|0176|Second Highest Salary||32.9%|Easy|| +|0177|Nth Highest Salary||32.8%|Medium|| +|0178|Rank Scores||49.0%|Medium|| +|0179|Largest Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0179.Largest-Number)|30.4%|Medium|| +|0180|Consecutive Numbers||41.6%|Medium|| +|0181|Employees Earning More Than Their Managers||59.5%|Easy|| +|0182|Duplicate Emails||64.0%|Easy|| +|0183|Customers Who Never Order||56.0%|Easy|| +|0184|Department Highest Salary||39.2%|Medium|| +|0185|Department Top Three Salaries||37.8%|Hard|| +|0186|Reverse Words in a String II||45.0%|Medium|| +|0187|Repeated DNA Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0187.Repeated-DNA-Sequences)|41.2%|Medium|| +|0188|Best Time to Buy and Sell Stock IV||29.2%|Hard|| +|0189|Rotate Array||36.3%|Medium|| +|0190|Reverse Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0190.Reverse-Bits)|41.5%|Easy|| +|0191|Number of 1 Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0191.Number-of-1-Bits)|51.8%|Easy|| +|0192|Word Frequency||25.8%|Medium|| +|0193|Valid Phone Numbers||25.3%|Easy|| +|0194|Transpose File||24.5%|Medium|| +|0195|Tenth Line||32.9%|Easy|| +|0196|Delete Duplicate Emails||44.2%|Easy|| +|0197|Rising Temperature||39.5%|Easy|| +|0198|House Robber|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0198.House-Robber)|42.7%|Medium|| +|0199|Binary Tree Right Side View|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0199.Binary-Tree-Right-Side-View)|55.6%|Medium|| +|0200|Number of Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0200.Number-of-Islands)|48.5%|Medium|| +|0201|Bitwise AND of Numbers Range|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0201.Bitwise-AND-of-Numbers-Range)|39.6%|Medium|| +|0202|Happy Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0202.Happy-Number)|51.1%|Easy|| +|0203|Remove Linked List Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0203.Remove-Linked-List-Elements)|39.0%|Easy|| +|0204|Count Primes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0204.Count-Primes)|32.1%|Easy|| +|0205|Isomorphic Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0205.Isomorphic-Strings)|40.3%|Easy|| +|0206|Reverse Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0206.Reverse-Linked-List)|64.6%|Easy|| +|0207|Course Schedule|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0207.Course-Schedule)|44.2%|Medium|| +|0208|Implement Trie (Prefix Tree)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0208.Implement-Trie-(Prefix-Tree))|51.4%|Medium|| +|0209|Minimum Size Subarray Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0209.Minimum-Size-Subarray-Sum)|39.1%|Medium|| +|0210|Course Schedule II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0210.Course-Schedule-II)|42.2%|Medium|| +|0211|Design Add and Search Words Data Structure|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0211.Design-Add-and-Search-Words-Data-Structure)|39.7%|Medium|| +|0212|Word Search II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0212.Word-Search-II)|36.4%|Hard|| +|0213|House Robber II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0213.House-Robber-II)|37.4%|Medium|| +|0214|Shortest Palindrome||30.4%|Hard|| +|0215|Kth Largest Element in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0215.Kth-Largest-Element-in-an-Array)|57.4%|Medium|| +|0216|Combination Sum III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0216.Combination-Sum-III)|59.8%|Medium|| +|0217|Contains Duplicate|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0217.Contains-Duplicate)|56.5%|Easy|| +|0218|The Skyline Problem|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0218.The-Skyline-Problem)|36.0%|Hard|| +|0219|Contains Duplicate II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0219.Contains-Duplicate-II)|38.4%|Easy|| +|0220|Contains Duplicate III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0220.Contains-Duplicate-III)|21.3%|Medium|| +|0221|Maximal Square||38.6%|Medium|| +|0222|Count Complete Tree Nodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0222.Count-Complete-Tree-Nodes)|48.7%|Medium|| +|0223|Rectangle Area|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0223.Rectangle-Area)|38.1%|Medium|| +|0224|Basic Calculator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0224.Basic-Calculator)|37.9%|Hard|| +|0225|Implement Stack using Queues|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0225.Implement-Stack-using-Queues)|46.8%|Easy|| +|0226|Invert Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0226.Invert-Binary-Tree)|66.5%|Easy|| +|0227|Basic Calculator II||38.2%|Medium|| +|0228|Summary Ranges||42.0%|Easy|| +|0229|Majority Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0229.Majority-Element-II)|38.4%|Medium|| +|0230|Kth Smallest Element in a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0230.Kth-Smallest-Element-in-a-BST)|62.0%|Medium|| +|0231|Power of Two|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0231.Power-of-Two)|43.8%|Easy|| +|0232|Implement Queue using Stacks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0232.Implement-Queue-using-Stacks)|51.5%|Easy|| +|0233|Number of Digit One||31.6%|Hard|| +|0234|Palindrome Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0234.Palindrome-Linked-List)|40.2%|Easy|| +|0235|Lowest Common Ancestor of a Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree)|51.3%|Easy|| +|0236|Lowest Common Ancestor of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree)|48.0%|Medium|| +|0237|Delete Node in a Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0237.Delete-Node-in-a-Linked-List)|66.1%|Easy|| +|0238|Product of Array Except Self||61.2%|Medium|| +|0239|Sliding Window Maximum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0239.Sliding-Window-Maximum)|44.5%|Hard|| +|0240|Search a 2D Matrix II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0240.Search-a-2D-Matrix-II)|44.0%|Medium|| +|0241|Different Ways to Add Parentheses||56.9%|Medium|| +|0242|Valid Anagram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0242.Valid-Anagram)|57.9%|Easy|| +|0243|Shortest Word Distance||61.7%|Easy|| +|0244|Shortest Word Distance II||53.4%|Medium|| +|0245|Shortest Word Distance III||55.8%|Medium|| +|0246|Strobogrammatic Number||45.6%|Easy|| +|0247|Strobogrammatic Number II||48.3%|Medium|| +|0248|Strobogrammatic Number III||40.1%|Hard|| +|0249|Group Shifted Strings||57.5%|Medium|| +|0250|Count Univalue Subtrees||53.0%|Medium|| +|0251|Flatten 2D Vector||46.2%|Medium|| +|0252|Meeting Rooms||55.2%|Easy|| +|0253|Meeting Rooms II||46.5%|Medium|| +|0254|Factor Combinations||47.2%|Medium|| +|0255|Verify Preorder Sequence in Binary Search Tree||46.0%|Medium|| +|0256|Paint House||53.2%|Medium|| +|0257|Binary Tree Paths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0257.Binary-Tree-Paths)|53.1%|Easy|| +|0258|Add Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0258.Add-Digits)|58.3%|Easy|| +|0259|3Sum Smaller||48.7%|Medium|| +|0260|Single Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0260.Single-Number-III)|65.2%|Medium|| +|0261|Graph Valid Tree||42.9%|Medium|| +|0262|Trips and Users||35.3%|Hard|| +|0263|Ugly Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0263.Ugly-Number)|41.7%|Easy|| +|0264|Ugly Number II||42.7%|Medium|| +|0265|Paint House II||45.4%|Hard|| +|0266|Palindrome Permutation||62.6%|Easy|| +|0267|Palindrome Permutation II||37.2%|Medium|| +|0268|Missing Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0268.Missing-Number)|53.2%|Easy|| +|0269|Alien Dictionary||33.5%|Hard|| +|0270|Closest Binary Search Tree Value||49.6%|Easy|| +|0271|Encode and Decode Strings||32.4%|Medium|| +|0272|Closest Binary Search Tree Value II||51.7%|Hard|| +|0273|Integer to English Words||27.9%|Hard|| +|0274|H-Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0274.H-Index)|36.3%|Medium|| +|0275|H-Index II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0275.H-Index-II)|36.2%|Medium|| +|0276|Paint Fence||38.9%|Easy|| +|0277|Find the Celebrity||43.1%|Medium|| +|0278|First Bad Version||37.1%|Easy|| +|0279|Perfect Squares||48.5%|Medium|| +|0280|Wiggle Sort||64.5%|Medium|| +|0281|Zigzag Iterator||59.2%|Medium|| +|0282|Expression Add Operators||36.5%|Hard|| +|0283|Move Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0283.Move-Zeroes)|58.4%|Easy|| +|0284|Peeking Iterator||47.3%|Medium|| +|0285|Inorder Successor in BST||42.2%|Medium|| +|0286|Walls and Gates||55.9%|Medium|| +|0287|Find the Duplicate Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0287.Find-the-Duplicate-Number)|57.0%|Medium|| +|0288|Unique Word Abbreviation||22.7%|Medium|| +|0289|Game of Life||57.6%|Medium|| +|0290|Word Pattern|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0290.Word-Pattern)|38.2%|Easy|| +|0291|Word Pattern II||44.0%|Hard|| +|0292|Nim Game||54.9%|Easy|| +|0293|Flip Game||61.2%|Easy|| +|0294|Flip Game II||50.5%|Medium|| +|0295|Find Median from Data Stream||46.3%|Hard|| +|0296|Best Meeting Point||58.0%|Hard|| +|0297|Serialize and Deserialize Binary Tree||49.3%|Hard|| +|0298|Binary Tree Longest Consecutive Sequence||47.8%|Medium|| +|0299|Bulls and Cows||44.2%|Medium|| +|0300|Longest Increasing Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0300.Longest-Increasing-Subsequence)|43.5%|Medium|| +|0301|Remove Invalid Parentheses||44.3%|Hard|| +|0302|Smallest Rectangle Enclosing Black Pixels||52.3%|Hard|| +|0303|Range Sum Query - Immutable|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0303.Range-Sum-Query---Immutable)|46.9%|Easy|| +|0304|Range Sum Query 2D - Immutable||40.1%|Medium|| +|0305|Number of Islands II||39.8%|Hard|| +|0306|Additive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0306.Additive-Number)|29.5%|Medium|| +|0307|Range Sum Query - Mutable|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0307.Range-Sum-Query---Mutable)|36.4%|Medium|| +|0308|Range Sum Query 2D - Mutable||37.1%|Hard|| +|0309|Best Time to Buy and Sell Stock with Cooldown|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown)|48.0%|Medium|| +|0310|Minimum Height Trees||34.5%|Medium|| +|0311|Sparse Matrix Multiplication||63.5%|Medium|| +|0312|Burst Balloons||53.6%|Hard|| +|0313|Super Ugly Number||45.9%|Medium|| +|0314|Binary Tree Vertical Order Traversal||46.6%|Medium|| +|0315|Count of Smaller Numbers After Self|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0315.Count-of-Smaller-Numbers-After-Self)|42.5%|Hard|| +|0316|Remove Duplicate Letters||38.8%|Medium|| +|0317|Shortest Distance from All Buildings||42.4%|Hard|| +|0318|Maximum Product of Word Lengths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0318.Maximum-Product-of-Word-Lengths)|52.0%|Medium|| +|0319|Bulb Switcher||45.3%|Medium|| +|0320|Generalized Abbreviation||53.3%|Medium|| +|0321|Create Maximum Number||27.4%|Hard|| +|0322|Coin Change|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0322.Coin-Change)|36.8%|Medium|| +|0323|Number of Connected Components in an Undirected Graph||57.3%|Medium|| +|0324|Wiggle Sort II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0324.Wiggle-Sort-II)|30.5%|Medium|| +|0325|Maximum Size Subarray Sum Equals k||47.2%|Medium|| +|0326|Power of Three|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0326.Power-of-Three)|42.0%|Easy|| +|0327|Count of Range Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0327.Count-of-Range-Sum)|35.9%|Hard|| +|0328|Odd Even Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0328.Odd-Even-Linked-List)|56.8%|Medium|| +|0329|Longest Increasing Path in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0329.Longest-Increasing-Path-in-a-Matrix)|44.3%|Hard|| +|0330|Patching Array||34.9%|Hard|| +|0331|Verify Preorder Serialization of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree)|40.9%|Medium|| +|0332|Reconstruct Itinerary||37.6%|Medium|| +|0333|Largest BST Subtree||37.3%|Medium|| +|0334|Increasing Triplet Subsequence||40.5%|Medium|| +|0335|Self Crossing||28.5%|Hard|| +|0336|Palindrome Pairs||34.4%|Hard|| +|0337|House Robber III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0337.House-Robber-III)|51.7%|Medium|| +|0338|Counting Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0338.Counting-Bits)|70.2%|Medium|| +|0339|Nested List Weight Sum||75.4%|Easy|| +|0340|Longest Substring with At Most K Distinct Characters||45.1%|Medium|| +|0341|Flatten Nested List Iterator||54.1%|Medium|| +|0342|Power of Four|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0342.Power-of-Four)|41.6%|Easy|| +|0343|Integer Break|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0343.Integer-Break)|51.0%|Medium|| +|0344|Reverse String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0344.Reverse-String)|69.9%|Easy|| +|0345|Reverse Vowels of a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0345.Reverse-Vowels-of-a-String)|44.9%|Easy|| +|0346|Moving Average from Data Stream||72.7%|Easy|| +|0347|Top K Frequent Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0347.Top-K-Frequent-Elements)|62.1%|Medium|| +|0348|Design Tic-Tac-Toe||55.3%|Medium|| +|0349|Intersection of Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0349.Intersection-of-Two-Arrays)|64.3%|Easy|| +|0350|Intersection of Two Arrays II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0350.Intersection-of-Two-Arrays-II)|51.9%|Easy|| +|0351|Android Unlock Patterns||49.3%|Medium|| +|0352|Data Stream as Disjoint Intervals||48.4%|Hard|| +|0353|Design Snake Game||35.1%|Medium|| +|0354|Russian Doll Envelopes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0354.Russian-Doll-Envelopes)|36.1%|Hard|| +|0355|Design Twitter||31.0%|Medium|| +|0356|Line Reflection||32.6%|Medium|| +|0357|Count Numbers with Unique Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0357.Count-Numbers-with-Unique-Digits)|48.7%|Medium|| +|0358|Rearrange String k Distance Apart||35.5%|Hard|| +|0359|Logger Rate Limiter||71.8%|Easy|| +|0360|Sort Transformed Array||49.5%|Medium|| +|0361|Bomb Enemy||46.5%|Medium|| +|0362|Design Hit Counter||64.9%|Medium|| +|0363|Max Sum of Rectangle No Larger Than K||38.3%|Hard|| +|0364|Nested List Weight Sum II||63.4%|Medium|| +|0365|Water and Jug Problem||30.9%|Medium|| +|0366|Find Leaves of Binary Tree||71.5%|Medium|| +|0367|Valid Perfect Square|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0367.Valid-Perfect-Square)|42.0%|Easy|| +|0368|Largest Divisible Subset||38.1%|Medium|| +|0369|Plus One Linked List||59.4%|Medium|| +|0370|Range Addition||63.4%|Medium|| +|0371|Sum of Two Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0371.Sum-of-Two-Integers)|50.6%|Medium|| +|0372|Super Pow|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0372.Super-Pow)|36.6%|Medium|| +|0373|Find K Pairs with Smallest Sums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0373.Find-K-Pairs-with-Smallest-Sums)|37.4%|Medium|| +|0374|Guess Number Higher or Lower||44.3%|Easy|| +|0375|Guess Number Higher or Lower II||41.8%|Medium|| +|0376|Wiggle Subsequence||40.1%|Medium|| +|0377|Combination Sum IV||45.8%|Medium|| +|0378|Kth Smallest Element in a Sorted Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0378.Kth-Smallest-Element-in-a-Sorted-Matrix)|55.8%|Medium|| +|0379|Design Phone Directory||47.6%|Medium|| +|0380|Insert Delete GetRandom O(1)||48.5%|Medium|| +|0381|Insert Delete GetRandom O(1) - Duplicates allowed||34.7%|Hard|| +|0382|Linked List Random Node||53.9%|Medium|| +|0383|Ransom Note||53.2%|Easy|| +|0384|Shuffle an Array||53.7%|Medium|| +|0385|Mini Parser|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0385.Mini-Parser)|34.3%|Medium|| +|0386|Lexicographical Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0386.Lexicographical-Numbers)|53.5%|Medium|| +|0387|First Unique Character in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0387.First-Unique-Character-in-a-String)|53.7%|Easy|| +|0388|Longest Absolute File Path||42.4%|Medium|| +|0389|Find the Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0389.Find-the-Difference)|57.6%|Easy|| +|0390|Elimination Game||44.8%|Medium|| +|0391|Perfect Rectangle||31.0%|Hard|| +|0392|Is Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0392.Is-Subsequence)|49.4%|Easy|| +|0393|UTF-8 Validation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0393.UTF-8-Validation)|37.9%|Medium|| +|0394|Decode String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0394.Decode-String)|52.3%|Medium|| +|0395|Longest Substring with At Least K Repeating Characters||43.3%|Medium|| +|0396|Rotate Function||36.6%|Medium|| +|0397|Integer Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0397.Integer-Replacement)|33.3%|Medium|| +|0398|Random Pick Index||57.5%|Medium|| +|0399|Evaluate Division|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0399.Evaluate-Division)|53.9%|Medium|| +|0400|Nth Digit||32.3%|Medium|| +|0401|Binary Watch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0401.Binary-Watch)|48.2%|Easy|| +|0402|Remove K Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0402.Remove-K-Digits)|28.6%|Medium|| +|0403|Frog Jump||41.0%|Hard|| +|0404|Sum of Left Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0404.Sum-of-Left-Leaves)|52.2%|Easy|| +|0405|Convert a Number to Hexadecimal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0405.Convert-a-Number-to-Hexadecimal)|44.3%|Easy|| +|0406|Queue Reconstruction by Height||68.0%|Medium|| +|0407|Trapping Rain Water II||43.7%|Hard|| +|0408|Valid Word Abbreviation||31.2%|Easy|| +|0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.1%|Easy|| +|0410|Split Array Largest Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0410.Split-Array-Largest-Sum)|46.0%|Hard|| +|0411|Minimum Unique Word Abbreviation||36.9%|Hard|| +|0412|Fizz Buzz|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0412.Fizz-Buzz)|63.5%|Easy|| +|0413|Arithmetic Slices||58.4%|Medium|| +|0414|Third Maximum Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0414.Third-Maximum-Number)|30.6%|Easy|| +|0415|Add Strings||48.1%|Easy|| +|0416|Partition Equal Subset Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0416.Partition-Equal-Subset-Sum)|44.7%|Medium|| +|0417|Pacific Atlantic Water Flow||42.2%|Medium|| +|0418|Sentence Screen Fitting||32.9%|Medium|| +|0419|Battleships in a Board||70.8%|Medium|| +|0420|Strong Password Checker||13.8%|Hard|| +|0421|Maximum XOR of Two Numbers in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0421.Maximum-XOR-of-Two-Numbers-in-an-Array)|53.9%|Medium|| +|0422|Valid Word Square||38.0%|Easy|| +|0423|Reconstruct Original Digits from English||47.3%|Medium|| +|0424|Longest Repeating Character Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0424.Longest-Repeating-Character-Replacement)|47.9%|Medium|| +|0425|Word Squares||49.8%|Hard|| +|0426|Convert Binary Search Tree to Sorted Doubly Linked List||60.7%|Medium|| +|0427|Construct Quad Tree||62.3%|Medium|| +|0428|Serialize and Deserialize N-ary Tree||61.0%|Hard|| +|0429|N-ary Tree Level Order Traversal||66.3%|Medium|| +|0430|Flatten a Multilevel Doubly Linked List||56.6%|Medium|| +|0431|Encode N-ary Tree to Binary Tree||74.4%|Hard|| +|0432|All O`one Data Structure||33.0%|Hard|| +|0433|Minimum Genetic Mutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0433.Minimum-Genetic-Mutation)|42.9%|Medium|| +|0434|Number of Segments in a String||37.8%|Easy|| +|0435|Non-overlapping Intervals|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0435.Non-overlapping-Intervals)|43.8%|Medium|| +|0436|Find Right Interval|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0436.Find-Right-Interval)|48.4%|Medium|| +|0437|Path Sum III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0437.Path-Sum-III)|47.9%|Medium|| +|0438|Find All Anagrams in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0438.Find-All-Anagrams-in-a-String)|44.6%|Medium|| +|0439|Ternary Expression Parser||56.5%|Medium|| +|0440|K-th Smallest in Lexicographical Order||29.6%|Hard|| +|0441|Arranging Coins|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0441.Arranging-Coins)|42.3%|Easy|| +|0442|Find All Duplicates in an Array||68.7%|Medium|| +|0443|String Compression||42.9%|Medium|| +|0444|Sequence Reconstruction||23.4%|Medium|| +|0445|Add Two Numbers II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0445.Add-Two-Numbers-II)|56.0%|Medium|| +|0446|Arithmetic Slices II - Subsequence||33.2%|Hard|| +|0447|Number of Boomerangs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0447.Number-of-Boomerangs)|52.3%|Medium|| +|0448|Find All Numbers Disappeared in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array)|56.1%|Easy|| +|0449|Serialize and Deserialize BST||53.7%|Medium|| +|0450|Delete Node in a BST||45.1%|Medium|| +|0451|Sort Characters By Frequency|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0451.Sort-Characters-By-Frequency)|64.1%|Medium|| +|0452|Minimum Number of Arrows to Burst Balloons||49.7%|Medium|| +|0453|Minimum Moves to Equal Array Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0453.Minimum-Moves-to-Equal-Array-Elements)|50.6%|Easy|| +|0454|4Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0454.4Sum-II)|54.5%|Medium|| +|0455|Assign Cookies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0455.Assign-Cookies)|50.3%|Easy|| +|0456|132 Pattern|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0456.132-Pattern)|30.6%|Medium|| +|0457|Circular Array Loop|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0457.Circular-Array-Loop)|29.9%|Medium|| +|0458|Poor Pigs||54.4%|Hard|| +|0459|Repeated Substring Pattern||43.2%|Easy|| +|0460|LFU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0460.LFU-Cache)|35.6%|Hard|| +|0461|Hamming Distance|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0461.Hamming-Distance)|73.1%|Easy|| +|0462|Minimum Moves to Equal Array Elements II||54.3%|Medium|| +|0463|Island Perimeter|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0463.Island-Perimeter)|66.5%|Easy|| +|0464|Can I Win||29.5%|Medium|| +|0465|Optimal Account Balancing||48.0%|Hard|| +|0466|Count The Repetitions||28.6%|Hard|| +|0467|Unique Substrings in Wraparound String||36.0%|Medium|| +|0468|Validate IP Address||24.8%|Medium|| +|0469|Convex Polygon||37.3%|Medium|| +|0470|Implement Rand10() Using Rand7()|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0470.Implement-Rand10()-Using-Rand7())|46.0%|Medium|| +|0471|Encode String with Shortest Length||48.8%|Hard|| +|0472|Concatenated Words||44.7%|Hard|| +|0473|Matchsticks to Square||38.1%|Medium|| +|0474|Ones and Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0474.Ones-and-Zeroes)|43.4%|Medium|| +|0475|Heaters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0475.Heaters)|33.5%|Medium|| +|0476|Number Complement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0476.Number-Complement)|65.1%|Easy|| +|0477|Total Hamming Distance|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0477.Total-Hamming-Distance)|50.6%|Medium|| +|0478|Generate Random Point in a Circle||38.9%|Medium|| +|0479|Largest Palindrome Product||29.4%|Hard|| +|0480|Sliding Window Median|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0480.Sliding-Window-Median)|38.4%|Hard|| +|0481|Magical String||48.0%|Medium|| +|0482|License Key Formatting||43.0%|Easy|| +|0483|Smallest Good Base|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0483.Smallest-Good-Base)|36.2%|Hard|| +|0484|Find Permutation||64.0%|Medium|| +|0485|Max Consecutive Ones|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0485.Max-Consecutive-Ones)|53.3%|Easy|| +|0486|Predict the Winner||48.4%|Medium|| +|0487|Max Consecutive Ones II||47.8%|Medium|| +|0488|Zuma Game||38.7%|Hard|| +|0489|Robot Room Cleaner||72.0%|Hard|| +|0490|The Maze||52.5%|Medium|| +|0491|Increasing Subsequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0491.Increasing-Subsequences)|47.2%|Medium|| +|0492|Construct the Rectangle||50.2%|Easy|| +|0493|Reverse Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0493.Reverse-Pairs)|26.5%|Hard|| +|0494|Target Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0494.Target-Sum)|45.9%|Medium|| +|0495|Teemo Attacking||56.1%|Medium|| +|0496|Next Greater Element I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0496.Next-Greater-Element-I)|65.1%|Easy|| +|0497|Random Point in Non-overlapping Rectangles|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles)|39.1%|Medium|| +|0498|Diagonal Traverse|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0498.Diagonal-Traverse)|50.1%|Medium|| +|0499|The Maze III||42.1%|Hard|| +|0500|Keyboard Row|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0500.Keyboard-Row)|65.4%|Easy|| +|0501|Find Mode in Binary Search Tree||43.2%|Easy|| +|0502|IPO||41.3%|Hard|| +|0503|Next Greater Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0503.Next-Greater-Element-II)|58.1%|Medium|| +|0504|Base 7||46.4%|Easy|| +|0505|The Maze II||48.3%|Medium|| +|0506|Relative Ranks||51.0%|Easy|| +|0507|Perfect Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0507.Perfect-Number)|36.0%|Easy|| +|0508|Most Frequent Subtree Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0508.Most-Frequent-Subtree-Sum)|58.8%|Medium|| +|0509|Fibonacci Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0509.Fibonacci-Number)|67.2%|Easy|| +|0510|Inorder Successor in BST II||59.8%|Medium|| +|0511|Game Play Analysis I||81.3%|Easy|| +|0512|Game Play Analysis II||55.9%|Easy|| +|0513|Find Bottom Left Tree Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0513.Find-Bottom-Left-Tree-Value)|62.3%|Medium|| +|0514|Freedom Trail||44.8%|Hard|| +|0515|Find Largest Value in Each Tree Row|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0515.Find-Largest-Value-in-Each-Tree-Row)|62.0%|Medium|| +|0516|Longest Palindromic Subsequence||54.8%|Medium|| +|0517|Super Washing Machines||38.5%|Hard|| +|0518|Coin Change 2||51.3%|Medium|| +|0519|Random Flip Matrix||37.6%|Medium|| +|0520|Detect Capital||53.8%|Easy|| +|0521|Longest Uncommon Subsequence I||58.4%|Easy|| +|0522|Longest Uncommon Subsequence II||34.1%|Medium|| +|0523|Continuous Subarray Sum||24.7%|Medium|| +|0524|Longest Word in Dictionary through Deleting|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0524.Longest-Word-in-Dictionary-through-Deleting)|48.9%|Medium|| +|0525|Contiguous Array||43.3%|Medium|| +|0526|Beautiful Arrangement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0526.Beautiful-Arrangement)|61.7%|Medium|| +|0527|Word Abbreviation||55.9%|Hard|| +|0528|Random Pick with Weight|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0528.Random-Pick-with-Weight)|44.5%|Medium|| +|0529|Minesweeper|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0529.Minesweeper)|60.6%|Medium|| +|0530|Minimum Absolute Difference in BST||54.6%|Easy|| +|0531|Lonely Pixel I||59.4%|Medium|| +|0532|K-diff Pairs in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0532.K-diff-Pairs-in-an-Array)|34.8%|Medium|| +|0533|Lonely Pixel II||48.0%|Medium|| +|0534|Game Play Analysis III||78.5%|Medium|| +|0535|Encode and Decode TinyURL||80.7%|Medium|| +|0536|Construct Binary Tree from String||50.3%|Medium|| +|0537|Complex Number Multiplication|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0537.Complex-Number-Multiplication)|68.3%|Medium|| +|0538|Convert BST to Greater Tree||56.5%|Medium|| +|0539|Minimum Time Difference||52.1%|Medium|| +|0540|Single Element in a Sorted Array||57.9%|Medium|| +|0541|Reverse String II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0541.Reverse-String-II)|49.0%|Easy|| +|0542|01 Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0542.01-Matrix)|40.5%|Medium|| +|0543|Diameter of Binary Tree||49.0%|Easy|| +|0544|Output Contest Matches||75.7%|Medium|| +|0545|Boundary of Binary Tree||39.4%|Medium|| +|0546|Remove Boxes||44.2%|Hard|| +|0547|Number of Provinces|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0547.Number-of-Provinces)|59.9%|Medium|| +|0548|Split Array with Equal Sum||47.6%|Medium|| +|0549|Binary Tree Longest Consecutive Sequence II||47.2%|Medium|| +|0550|Game Play Analysis IV||46.1%|Medium|| +|0551|Student Attendance Record I||46.0%|Easy|| +|0552|Student Attendance Record II||37.2%|Hard|| +|0553|Optimal Division||57.3%|Medium|| +|0554|Brick Wall||50.5%|Medium|| +|0555|Split Concatenated Strings||42.7%|Medium|| +|0556|Next Greater Element III||33.5%|Medium|| +|0557|Reverse Words in a String III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0557.Reverse-Words-in-a-String-III)|71.5%|Easy|| +|0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.4%|Medium|| +|0559|Maximum Depth of N-ary Tree||69.3%|Easy|| +|0560|Subarray Sum Equals K||43.9%|Medium|| +|0561|Array Partition I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0561.Array-Partition-I)|72.8%|Easy|| +|0562|Longest Line of Consecutive One in Matrix||46.2%|Medium|| +|0563|Binary Tree Tilt|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0563.Binary-Tree-Tilt)|52.6%|Easy|| +|0564|Find the Closest Palindrome||20.2%|Hard|| +|0565|Array Nesting||55.9%|Medium|| +|0566|Reshape the Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0566.Reshape-the-Matrix)|60.9%|Easy|| +|0567|Permutation in String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0567.Permutation-in-String)|44.5%|Medium|| +|0568|Maximum Vacation Days||41.4%|Hard|| +|0569|Median Employee Salary||60.9%|Hard|| +|0570|Managers with at Least 5 Direct Reports||66.6%|Medium|| +|0571|Find Median Given Frequency of Numbers||45.5%|Hard|| +|0572|Subtree of Another Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0572.Subtree-of-Another-Tree)|44.4%|Easy|| +|0573|Squirrel Simulation||56.0%|Medium|| +|0574|Winning Candidate||51.1%|Medium|| +|0575|Distribute Candies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0575.Distribute-Candies)|61.8%|Easy|| +|0576|Out of Boundary Paths||35.7%|Medium|| +|0577|Employee Bonus||70.7%|Easy|| +|0578|Get Highest Answer Rate Question||41.2%|Medium|| +|0579|Find Cumulative Salary of an Employee||38.0%|Hard|| +|0580|Count Student Number in Departments||50.9%|Medium|| +|0581|Shortest Unsorted Continuous Subarray||31.6%|Medium|| +|0582|Kill Process||62.3%|Medium|| +|0583|Delete Operation for Two Strings||49.7%|Medium|| +|0584|Find Customer Referee||73.6%|Easy|| +|0585|Investments in 2016||56.4%|Medium|| +|0586|Customer Placing the Largest Number of Orders||75.0%|Easy|| +|0587|Erect the Fence||36.3%|Hard|| +|0588|Design In-Memory File System||46.5%|Hard|| +|0589|N-ary Tree Preorder Traversal||73.1%|Easy|| +|0590|N-ary Tree Postorder Traversal||73.1%|Easy|| +|0591|Tag Validator||34.6%|Hard|| +|0592|Fraction Addition and Subtraction||50.0%|Medium|| +|0593|Valid Square||43.3%|Medium|| +|0594|Longest Harmonious Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0594.Longest-Harmonious-Subsequence)|47.7%|Easy|| +|0595|Big Countries||78.2%|Easy|| +|0596|Classes More Than 5 Students||38.6%|Easy|| +|0597|Friend Requests I: Overall Acceptance Rate||41.6%|Easy|| +|0598|Range Addition II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0598.Range-Addition-II)|49.9%|Easy|| +|0599|Minimum Index Sum of Two Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0599.Minimum-Index-Sum-of-Two-Lists)|51.5%|Easy|| +|0600|Non-negative Integers without Consecutive Ones||34.5%|Hard|| +|0601|Human Traffic of Stadium||44.2%|Hard|| +|0602|Friend Requests II: Who Has the Most Friends||56.5%|Medium|| +|0603|Consecutive Available Seats||65.6%|Easy|| +|0604|Design Compressed String Iterator||38.0%|Easy|| +|0605|Can Place Flowers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0605.Can-Place-Flowers)|31.9%|Easy|| +|0606|Construct String from Binary Tree||55.0%|Easy|| +|0607|Sales Person||64.6%|Easy|| +|0608|Tree Node||68.9%|Medium|| +|0609|Find Duplicate File in System||60.8%|Medium|| +|0610|Triangle Judgement||67.8%|Easy|| +|0611|Valid Triangle Number||49.0%|Medium|| +|0612|Shortest Distance in a Plane||60.8%|Medium|| +|0613|Shortest Distance in a Line||79.1%|Easy|| +|0614|Second Degree Follower||32.0%|Medium|| +|0615|Average Salary: Departments VS Company||51.2%|Hard|| +|0616|Add Bold Tag in String||44.3%|Medium|| +|0617|Merge Two Binary Trees||75.1%|Easy|| +|0618|Students Report By Geography||58.6%|Hard|| +|0619|Biggest Single Number||44.5%|Easy|| +|0620|Not Boring Movies||69.2%|Easy|| +|0621|Task Scheduler||51.4%|Medium|| +|0622|Design Circular Queue||45.0%|Medium|| +|0623|Add One Row to Tree||50.2%|Medium|| +|0624|Maximum Distance in Arrays||39.4%|Medium|| +|0625|Minimum Factorization||32.9%|Medium|| +|0626|Exchange Seats||64.8%|Medium|| +|0627|Swap Salary||77.1%|Easy|| +|0628|Maximum Product of Three Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0628.Maximum-Product-of-Three-Numbers)|47.0%|Easy|| +|0629|K Inverse Pairs Array||31.6%|Hard|| +|0630|Course Schedule III||33.6%|Hard|| +|0631|Design Excel Sum Formula||32.1%|Hard|| +|0632|Smallest Range Covering Elements from K Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists)|53.8%|Hard|| +|0633|Sum of Square Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0633.Sum-of-Square-Numbers)|32.4%|Medium|| +|0634|Find the Derangement of An Array||40.4%|Medium|| +|0635|Design Log Storage System||59.3%|Medium|| +|0636|Exclusive Time of Functions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0636.Exclusive-Time-of-Functions)|53.8%|Medium|| +|0637|Average of Levels in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0637.Average-of-Levels-in-Binary-Tree)|64.4%|Easy|| +|0638|Shopping Offers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0638.Shopping-Offers)|52.4%|Medium|| +|0639|Decode Ways II||27.4%|Hard|| +|0640|Solve the Equation||42.6%|Medium|| +|0641|Design Circular Deque||54.5%|Medium|| +|0642|Design Search Autocomplete System||45.8%|Hard|| +|0643|Maximum Average Subarray I||42.0%|Easy|| +|0644|Maximum Average Subarray II||33.9%|Hard|| +|0645|Set Mismatch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0645.Set-Mismatch)|42.4%|Easy|| +|0646|Maximum Length of Pair Chain||52.6%|Medium|| +|0647|Palindromic Substrings||61.6%|Medium|| +|0648|Replace Words|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0648.Replace-Words)|58.1%|Medium|| +|0649|Dota2 Senate||39.4%|Medium|| +|0650|2 Keys Keyboard||49.8%|Medium|| +|0651|4 Keys Keyboard||52.9%|Medium|| +|0652|Find Duplicate Subtrees||51.9%|Medium|| +|0653|Two Sum IV - Input is a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0653.Two-Sum-IV---Input-is-a-BST)|56.1%|Easy|| +|0654|Maximum Binary Tree||80.8%|Medium|| +|0655|Print Binary Tree||55.7%|Medium|| +|0656|Coin Path||29.5%|Hard|| +|0657|Robot Return to Origin||73.6%|Easy|| +|0658|Find K Closest Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0658.Find-K-Closest-Elements)|41.7%|Medium|| +|0659|Split Array into Consecutive Subsequences||44.2%|Medium|| +|0660|Remove 9||54.0%|Hard|| +|0661|Image Smoother|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0661.Image-Smoother)|52.1%|Easy|| +|0662|Maximum Width of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0662.Maximum-Width-of-Binary-Tree)|40.0%|Medium|| +|0663|Equal Tree Partition||39.6%|Medium|| +|0664|Strange Printer||41.2%|Hard|| +|0665|Non-decreasing Array||19.6%|Easy|| +|0666|Path Sum IV||55.6%|Medium|| +|0667|Beautiful Arrangement II||54.9%|Medium|| +|0668|Kth Smallest Number in Multiplication Table|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0668.Kth-Smallest-Number-in-Multiplication-Table)|47.6%|Hard|| +|0669|Trim a Binary Search Tree||63.3%|Easy|| +|0670|Maximum Swap||44.8%|Medium|| +|0671|Second Minimum Node In a Binary Tree||42.7%|Easy|| +|0672|Bulb Switcher II||51.0%|Medium|| +|0673|Number of Longest Increasing Subsequence||38.3%|Medium|| +|0674|Longest Continuous Increasing Subsequence||46.0%|Easy|| +|0675|Cut Off Trees for Golf Event||35.1%|Hard|| +|0676|Implement Magic Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0676.Implement-Magic-Dictionary)|55.1%|Medium|| +|0677|Map Sum Pairs||53.9%|Medium|| +|0678|Valid Parenthesis String||31.5%|Medium|| +|0679|24 Game||47.0%|Hard|| +|0680|Valid Palindrome II||37.0%|Easy|| +|0681|Next Closest Time||45.7%|Medium|| +|0682|Baseball Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0682.Baseball-Game)|65.9%|Easy|| +|0683|K Empty Slots||35.9%|Hard|| +|0684|Redundant Connection|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0684.Redundant-Connection)|58.7%|Medium|| +|0685|Redundant Connection II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0685.Redundant-Connection-II)|32.9%|Hard|| +|0686|Repeated String Match||32.7%|Medium|| +|0687|Longest Univalue Path||37.0%|Medium|| +|0688|Knight Probability in Chessboard||49.8%|Medium|| +|0689|Maximum Sum of 3 Non-Overlapping Subarrays||47.1%|Hard|| +|0690|Employee Importance||58.3%|Easy|| +|0691|Stickers to Spell Word||44.1%|Hard|| +|0692|Top K Frequent Words||52.8%|Medium|| +|0693|Binary Number with Alternating Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0693.Binary-Number-with-Alternating-Bits)|59.7%|Easy|| +|0694|Number of Distinct Islands||57.2%|Medium|| +|0695|Max Area of Island|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0695.Max-Area-of-Island)|64.2%|Medium|| +|0696|Count Binary Substrings||57.2%|Easy|| +|0697|Degree of an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0697.Degree-of-an-Array)|54.3%|Easy|| +|0698|Partition to K Equal Sum Subsets||45.5%|Medium|| +|0699|Falling Squares|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0699.Falling-Squares)|42.4%|Hard|| +|0700|Search in a Binary Search Tree||73.3%|Easy|| +|0701|Insert into a Binary Search Tree||75.8%|Medium|| +|0702|Search in a Sorted Array of Unknown Size||68.4%|Medium|| +|0703|Kth Largest Element in a Stream||50.5%|Easy|| +|0704|Binary Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0704.Binary-Search)|53.9%|Easy|| +|0705|Design HashSet|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0705.Design-HashSet)|64.5%|Easy|| +|0706|Design HashMap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0706.Design-HashMap)|62.4%|Easy|| +|0707|Design Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0707.Design-Linked-List)|25.6%|Medium|| +|0708|Insert into a Sorted Circular Linked List||32.3%|Medium|| +|0709|To Lower Case||79.9%|Easy|| +|0710|Random Pick with Blacklist|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0710.Random-Pick-with-Blacklist)|32.7%|Hard|| +|0711|Number of Distinct Islands II||49.0%|Hard|| +|0712|Minimum ASCII Delete Sum for Two Strings||59.2%|Medium|| +|0713|Subarray Product Less Than K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0713.Subarray-Product-Less-Than-K)|40.4%|Medium|| +|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee)|55.8%|Medium|| +|0715|Range Module|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0715.Range-Module)|39.9%|Hard|| +|0716|Max Stack||42.9%|Easy|| +|0717|1-bit and 2-bit Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0717.1-bit-and-2-bit-Characters)|47.6%|Easy|| +|0718|Maximum Length of Repeated Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0718.Maximum-Length-of-Repeated-Subarray)|50.1%|Medium|| +|0719|Find K-th Smallest Pair Distance|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0719.Find-K-th-Smallest-Pair-Distance)|32.4%|Hard|| +|0720|Longest Word in Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0720.Longest-Word-in-Dictionary)|49.0%|Easy|| +|0721|Accounts Merge|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0721.Accounts-Merge)|51.0%|Medium|| +|0722|Remove Comments||35.8%|Medium|| +|0723|Candy Crush||72.2%|Medium|| +|0724|Find Pivot Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0724.Find-Pivot-Index)|45.0%|Easy|| +|0725|Split Linked List in Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0725.Split-Linked-List-in-Parts)|52.7%|Medium|| +|0726|Number of Atoms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0726.Number-of-Atoms)|51.0%|Hard|| +|0727|Minimum Window Subsequence||42.1%|Hard|| +|0728|Self Dividing Numbers||75.2%|Easy|| +|0729|My Calendar I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0729.My-Calendar-I)|53.0%|Medium|| +|0730|Count Different Palindromic Subsequences||43.3%|Hard|| +|0731|My Calendar II||50.1%|Medium|| +|0732|My Calendar III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0732.My-Calendar-III)|61.3%|Hard|| +|0733|Flood Fill|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0733.Flood-Fill)|55.7%|Easy|| +|0734|Sentence Similarity||42.3%|Easy|| +|0735|Asteroid Collision|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0735.Asteroid-Collision)|43.1%|Medium|| +|0736|Parse Lisp Expression||49.8%|Hard|| +|0737|Sentence Similarity II||46.4%|Medium|| +|0738|Monotone Increasing Digits||45.5%|Medium|| +|0739|Daily Temperatures|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0739.Daily-Temperatures)|64.3%|Medium|| +|0740|Delete and Earn||49.2%|Medium|| +|0741|Cherry Pickup||34.9%|Hard|| +|0742|Closest Leaf in a Binary Tree||44.1%|Medium|| +|0743|Network Delay Time||45.3%|Medium|| +|0744|Find Smallest Letter Greater Than Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0744.Find-Smallest-Letter-Greater-Than-Target)|45.6%|Easy|| +|0745|Prefix and Suffix Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0745.Prefix-and-Suffix-Search)|35.0%|Hard|| +|0746|Min Cost Climbing Stairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0746.Min-Cost-Climbing-Stairs)|50.8%|Easy|| +|0747|Largest Number At Least Twice of Others||42.8%|Easy|| +|0748|Shortest Completing Word|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0748.Shortest-Completing-Word)|57.3%|Easy|| +|0749|Contain Virus||47.7%|Hard|| +|0750|Number Of Corner Rectangles||66.6%|Medium|| +|0751|IP to CIDR||60.1%|Medium|| +|0752|Open the Lock||52.5%|Medium|| +|0753|Cracking the Safe|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0753.Cracking-the-Safe)|51.9%|Hard|| +|0754|Reach a Number||40.5%|Medium|| +|0755|Pour Water||44.0%|Medium|| +|0756|Pyramid Transition Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0756.Pyramid-Transition-Matrix)|55.5%|Medium|| +|0757|Set Intersection Size At Least Two||42.0%|Hard|| +|0758|Bold Words in String||47.0%|Easy|| +|0759|Employee Free Time||67.8%|Hard|| +|0760|Find Anagram Mappings||81.6%|Easy|| +|0761|Special Binary String||58.6%|Hard|| +|0762|Prime Number of Set Bits in Binary Representation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation)|64.1%|Easy|| +|0763|Partition Labels|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0763.Partition-Labels)|77.9%|Medium|| +|0764|Largest Plus Sign||46.3%|Medium|| +|0765|Couples Holding Hands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0765.Couples-Holding-Hands)|55.3%|Hard|| +|0766|Toeplitz Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0766.Toeplitz-Matrix)|65.7%|Easy|| +|0767|Reorganize String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0767.Reorganize-String)|49.8%|Medium|| +|0768|Max Chunks To Make Sorted II||49.6%|Hard|| +|0769|Max Chunks To Make Sorted||55.4%|Medium|| +|0770|Basic Calculator IV||54.5%|Hard|| +|0771|Jewels and Stones|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0771.Jewels-and-Stones)|86.8%|Easy|| +|0772|Basic Calculator III||43.0%|Hard|| +|0773|Sliding Puzzle||60.4%|Hard|| +|0774|Minimize Max Distance to Gas Station||48.0%|Hard|| +|0775|Global and Local Inversions||42.4%|Medium|| +|0776|Split BST||56.4%|Medium|| +|0777|Swap Adjacent in LR String||35.4%|Medium|| +|0778|Swim in Rising Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0778.Swim-in-Rising-Water)|54.3%|Hard|| +|0779|K-th Symbol in Grammar||38.4%|Medium|| +|0780|Reaching Points||30.1%|Hard|| +|0781|Rabbits in Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0781.Rabbits-in-Forest)|55.3%|Medium|| +|0782|Transform to Chessboard||46.8%|Hard|| +|0783|Minimum Distance Between BST Nodes||53.6%|Easy|| +|0784|Letter Case Permutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0784.Letter-Case-Permutation)|66.1%|Medium|| +|0785|Is Graph Bipartite?|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0785.Is-Graph-Bipartite?)|48.2%|Medium|| +|0786|K-th Smallest Prime Fraction|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0786.K-th-Smallest-Prime-Fraction)|41.7%|Hard|| +|0787|Cheapest Flights Within K Stops||39.5%|Medium|| +|0788|Rotated Digits||57.2%|Easy|| +|0789|Escape The Ghosts||58.0%|Medium|| +|0790|Domino and Tromino Tiling||39.8%|Medium|| +|0791|Custom Sort String||65.9%|Medium|| +|0792|Number of Matching Subsequences||48.0%|Medium|| +|0793|Preimage Size of Factorial Zeroes Function|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0793.Preimage-Size-of-Factorial-Zeroes-Function)|40.6%|Hard|| +|0794|Valid Tic-Tac-Toe State||33.6%|Medium|| +|0795|Number of Subarrays with Bounded Maximum||47.2%|Medium|| +|0796|Rotate String||49.3%|Easy|| +|0797|All Paths From Source to Target||78.3%|Medium|| +|0798|Smallest Rotation with Highest Score||44.7%|Hard|| +|0799|Champagne Tower||43.9%|Medium|| +|0800|Similar RGB Color||62.1%|Easy|| +|0801|Minimum Swaps To Make Sequences Increasing||39.0%|Medium|| +|0802|Find Eventual Safe States|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0802.Find-Eventual-Safe-States)|49.6%|Medium|| +|0803|Bricks Falling When Hit|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0803.Bricks-Falling-When-Hit)|31.2%|Hard|| +|0804|Unique Morse Code Words||78.8%|Easy|| +|0805|Split Array With Same Average||26.6%|Hard|| +|0806|Number of Lines To Write String||65.4%|Easy|| +|0807|Max Increase to Keep City Skyline||84.2%|Medium|| +|0808|Soup Servings||40.8%|Medium|| +|0809|Expressive Words||46.6%|Medium|| +|0810|Chalkboard XOR Game||49.4%|Hard|| +|0811|Subdomain Visit Count|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0811.Subdomain-Visit-Count)|71.1%|Easy|| +|0812|Largest Triangle Area|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0812.Largest-Triangle-Area)|58.8%|Easy|| +|0813|Largest Sum of Averages||50.8%|Medium|| +|0814|Binary Tree Pruning||73.0%|Medium|| +|0815|Bus Routes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0815.Bus-Routes)|43.2%|Hard|| +|0816|Ambiguous Coordinates||47.8%|Medium|| +|0817|Linked List Components|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0817.Linked-List-Components)|57.5%|Medium|| +|0818|Race Car||39.6%|Hard|| +|0819|Most Common Word|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0819.Most-Common-Word)|45.4%|Easy|| +|0820|Short Encoding of Words||51.3%|Medium|| +|0821|Shortest Distance to a Character||67.7%|Easy|| +|0822|Card Flipping Game||43.5%|Medium|| +|0823|Binary Trees With Factors||36.3%|Medium|| +|0824|Goat Latin||66.3%|Easy|| +|0825|Friends Of Appropriate Ages||43.8%|Medium|| +|0826|Most Profit Assigning Work|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0826.Most-Profit-Assigning-Work)|38.9%|Medium|| +|0827|Making A Large Island||47.0%|Hard|| +|0828|Count Unique Characters of All Substrings of a Given String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String)|46.8%|Hard|| +|0829|Consecutive Numbers Sum||39.3%|Hard|| +|0830|Positions of Large Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0830.Positions-of-Large-Groups)|50.2%|Easy|| +|0831|Masking Personal Information||44.7%|Medium|| +|0832|Flipping an Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0832.Flipping-an-Image)|77.8%|Easy|| +|0833|Find And Replace in String||51.2%|Medium|| +|0834|Sum of Distances in Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0834.Sum-of-Distances-in-Tree)|45.5%|Hard|| +|0835|Image Overlap||61.9%|Medium|| +|0836|Rectangle Overlap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0836.Rectangle-Overlap)|45.3%|Easy|| +|0837|New 21 Game||35.3%|Medium|| +|0838|Push Dominoes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0838.Push-Dominoes)|49.6%|Medium|| +|0839|Similar String Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0839.Similar-String-Groups)|39.9%|Hard|| +|0840|Magic Squares In Grid||37.7%|Medium|| +|0841|Keys and Rooms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0841.Keys-and-Rooms)|65.1%|Medium|| +|0842|Split Array into Fibonacci Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0842.Split-Array-into-Fibonacci-Sequence)|36.6%|Medium|| +|0843|Guess the Word||46.4%|Hard|| +|0844|Backspace String Compare|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0844.Backspace-String-Compare)|46.8%|Easy|| +|0845|Longest Mountain in Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0845.Longest-Mountain-in-Array)|38.4%|Medium|| +|0846|Hand of Straights||55.2%|Medium|| +|0847|Shortest Path Visiting All Nodes||53.2%|Hard|| +|0848|Shifting Letters||45.0%|Medium|| +|0849|Maximize Distance to Closest Person||44.4%|Medium|| +|0850|Rectangle Area II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0850.Rectangle-Area-II)|48.3%|Hard|| +|0851|Loud and Rich|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0851.Loud-and-Rich)|52.4%|Medium|| +|0852|Peak Index in a Mountain Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0852.Peak-Index-in-a-Mountain-Array)|71.8%|Easy|| +|0853|Car Fleet|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0853.Car-Fleet)|43.5%|Medium|| +|0854|K-Similar Strings||38.6%|Hard|| +|0855|Exam Room||43.4%|Medium|| +|0856|Score of Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0856.Score-of-Parentheses)|62.1%|Medium|| +|0857|Minimum Cost to Hire K Workers||50.2%|Hard|| +|0858|Mirror Reflection||59.5%|Medium|| +|0859|Buddy Strings||29.7%|Easy|| +|0860|Lemonade Change||51.9%|Easy|| +|0861|Score After Flipping Matrix||73.4%|Medium|| +|0862|Shortest Subarray with Sum at Least K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K)|25.1%|Hard|| +|0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|57.4%|Medium|| +|0864|Shortest Path to Get All Keys|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0864.Shortest-Path-to-Get-All-Keys)|41.4%|Hard|| +|0865|Smallest Subtree with all the Deepest Nodes||64.6%|Medium|| +|0866|Prime Palindrome||25.1%|Medium|| +|0867|Transpose Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0867.Transpose-Matrix)|62.2%|Easy|| +|0868|Binary Gap||60.8%|Easy|| +|0869|Reordered Power of 2||54.1%|Medium|| +|0870|Advantage Shuffle||46.5%|Medium|| +|0871|Minimum Number of Refueling Stops||32.2%|Hard|| +|0872|Leaf-Similar Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0872.Leaf-Similar-Trees)|64.6%|Easy|| +|0873|Length of Longest Fibonacci Subsequence||48.1%|Medium|| +|0874|Walking Robot Simulation||36.7%|Easy|| +|0875|Koko Eating Bananas|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0875.Koko-Eating-Bananas)|53.3%|Medium|| +|0876|Middle of the Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0876.Middle-of-the-Linked-List)|68.9%|Easy|| +|0877|Stone Game||66.3%|Medium|| +|0878|Nth Magical Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0878.Nth-Magical-Number)|28.9%|Hard|| +|0879|Profitable Schemes||40.1%|Hard|| +|0880|Decoded String at Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0880.Decoded-String-at-Index)|28.3%|Medium|| +|0881|Boats to Save People|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0881.Boats-to-Save-People)|47.6%|Medium|| +|0882|Reachable Nodes In Subdivided Graph||42.2%|Hard|| +|0883|Projection Area of 3D Shapes||68.0%|Easy|| +|0884|Uncommon Words from Two Sentences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0884.Uncommon-Words-from-Two-Sentences)|63.9%|Easy|| +|0885|Spiral Matrix III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0885.Spiral-Matrix-III)|70.4%|Medium|| +|0886|Possible Bipartition||44.9%|Medium|| +|0887|Super Egg Drop|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0887.Super-Egg-Drop)|27.1%|Hard|| +|0888|Fair Candy Swap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0888.Fair-Candy-Swap)|58.7%|Easy|| +|0889|Construct Binary Tree from Preorder and Postorder Traversal||67.3%|Medium|| +|0890|Find and Replace Pattern||74.1%|Medium|| +|0891|Sum of Subsequence Widths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0891.Sum-of-Subsequence-Widths)|32.8%|Hard|| +|0892|Surface Area of 3D Shapes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0892.Surface-Area-of-3D-Shapes)|59.5%|Easy|| +|0893|Groups of Special-Equivalent Strings||68.2%|Easy|| +|0894|All Possible Full Binary Trees||76.9%|Medium|| +|0895|Maximum Frequency Stack|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0895.Maximum-Frequency-Stack)|62.1%|Hard|| +|0896|Monotonic Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0896.Monotonic-Array)|58.0%|Easy|| +|0897|Increasing Order Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0897.Increasing-Order-Search-Tree)|74.3%|Easy|| +|0898|Bitwise ORs of Subarrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0898.Bitwise-ORs-of-Subarrays)|34.0%|Medium|| +|0899|Orderly Queue||52.8%|Hard|| +|0900|RLE Iterator||55.1%|Medium|| +|0901|Online Stock Span|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0901.Online-Stock-Span)|61.1%|Medium|| +|0902|Numbers At Most N Given Digit Set||36.1%|Hard|| +|0903|Valid Permutations for DI Sequence||54.2%|Hard|| +|0904|Fruit Into Baskets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets)|42.8%|Medium|| +|0905|Sort Array By Parity||74.9%|Easy|| +|0906|Super Palindromes||32.9%|Hard|| +|0907|Sum of Subarray Minimums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0907.Sum-of-Subarray-Minimums)|33.2%|Medium|| +|0908|Smallest Range I||66.4%|Easy|| +|0909|Snakes and Ladders||39.0%|Medium|| +|0910|Smallest Range II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0910.Smallest-Range-II)|31.2%|Medium|| +|0911|Online Election|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0911.Online-Election)|51.2%|Medium|| +|0912|Sort an Array||64.4%|Medium|| +|0913|Cat and Mouse||33.8%|Hard|| +|0914|X of a Kind in a Deck of Cards|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0914.X-of-a-Kind-in-a-Deck-of-Cards)|34.4%|Easy|| +|0915|Partition Array into Disjoint Intervals||45.9%|Medium|| +|0916|Word Subsets||48.1%|Medium|| +|0917|Reverse Only Letters||58.6%|Easy|| +|0918|Maximum Sum Circular Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0918.Maximum-Sum-Circular-Subarray)|34.0%|Medium|| +|0919|Complete Binary Tree Inserter||58.5%|Medium|| +|0920|Number of Music Playlists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0920.Number-of-Music-Playlists)|47.7%|Hard|| +|0921|Minimum Add to Make Parentheses Valid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid)|74.6%|Medium|| +|0922|Sort Array By Parity II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0922.Sort-Array-By-Parity-II)|70.2%|Easy|| +|0923|3Sum With Multiplicity|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0923.3Sum-With-Multiplicity)|36.0%|Medium|| +|0924|Minimize Malware Spread|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0924.Minimize-Malware-Spread)|41.9%|Hard|| +|0925|Long Pressed Name|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0925.Long-Pressed-Name)|38.5%|Easy|| +|0926|Flip String to Monotone Increasing||52.9%|Medium|| +|0927|Three Equal Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0927.Three-Equal-Parts)|34.4%|Hard|| +|0928|Minimize Malware Spread II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0928.Minimize-Malware-Spread-II)|41.1%|Hard|| +|0929|Unique Email Addresses||67.2%|Easy|| +|0930|Binary Subarrays With Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0930.Binary-Subarrays-With-Sum)|44.2%|Medium|| +|0931|Minimum Falling Path Sum||63.1%|Medium|| +|0932|Beautiful Array||61.0%|Medium|| +|0933|Number of Recent Calls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0933.Number-of-Recent-Calls)|72.0%|Easy|| +|0934|Shortest Bridge||49.3%|Medium|| +|0935|Knight Dialer||46.1%|Medium|| +|0936|Stamping The Sequence||47.1%|Hard|| +|0937|Reorder Data in Log Files||54.3%|Easy|| +|0938|Range Sum of BST||82.8%|Easy|| +|0939|Minimum Area Rectangle||51.8%|Medium|| +|0940|Distinct Subsequences II||41.6%|Hard|| +|0941|Valid Mountain Array||33.5%|Easy|| +|0942|DI String Match|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0942.DI-String-Match)|73.3%|Easy|| +|0943|Find the Shortest Superstring||43.5%|Hard|| +|0944|Delete Columns to Make Sorted||71.0%|Easy|| +|0945|Minimum Increment to Make Array Unique||46.6%|Medium|| +|0946|Validate Stack Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0946.Validate-Stack-Sequences)|63.3%|Medium|| +|0947|Most Stones Removed with Same Row or Column|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0947.Most-Stones-Removed-with-Same-Row-or-Column)|55.4%|Medium|| +|0948|Bag of Tokens||46.2%|Medium|| +|0949|Largest Time for Given Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0949.Largest-Time-for-Given-Digits)|36.2%|Medium|| +|0950|Reveal Cards In Increasing Order||75.2%|Medium|| +|0951|Flip Equivalent Binary Trees||65.6%|Medium|| +|0952|Largest Component Size by Common Factor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0952.Largest-Component-Size-by-Common-Factor)|36.1%|Hard|| +|0953|Verifying an Alien Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0953.Verifying-an-Alien-Dictionary)|52.6%|Easy|| +|0954|Array of Doubled Pairs||35.3%|Medium|| +|0955|Delete Columns to Make Sorted II||33.6%|Medium|| +|0956|Tallest Billboard||39.8%|Hard|| +|0957|Prison Cells After N Days||40.2%|Medium|| +|0958|Check Completeness of a Binary Tree||52.4%|Medium|| +|0959|Regions Cut By Slashes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0959.Regions-Cut-By-Slashes)|66.8%|Medium|| +|0960|Delete Columns to Make Sorted III||54.3%|Hard|| +|0961|N-Repeated Element in Size 2N Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0961.N-Repeated-Element-in-Size-2N-Array)|74.3%|Easy|| +|0962|Maximum Width Ramp||46.2%|Medium|| +|0963|Minimum Area Rectangle II||51.6%|Medium|| +|0964|Least Operators to Express Number||44.8%|Hard|| +|0965|Univalued Binary Tree||67.7%|Easy|| +|0966|Vowel Spellchecker||47.7%|Medium|| +|0967|Numbers With Same Consecutive Differences||44.4%|Medium|| +|0968|Binary Tree Cameras|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0968.Binary-Tree-Cameras)|38.4%|Hard|| +|0969|Pancake Sorting|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0969.Pancake-Sorting)|68.5%|Medium|| +|0970|Powerful Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0970.Powerful-Integers)|39.9%|Easy|| +|0971|Flip Binary Tree To Match Preorder Traversal||46.1%|Medium|| +|0972|Equal Rational Numbers||41.9%|Hard|| +|0973|K Closest Points to Origin|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0973.K-Closest-Points-to-Origin)|64.4%|Medium|| +|0974|Subarray Sums Divisible by K||50.4%|Medium|| +|0975|Odd Even Jump||41.5%|Hard|| +|0976|Largest Perimeter Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0976.Largest-Perimeter-Triangle)|58.5%|Easy|| +|0977|Squares of a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0977.Squares-of-a-Sorted-Array)|72.3%|Easy|| +|0978|Longest Turbulent Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0978.Longest-Turbulent-Subarray)|46.6%|Medium|| +|0979|Distribute Coins in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0979.Distribute-Coins-in-Binary-Tree)|69.4%|Medium|| +|0980|Unique Paths III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0980.Unique-Paths-III)|77.1%|Hard|| +|0981|Time Based Key-Value Store|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0981.Time-Based-Key-Value-Store)|53.9%|Medium|| +|0982|Triples with Bitwise AND Equal To Zero||56.1%|Hard|| +|0983|Minimum Cost For Tickets||62.6%|Medium|| +|0984|String Without AAA or BBB|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0984.String-Without-AAA-or-BBB)|38.4%|Medium|| +|0985|Sum of Even Numbers After Queries|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0985.Sum-of-Even-Numbers-After-Queries)|60.7%|Easy|| +|0986|Interval List Intersections|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0986.Interval-List-Intersections)|68.0%|Medium|| +|0987|Vertical Order Traversal of a Binary Tree||37.5%|Medium|| +|0988|Smallest String Starting From Leaf||46.6%|Medium|| +|0989|Add to Array-Form of Integer||44.7%|Easy|| +|0990|Satisfiability of Equality Equations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0990.Satisfiability-of-Equality-Equations)|46.4%|Medium|| +|0991|Broken Calculator||46.3%|Medium|| +|0992|Subarrays with K Different Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0992.Subarrays-with-K-Different-Integers)|50.3%|Hard|| +|0993|Cousins in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0993.Cousins-in-Binary-Tree)|52.2%|Easy|| +|0994|Rotting Oranges||49.5%|Medium|| +|0995|Minimum Number of K Consecutive Bit Flips|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0995.Minimum-Number-of-K-Consecutive-Bit-Flips)|49.5%|Hard|| +|0996|Number of Squareful Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0996.Number-of-Squareful-Arrays)|47.9%|Hard|| +|0997|Find the Town Judge||49.8%|Easy|| +|0998|Maximum Binary Tree II||63.6%|Medium|| +|0999|Available Captures for Rook|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0999.Available-Captures-for-Rook)|66.7%|Easy|| +|1000|Minimum Cost to Merge Stones||40.4%|Hard|| +|1001|Grid Illumination||36.5%|Hard|| +|1002|Find Common Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1002.Find-Common-Characters)|68.0%|Easy|| +|1003|Check If Word Is Valid After Substitutions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions)|55.9%|Medium|| +|1004|Max Consecutive Ones III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1004.Max-Consecutive-Ones-III)|60.5%|Medium|| +|1005|Maximize Sum Of Array After K Negations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations)|52.3%|Easy|| +|1006|Clumsy Factorial||53.7%|Medium|| +|1007|Minimum Domino Rotations For Equal Row||50.9%|Medium|| +|1008|Construct Binary Search Tree from Preorder Traversal||78.7%|Medium|| +|1009|Complement of Base 10 Integer||61.5%|Easy|| +|1010|Pairs of Songs With Total Durations Divisible by 60||49.6%|Medium|| +|1011|Capacity To Ship Packages Within D Days|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1011.Capacity-To-Ship-Packages-Within-D-Days)|59.5%|Medium|| +|1012|Numbers With Repeated Digits||37.6%|Hard|| +|1013|Partition Array Into Three Parts With Equal Sum||49.5%|Easy|| +|1014|Best Sightseeing Pair||52.8%|Medium|| +|1015|Smallest Integer Divisible by K||41.8%|Medium|| +|1016|Binary String With Substrings Representing 1 To N||59.1%|Medium|| +|1017|Convert to Base -2|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1017.Convert-to-Base--2)|59.5%|Medium|| +|1018|Binary Prefix Divisible By 5||47.8%|Easy|| +|1019|Next Greater Node In Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1019.Next-Greater-Node-In-Linked-List)|58.2%|Medium|| +|1020|Number of Enclaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1020.Number-of-Enclaves)|58.7%|Medium|| +|1021|Remove Outermost Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1021.Remove-Outermost-Parentheses)|78.6%|Easy|| +|1022|Sum of Root To Leaf Binary Numbers||71.4%|Easy|| +|1023|Camelcase Matching||57.3%|Medium|| +|1024|Video Stitching||49.2%|Medium|| +|1025|Divisor Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1025.Divisor-Game)|66.1%|Easy|| +|1026|Maximum Difference Between Node and Ancestor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor)|69.0%|Medium|| +|1027|Longest Arithmetic Subsequence||49.9%|Medium|| +|1028|Recover a Tree From Preorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1028.Recover-a-Tree-From-Preorder-Traversal)|70.7%|Hard|| +|1029|Two City Scheduling||57.5%|Medium|| +|1030|Matrix Cells in Distance Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1030.Matrix-Cells-in-Distance-Order)|66.8%|Easy|| +|1031|Maximum Sum of Two Non-Overlapping Subarrays||58.8%|Medium|| +|1032|Stream of Characters||48.6%|Hard|| +|1033|Moving Stones Until Consecutive||42.9%|Easy|| +|1034|Coloring A Border||45.4%|Medium|| +|1035|Uncrossed Lines||56.0%|Medium|| +|1036|Escape a Large Maze||34.9%|Hard|| +|1037|Valid Boomerang|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1037.Valid-Boomerang)|37.8%|Easy|| +|1038|Binary Search Tree to Greater Sum Tree||82.0%|Medium|| +|1039|Minimum Score Triangulation of Polygon||50.0%|Medium|| +|1040|Moving Stones Until Consecutive II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1040.Moving-Stones-Until-Consecutive-II)|53.8%|Medium|| +|1041|Robot Bounded In Circle||54.6%|Medium|| +|1042|Flower Planting With No Adjacent||48.6%|Medium|| +|1043|Partition Array for Maximum Sum||66.7%|Medium|| +|1044|Longest Duplicate Substring||31.6%|Hard|| +|1045|Customers Who Bought All Products||68.2%|Medium|| +|1046|Last Stone Weight||62.4%|Easy|| +|1047|Remove All Adjacent Duplicates In String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String)|70.2%|Easy|| +|1048|Longest String Chain||55.2%|Medium|| +|1049|Last Stone Weight II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II)|44.8%|Medium|| +|1050|Actors and Directors Who Cooperated At Least Three Times||72.1%|Easy|| +|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.8%|Easy|| +|1052|Grumpy Bookstore Owner|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1052.Grumpy-Bookstore-Owner)|55.7%|Medium|| +|1053|Previous Permutation With One Swap||50.7%|Medium|| +|1054|Distant Barcodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1054.Distant-Barcodes)|44.1%|Medium|| +|1055|Shortest Way to Form String||57.1%|Medium|| +|1056|Confusing Number||47.2%|Easy|| +|1057|Campus Bikes||57.6%|Medium|| +|1058|Minimize Rounding Error to Meet Target||43.1%|Medium|| +|1059|All Paths from Source Lead to Destination||43.3%|Medium|| +|1060|Missing Element in Sorted Array||54.7%|Medium|| +|1061|Lexicographically Smallest Equivalent String||66.5%|Medium|| +|1062|Longest Repeating Substring||57.9%|Medium|| +|1063|Number of Valid Subarrays||72.1%|Hard|| +|1064|Fixed Point||65.5%|Easy|| +|1065|Index Pairs of a String||60.9%|Easy|| +|1066|Campus Bikes II||54.0%|Medium|| +|1067|Digit Count in Range||41.2%|Hard|| +|1068|Product Sales Analysis I||82.4%|Easy|| +|1069|Product Sales Analysis II||83.2%|Easy|| +|1070|Product Sales Analysis III||49.6%|Medium|| +|1071|Greatest Common Divisor of Strings||51.4%|Easy|| +|1072|Flip Columns For Maximum Number of Equal Rows||61.2%|Medium|| +|1073|Adding Two Negabinary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1073.Adding-Two-Negabinary-Numbers)|34.7%|Medium|| +|1074|Number of Submatrices That Sum to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1074.Number-of-Submatrices-That-Sum-to-Target)|61.4%|Hard|| +|1075|Project Employees I||66.0%|Easy|| +|1076|Project Employees II||53.3%|Easy|| +|1077|Project Employees III||77.2%|Medium|| +|1078|Occurrences After Bigram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1078.Occurrences-After-Bigram)|64.9%|Easy|| +|1079|Letter Tile Possibilities|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1079.Letter-Tile-Possibilities)|75.8%|Medium|| +|1080|Insufficient Nodes in Root to Leaf Paths||49.7%|Medium|| +|1081|Smallest Subsequence of Distinct Characters||53.4%|Medium|| +|1082|Sales Analysis I||73.2%|Easy|| +|1083|Sales Analysis II||50.7%|Easy|| +|1084|Sales Analysis III||54.7%|Easy|| +|1085|Sum of Digits in the Minimum Number||75.0%|Easy|| +|1086|High Five||78.9%|Easy|| +|1087|Brace Expansion||63.1%|Medium|| +|1088|Confusing Number II||45.1%|Hard|| +|1089|Duplicate Zeros|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1089.Duplicate-Zeros)|52.0%|Easy|| +|1090|Largest Values From Labels||60.0%|Medium|| +|1091|Shortest Path in Binary Matrix||39.0%|Medium|| +|1092|Shortest Common Supersequence ||52.7%|Hard|| +|1093|Statistics from a Large Sample|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1093.Statistics-from-a-Large-Sample)|49.3%|Medium|| +|1094|Car Pooling||59.0%|Medium|| +|1095|Find in Mountain Array||35.9%|Hard|| +|1096|Brace Expansion II||62.4%|Hard|| +|1097|Game Play Analysis V||56.3%|Hard|| +|1098|Unpopular Books||45.5%|Medium|| +|1099|Two Sum Less Than K||60.8%|Easy|| +|1100|Find K-Length Substrings With No Repeated Characters||73.3%|Medium|| +|1101|The Earliest Moment When Everyone Become Friends||67.4%|Medium|| +|1102|Path With Maximum Minimum Value||50.1%|Medium|| +|1103|Distribute Candies to People||63.6%|Easy|| +|1104|Path In Zigzag Labelled Binary Tree||72.9%|Medium|| +|1105|Filling Bookcase Shelves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1105.Filling-Bookcase-Shelves)|57.8%|Medium|| +|1106|Parsing A Boolean Expression||59.0%|Hard|| +|1107|New Users Daily Count||45.7%|Medium|| +|1108|Defanging an IP Address|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1108.Defanging-an-IP-Address)|88.5%|Easy|| +|1109|Corporate Flight Bookings||54.1%|Medium|| +|1110|Delete Nodes And Return Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1110.Delete-Nodes-And-Return-Forest)|67.5%|Medium|| +|1111|Maximum Nesting Depth of Two Valid Parentheses Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings)|72.4%|Medium|| +|1112|Highest Grade For Each Student||71.7%|Medium|| +|1113|Reported Posts||65.3%|Easy|| +|1114|Print in Order||66.9%|Easy|| +|1115|Print FooBar Alternately||59.1%|Medium|| +|1116|Print Zero Even Odd||57.5%|Medium|| +|1117|Building H2O||53.2%|Medium|| +|1118|Number of Days in a Month||57.4%|Easy|| +|1119|Remove Vowels from a String||90.4%|Easy|| +|1120|Maximum Average Subtree||63.6%|Medium|| +|1121|Divide Array Into Increasing Sequences||57.9%|Hard|| +|1122|Relative Sort Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1122.Relative-Sort-Array)|67.7%|Easy|| +|1123|Lowest Common Ancestor of Deepest Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves)|67.8%|Medium|| +|1124|Longest Well-Performing Interval||33.2%|Medium|| +|1125|Smallest Sufficient Team||46.9%|Hard|| +|1126|Active Businesses||68.6%|Medium|| +|1127|User Purchase Platform||50.3%|Hard|| +|1128|Number of Equivalent Domino Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1128.Number-of-Equivalent-Domino-Pairs)|46.6%|Easy|| +|1129|Shortest Path with Alternating Colors||40.0%|Medium|| +|1130|Minimum Cost Tree From Leaf Values||67.1%|Medium|| +|1131|Maximum of Absolute Value Expression||52.2%|Medium|| +|1132|Reported Posts II||34.5%|Medium|| +|1133|Largest Unique Number||67.1%|Easy|| +|1134|Armstrong Number||78.2%|Easy|| +|1135|Connecting Cities With Minimum Cost||59.0%|Medium|| +|1136|Parallel Courses||61.2%|Hard|| +|1137|N-th Tribonacci Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1137.N-th-Tribonacci-Number)|56.1%|Easy|| +|1138|Alphabet Board Path||50.4%|Medium|| +|1139|Largest 1-Bordered Square||48.3%|Medium|| +|1140|Stone Game II||64.8%|Medium|| +|1141|User Activity for the Past 30 Days I||54.4%|Easy|| +|1142|User Activity for the Past 30 Days II||35.2%|Easy|| +|1143|Longest Common Subsequence||58.6%|Medium|| +|1144|Decrease Elements To Make Array Zigzag||45.9%|Medium|| +|1145|Binary Tree Coloring Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1145.Binary-Tree-Coloring-Game)|51.4%|Medium|| +|1146|Snapshot Array||36.8%|Medium|| +|1147|Longest Chunked Palindrome Decomposition||59.3%|Hard|| +|1148|Article Views I||76.9%|Easy|| +|1149|Article Views II||48.4%|Medium|| +|1150|Check If a Number Is Majority Element in a Sorted Array||58.0%|Easy|| +|1151|Minimum Swaps to Group All 1's Together||58.4%|Medium|| +|1152|Analyze User Website Visit Pattern||43.3%|Medium|| +|1153|String Transforms Into Another String||36.0%|Hard|| +|1154|Day of the Year|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1154.Day-of-the-Year)|49.3%|Easy|| +|1155|Number of Dice Rolls With Target Sum||47.5%|Medium|| +|1156|Swap For Longest Repeated Character Substring||47.5%|Medium|| +|1157|Online Majority Element In Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1157.Online-Majority-Element-In-Subarray)|39.4%|Hard|| +|1158|Market Analysis I||63.4%|Medium|| +|1159|Market Analysis II||55.3%|Hard|| +|1160|Find Words That Can Be Formed by Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters)|67.4%|Easy|| +|1161|Maximum Level Sum of a Binary Tree||70.2%|Medium|| +|1162|As Far from Land as Possible||44.8%|Medium|| +|1163|Last Substring in Lexicographical Order||36.3%|Hard|| +|1164|Product Price at a Given Date||68.0%|Medium|| +|1165|Single-Row Keyboard||84.7%|Easy|| +|1166|Design File System||58.0%|Medium|| +|1167|Minimum Cost to Connect Sticks||64.0%|Medium|| +|1168|Optimize Water Distribution in a Village||62.2%|Hard|| +|1169|Invalid Transactions||31.6%|Medium|| +|1170|Compare Strings by Frequency of the Smallest Character|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character)|59.5%|Easy|| +|1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List)|41.4%|Medium|| +|1172|Dinner Plate Stacks||37.8%|Hard|| +|1173|Immediate Food Delivery I||82.3%|Easy|| +|1174|Immediate Food Delivery II||60.8%|Medium|| +|1175|Prime Arrangements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1175.Prime-Arrangements)|51.8%|Easy|| +|1176|Diet Plan Performance||53.9%|Easy|| +|1177|Can Make Palindrome from Substring||36.0%|Medium|| +|1178|Number of Valid Words for Each Puzzle||38.6%|Hard|| +|1179|Reformat Department Table||82.0%|Easy|| +|1180|Count Substrings with Only One Distinct Letter||77.5%|Easy|| +|1181|Before and After Puzzle||44.5%|Medium|| +|1182|Shortest Distance to Target Color||53.4%|Medium|| +|1183|Maximum Number of Ones||56.5%|Hard|| +|1184|Distance Between Bus Stops|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1184.Distance-Between-Bus-Stops)|54.2%|Easy|| +|1185|Day of the Week|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week)|62.1%|Easy|| +|1186|Maximum Subarray Sum with One Deletion||38.4%|Medium|| +|1187|Make Array Strictly Increasing||41.6%|Hard|| +|1188|Design Bounded Blocking Queue||72.6%|Medium|| +|1189|Maximum Number of Balloons|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1189.Maximum-Number-of-Balloons)|61.8%|Easy|| +|1190|Reverse Substrings Between Each Pair of Parentheses||64.0%|Medium|| +|1191|K-Concatenation Maximum Sum||25.4%|Medium|| +|1192|Critical Connections in a Network||49.7%|Hard|| +|1193|Monthly Transactions I||69.2%|Medium|| +|1194|Tournament Winners||52.1%|Hard|| +|1195|Fizz Buzz Multithreaded||70.3%|Medium|| +|1196|How Many Apples Can You Put into the Basket||68.1%|Easy|| +|1197|Minimum Knight Moves||37.0%|Medium|| +|1198|Find Smallest Common Element in All Rows||75.2%|Medium|| +|1199|Minimum Time to Build Blocks||38.4%|Hard|| +|1200|Minimum Absolute Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1200.Minimum-Absolute-Difference)|66.8%|Easy|| +|1201|Ugly Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1201.Ugly-Number-III)|26.4%|Medium|| +|1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|47.9%|Medium|| +|1203|Sort Items by Groups Respecting Dependencies||48.8%|Hard|| +|1204|Last Person to Fit in the Elevator||71.4%|Medium|| +|1205|Monthly Transactions II||46.3%|Medium|| +|1206|Design Skiplist||58.6%|Hard|| +|1207|Unique Number of Occurrences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1207.Unique-Number-of-Occurrences)|71.6%|Easy|| +|1208|Get Equal Substrings Within Budget|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1208.Get-Equal-Substrings-Within-Budget)|43.6%|Medium|| +|1209|Remove All Adjacent Duplicates in String II||57.4%|Medium|| +|1210|Minimum Moves to Reach Target with Rotations||46.1%|Hard|| +|1211|Queries Quality and Percentage||69.9%|Easy|| +|1212|Team Scores in Football Tournament||56.8%|Medium|| +|1213|Intersection of Three Sorted Arrays||79.2%|Easy|| +|1214|Two Sum BSTs||67.8%|Medium|| +|1215|Stepping Numbers||43.0%|Medium|| +|1216|Valid Palindrome III||49.4%|Hard|| +|1217|Minimum Cost to Move Chips to The Same Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position)|71.3%|Easy|| +|1218|Longest Arithmetic Subsequence of Given Difference||46.4%|Medium|| +|1219|Path with Maximum Gold||65.5%|Medium|| +|1220|Count Vowels Permutation||54.1%|Hard|| +|1221|Split a String in Balanced Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1221.Split-a-String-in-Balanced-Strings)|84.0%|Easy|| +|1222|Queens That Can Attack the King||69.2%|Medium|| +|1223|Dice Roll Simulation||46.6%|Medium|| +|1224|Maximum Equal Frequency||34.4%|Hard|| +|1225|Report Contiguous Dates||62.3%|Hard|| +|1226|The Dining Philosophers||58.9%|Medium|| +|1227|Airplane Seat Assignment Probability||61.9%|Medium|| +|1228|Missing Number In Arithmetic Progression||51.8%|Easy|| +|1229|Meeting Scheduler||54.1%|Medium|| +|1230|Toss Strange Coins||49.8%|Medium|| +|1231|Divide Chocolate||53.4%|Hard|| +|1232|Check If It Is a Straight Line|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1232.Check-If-It-Is-a-Straight-Line)|43.9%|Easy|| +|1233|Remove Sub-Folders from the Filesystem||61.6%|Medium|| +|1234|Replace the Substring for Balanced String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1234.Replace-the-Substring-for-Balanced-String)|34.3%|Medium|| +|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|46.6%|Hard|| +|1236|Web Crawler||64.5%|Medium|| +|1237|Find Positive Integer Solution for a Given Equation||69.8%|Easy|| +|1238|Circular Permutation in Binary Representation||65.8%|Medium|| +|1239|Maximum Length of a Concatenated String with Unique Characters||49.2%|Medium|| +|1240|Tiling a Rectangle with the Fewest Squares||52.4%|Hard|| +|1241|Number of Comments per Post||67.5%|Easy|| +|1242|Web Crawler Multithreaded||47.7%|Medium|| +|1243|Array Transformation||50.4%|Easy|| +|1244|Design A Leaderboard||65.7%|Medium|| +|1245|Tree Diameter||61.1%|Medium|| +|1246|Palindrome Removal||45.8%|Hard|| +|1247|Minimum Swaps to Make Strings Equal||62.3%|Medium|| +|1248|Count Number of Nice Subarrays||56.5%|Medium|| +|1249|Minimum Remove to Make Valid Parentheses||63.4%|Medium|| +|1250|Check If It Is a Good Array||56.3%|Hard|| +|1251|Average Selling Price||82.5%|Easy|| +|1252|Cells with Odd Values in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix)|78.4%|Easy|| +|1253|Reconstruct a 2-Row Binary Matrix||41.3%|Medium|| +|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|61.5%|Medium|| +|1255|Maximum Score Words Formed by Letters||69.9%|Hard|| +|1256|Encode Number||67.3%|Medium|| +|1257|Smallest Common Region||60.2%|Medium|| +|1258|Synonymous Sentences||67.0%|Medium|| +|1259|Handshakes That Don't Cross||54.1%|Hard|| +|1260|Shift 2D Grid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1260.Shift-2D-Grid)|61.7%|Easy|| +|1261|Find Elements in a Contaminated Binary Tree||74.5%|Medium|| +|1262|Greatest Sum Divisible by Three||49.2%|Medium|| +|1263|Minimum Moves to Move a Box to Their Target Location||42.7%|Hard|| +|1264|Page Recommendations||69.0%|Medium|| +|1265|Print Immutable Linked List in Reverse||94.4%|Medium|| +|1266|Minimum Time Visiting All Points|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1266.Minimum-Time-Visiting-All-Points)|79.3%|Easy|| +|1267|Count Servers that Communicate||57.8%|Medium|| +|1268|Search Suggestions System||64.4%|Medium|| +|1269|Number of Ways to Stay in the Same Place After Some Steps||43.2%|Hard|| +|1270|All People Report to the Given Manager||88.4%|Medium|| +|1271|Hexspeak||55.1%|Easy|| +|1272|Remove Interval||57.8%|Medium|| +|1273|Delete Tree Nodes||62.8%|Medium|| +|1274|Number of Ships in a Rectangle||66.0%|Hard|| +|1275|Find Winner on a Tic Tac Toe Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game)|53.1%|Easy|| +|1276|Number of Burgers with No Waste of Ingredients||49.9%|Medium|| +|1277|Count Square Submatrices with All Ones||72.9%|Medium|| +|1278|Palindrome Partitioning III||60.5%|Hard|| +|1279|Traffic Light Controlled Intersection||75.8%|Easy|| +|1280|Students and Examinations||74.2%|Easy|| +|1281|Subtract the Product and Sum of Digits of an Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer)|85.6%|Easy|| +|1282|Group the People Given the Group Size They Belong To||84.3%|Medium|| +|1283|Find the Smallest Divisor Given a Threshold|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold)|49.1%|Medium|| +|1284|Minimum Number of Flips to Convert Binary Matrix to Zero Matrix||70.0%|Hard|| +|1285|Find the Start and End Number of Continuous Ranges||86.5%|Medium|| +|1286|Iterator for Combination||70.9%|Medium|| +|1287|Element Appearing More Than 25% In Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1287.Element-Appearing-More-Than-25%-In-Sorted-Array)|60.2%|Easy|| +|1288|Remove Covered Intervals||57.2%|Medium|| +|1289|Minimum Falling Path Sum II||62.2%|Hard|| +|1290|Convert Binary Number in a Linked List to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer)|81.7%|Easy|| +|1291|Sequential Digits||57.4%|Medium|| +|1292|Maximum Side Length of a Square with Sum Less than or Equal to Threshold||50.4%|Medium|| +|1293|Shortest Path in a Grid with Obstacles Elimination||42.8%|Hard|| +|1294|Weather Type in Each Country||66.0%|Easy|| +|1295|Find Numbers with Even Number of Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits)|79.4%|Easy|| +|1296|Divide Array in Sets of K Consecutive Numbers||55.2%|Medium|| +|1297|Maximum Number of Occurrences of a Substring||49.2%|Medium|| +|1298|Maximum Candies You Can Get from Boxes||59.6%|Hard|| +|1299|Replace Elements with Greatest Element on Right Side|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side)|74.2%|Easy|| +|1300|Sum of Mutated Array Closest to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target)|43.3%|Medium|| +|1301|Number of Paths with Max Score||38.0%|Hard|| +|1302|Deepest Leaves Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1302.Deepest-Leaves-Sum)|84.0%|Medium|| +|1303|Find the Team Size||89.4%|Easy|| +|1304|Find N Unique Integers Sum up to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero)|76.5%|Easy|| +|1305|All Elements in Two Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1305.All-Elements-in-Two-Binary-Search-Trees)|77.8%|Medium|| +|1306|Jump Game III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1306.Jump-Game-III)|62.6%|Medium|| +|1307|Verbal Arithmetic Puzzle||37.2%|Hard|| +|1308|Running Total for Different Genders||87.0%|Medium|| +|1309|Decrypt String from Alphabet to Integer Mapping||77.2%|Easy|| +|1310|XOR Queries of a Subarray||69.2%|Medium|| +|1311|Get Watched Videos by Your Friends||44.0%|Medium|| +|1312|Minimum Insertion Steps to Make a String Palindrome||59.1%|Hard|| +|1313|Decompress Run-Length Encoded List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1313.Decompress-Run-Length-Encoded-List)|85.3%|Easy|| +|1314|Matrix Block Sum||73.6%|Medium|| +|1315|Sum of Nodes with Even-Valued Grandparent||84.1%|Medium|| +|1316|Distinct Echo Substrings||49.6%|Hard|| +|1317|Convert Integer to the Sum of Two No-Zero Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers)|56.8%|Easy|| +|1318|Minimum Flips to Make a OR b Equal to c||63.7%|Medium|| +|1319|Number of Operations to Make Network Connected||54.7%|Medium|| +|1320|Minimum Distance to Type a Word Using Two Fingers||62.7%|Hard|| +|1321|Restaurant Growth||70.3%|Medium|| +|1322|Ads Performance||57.9%|Easy|| +|1323|Maximum 69 Number||77.9%|Easy|| +|1324|Print Words Vertically||58.6%|Medium|| +|1325|Delete Leaves With a Given Value||73.4%|Medium|| +|1326|Minimum Number of Taps to Open to Water a Garden||46.1%|Hard|| +|1327|List the Products Ordered in a Period||77.4%|Easy|| +|1328|Break a Palindrome||45.4%|Medium|| +|1329|Sort the Matrix Diagonally||79.3%|Medium|| +|1330|Reverse Subarray To Maximize Array Value||36.4%|Hard|| +|1331|Rank Transform of an Array||57.7%|Easy|| +|1332|Remove Palindromic Subsequences||62.8%|Easy|| +|1333|Filter Restaurants by Vegan-Friendly, Price and Distance||57.0%|Medium|| +|1334|Find the City With the Smallest Number of Neighbors at a Threshold Distance||46.5%|Medium|| +|1335|Minimum Difficulty of a Job Schedule||57.1%|Hard|| +|1336|Number of Transactions per Visit||47.3%|Hard|| +|1337|The K Weakest Rows in a Matrix||69.6%|Easy|| +|1338|Reduce Array Size to The Half||66.6%|Medium|| +|1339|Maximum Product of Splitted Binary Tree||37.8%|Medium|| +|1340|Jump Game V||58.9%|Hard|| +|1341|Movie Rating||58.3%|Medium|| +|1342|Number of Steps to Reduce a Number to Zero||85.7%|Easy|| +|1343|Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold||64.5%|Medium|| +|1344|Angle Between Hands of a Clock||61.3%|Medium|| +|1345|Jump Game IV||41.9%|Hard|| +|1346|Check If N and Its Double Exist||36.5%|Easy|| +|1347|Minimum Number of Steps to Make Two Strings Anagram||75.3%|Medium|| +|1348|Tweet Counts Per Frequency||33.5%|Medium|| +|1349|Maximum Students Taking Exam||44.0%|Hard|| +|1350|Students With Invalid Departments||90.5%|Easy|| +|1351|Count Negative Numbers in a Sorted Matrix||75.8%|Easy|| +|1352|Product of the Last K Numbers||43.6%|Medium|| +|1353|Maximum Number of Events That Can Be Attended||30.1%|Medium|| +|1354|Construct Target Array With Multiple Sums||31.4%|Hard|| +|1355|Activity Participants||73.8%|Medium|| +|1356|Sort Integers by The Number of 1 Bits||69.5%|Easy|| +|1357|Apply Discount Every n Orders||66.7%|Medium|| +|1358|Number of Substrings Containing All Three Characters||60.3%|Medium|| +|1359|Count All Valid Pickup and Delivery Options||56.9%|Hard|| +|1360|Number of Days Between Two Dates||47.1%|Easy|| +|1361|Validate Binary Tree Nodes||44.3%|Medium|| +|1362|Closest Divisors||57.5%|Medium|| +|1363|Largest Multiple of Three||34.0%|Hard|| +|1364|Number of Trusted Contacts of a Customer||77.8%|Medium|| +|1365|How Many Numbers Are Smaller Than the Current Number||85.9%|Easy|| +|1366|Rank Teams by Votes||54.9%|Medium|| +|1367|Linked List in Binary Tree||41.1%|Medium|| +|1368|Minimum Cost to Make at Least One Valid Path in a Grid||56.7%|Hard|| +|1369|Get the Second Most Recent Activity||68.4%|Hard|| +|1370|Increasing Decreasing String||76.3%|Easy|| +|1371|Find the Longest Substring Containing Vowels in Even Counts||61.4%|Medium|| +|1372|Longest ZigZag Path in a Binary Tree||54.5%|Medium|| +|1373|Maximum Sum BST in Binary Tree||37.7%|Hard|| +|1374|Generate a String With Characters That Have Odd Counts||76.2%|Easy|| +|1375|Bulb Switcher III||64.1%|Medium|| +|1376|Time Needed to Inform All Employees||56.2%|Medium|| +|1377|Frog Position After T Seconds||34.7%|Hard|| +|1378|Replace Employee ID With The Unique Identifier||89.7%|Easy|| +|1379|Find a Corresponding Node of a Binary Tree in a Clone of That Tree||85.4%|Medium|| +|1380|Lucky Numbers in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix)|70.8%|Easy|| +|1381|Design a Stack With Increment Operation||75.7%|Medium|| +|1382|Balance a Binary Search Tree||76.0%|Medium|| +|1383|Maximum Performance of a Team||34.9%|Hard|| +|1384|Total Sales Amount by Year||63.8%|Hard|| +|1385|Find the Distance Value Between Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays)|66.5%|Easy|| +|1386|Cinema Seat Allocation||35.5%|Medium|| +|1387|Sort Integers by The Power Value||70.5%|Medium|| +|1388|Pizza With 3n Slices||45.4%|Hard|| +|1389|Create Target Array in the Given Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1389.Create-Target-Array-in-the-Given-Order)|84.7%|Easy|| +|1390|Four Divisors||39.0%|Medium|| +|1391|Check if There is a Valid Path in a Grid||44.9%|Medium|| +|1392|Longest Happy Prefix||41.2%|Hard|| +|1393|Capital Gain/Loss||90.5%|Medium|| +|1394|Find Lucky Integer in an Array||63.2%|Easy|| +|1395|Count Number of Teams||81.8%|Medium|| +|1396|Design Underground System||68.6%|Medium|| +|1397|Find All Good Strings||37.9%|Hard|| +|1398|Customers Who Bought Products A and B but Not C||82.0%|Medium|| +|1399|Count Largest Group||65.4%|Easy|| +|1400|Construct K Palindrome Strings||62.8%|Medium|| +|1401|Circle and Rectangle Overlapping||42.2%|Medium|| +|1402|Reducing Dishes||72.3%|Hard|| +|1403|Minimum Subsequence in Non-Increasing Order||71.0%|Easy|| +|1404|Number of Steps to Reduce a Number in Binary Representation to One||49.8%|Medium|| +|1405|Longest Happy String||52.2%|Medium|| +|1406|Stone Game III||57.1%|Hard|| +|1407|Top Travellers||83.6%|Easy|| +|1408|String Matching in an Array||62.7%|Easy|| +|1409|Queries on a Permutation With Key||81.4%|Medium|| +|1410|HTML Entity Parser||54.5%|Medium|| +|1411|Number of Ways to Paint N × 3 Grid||60.5%|Hard|| +|1412|Find the Quiet Students in All Exams||65.6%|Hard|| +|1413|Minimum Value to Get Positive Step by Step Sum||65.3%|Easy|| +|1414|Find the Minimum Number of Fibonacci Numbers Whose Sum Is K||63.7%|Medium|| +|1415|The k-th Lexicographical String of All Happy Strings of Length n||70.0%|Medium|| +|1416|Restore The Array||36.3%|Hard|| +|1417|Reformat The String||55.4%|Easy|| +|1418|Display Table of Food Orders in a Restaurant||68.1%|Medium|| +|1419|Minimum Number of Frogs Croaking||47.1%|Medium|| +|1420|Build Array Where You Can Find The Maximum Exactly K Comparisons||64.4%|Hard|| +|1421|NPV Queries||81.7%|Medium|| +|1422|Maximum Score After Splitting a String||56.0%|Easy|| +|1423|Maximum Points You Can Obtain from Cards||46.1%|Medium|| +|1424|Diagonal Traverse II||45.3%|Medium|| +|1425|Constrained Subsequence Sum||44.9%|Hard|| +|1426|Counting Elements||59.0%|Easy|| +|1427|Perform String Shifts||53.4%|Easy|| +|1428|Leftmost Column with at Least a One||48.7%|Medium|| +|1429|First Unique Number||49.0%|Medium|| +|1430|Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree||45.1%|Medium|| +|1431|Kids With the Greatest Number of Candies||88.5%|Easy|| +|1432|Max Difference You Can Get From Changing an Integer||42.9%|Medium|| +|1433|Check If a String Can Break Another String||67.0%|Medium|| +|1434|Number of Ways to Wear Different Hats to Each Other||39.2%|Hard|| +|1435|Create a Session Bar Chart||77.7%|Easy|| +|1436|Destination City||77.2%|Easy|| +|1437|Check If All 1's Are at Least Length K Places Away||61.8%|Medium|| +|1438|Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit||43.8%|Medium|| +|1439|Find the Kth Smallest Sum of a Matrix With Sorted Rows||60.0%|Hard|| +|1440|Evaluate Boolean Expression||74.4%|Medium|| +|1441|Build an Array With Stack Operations||69.0%|Easy|| +|1442|Count Triplets That Can Form Two Arrays of Equal XOR||70.9%|Medium|| +|1443|Minimum Time to Collect All Apples in a Tree||54.6%|Medium|| +|1444|Number of Ways of Cutting a Pizza||53.6%|Hard|| +|1445|Apples & Oranges||90.6%|Medium|| +|1446|Consecutive Characters||61.2%|Easy|| +|1447|Simplified Fractions||62.0%|Medium|| +|1448|Count Good Nodes in Binary Tree||70.3%|Medium|| +|1449|Form Largest Integer With Digits That Add up to Target||43.6%|Hard|| +|1450|Number of Students Doing Homework at a Given Time||76.9%|Easy|| +|1451|Rearrange Words in a Sentence||59.0%|Medium|| +|1452|People Whose List of Favorite Companies Is Not a Subset of Another List||54.8%|Medium|| +|1453|Maximum Number of Darts Inside of a Circular Dartboard||35.1%|Hard|| +|1454|Active Users||38.6%|Medium|| +|1455|Check If a Word Occurs As a Prefix of Any Word in a Sentence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence)|64.8%|Easy|| +|1456|Maximum Number of Vowels in a Substring of Given Length||54.2%|Medium|| +|1457|Pseudo-Palindromic Paths in a Binary Tree||71.6%|Medium|| +|1458|Max Dot Product of Two Subsequences||42.8%|Hard|| +|1459|Rectangles Area||64.2%|Medium|| +|1460|Make Two Arrays Equal by Reversing Sub-arrays||72.2%|Easy|| +|1461|Check If a String Contains All Binary Codes of Size K||46.8%|Medium|| +|1462|Course Schedule IV||44.2%|Medium|| +|1463|Cherry Pickup II||69.5%|Hard|| +|1464|Maximum Product of Two Elements in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array)|76.8%|Easy|| +|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.6%|Medium|| +|1466|Reorder Routes to Make All Paths Lead to the City Zero||61.3%|Medium|| +|1467|Probability of a Two Boxes Having The Same Number of Distinct Balls||60.9%|Hard|| +|1468|Calculate Salaries||80.9%|Medium|| +|1469|Find All The Lonely Nodes||80.6%|Easy|| +|1470|Shuffle the Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1470.Shuffle-the-Array)|88.5%|Easy|| +|1471|The k Strongest Values in an Array||58.4%|Medium|| +|1472|Design Browser History||70.1%|Medium|| +|1473|Paint House III||48.8%|Hard|| +|1474|Delete N Nodes After M Nodes of a Linked List||74.4%|Easy|| +|1475|Final Prices With a Special Discount in a Shop||74.6%|Easy|| +|1476|Subrectangle Queries||88.7%|Medium|| +|1477|Find Two Non-overlapping Sub-arrays Each With Target Sum||33.9%|Medium|| +|1478|Allocate Mailboxes||54.6%|Hard|| +|1479|Sales by Day of the Week||83.5%|Hard|| +|1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|89.7%|Easy|| +|1481|Least Number of Unique Integers after K Removals||55.4%|Medium|| +|1482|Minimum Number of Days to Make m Bouquets||49.6%|Medium|| +|1483|Kth Ancestor of a Tree Node||30.1%|Hard|| +|1484|Group Sold Products By The Date||86.0%|Easy|| +|1485|Clone Binary Tree With Random Pointer||79.7%|Medium|| +|1486|XOR Operation in an Array||84.0%|Easy|| +|1487|Making File Names Unique||30.4%|Medium|| +|1488|Avoid Flood in The City||24.7%|Medium|| +|1489|Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree||52.3%|Hard|| +|1490|Clone N-ary Tree||83.5%|Medium|| +|1491|Average Salary Excluding the Minimum and Maximum Salary||68.5%|Easy|| +|1492|The kth Factor of n||63.4%|Medium|| +|1493|Longest Subarray of 1's After Deleting One Element||58.2%|Medium|| +|1494|Parallel Courses II||31.3%|Hard|| +|1495|Friendly Movies Streamed Last Month||51.4%|Easy|| +|1496|Path Crossing||55.4%|Easy|| +|1497|Check If Array Pairs Are Divisible by k||40.6%|Medium|| +|1498|Number of Subsequences That Satisfy the Given Sum Condition||38.2%|Medium|| +|1499|Max Value of Equation||45.2%|Hard|| +|1500|Design a File Sharing System||45.8%|Medium|| +|1501|Countries You Can Safely Invest In||60.0%|Medium|| +|1502|Can Make Arithmetic Progression From Sequence||70.8%|Easy|| +|1503|Last Moment Before All Ants Fall Out of a Plank||53.0%|Medium|| +|1504|Count Submatrices With All Ones||61.0%|Medium|| +|1505|Minimum Possible Integer After at Most K Adjacent Swaps On Digits||36.2%|Hard|| +|1506|Find Root of N-Ary Tree||79.5%|Medium|| +|1507|Reformat Date||60.4%|Easy|| +|1508|Range Sum of Sorted Subarray Sums||62.1%|Medium|| +|1509|Minimum Difference Between Largest and Smallest Value in Three Moves||51.7%|Medium|| +|1510|Stone Game IV||58.7%|Hard|| +|1511|Customer Order Frequency||73.5%|Easy|| +|1512|Number of Good Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1512.Number-of-Good-Pairs)|87.9%|Easy|| +|1513|Number of Substrings With Only 1s||41.3%|Medium|| +|1514|Path with Maximum Probability||39.2%|Medium|| +|1515|Best Position for a Service Centre||36.9%|Hard|| +|1516|Move Sub-Tree of N-Ary Tree||62.9%|Hard|| +|1517|Find Users With Valid E-Mails||72.1%|Easy|| +|1518|Water Bottles||60.7%|Easy|| +|1519|Number of Nodes in the Sub-Tree With the Same Label||36.8%|Medium|| +|1520|Maximum Number of Non-Overlapping Substrings||35.8%|Hard|| +|1521|Find a Value of a Mysterious Function Closest to Target||44.4%|Hard|| +|1522|Diameter of N-Ary Tree||68.7%|Medium|| +|1523|Count Odd Numbers in an Interval Range||55.2%|Easy|| +|1524|Number of Sub-arrays With Odd Sum||39.4%|Medium|| +|1525|Number of Good Ways to Split a String||66.9%|Medium|| +|1526|Minimum Number of Increments on Subarrays to Form a Target Array||59.7%|Hard|| +|1527|Patients With a Condition||78.2%|Easy|| +|1528|Shuffle String||85.8%|Easy|| +|1529|Bulb Switcher IV||70.9%|Medium|| +|1530|Number of Good Leaf Nodes Pairs||55.8%|Medium|| +|1531|String Compression II||33.3%|Hard|| +|1532|The Most Recent Three Orders||72.9%|Medium|| +|1533|Find the Index of the Large Integer||54.8%|Medium|| +|1534|Count Good Triplets||80.2%|Easy|| +|1535|Find the Winner of an Array Game||47.1%|Medium|| +|1536|Minimum Swaps to Arrange a Binary Grid||43.1%|Medium|| +|1537|Get the Maximum Score||36.3%|Hard|| +|1538|Guess the Majority in a Hidden Array||61.6%|Medium|| +|1539|Kth Missing Positive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1539.Kth-Missing-Positive-Number)|55.5%|Easy|| +|1540|Can Convert String in K Moves||30.4%|Medium|| +|1541|Minimum Insertions to Balance a Parentheses String||42.4%|Medium|| +|1542|Find Longest Awesome Substring||36.4%|Hard|| +|1543|Fix Product Name Format||68.1%|Easy|| +|1544|Make The String Great||55.0%|Easy|| +|1545|Find Kth Bit in Nth Binary String||57.2%|Medium|| +|1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||43.6%|Medium|| +|1547|Minimum Cost to Cut a Stick||51.8%|Hard|| +|1548|The Most Similar Path in a Graph||54.3%|Hard|| +|1549|The Most Recent Orders for Each Product||66.2%|Medium|| +|1550|Three Consecutive Odds||65.3%|Easy|| +|1551|Minimum Operations to Make Array Equal||77.7%|Medium|| +|1552|Magnetic Force Between Two Balls||48.6%|Medium|| +|1553|Minimum Number of Days to Eat N Oranges||29.1%|Hard|| +|1554|Strings Differ by One Character||63.6%|Medium|| +|1555|Bank Account Summary||52.2%|Medium|| +|1556|Thousand Separator||58.3%|Easy|| +|1557|Minimum Number of Vertices to Reach All Nodes||75.2%|Medium|| +|1558|Minimum Numbers of Function Calls to Make Target Array||62.5%|Medium|| +|1559|Detect Cycles in 2D Grid||44.7%|Hard|| +|1560|Most Visited Sector in a Circular Track||56.9%|Easy|| +|1561|Maximum Number of Coins You Can Get||78.1%|Medium|| +|1562|Find Latest Group of Size M||39.3%|Medium|| +|1563|Stone Game V||40.0%|Hard|| +|1564|Put Boxes Into the Warehouse I||66.0%|Medium|| +|1565|Unique Orders and Customers Per Month||83.7%|Easy|| +|1566|Detect Pattern of Length M Repeated K or More Times||42.2%|Easy|| +|1567|Maximum Length of Subarray With Positive Product||36.4%|Medium|| +|1568|Minimum Number of Days to Disconnect Island||50.5%|Hard|| +|1569|Number of Ways to Reorder Array to Get Same BST||50.0%|Hard|| +|1570|Dot Product of Two Sparse Vectors||91.5%|Medium|| +|1571|Warehouse Manager||90.1%|Easy|| +|1572|Matrix Diagonal Sum||78.2%|Easy|| +|1573|Number of Ways to Split a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1573.Number-of-Ways-to-Split-a-String)|30.7%|Medium|| +|1574|Shortest Subarray to be Removed to Make Array Sorted||32.8%|Medium|| +|1575|Count All Possible Routes||57.5%|Hard|| +|1576|Replace All ?'s to Avoid Consecutive Repeating Characters||48.0%|Easy|| +|1577|Number of Ways Where Square of Number Is Equal to Product of Two Numbers||37.2%|Medium|| +|1578|Minimum Deletion Cost to Avoid Repeating Letters||60.2%|Medium|| +|1579|Remove Max Number of Edges to Keep Graph Fully Traversable||45.7%|Hard|| +|1580|Put Boxes Into the Warehouse II||62.1%|Medium|| +|1581|Customer Who Visited but Did Not Make Any Transactions||90.1%|Easy|| +|1582|Special Positions in a Binary Matrix||64.0%|Easy|| +|1583|Count Unhappy Friends||53.5%|Medium|| +|1584|Min Cost to Connect All Points||50.2%|Medium|| +|1585|Check If String Is Transformable With Substring Sort Operations||48.1%|Hard|| +|1586|Binary Search Tree Iterator II||66.8%|Medium|| +|1587|Bank Account Summary II||90.5%|Easy|| +|1588|Sum of All Odd Length Subarrays||82.0%|Easy|| +|1589|Maximum Sum Obtained of Any Permutation||34.5%|Medium|| +|1590|Make Sum Divisible by P||27.1%|Medium|| +|1591|Strange Printer II||55.3%|Hard|| +|1592|Rearrange Spaces Between Words||43.7%|Easy|| +|1593|Split a String Into the Max Number of Unique Substrings||48.1%|Medium|| +|1594|Maximum Non Negative Product in a Matrix||31.9%|Medium|| +|1595|Minimum Cost to Connect Two Groups of Points||42.5%|Hard|| +|1596|The Most Frequently Ordered Products for Each Customer||84.1%|Medium|| +|1597|Build Binary Expression Tree From Infix Expression||65.9%|Hard|| +|1598|Crawler Log Folder||64.3%|Easy|| +|1599|Maximum Profit of Operating a Centennial Wheel||43.3%|Medium|| +|1600|Throne Inheritance||59.7%|Medium|| +|1601|Maximum Number of Achievable Transfer Requests||47.3%|Hard|| +|1602|Find Nearest Right Node in Binary Tree||74.0%|Medium|| +|1603|Design Parking System||86.7%|Easy|| +|1604|Alert Using Same Key-Card Three or More Times in a One Hour Period||42.0%|Medium|| +|1605|Find Valid Matrix Given Row and Column Sums||77.4%|Medium|| +|1606|Find Servers That Handled Most Number of Requests||36.7%|Hard|| +|1607|Sellers With No Sales||56.0%|Easy|| +|1608|Special Array With X Elements Greater Than or Equal X||61.7%|Easy|| +|1609|Even Odd Tree||53.4%|Medium|| +|1610|Maximum Number of Visible Points||28.4%|Hard|| +|1611|Minimum One Bit Operations to Make Integers Zero||57.0%|Hard|| +|1612|Check If Two Expression Trees are Equivalent||70.0%|Medium|| +|1613|Find the Missing IDs||72.4%|Medium|| +|1614|Maximum Nesting Depth of the Parentheses||83.7%|Easy|| +|1615|Maximal Network Rank||51.6%|Medium|| +|1616|Split Two Strings to Make Palindrome||36.5%|Medium|| +|1617|Count Subtrees With Max Distance Between Cities||63.3%|Hard|| +|1618|Maximum Font to Fit a Sentence in a Screen||57.5%|Medium|| +|1619|Mean of Array After Removing Some Elements||65.6%|Easy|| +|1620|Coordinate With Maximum Network Quality||37.1%|Medium|| +|1621|Number of Sets of K Non-Overlapping Line Segments||41.3%|Medium|| +|1622|Fancy Sequence||15.5%|Hard|| +|1623|All Valid Triplets That Can Represent a Country||89.3%|Easy|| +|1624|Largest Substring Between Two Equal Characters||59.1%|Easy|| +|1625|Lexicographically Smallest String After Applying Operations||63.2%|Medium|| +|1626|Best Team With No Conflicts||37.1%|Medium|| +|1627|Graph Connectivity With Threshold||38.1%|Hard|| +|1628|Design an Expression Tree With Evaluate Function||80.8%|Medium|| +|1629|Slowest Key||58.9%|Easy|| +|1630|Arithmetic Subarrays||77.8%|Medium|| +|1631|Path With Minimum Effort||43.1%|Medium|| +|1632|Rank Transform of a Matrix||30.2%|Hard|| +|1633|Percentage of Users Attended a Contest||73.2%|Easy|| +|1634|Add Two Polynomials Represented as Linked Lists||56.1%|Medium|| +|1635|Hopper Company Queries I||57.7%|Hard|| +|1636|Sort Array by Increasing Frequency||66.4%|Easy|| +|1637|Widest Vertical Area Between Two Points Containing No Points||84.0%|Medium|| +|1638|Count Substrings That Differ by One Character||67.8%|Medium|| +|1639|Number of Ways to Form a Target String Given a Dictionary||39.5%|Hard|| +|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|64.1%|Easy|| +|1641|Count Sorted Vowel Strings||74.9%|Medium|| +|1642|Furthest Building You Can Reach||51.6%|Medium|| +|1643|Kth Smallest Instructions||42.8%|Hard|| +|1644|Lowest Common Ancestor of a Binary Tree II||57.5%|Medium|| +|1645|Hopper Company Queries II||41.4%|Hard|| +|1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|48.3%|Easy|| +|1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|53.7%|Medium|| +|1648|Sell Diminishing-Valued Colored Balls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls)|30.8%|Medium|| +|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|42.5%|Hard|| +|1650|Lowest Common Ancestor of a Binary Tree III||77.4%|Medium|| +|1651|Hopper Company Queries III||67.3%|Hard|| +|1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.6%|Easy|| +|1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.5%|Medium|| +|1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.4%|Medium|| +|1655|Distribute Repeating Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1655.Distribute-Repeating-Integers)|40.9%|Hard|| +|1656|Design an Ordered Stream|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1656.Design-an-Ordered-Stream)|82.3%|Easy|| +|1657|Determine if Two Strings Are Close|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1657.Determine-if-Two-Strings-Are-Close)|51.2%|Medium|| +|1658|Minimum Operations to Reduce X to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero)|30.5%|Medium|| +|1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|34.5%|Hard|| +|1660|Correct a Binary Tree||78.9%|Medium|| +|1661|Average Time of Process per Machine||79.1%|Easy|| +|1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|83.8%|Easy|| +|1663|Smallest String With A Given Numeric Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value)|59.9%|Medium|| +|1664|Ways to Make a Fair Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1664.Ways-to-Make-a-Fair-Array)|60.5%|Medium|| +|1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|68.3%|Hard|| +|1666|Change the Root of a Binary Tree||67.4%|Medium|| +|1667|Fix Names in a Table||63.8%|Easy|| +|1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.7%|Easy|| +|1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.7%|Medium|| +|1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.6%|Medium|| +|1671|Minimum Number of Removals to Make Mountain Array||45.9%|Hard|| +|1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.9%|Easy|| +|1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|37.9%|Medium|| +|1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|34.2%|Medium|| +|1675|Minimize Deviation in Array||44.9%|Hard|| +|1676|Lowest Common Ancestor of a Binary Tree IV||77.6%|Medium|| +|1677|Product's Worth Over Invoices||75.0%|Easy|| +|1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.9%|Easy|| +|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|52.2%|Medium|| +|1680|Concatenation of Consecutive Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers)|45.0%|Medium|| +|1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|34.6%|Hard|| +|1682|Longest Palindromic Subsequence II||51.8%|Medium|| +|1683|Invalid Tweets||91.9%|Easy|| +|1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|84.5%|Easy|| +|1685|Sum of Absolute Differences in a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array)|61.5%|Medium|| +|1686|Stone Game VI||48.7%|Medium|| +|1687|Delivering Boxes from Storage to Ports||34.8%|Hard|| +|1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|83.4%|Easy|| +|1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.4%|Medium|| +|1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|46.3%|Medium|| +|1691|Maximum Height by Stacking Cuboids ||48.9%|Hard|| +|1692|Count Ways to Distribute Candies||61.5%|Hard|| +|1693|Daily Leads and Partners||91.9%|Easy|| +|1694|Reformat Phone Number||67.3%|Easy|| +|1695|Maximum Erasure Value||49.1%|Medium|| +|1696|Jump Game VI||56.6%|Medium|| +|1697|Checking Existence of Edge Length Limited Paths||56.4%|Hard|| +|1698|Number of Distinct Substrings in a String||55.4%|Medium|| +|1699|Number of Calls Between Two Persons||85.2%|Medium|| +|1700|Number of Students Unable to Eat Lunch||69.9%|Easy|| +|1701|Average Waiting Time||61.4%|Medium|| +|1702|Maximum Binary String After Change||62.2%|Medium|| +|1703|Minimum Adjacent Swaps for K Consecutive Ones||40.8%|Hard|| +|1704|Determine if String Halves Are Alike||78.4%|Easy|| +|1705|Maximum Number of Eaten Apples||42.8%|Medium|| +|1706|Where Will the Ball Fall||57.6%|Medium|| +|1707|Maximum XOR With an Element From Array||49.0%|Hard|| +|1708|Largest Subarray Length K||65.6%|Easy|| +|1709|Biggest Window Between Visits||83.2%|Medium|| +|1710|Maximum Units on a Truck||72.8%|Easy|| +|1711|Count Good Meals||25.2%|Medium|| +|1712|Ways to Split Array Into Three Subarrays||29.5%|Medium|| +|1713|Minimum Operations to Make a Subsequence||44.7%|Hard|| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------| - ------------------------------------------------------------------ 下面这些是免费的算法题,但是暂时还不能使用 Go 解答的: diff --git a/automation/models/mdrow.go b/automation/models/mdrow.go index 91e65ed0..8070df19 100644 --- a/automation/models/mdrow.go +++ b/automation/models/mdrow.go @@ -1,11 +1,11 @@ package models import ( - "strconv" + "fmt" ) type Mdrow struct { - FrontendQuestionId string `json:"question_id"` + FrontendQuestionId int32 `json:"question_id"` QuestionTitle string `json:"question__title"` QuestionTitleSlug string `json:"question__title_slug"` SolutionPath string `json:"solution_path"` @@ -14,13 +14,37 @@ type Mdrow struct { Frequency string `json:"frequency"` } +// | 0001 | Two Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum)| 45.6% | Easy | | +func (m Mdrow) tableLine() string { + return fmt.Sprintf("|%04d|%v|%v|%v|%v||\n", m.FrontendQuestionId, m.QuestionTitle, m.SolutionPath, m.Acceptance, m.Difficulty) +} + // SortByQuestionId define type SortByQuestionId []Mdrow func (a SortByQuestionId) Len() int { return len(a) } func (a SortByQuestionId) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a SortByQuestionId) Less(i, j int) bool { - first, _ := strconv.Atoi(a[i].FrontendQuestionId) - second, _ := strconv.Atoi(a[j].FrontendQuestionId) - return first < second + return a[i].FrontendQuestionId < a[j].FrontendQuestionId +} + +type Mdrows struct { + Mdrows []Mdrow +} + +// | No. | Title | Solution | Acceptance | Difficulty | Frequency | +// |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| +func (mds Mdrows) table() string { + res := "| No. | Title | Solution | Acceptance | Difficulty | Frequency |\n" + res += "|:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:|\n" + for _, p := range mds.Mdrows { + res += p.tableLine() + } + // 加这一行是为了撑开整个表格 + res += "|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|" + return res +} + +func (mds Mdrows) AvailableTable() string { + return mds.table() } diff --git a/automation/render.go b/automation/render.go index 869f4f3b..18966abd 100644 --- a/automation/render.go +++ b/automation/render.go @@ -1,55 +1,75 @@ package main import ( + "bufio" + "bytes" "encoding/json" "fmt" m "github.com/halfrost/LeetCode-Go/automation/models" + "html/template" + "io" "io/ioutil" "net/http" "os" + "regexp" "sort" "strconv" + "strings" ) func main() { - resp, err := http.Get("https://leetcode.com/api/problems/all/") - if err != nil { - fmt.Println(err) - return - } - defer resp.Body.Close() + var ( + result []m.StatStatusPairs + lpa m.LeetCodeProblemAll + ) - var result []m.StatStatusPairs - var lpa m.LeetCodeProblemAll - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - fmt.Println(err) - return - } - - err = json.Unmarshal(body, &lpa) + body := getProblemAllList() + err := json.Unmarshal(body, &lpa) if err != nil { fmt.Println(err) return } result = lpa.StatStatusPairs - //fmt.Println(result) mdrows := []m.Mdrow{} for i := 0; i < len(result); i++ { mdrows = append(mdrows, convertModel(result[i])) } sort.Sort(m.SortByQuestionId(mdrows)) - res, _ := json.Marshal(mdrows) - write(res) - //fmt.Println(resp.StatusCode) + solutionIds := loadSolutionsDir() + generateMdRows(solutionIds, mdrows) + // res, _ := json.Marshal(mdrows) + //writeFile("leetcode_problem", res) + mds := m.Mdrows{Mdrows: mdrows} + res, err := readFile("./template.markdown", "{{.AvailableTable}}", mds) + if err != nil { + fmt.Println(err) + return + } + writeFile("../README.md", res) + //makeReadmeFile(mds) +} +func getProblemAllList() []byte { + resp, err := http.Get("https://leetcode.com/api/problems/all/") + if err != nil { + fmt.Println(err) + return []byte{} + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + fmt.Println(err) + return []byte{} + } if resp.StatusCode == 200 { fmt.Println("ok") } + return body } -func write(content []byte) { - file, err := os.OpenFile("leetcode_problem", os.O_RDWR|os.O_CREATE, 0777) +func writeFile(fileName string, content []byte) { + file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0777) if err != nil { fmt.Println(err) } @@ -64,12 +84,100 @@ func write(content []byte) { func convertModel(ssp m.StatStatusPairs) m.Mdrow { res := m.Mdrow{} - res.FrontendQuestionId = strconv.FormatInt(int64(ssp.Stat.FrontendQuestionId), 10) + res.FrontendQuestionId = ssp.Stat.FrontendQuestionId res.QuestionTitle = ssp.Stat.QuestionTitle res.QuestionTitleSlug = ssp.Stat.QuestionTitleSlug - // res.SolutionPath res.Acceptance = fmt.Sprintf("%.1f%%", (ssp.Stat.TotalAcs/ssp.Stat.TotalSubmitted)*100) res.Difficulty = m.DifficultyMap[ssp.Difficulty.Level] res.Frequency = fmt.Sprintf("%f", ssp.Frequency) return res } + +func loadSolutionsDir() []int { + files, err := ioutil.ReadDir("../leetcode/") + if err != nil { + fmt.Println(err) + } + solutionIds := []int{} + for _, f := range files { + if f.Name()[4] == '.' { + tmp, err := strconv.Atoi(f.Name()[:4]) + if err != nil { + fmt.Println(err) + } + solutionIds = append(solutionIds, tmp) + } + } + sort.Ints(solutionIds) + fmt.Printf("读取了 %v 道题的题解,当前目录下有 %v 个文件(可能包含 .DS_Store),有 %v 道题在尝试中\n", len(solutionIds), len(files), len(files)-len(solutionIds)) + return solutionIds +} + +func generateMdRows(solutionIds []int, mdrows []m.Mdrow) { + for i := 0; i < len(solutionIds); i++ { + id := mdrows[solutionIds[i]-1].FrontendQuestionId + if solutionIds[i] == int(id) { + //fmt.Printf("id = %v i = %v solutionIds = %v\n", id, i, solutionIds[i]) + mdrows[id-1].SolutionPath = fmt.Sprintf("[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/%v)", fmt.Sprintf("%04d.%v", id, strings.Replace(mdrows[id-1].QuestionTitle, " ", "-", -1))) + } else { + fmt.Printf("序号出错了 solutionIds = %v id = %v\n", solutionIds[i], id) + } + } + fmt.Printf("") +} + +func makeReadmeFile(mdrows m.Mdrows) { + file := "./README.md" + os.Remove(file) + var b bytes.Buffer + tmpl := template.Must(template.New("readme").Parse(readTMPL("template.markdown"))) + err := tmpl.Execute(&b, mdrows) + if err != nil { + fmt.Println(err) + } + // 保存 README.md 文件 + writeFile(file, b.Bytes()) +} + +func readTMPL(path string) string { + file, err := os.Open(path) + if err != nil { + fmt.Println(err) + } + defer file.Close() + + data, err := ioutil.ReadAll(file) + if err != nil { + fmt.Println(err) + } + return string(data) +} + +func readFile(filePath, template string, mdrows m.Mdrows) ([]byte, error) { + f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) + if err != nil { + return nil, err + } + defer f.Close() + reader, output := bufio.NewReader(f), []byte{} + + for { + line, _, err := reader.ReadLine() + if err != nil { + if err == io.EOF { + return output, nil + } + return nil, err + } + if ok, _ := regexp.Match(template, line); ok { + reg := regexp.MustCompile(template) + newByte := reg.ReplaceAll(line, []byte(mdrows.AvailableTable())) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else { + output = append(output, line...) + output = append(output, []byte("\n")...) + } + } + return output, nil +} diff --git a/automation/template.markdown b/automation/template.markdown new file mode 100644 index 00000000..ada01e95 --- /dev/null +++ b/automation/template.markdown @@ -0,0 +1,635 @@ + +# LeetCode in Go +[LeetCode Online Judge](https://leetcode.com/) is a website containing many **algorithm questions**. Most of them are real interview questions of **Google, Facebook, LinkedIn, Apple**, etc. and it always help to sharp our algorithm Skills. Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. This repo shows my solutions in Go with the code style strictly follows the [Google Golang Style Guide](https://github.com/golang/go/wiki/CodeReviewComments). Please feel free to reference and **STAR** to support this repo, thank you! + + +

+ +

+ +![](./website/static/wechat-qr-code.png) + +

+GitHub All Releases + + + + + + +Support Go version + +

+ +

+GitHub + + + + + + + + + +

+ +支持 Progressive Web Apps 和 Dark Mode 的题解电子书《LeetCode Cookbook》 Online Reading + +

+ + +

+ +离线版本的电子书《LeetCode Cookbook》PDF Download here + +

+ +

+ +通过 iOS / Android 浏览器安装 PWA 版《LeetCode Cookbook》至设备桌面随时学习 + +

+ + + +

+ + +## Data Structures + +> 标识了 ✅ 的专题是完成所有题目了的,没有标识的是还没有做完所有题目的 + +logo + +* [Array](#array) +* [String](#string) +* [✅ Two Pointers](#two-pointers) +* [✅ Linked List](#linked-list) +* [✅ Stack](#stack) +* [Tree](#tree) +* [Dynamic programming](#dynamic-programming) +* [✅ Backtracking](#backtracking) +* [Depth First Search](#depth-first-search) +* [Breadth First Search](#breadth-first-search) +* [Binary Search](#binary-search) +* [Math](#math) +* [Hash Table](#hash-table) +* [✅ Sort](#sort) +* [✅ Bit Manipulation](#bit-manipulation) +* [✅ Union Find](#union-find) +* [✅ Sliding Window](#sliding-window) +* [✅ Segment Tree](#segment-tree) +* [✅ Binary Indexed Tree](#binary-indexed-tree) + +| 数据结构 | 变种 | 相关题目 | 讲解文章 | +|:-------:|:-------|:------|:------| +|顺序线性表:向量|||| +|单链表|1. 双向链表
2. 静态链表
3. 对称矩阵
4. 稀疏矩阵||| +|哈希表|1. 散列函数
2. 解决碰撞/填充因子
||| +|栈和队列|1. 广义栈
2. 双端队列
||| +|队列|1. 链表实现
2. 循环数组实现
3. 双端队列||| +|字符串|1. KMP算法
2. 有限状态自动机
3. 模式匹配有限状态自动机
4. BM 模式匹配算法
5. BM-KMP 算法
6. BF 算法||| +|树|1. 二叉树
2. 并查集
3. Huffman 树||| +|数组实现的堆|1. 极大堆和极小堆
2. 极大极小堆
3. 双端堆
4. d 叉堆||| +|树实现的堆|1. 左堆
2. 扁堆
3. 二项式堆
4. 斐波那契堆
5. 配对堆||| +|查找|1. 哈希表
2. 跳跃表
3. 排序二叉树
4. AVL 树
5. B 树 / B+ 树 / B* 树
6. AA 树
7. 红黑树
8. 排序二叉堆
9. Splay 树
10. 双链树
11. Trie 树
12. R 树||| +|--------------------------------------------|--------------------------------------------------------------------------------------------|---------------------------|-----------------------------------| + + +## Algorithm + + +| 算法 | 具体类型 | 相关题目 | 讲解文章 | +|:-------:|:-------|:------|:------| +|排序算法|1. 冒泡排序
2. 插入排序
3. 选择排序
4. 希尔 Shell 排序
5. 快速排序
6. 归并排序
7. 堆排序
8. 线性排序算法
9. 自省排序
10. 间接排序
11. 计数排序
12. 基数排序
13. 桶排序
14. 外部排序 - k 路归并败者树
15. 外部排序 - 最佳归并树||| +|递归与分治||1. 二分搜索/查找
2. 大整数的乘法
3. Strassen 矩阵乘法
4. 棋盘覆盖
5. 合并排序
6. 快速排序
7. 线性时间选择
8. 最接近点对问题
9. 循环赛日程表
|| +|动态规划||1. 矩阵连乘问题
2. 最长公共子序列
3. 最大子段和
4. 凸多边形最优三角剖分
5. 多边形游戏
6. 图像压缩
7. 电路布线
8. 流水作业调度
9. 0-1 背包问题/背包九讲
10. 最优二叉搜索树
11. 动态规划加速原理
12. 树型 DP
|| +|贪心||1. 活动安排问题
2. 最优装载
3. 哈夫曼编码
4. 单源最短路径
5. 最小生成树
6. 多机调度问题
|| +|回溯法||1. 装载问题
2. 批处理作业调度
3. 符号三角形问题
4. n 后问题
5. 0-1 背包问题
6. 最大团问题
7. 图的 m 着色问题
8. 旅行售货员问题
9. 圆排列问题
10. 电路板排列问题
11. 连续邮资问题
|| +|搜索|1. 枚举
2. DFS
3. BFS
4. 启发式搜索
||| +|随机化|1. 随机数
2. 数值随机化算法
3. Sherwood 舍伍德算法
4. Las Vegas 拉斯维加斯算法
5. Monte Carlo 蒙特卡罗算法
|1. 计算 π 值
2. 计算定积分
3. 解非线性方程组
4. 线性时间选择算法
5. 跳跃表
6. n 后问题
7. 整数因子分解
8. 主元素问题
9. 素数测试
|| +|图论|1. 遍历 DFS / BFS
2. AOV / AOE 网络
3. Kruskal 算法(最小生成树)
4. Prim 算法(最小生成树)
5. Boruvka 算法(最小生成树)
6. Dijkstra 算法(单源最短路径)
7. Bellman-Ford 算法(单源最短路径)
8. SPFA 算法(单源最短路径)
9. Floyd 算法(多源最短路径)
10. Johnson 算法(多源最短路径)
11. Fleury 算法(欧拉回路)
12. Ford-Fulkerson 算法(最大网络流增广路)
13. Edmonds-Karp 算法(最大网络流)
14. Dinic 算法(最大网络流)
15. 一般预流推进算法
16. 最高标号预流推进 HLPP 算法
17. Primal-Dual 原始对偶算法(最小费用流)18. Kosaraju 算法(有向图强连通分量)
19. Tarjan 算法(有向图强连通分量)
20. Gabow 算法(有向图强连通分量)
21. 匈牙利算法(二分图匹配)
22. Hopcroft-Karp 算法(二分图匹配)
23. kuhn munkras 算法(二分图最佳匹配)
24. Edmonds’ Blossom-Contraction 算法(一般图匹配)
|1. 图遍历
2. 有向图和无向图的强弱连通性
3. 割点/割边
3. AOV 网络和拓扑排序
4. AOE 网络和关键路径
5. 最小代价生成树/次小生成树
6. 最短路径问题/第 K 短路问题
7. 最大网络流问题
8. 最小费用流问题
9. 图着色问题
10. 差分约束系统
11. 欧拉回路
12. 中国邮递员问题
13. 汉密尔顿回路
14. 最佳边割集/最佳点割集/最小边割集/最小点割集/最小路径覆盖/最小点集覆盖
15. 边覆盖集
16. 二分图完美匹配和最大匹配问题
17. 仙人掌图
18. 弦图
19. 稳定婚姻问题
20. 最大团问题
|| +|数论||1. 最大公约数
2. 最小公倍数
3. 分解质因数
4. 素数判定
5. 进制转换
6. 高精度计算
7. 整除问题
8. 同余问题
9. 欧拉函数
10. 扩展欧几里得
11. 置换群
12. 母函数
13. 离散变换
14. 康托展开
15. 矩阵
16. 向量
17. 线性方程组
18. 线性规划
|| +|几何||1. 凸包 - Gift wrapping
2. 凸包 - Graham scan
3. 线段问题
4. 多边形和多面体相关问题
|| +|NP 完全|1. 计算模型
2. P 类与 NP 类问题
3. NP 完全问题
4. NP 完全问题的近似算法
|1. 随机存取机 RAM
2. 随机存取存储程序机 RASP
3. 图灵机
4. 非确定性图灵机
5. P 类与 NP 类语言
6. 多项式时间验证
7. 多项式时间变换
8. Cook定理
9. 合取范式的可满足性问题 CNF-SAT
10. 3 元合取范式的可满足性问题 3-SAT
11. 团问题 CLIQUE
12. 顶点覆盖问题 VERTEX-COVER
13. 子集和问题 SUBSET-SUM
14. 哈密顿回路问题 HAM-CYCLE
15. 旅行售货员问题 TSP
16. 顶点覆盖问题的近似算法
17. 旅行售货员问题近似算法
18. 具有三角不等式性质的旅行售货员问题
19. 一般的旅行售货员问题
20. 集合覆盖问题的近似算法
21. 子集和问题的近似算法
22. 子集和问题的指数时间算法
23. 子集和问题的多项式时间近似格式
|| +|------------|------------------------------------------------------------------|-----------------------------------------------------------------|--------------------| + + +## LeetCode Problems + +## 一. 目录 + +{{.AvailableTable}} + +------------------------------------------------------------------ + +下面这些是免费的算法题,但是暂时还不能使用 Go 解答的: + +暂无 + +------------------------------------------------------------------ + + +## 二.分类 + +## Array + + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Array/) + + + +## String + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/String/) + + +## Two Pointers + +![](./topic/Two_pointers.png) + +- 双指针滑动窗口的经典写法。右指针不断往右移,移动到不能往右移动为止(具体条件根据题目而定)。当右指针到最右边以后,开始挪动左指针,释放窗口左边界。第 3 题,第 76 题,第 209 题,第 424 题,第 438 题,第 567 题,第 713 题,第 763 题,第 845 题,第 881 题,第 904 题,第 978 题,第 992 题,第 1004 题,第 1040 题,第 1052 题。 + +```c + left, right := 0, -1 + + for left < len(s) { + if right+1 < len(s) && freq[s[right+1]-'a'] == 0 { + freq[s[right+1]-'a']++ + right++ + } else { + freq[s[left]-'a']-- + left++ + } + result = max(result, right-left+1) + } +``` + +- 快慢指针可以查找重复数字,时间复杂度 O(n),第 287 题。 +- 替换字母以后,相同字母能出现连续最长的长度。第 424 题。 +- SUM 问题集。第 1 题,第 15 题,第 16 题,第 18 题,第 167 题,第 923 题,第 1074 题。 + + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Two_Pointers/) + + +## Linked List + +![](./topic/Linked_List.png) + + +- 巧妙的构造虚拟头结点。可以使遍历处理逻辑更加统一。 +- 灵活使用递归。构造递归条件,使用递归可以巧妙的解题。不过需要注意有些题目不能使用递归,因为递归深度太深会导致超时和栈溢出。 +- 链表区间逆序。第 92 题。 +- 链表寻找中间节点。第 876 题。链表寻找倒数第 n 个节点。第 19 题。只需要一次遍历就可以得到答案。 +- 合并 K 个有序链表。第 21 题,第 23 题。 +- 链表归类。第 86 题,第 328 题。 +- 链表排序,时间复杂度要求 O(n * log n),空间复杂度 O(1)。只有一种做法,归并排序,至顶向下归并。第 148 题。 +- 判断链表是否存在环,如果有环,输出环的交叉点的下标;判断 2 个链表是否有交叉点,如果有交叉点,输出交叉点。第 141 题,第 142 题,第 160 题。 + + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Linked_List/) + + + + +## Stack + +![](./topic/Stack.png) + +- 括号匹配问题及类似问题。第 20 题,第 921 题,第 1021 题。 +- 栈的基本 pop 和 push 操作。第 71 题,第 150 题,第 155 题,第 224 题,第 225 题,第 232 题,第 946 题,第 1047 题。 +- 利用栈进行编码问题。第 394 题,第 682 题,第 856 题,第 880 题。 +- **单调栈**。**利用栈维护一个单调递增或者递减的下标数组**。第 84 题,第 456 题,第 496 题,第 503 题,第 739 题,第 901 题,第 907 题,第 1019 题。 + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Stack/) + + + +## Tree + + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Tree/) + + + + + +## Dynamic Programming + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Dynamic_Programming/) + + + +## Backtracking + +![](./topic/Backtracking.png) + +- 排列问题 Permutations。第 46 题,第 47 题。第 60 题,第 526 题,第 996 题。 +- 组合问题 Combination。第 39 题,第 40 题,第 77 题,第 216 题。 +- 排列和组合杂交问题。第 1079 题。 +- N 皇后终极解法(二进制解法)。第 51 题,第 52 题。 +- 数独问题。第 37 题。 +- 四个方向搜索。第 79 题,第 212 题,第 980 题。 +- 子集合问题。第 78 题,第 90 题。 +- Trie。第 208 题,第 211 题。 +- BFS 优化。第 126 题,第 127 题。 +- DFS 模板。(只是一个例子,不对应任何题) + +```go +func combinationSum2(candidates []int, target int) [][]int { + if len(candidates) == 0 { + return [][]int{} + } + c, res := []int{}, [][]int{} + sort.Ints(candidates) + findcombinationSum2(candidates, target, 0, c, &res) + return res +} + +func findcombinationSum2(nums []int, target, index int, c []int, res *[][]int) { + if target == 0 { + b := make([]int, len(c)) + copy(b, c) + *res = append(*res, b) + return + } + for i := index; i < len(nums); i++ { + if i > index && nums[i] == nums[i-1] { // 这里是去重的关键逻辑 + continue + } + if target >= nums[i] { + c = append(c, nums[i]) + findcombinationSum2(nums, target-nums[i], i+1, c, res) + c = c[:len(c)-1] + } + } +} +``` +- BFS 模板。(只是一个例子,不对应任何题) + +```go +func updateMatrix_BFS(matrix [][]int) [][]int { + res := make([][]int, len(matrix)) + if len(matrix) == 0 || len(matrix[0]) == 0 { + return res + } + queue := make([][]int, 0) + for i, _ := range matrix { + res[i] = make([]int, len(matrix[0])) + for j, _ := range res[i] { + if matrix[i][j] == 0 { + res[i][j] = -1 + queue = append(queue, []int{i, j}) + } + } + } + level := 1 + for len(queue) > 0 { + size := len(queue) + for size > 0 { + size -= 1 + node := queue[0] + queue = queue[1:] + i, j := node[0], node[1] + for _, direction := range [][]int{{-1, 0}, {1, 0}, {0, 1}, {0, -1}} { + x := i + direction[0] + y := j + direction[1] + if x < 0 || x >= len(matrix) || y < 0 || y >= len(matrix[0]) || res[x][y] < 0 || res[x][y] > 0 { + continue + } + res[x][y] = level + queue = append(queue, []int{x, y}) + } + } + level++ + } + for i, row := range res { + for j, cell := range row { + if cell == -1 { + res[i][j] = 0 + } + } + } + return res +} +``` + + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Backtracking/) + + +## Depth First Search + + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Depth_First_Search/) + + + + +## Breadth First Search + + + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Breadth_First_Search/) + + + + + +## Binary Search + +![]() + +- 二分搜索的经典写法。需要注意的三点: + 1. 循环退出条件,注意是 low <= high,而不是 low < high。 + 2. mid 的取值,mid := low + (high-low)>>1 + 3. low 和 high 的更新。low = mid + 1,high = mid - 1。 + +```go +func binarySearchMatrix(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + (high-low)>>1 + if nums[mid] == target { + return mid + } else if nums[mid] > target { + high = mid - 1 + } else { + low = mid + 1 + } + } + return -1 +} +``` + +- 二分搜索的变种写法。有 4 个基本变种: + 1. 查找第一个与 target 相等的元素,时间复杂度 O(logn) + 2. 查找最后一个与 target 相等的元素,时间复杂度 O(logn) + 3. 查找第一个大于等于 target 的元素,时间复杂度 O(logn) + 4. 查找最后一个小于等于 target 的元素,时间复杂度 O(logn) + +```go +// 二分查找第一个与 target 相等的元素,时间复杂度 O(logn) +func searchFirstEqualElement(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + ((high - low) >> 1) + if nums[mid] > target { + high = mid - 1 + } else if nums[mid] < target { + low = mid + 1 + } else { + if (mid == 0) || (nums[mid-1] != target) { // 找到第一个与 target 相等的元素 + return mid + } + high = mid - 1 + } + } + return -1 +} + +// 二分查找最后一个与 target 相等的元素,时间复杂度 O(logn) +func searchLastEqualElement(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + ((high - low) >> 1) + if nums[mid] > target { + high = mid - 1 + } else if nums[mid] < target { + low = mid + 1 + } else { + if (mid == len(nums)-1) || (nums[mid+1] != target) { // 找到最后一个与 target 相等的元素 + return mid + } + low = mid + 1 + } + } + return -1 +} + +// 二分查找第一个大于等于 target 的元素,时间复杂度 O(logn) +func searchFirstGreaterElement(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + ((high - low) >> 1) + if nums[mid] >= target { + if (mid == 0) || (nums[mid-1] < target) { // 找到第一个大于等于 target 的元素 + return mid + } + high = mid - 1 + } else { + low = mid + 1 + } + } + return -1 +} + +// 二分查找最后一个小于等于 target 的元素,时间复杂度 O(logn) +func searchLastLessElement(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + ((high - low) >> 1) + if nums[mid] <= target { + if (mid == len(nums)-1) || (nums[mid+1] > target) { // 找到最后一个小于等于 target 的元素 + return mid + } + low = mid + 1 + } else { + high = mid - 1 + } + } + return -1 +} +``` + +- 在基本有序的数组中用二分搜索。经典解法可以解,变种写法也可以写,常见的题型,在山峰数组中找山峰,在旋转有序数组中找分界点。第 33 题,第 81 题,第 153 题,第 154 题,第 162 题,第 852 题 + +```go +func peakIndexInMountainArray(A []int) int { + low, high := 0, len(A)-1 + for low < high { + mid := low + (high-low)>>1 + // 如果 mid 较大,则左侧存在峰值,high = m,如果 mid + 1 较大,则右侧存在峰值,low = mid + 1 + if A[mid] > A[mid+1] { + high = mid + } else { + low = mid + 1 + } + } + return low +} +``` + +- max-min 最大值最小化问题。求在最小满足条件的情况下的最大值。第 410 题,第 875 题,第 1011 题,第 1283 题。 + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Binary_Search/) + + + +## Math + + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Math/) + + + + +## Hash Table + + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Hash_Table/) + + + +## Sort + +![](./topic/Sort.png) + +- 深刻的理解多路快排。第 75 题。 +- 链表的排序,插入排序(第 147 题)和归并排序(第 148 题) +- 桶排序和基数排序。第 164 题。 +- "摆动排序"。第 324 题。 +- 两两不相邻的排序。第 767 题,第 1054 题。 +- "饼子排序"。第 969 题。 + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Sort/) + + +## Bit Manipulation + +![](./topic/Bit_Manipulation.png) + +- 异或的特性。第 136 题,第 268 题,第 389 题,第 421 题, + +```go +x ^ 0 = x +x ^ 11111……1111 = ~x +x ^ (~x) = 11111……1111 +x ^ x = 0 +a ^ b = c => a ^ c = b => b ^ c = a (交换律) +a ^ b ^ c = a ^ (b ^ c) = (a ^ b)^ c (结合律) +``` + +- 构造特殊 Mask,将特殊位置放 0 或 1。 + +```go +将 x 最右边的 n 位清零, x & ( ~0 << n ) +获取 x 的第 n 位值(0 或者 1),(x >> n) & 1 +获取 x 的第 n 位的幂值,x & (1 << (n - 1)) +仅将第 n 位置为 1,x | (1 << n) +仅将第 n 位置为 0,x & (~(1 << n)) +将 x 最高位至第 n 位(含)清零,x & ((1 << n) - 1) +将第 n 位至第 0 位(含)清零,x & (~((1 << (n + 1)) - 1)) +``` + +- 有特殊意义的 & 位操作运算。第 260 题,第 201 题,第 318 题,第 371 题,第 397 题,第 461 题,第 693 题, + +```go +X & 1 == 1 判断是否是奇数(偶数) +X & = (X - 1) 将最低位(LSB)的 1 清零 +X & -X 得到最低位(LSB)的 1 +X & ~X = 0 +``` + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Bit_Manipulation/) + + +## Union Find + +![](./topic/Union_Find.png) + +- 灵活使用并查集的思想,熟练掌握并查集的[模板](https://github.com/halfrost/LeetCode-Go/blob/master/template/UnionFind.go),模板中有两种并查集的实现方式,一种是路径压缩 + 秩优化的版本,另外一种是计算每个集合中元素的个数 + 最大集合元素个数的版本,这两种版本都有各自使用的地方。能使用第一类并查集模板的题目有:第 128 题,第 130 题,第 547 题,第 684 题,第 721 题,第 765 题,第 778 题,第 839 题,第 924 题,第 928 题,第 947 题,第 952 题,第 959 题,第 990 题。能使用第二类并查集模板的题目有:第 803 题,第 952 题。第 803 题秩优化和统计集合个数这些地方会卡时间,如果不优化,会 TLE。 +- 并查集是一种思想,有些题需要灵活使用这种思想,而不是死套模板,如第 399 题,这一题是 stringUnionFind,利用并查集思想实现的。这里每个节点是基于字符串和 map 的,而不是单纯的用 int 节点编号实现的。 +- 有些题死套模板反而做不出来,比如第 685 题,这一题不能路径压缩和秩优化,因为题目中涉及到有向图,需要知道节点的前驱节点,如果路径压缩了,这一题就没法做了。这一题不需要路径压缩和秩优化。 +- 灵活的抽象题目给的信息,将给定的信息合理的编号,使用并查集解题,并用 map 降低时间复杂度,如第 721 题,第 959 题。 +- 关于地图,砖块,网格的题目,可以新建一个特殊节点,将四周边缘的砖块或者网格都 union() 到这个特殊节点上。第 130 题,第 803 题。 +- 能用并查集的题目,一般也可以用 DFS 和 BFS 解答,只不过时间复杂度会高一点。 + + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Union_Find/) + + + +## Sliding Window + +![](./topic/Sliding_Window.png) + +- 双指针滑动窗口的经典写法。右指针不断往右移,移动到不能往右移动为止(具体条件根据题目而定)。当右指针到最右边以后,开始挪动左指针,释放窗口左边界。第 3 题,第 76 题,第 209 题,第 424 题,第 438 题,第 567 题,第 713 题,第 763 题,第 845 题,第 881 题,第 904 题,第 978 题,第 992 题,第 1004 题,第 1040 题,第 1052 题。 + +```c + left, right := 0, -1 + + for left < len(s) { + if right+1 < len(s) && freq[s[right+1]-'a'] == 0 { + freq[s[right+1]-'a']++ + right++ + } else { + freq[s[left]-'a']-- + left++ + } + result = max(result, right-left+1) + } +``` +- 滑动窗口经典题。第 239 题,第 480 题。 + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Sliding_Window/) + + +## Segment Tree + +![](./topic/Segment_Tree.png) + +- 线段树的经典数组实现写法。将合并两个节点 pushUp 逻辑抽象出来了,可以实现任意操作(常见的操作有:加法,取 max,min 等等)。第 218 题,第 303 题,第 307 题,第 699 题。 +- 计数线段树的经典写法。第 315 题,第 327 题,第 493 题。 +- 线段树的树的实现写法。第 715 题,第 732 题。 +- 区间懒惰更新。第 218 题,第 699 题。 +- 离散化。离散化需要注意一个特殊情况:假如三个区间为 [1,10] [1,4] [6,10],离散化后 x[1]=1,x[2]=4,x[3]=6,x[4]=10。第一个区间为 [1,4],第二个区间为 [1,2],第三个区间为 [3,4],这样一来,区间一 = 区间二 + 区间三,这和离散前的模型不符,离散前,很明显,区间一 > 区间二 + 区间三。正确的做法是:在相差大于 1 的数间加一个数,例如在上面 1 4 6 10 中间加 5,即可 x[1]=1,x[2]=4,x[3]=5,x[4]=6,x[5]=10。这样处理之后,区间一是 1-5 ,区间二是 1-2 ,区间三是 4-5 。 +- 灵活构建线段树。线段树节点可以存储多条信息,合并两个节点的 pushUp 操作也可以是多样的。第 850 题,第 1157 题。 + + +线段树[题型](https://blog.csdn.net/xuechelingxiao/article/details/38313105)从简单到困难: + +1. 单点更新: + [HDU 1166 敌兵布阵](http://acm.hdu.edu.cn/showproblem.php?pid=1166) update:单点增减 query:区间求和 + [HDU 1754 I Hate It](http://acm.hdu.edu.cn/showproblem.php?pid=1754) update:单点替换 query:区间最值 + [HDU 1394 Minimum Inversion Number](http://acm.hdu.edu.cn/showproblem.php?pid=1394) update:单点增减 query:区间求和 + [HDU 2795 Billboard](http://acm.hdu.edu.cn/showproblem.php?pid=2795) query:区间求最大值的位子(直接把update的操作在query里做了) +2. 区间更新: + [HDU 1698 Just a Hook](http://acm.hdu.edu.cn/showproblem.php?pid=1698) update:成段替换 (由于只query一次总区间,所以可以直接输出 1 结点的信息) + [POJ 3468 A Simple Problem with Integers](http://poj.org/problem?id=3468) update:成段增减 query:区间求和 + [POJ 2528 Mayor’s posters](http://poj.org/problem?id=2528) 离散化 + update:成段替换 query:简单hash + [POJ 3225 Help with Intervals](http://poj.org/problem?id=3225) update:成段替换,区间异或 query:简单hash +3. 区间合并(这类题目会询问区间中满足条件的连续最长区间,所以PushUp的时候需要对左右儿子的区间进行合并): + [POJ 3667 Hotel](http://poj.org/problem?id=3667) update:区间替换 query:询问满足条件的最左端点 +4. 扫描线(这类题目需要将一些操作排序,然后从左到右用一根扫描线扫过去最典型的就是矩形面积并,周长并等题): + [HDU 1542 Atlantis](http://acm.hdu.edu.cn/showproblem.php?pid=1542) update:区间增减 query:直接取根节点的值 + [HDU 1828 Picture](http://acm.hdu.edu.cn/showproblem.php?pid=1828) update:区间增减 query:直接取根节点的值 + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Segment_Tree/) + + +## Binary Indexed Tree + +![](./topic/Binary_Indexed_Tree.png) + +Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Binary_Indexed_Tree/) + + +---------------------------------------------------------------------------------------- + +

+ +

+ +Thank you for reading here. This is bonus. You can download my [《ACM-ICPC Algorithm Template》](https://github.com/halfrost/LeetCode-Go/releases/tag/Special/) + + + +## ♥️ Thanks + +Thanks for your Star! + +[![Stargazers over time](https://starchart.cc/halfrost/LeetCode-Go.svg)](https://starchart.cc/halfrost/LeetCode-Go) + From 1bc9d342090ef8ad492b0b402efee40612c887bf Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 8 Jan 2021 01:58:42 +0800 Subject: [PATCH 68/82] Add solution 189 --- README.md | 4 +- automation/render.go | 13 +++- automation/template.markdown | 2 + .../0189.Rotate-Array/189. Rotate Array.go | 24 ++++++ .../189. Rotate Array_test.go | 50 +++++++++++++ leetcode/0189.Rotate-Array/README.md | 75 +++++++++++++++++++ .../content/ChapterFour/0189.Rotate-Array.md | 75 +++++++++++++++++++ website/content/menu/index.md | 1 + 8 files changed, 240 insertions(+), 4 deletions(-) create mode 100644 leetcode/0189.Rotate-Array/189. Rotate Array.go create mode 100644 leetcode/0189.Rotate-Array/189. Rotate Array_test.go create mode 100644 leetcode/0189.Rotate-Array/README.md create mode 100644 website/content/ChapterFour/0189.Rotate-Array.md diff --git a/README.md b/README.md index 0127aa5a..a195ef24 100755 --- a/README.md +++ b/README.md @@ -120,6 +120,8 @@ ## 一. 目录 +以下已经收录了 556 道题的题解,还有 13 道题在尝试优化到 beats 100% + | No. | Title | Solution | Acceptance | Difficulty | Frequency | |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| |0001|Two Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum)|46.1%|Easy|| @@ -310,7 +312,7 @@ |0186|Reverse Words in a String II||45.0%|Medium|| |0187|Repeated DNA Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0187.Repeated-DNA-Sequences)|41.2%|Medium|| |0188|Best Time to Buy and Sell Stock IV||29.2%|Hard|| -|0189|Rotate Array||36.3%|Medium|| +|0189|Rotate Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0189.Rotate-Array)|36.3%|Medium|| |0190|Reverse Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0190.Reverse-Bits)|41.5%|Easy|| |0191|Number of 1 Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0191.Number-of-1-Bits)|51.8%|Easy|| |0192|Word Frequency||25.8%|Medium|| diff --git a/automation/render.go b/automation/render.go index 18966abd..263d121e 100644 --- a/automation/render.go +++ b/automation/render.go @@ -17,6 +17,8 @@ import ( "strings" ) +var try int + func main() { var ( result []m.StatStatusPairs @@ -40,7 +42,7 @@ func main() { // res, _ := json.Marshal(mdrows) //writeFile("leetcode_problem", res) mds := m.Mdrows{Mdrows: mdrows} - res, err := readFile("./template.markdown", "{{.AvailableTable}}", mds) + res, err := readFile("./template.markdown", "{{.AvailableTable}}", len(solutionIds), try, mds) if err != nil { fmt.Println(err) return @@ -109,6 +111,7 @@ func loadSolutionsDir() []int { } } sort.Ints(solutionIds) + try = len(files) - len(solutionIds) fmt.Printf("读取了 %v 道题的题解,当前目录下有 %v 个文件(可能包含 .DS_Store),有 %v 道题在尝试中\n", len(solutionIds), len(files), len(files)-len(solutionIds)) return solutionIds } @@ -153,7 +156,7 @@ func readTMPL(path string) string { return string(data) } -func readFile(filePath, template string, mdrows m.Mdrows) ([]byte, error) { +func readFile(filePath, template string, total, try int, mdrows m.Mdrows) ([]byte, error) { f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) if err != nil { return nil, err @@ -174,10 +177,14 @@ func readFile(filePath, template string, mdrows m.Mdrows) ([]byte, error) { newByte := reg.ReplaceAll(line, []byte(mdrows.AvailableTable())) output = append(output, newByte...) output = append(output, []byte("\n")...) + } else if ok, _ := regexp.Match("{{.TotalNum}}", line); ok { + reg := regexp.MustCompile("{{.TotalNum}}") + newByte := reg.ReplaceAll(line, []byte(fmt.Sprintf("以下已经收录了 %v 道题的题解,还有 %v 道题在尝试优化到 beats 100%%", total, try))) + output = append(output, newByte...) + output = append(output, []byte("\n")...) } else { output = append(output, line...) output = append(output, []byte("\n")...) } } - return output, nil } diff --git a/automation/template.markdown b/automation/template.markdown index ada01e95..5562ab4a 100644 --- a/automation/template.markdown +++ b/automation/template.markdown @@ -120,6 +120,8 @@ ## 一. 目录 +{{.TotalNum}} + {{.AvailableTable}} ------------------------------------------------------------------ diff --git a/leetcode/0189.Rotate-Array/189. Rotate Array.go b/leetcode/0189.Rotate-Array/189. Rotate Array.go new file mode 100644 index 00000000..004b55e6 --- /dev/null +++ b/leetcode/0189.Rotate-Array/189. Rotate Array.go @@ -0,0 +1,24 @@ +package leetcode + +// 解法一 时间复杂度 O(n),空间复杂度 O(1) +func rotate(nums []int, k int) { + k %= len(nums) + reverse(nums) + reverse(nums[:k]) + reverse(nums[k:]) +} + +func reverse(a []int) { + for i, n := 0, len(a); i < n/2; i++ { + a[i], a[n-1-i] = a[n-1-i], a[i] + } +} + +// 解法二 时间复杂度 O(n),空间复杂度 O(n) +func rotate1(nums []int, k int) { + newNums := make([]int, len(nums)) + for i, v := range nums { + newNums[(i+k)%len(nums)] = v + } + copy(nums, newNums) +} diff --git a/leetcode/0189.Rotate-Array/189. Rotate Array_test.go b/leetcode/0189.Rotate-Array/189. Rotate Array_test.go new file mode 100644 index 00000000..a3267c9a --- /dev/null +++ b/leetcode/0189.Rotate-Array/189. Rotate Array_test.go @@ -0,0 +1,50 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question189 struct { + para189 + ans189 +} + +// para 是参数 +// one 代表第一个参数 +type para189 struct { + nums []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans189 struct { + one []int +} + +func Test_Problem189(t *testing.T) { + + qs := []question189{ + + { + para189{[]int{1, 2, 3, 4, 5, 6, 7}, 3}, + ans189{[]int{5, 6, 7, 1, 2, 3, 4}}, + }, + + { + para189{[]int{-1, -100, 3, 99}, 2}, + ans189{[]int{3, 99, -1, -100}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 189------------------------\n") + + for _, q := range qs { + _, p := q.ans189, q.para189 + fmt.Printf("【input】:%v ", p) + rotate(p.nums, p.k) + fmt.Printf("【output】:%v\n", p.nums) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/0189.Rotate-Array/README.md b/leetcode/0189.Rotate-Array/README.md new file mode 100644 index 00000000..a83b4ab6 --- /dev/null +++ b/leetcode/0189.Rotate-Array/README.md @@ -0,0 +1,75 @@ +# [189. Rotate Array](https://leetcode.com/problems/rotate-array/) + +## 题目 + +Given an array, rotate the array to the right by *k* steps, where *k* is non-negative. + +**Follow up:** + +- Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem. +- Could you do it in-place with O(1) extra space? + +**Example 1:** + +``` +Input: nums = [1,2,3,4,5,6,7], k = 3 +Output: [5,6,7,1,2,3,4] +Explanation: +rotate 1 steps to the right: [7,1,2,3,4,5,6] +rotate 2 steps to the right: [6,7,1,2,3,4,5] +rotate 3 steps to the right: [5,6,7,1,2,3,4] +``` + +**Example 2:** + +``` +Input: nums = [-1,-100,3,99], k = 2 +Output: [3,99,-1,-100] +Explanation: +rotate 1 steps to the right: [99,-1,-100,3] +rotate 2 steps to the right: [3,99,-1,-100] +``` + +**Constraints:** + +- `1 <= nums.length <= 2 * 10^4` +- `-2^31 <= nums[i] <= 2^31 - 1` +- `0 <= k <= 10^5` + +## 题目大意 + +给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 + +## 解题思路 + +- 解法二,使用一个额外的数组,先将原数组下标为 i 的元素移动到 `(i+k) mod n` 的位置,再将剩下的元素拷贝回来即可。 +- 解法一,由于题目要求不能使用额外的空间,所以本题最佳解法不是解法二。翻转最终态是,末尾 `k mod n` 个元素移动至了数组头部,剩下的元素右移 `k mod n` 个位置至最尾部。确定了最终态以后再变换就很容易。先将数组中所有元素从头到尾翻转一次,尾部的所有元素都到了头部,然后再将 `[0,(k mod n) − 1]` 区间内的元素翻转一次,最后再将 `[k mod n, n − 1]` 区间内的元素翻转一次,即可满足题目要求。 + +## 代码 + +```go +package leetcode + +// 解法一 时间复杂度 O(n),空间复杂度 O(1) +func rotate(nums []int, k int) { + k %= len(nums) + reverse(nums) + reverse(nums[:k]) + reverse(nums[k:]) +} + +func reverse(a []int) { + for i, n := 0, len(a); i < n/2; i++ { + a[i], a[n-1-i] = a[n-1-i], a[i] + } +} + +// 解法二 时间复杂度 O(n),空间复杂度 O(n) +func rotate1(nums []int, k int) { + newNums := make([]int, len(nums)) + for i, v := range nums { + newNums[(i+k)%len(nums)] = v + } + copy(nums, newNums) +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/0189.Rotate-Array.md b/website/content/ChapterFour/0189.Rotate-Array.md new file mode 100644 index 00000000..a83b4ab6 --- /dev/null +++ b/website/content/ChapterFour/0189.Rotate-Array.md @@ -0,0 +1,75 @@ +# [189. Rotate Array](https://leetcode.com/problems/rotate-array/) + +## 题目 + +Given an array, rotate the array to the right by *k* steps, where *k* is non-negative. + +**Follow up:** + +- Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem. +- Could you do it in-place with O(1) extra space? + +**Example 1:** + +``` +Input: nums = [1,2,3,4,5,6,7], k = 3 +Output: [5,6,7,1,2,3,4] +Explanation: +rotate 1 steps to the right: [7,1,2,3,4,5,6] +rotate 2 steps to the right: [6,7,1,2,3,4,5] +rotate 3 steps to the right: [5,6,7,1,2,3,4] +``` + +**Example 2:** + +``` +Input: nums = [-1,-100,3,99], k = 2 +Output: [3,99,-1,-100] +Explanation: +rotate 1 steps to the right: [99,-1,-100,3] +rotate 2 steps to the right: [3,99,-1,-100] +``` + +**Constraints:** + +- `1 <= nums.length <= 2 * 10^4` +- `-2^31 <= nums[i] <= 2^31 - 1` +- `0 <= k <= 10^5` + +## 题目大意 + +给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 + +## 解题思路 + +- 解法二,使用一个额外的数组,先将原数组下标为 i 的元素移动到 `(i+k) mod n` 的位置,再将剩下的元素拷贝回来即可。 +- 解法一,由于题目要求不能使用额外的空间,所以本题最佳解法不是解法二。翻转最终态是,末尾 `k mod n` 个元素移动至了数组头部,剩下的元素右移 `k mod n` 个位置至最尾部。确定了最终态以后再变换就很容易。先将数组中所有元素从头到尾翻转一次,尾部的所有元素都到了头部,然后再将 `[0,(k mod n) − 1]` 区间内的元素翻转一次,最后再将 `[k mod n, n − 1]` 区间内的元素翻转一次,即可满足题目要求。 + +## 代码 + +```go +package leetcode + +// 解法一 时间复杂度 O(n),空间复杂度 O(1) +func rotate(nums []int, k int) { + k %= len(nums) + reverse(nums) + reverse(nums[:k]) + reverse(nums[k:]) +} + +func reverse(a []int) { + for i, n := 0, len(a); i < n/2; i++ { + a[i], a[n-1-i] = a[n-1-i], a[i] + } +} + +// 解法二 时间复杂度 O(n),空间复杂度 O(n) +func rotate1(nums []int, k int) { + newNums := make([]int, len(nums)) + for i, v := range nums { + newNums[(i+k)%len(nums)] = v + } + copy(nums, newNums) +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 78ee4b1d..deaabf5e 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -168,6 +168,7 @@ headless: true - [0174.Dungeon-Game]({{< relref "/ChapterFour/0174.Dungeon-Game.md" >}}) - [0179.Largest-Number]({{< relref "/ChapterFour/0179.Largest-Number.md" >}}) - [0187.Repeated-DNA-Sequences]({{< relref "/ChapterFour/0187.Repeated-DNA-Sequences.md" >}}) + - [0189.Rotate-Array]({{< relref "/ChapterFour/0189.Rotate-Array.md" >}}) - [0190.Reverse-Bits]({{< relref "/ChapterFour/0190.Reverse-Bits.md" >}}) - [0191.Number-of-1-Bits]({{< relref "/ChapterFour/0191.Number-of-1-Bits.md" >}}) - [0198.House-Robber]({{< relref "/ChapterFour/0198.House-Robber.md" >}}) From fbbc4ff73a4d211f11c5da9fe74c9bd89d526812 Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 12 Jan 2021 11:04:25 +0800 Subject: [PATCH 69/82] =?UTF-8?q?Add=20solution=20228=E3=80=811694?= =?UTF-8?q?=E3=80=811695?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1430 +++++++++-------- .../228. Summary Ranges.go | 19 + .../228. Summary Ranges_test.go | 62 + leetcode/0228.Summary-Ranges/README.md | 107 ++ .../1694. Reformat Phone Number.go | 37 + .../1694. Reformat Phone Number_test.go | 67 + leetcode/1694.Reformat-Phone-Number/README.md | 135 ++ .../1695. Maximum Erasure Value.go | 30 + .../1695. Maximum Erasure Value_test.go | 47 + leetcode/1695.Maximum-Erasure-Value/README.md | 74 + .../777777/5629. Reformat Phone Number.go | 51 - .../5629. Reformat Phone Number_test.go | 67 - .../ChapterFour/0228.Summary-Ranges.md | 108 ++ .../ChapterFour/1694.Reformat-Phone-Number.md | 135 ++ .../ChapterFour/1695.Maximum-Erasure-Value.md | 74 + website/content/menu/index.md | 3 + 16 files changed, 1618 insertions(+), 828 deletions(-) create mode 100644 leetcode/0228.Summary-Ranges/228. Summary Ranges.go create mode 100644 leetcode/0228.Summary-Ranges/228. Summary Ranges_test.go create mode 100644 leetcode/0228.Summary-Ranges/README.md create mode 100644 leetcode/1694.Reformat-Phone-Number/1694. Reformat Phone Number.go create mode 100644 leetcode/1694.Reformat-Phone-Number/1694. Reformat Phone Number_test.go create mode 100644 leetcode/1694.Reformat-Phone-Number/README.md create mode 100644 leetcode/1695.Maximum-Erasure-Value/1695. Maximum Erasure Value.go create mode 100644 leetcode/1695.Maximum-Erasure-Value/1695. Maximum Erasure Value_test.go create mode 100644 leetcode/1695.Maximum-Erasure-Value/README.md delete mode 100644 leetcode/777777/5629. Reformat Phone Number.go delete mode 100644 leetcode/777777/5629. Reformat Phone Number_test.go create mode 100644 website/content/ChapterFour/0228.Summary-Ranges.md create mode 100644 website/content/ChapterFour/1694.Reformat-Phone-Number.md create mode 100644 website/content/ChapterFour/1695.Maximum-Erasure-Value.md diff --git a/README.md b/README.md index a195ef24..3be41f97 100755 --- a/README.md +++ b/README.md @@ -120,35 +120,35 @@ ## 一. 目录 -以下已经收录了 556 道题的题解,还有 13 道题在尝试优化到 beats 100% +以下已经收录了 559 道题的题解,还有 11 道题在尝试优化到 beats 100% | No. | Title | Solution | Acceptance | Difficulty | Frequency | |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| -|0001|Two Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum)|46.1%|Easy|| -|0002|Add Two Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0002.Add-Two-Numbers)|34.9%|Medium|| -|0003|Longest Substring Without Repeating Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0003.Longest-Substring-Without-Repeating-Characters)|31.1%|Medium|| +|0001|Two Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum)|46.2%|Easy|| +|0002|Add Two Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0002.Add-Two-Numbers)|35.0%|Medium|| +|0003|Longest Substring Without Repeating Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0003.Longest-Substring-Without-Repeating-Characters)|31.2%|Medium|| |0004|Median of Two Sorted Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0004.Median-of-Two-Sorted-Arrays)|30.7%|Hard|| |0005|Longest Palindromic Substring||30.1%|Medium|| -|0006|ZigZag Conversion||37.5%|Medium|| +|0006|ZigZag Conversion||37.6%|Medium|| |0007|Reverse Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0007.Reverse-Integer)|25.8%|Easy|| -|0008|String to Integer (atoi)||15.5%|Medium|| +|0008|String to Integer (atoi)||15.6%|Medium|| |0009|Palindrome Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0009.Palindrome-Number)|49.4%|Easy|| |0010|Regular Expression Matching||27.2%|Hard|| |0011|Container With Most Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0011.Container-With-Most-Water)|52.1%|Medium|| -|0012|Integer to Roman||55.8%|Medium|| +|0012|Integer to Roman||55.9%|Medium|| |0013|Roman to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0013.Roman-to-Integer)|56.3%|Easy|| |0014|Longest Common Prefix||36.0%|Easy|| |0015|3Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0015.3Sum)|27.7%|Medium|| |0016|3Sum Closest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0016.3Sum-Closest)|46.2%|Medium|| -|0017|Letter Combinations of a Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0017.Letter-Combinations-of-a-Phone-Number)|48.5%|Medium|| +|0017|Letter Combinations of a Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0017.Letter-Combinations-of-a-Phone-Number)|48.6%|Medium|| |0018|4Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0018.4Sum)|34.6%|Medium|| |0019|Remove Nth Node From End of List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0019.Remove-Nth-Node-From-End-of-List)|35.6%|Medium|| |0020|Valid Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0020.Valid-Parentheses)|39.5%|Easy|| -|0021|Merge Two Sorted Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0021.Merge-Two-Sorted-Lists)|55.5%|Easy|| -|0022|Generate Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0022.Generate-Parentheses)|64.7%|Medium|| +|0021|Merge Two Sorted Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0021.Merge-Two-Sorted-Lists)|55.6%|Easy|| +|0022|Generate Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0022.Generate-Parentheses)|64.8%|Medium|| |0023|Merge k Sorted Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0023.Merge-k-Sorted-Lists)|41.9%|Hard|| -|0024|Swap Nodes in Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0024.Swap-Nodes-in-Pairs)|52.5%|Medium|| -|0025|Reverse Nodes in k-Group|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0025.Reverse-Nodes-in-k-Group)|44.1%|Hard|| +|0024|Swap Nodes in Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0024.Swap-Nodes-in-Pairs)|52.6%|Medium|| +|0025|Reverse Nodes in k-Group|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0025.Reverse-Nodes-in-k-Group)|44.2%|Hard|| |0026|Remove Duplicates from Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0026.Remove-Duplicates-from-Sorted-Array)|46.3%|Easy|| |0027|Remove Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0027.Remove-Element)|49.0%|Easy|| |0028|Implement strStr()|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0028.Implement-strStr())|35.0%|Easy|| @@ -157,140 +157,140 @@ |0031|Next Permutation||33.2%|Medium|| |0032|Longest Valid Parentheses||29.1%|Hard|| |0033|Search in Rotated Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0033.Search-in-Rotated-Sorted-Array)|35.6%|Medium|| -|0034|Find First and Last Position of Element in Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array)|37.0%|Medium|| -|0035|Search Insert Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0035.Search-Insert-Position)|42.7%|Easy|| +|0034|Find First and Last Position of Element in Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array)|37.1%|Medium|| +|0035|Search Insert Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0035.Search-Insert-Position)|42.8%|Easy|| |0036|Valid Sudoku|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0036.Valid-Sudoku)|50.1%|Medium|| -|0037|Sudoku Solver|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0037.Sudoku-Solver)|45.8%|Hard|| -|0038|Count and Say||45.7%|Easy|| -|0039|Combination Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0039.Combination-Sum)|58.6%|Medium|| -|0040|Combination Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0040.Combination-Sum-II)|49.7%|Medium|| +|0037|Sudoku Solver|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0037.Sudoku-Solver)|45.9%|Hard|| +|0038|Count and Say||45.8%|Easy|| +|0039|Combination Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0039.Combination-Sum)|58.7%|Medium|| +|0040|Combination Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0040.Combination-Sum-II)|49.8%|Medium|| |0041|First Missing Positive|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0041.First-Missing-Positive)|33.4%|Hard|| -|0042|Trapping Rain Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0042.Trapping-Rain-Water)|50.6%|Hard|| +|0042|Trapping Rain Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0042.Trapping-Rain-Water)|50.7%|Hard|| |0043|Multiply Strings||34.7%|Medium|| |0044|Wildcard Matching||25.3%|Hard|| -|0045|Jump Game II||31.2%|Hard|| -|0046|Permutations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0046.Permutations)|65.9%|Medium|| +|0045|Jump Game II||31.3%|Hard|| +|0046|Permutations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0046.Permutations)|66.0%|Medium|| |0047|Permutations II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0047.Permutations-II)|48.9%|Medium|| -|0048|Rotate Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0048.Rotate-Image)|59.2%|Medium|| -|0049|Group Anagrams|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams)|58.7%|Medium|| +|0048|Rotate Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0048.Rotate-Image)|59.3%|Medium|| +|0049|Group Anagrams|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams)|58.8%|Medium|| |0050|Pow(x, n)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0050.Pow(x,-n))|30.8%|Medium|| -|0051|N-Queens|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0051.N-Queens)|48.9%|Hard|| +|0051|N-Queens|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0051.N-Queens)|49.0%|Hard|| |0052|N-Queens II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0052.N-Queens-II)|59.6%|Hard|| |0053|Maximum Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0053.Maximum-Subarray)|47.5%|Easy|| -|0054|Spiral Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0054.Spiral-Matrix)|35.4%|Medium|| +|0054|Spiral Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0054.Spiral-Matrix)|35.5%|Medium|| |0055|Jump Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0055.Jump-Game)|35.0%|Medium|| |0056|Merge Intervals|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0056.Merge-Intervals)|40.6%|Medium|| |0057|Insert Interval|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0057.Insert-Interval)|34.8%|Medium|| |0058|Length of Last Word||33.4%|Easy|| -|0059|Spiral Matrix II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0059.Spiral-Matrix-II)|57.3%|Medium|| -|0060|Permutation Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0060.Permutation-Sequence)|39.1%|Hard|| +|0059|Spiral Matrix II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0059.Spiral-Matrix-II)|57.4%|Medium|| +|0060|Permutation Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0060.Permutation-Sequence)|39.2%|Hard|| |0061|Rotate List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0061.Rotate-List)|31.5%|Medium|| -|0062|Unique Paths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0062.Unique-Paths)|55.5%|Medium|| +|0062|Unique Paths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0062.Unique-Paths)|55.6%|Medium|| |0063|Unique Paths II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0063.Unique-Paths-II)|35.1%|Medium|| |0064|Minimum Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0064.Minimum-Path-Sum)|55.8%|Medium|| |0065|Valid Number||15.7%|Hard|| |0066|Plus One|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0066.Plus-One)|42.6%|Easy|| -|0067|Add Binary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0067.Add-Binary)|46.5%|Easy|| -|0068|Text Justification||29.1%|Hard|| +|0067|Add Binary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0067.Add-Binary)|46.6%|Easy|| +|0068|Text Justification||29.2%|Hard|| |0069|Sqrt(x)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0069.Sqrt(x))|34.8%|Easy|| |0070|Climbing Stairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0070.Climbing-Stairs)|48.5%|Easy|| -|0071|Simplify Path|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0071.Simplify-Path)|33.5%|Medium|| +|0071|Simplify Path|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0071.Simplify-Path)|33.6%|Medium|| |0072|Edit Distance||46.3%|Hard|| |0073|Set Matrix Zeroes||44.0%|Medium|| |0074|Search a 2D Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0074.Search-a-2D-Matrix)|37.3%|Medium|| -|0075|Sort Colors|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0075.Sort-Colors)|48.8%|Medium|| -|0076|Minimum Window Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0076.Minimum-Window-Substring)|35.6%|Hard|| +|0075|Sort Colors|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0075.Sort-Colors)|48.9%|Medium|| +|0076|Minimum Window Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0076.Minimum-Window-Substring)|35.7%|Hard|| |0077|Combinations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0077.Combinations)|56.8%|Medium|| -|0078|Subsets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0078.Subsets)|64.3%|Medium|| +|0078|Subsets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0078.Subsets)|64.4%|Medium|| |0079|Word Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0079.Word-Search)|36.5%|Medium|| |0080|Remove Duplicates from Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II)|45.8%|Medium|| |0081|Search in Rotated Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0081.Search-in-Rotated-Sorted-Array-II)|33.4%|Medium|| -|0082|Remove Duplicates from Sorted List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II)|38.8%|Medium|| -|0083|Remove Duplicates from Sorted List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0083.Remove-Duplicates-from-Sorted-List)|46.2%|Easy|| +|0082|Remove Duplicates from Sorted List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II)|38.9%|Medium|| +|0083|Remove Duplicates from Sorted List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0083.Remove-Duplicates-from-Sorted-List)|46.3%|Easy|| |0084|Largest Rectangle in Histogram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0084.Largest-Rectangle-in-Histogram)|36.7%|Hard|| |0085|Maximal Rectangle||39.1%|Hard|| -|0086|Partition List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0086.Partition-List)|42.9%|Medium|| -|0087|Scramble String||34.4%|Hard|| -|0088|Merge Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0088.Merge-Sorted-Array)|40.2%|Easy|| +|0086|Partition List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0086.Partition-List)|43.0%|Medium|| +|0087|Scramble String||34.5%|Hard|| +|0088|Merge Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0088.Merge-Sorted-Array)|40.3%|Easy|| |0089|Gray Code|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0089.Gray-Code)|50.0%|Medium|| -|0090|Subsets II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0090.Subsets-II)|48.4%|Medium|| -|0091|Decode Ways|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0091.Decode-Ways)|26.1%|Medium|| -|0092|Reverse Linked List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0092.Reverse-Linked-List-II)|40.1%|Medium|| -|0093|Restore IP Addresses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0093.Restore-IP-Addresses)|37.1%|Medium|| +|0090|Subsets II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0090.Subsets-II)|48.5%|Medium|| +|0091|Decode Ways|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0091.Decode-Ways)|26.2%|Medium|| +|0092|Reverse Linked List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0092.Reverse-Linked-List-II)|40.2%|Medium|| +|0093|Restore IP Addresses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0093.Restore-IP-Addresses)|37.2%|Medium|| |0094|Binary Tree Inorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0094.Binary-Tree-Inorder-Traversal)|65.3%|Medium|| |0095|Unique Binary Search Trees II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0095.Unique-Binary-Search-Trees-II)|42.0%|Medium|| |0096|Unique Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0096.Unique-Binary-Search-Trees)|54.1%|Medium|| -|0097|Interleaving String||32.3%|Hard|| -|0098|Validate Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0098.Validate-Binary-Search-Tree)|28.5%|Medium|| +|0097|Interleaving String||32.4%|Hard|| +|0098|Validate Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0098.Validate-Binary-Search-Tree)|28.6%|Medium|| |0099|Recover Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0099.Recover-Binary-Search-Tree)|42.1%|Hard|| |0100|Same Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0100.Same-Tree)|54.0%|Easy|| |0101|Symmetric Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0101.Symmetric-Tree)|47.8%|Easy|| -|0102|Binary Tree Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0102.Binary-Tree-Level-Order-Traversal)|56.1%|Medium|| +|0102|Binary Tree Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0102.Binary-Tree-Level-Order-Traversal)|56.2%|Medium|| |0103|Binary Tree Zigzag Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal)|49.7%|Medium|| -|0104|Maximum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0104.Maximum-Depth-of-Binary-Tree)|67.6%|Easy|| +|0104|Maximum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0104.Maximum-Depth-of-Binary-Tree)|67.7%|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)|51.1%|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)|49.0%|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)|49.1%|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)|54.8%|Easy|| -|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)|59.8%|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)|49.6%|Medium|| -|0110|Balanced Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0110.Balanced-Binary-Tree)|44.5%|Easy|| -|0111|Minimum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0111.Minimum-Depth-of-Binary-Tree)|39.1%|Easy|| +|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)|59.9%|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)|49.7%|Medium|| +|0110|Balanced Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0110.Balanced-Binary-Tree)|44.6%|Easy|| +|0111|Minimum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0111.Minimum-Depth-of-Binary-Tree)|39.2%|Easy|| |0112|Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0112.Path-Sum)|42.1%|Easy|| -|0113|Path Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0113.Path-Sum-II)|48.5%|Medium|| -|0114|Flatten Binary Tree to Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0114.Flatten-Binary-Tree-to-Linked-List)|51.3%|Medium|| -|0115|Distinct Subsequences||39.3%|Hard|| -|0116|Populating Next Right Pointers in Each Node||48.3%|Medium|| +|0113|Path Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0113.Path-Sum-II)|48.6%|Medium|| +|0114|Flatten Binary Tree to Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0114.Flatten-Binary-Tree-to-Linked-List)|51.4%|Medium|| +|0115|Distinct Subsequences||39.4%|Hard|| +|0116|Populating Next Right Pointers in Each Node||48.4%|Medium|| |0117|Populating Next Right Pointers in Each Node II||41.6%|Medium|| |0118|Pascal's Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0118.Pascal's-Triangle)|54.3%|Easy|| |0119|Pascal's Triangle II||51.8%|Easy|| |0120|Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0120.Triangle)|45.4%|Medium|| |0121|Best Time to Buy and Sell Stock|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock)|51.2%|Easy|| |0122|Best Time to Buy and Sell Stock II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II)|58.2%|Easy|| -|0123|Best Time to Buy and Sell Stock III||39.6%|Hard|| +|0123|Best Time to Buy and Sell Stock III||39.7%|Hard|| |0124|Binary Tree Maximum Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0124.Binary-Tree-Maximum-Path-Sum)|35.2%|Hard|| -|0125|Valid Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0125.Valid-Palindrome)|37.8%|Easy|| -|0126|Word Ladder II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0126.Word-Ladder-II)|23.3%|Hard|| -|0127|Word Ladder|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0127.Word-Ladder)|31.0%|Hard|| +|0125|Valid Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0125.Valid-Palindrome)|37.9%|Easy|| +|0126|Word Ladder II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0126.Word-Ladder-II)|23.4%|Hard|| +|0127|Word Ladder|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0127.Word-Ladder)|31.4%|Hard|| |0128|Longest Consecutive Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0128.Longest-Consecutive-Sequence)|46.0%|Hard|| |0129|Sum Root to Leaf Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0129.Sum-Root-to-Leaf-Numbers)|50.5%|Medium|| |0130|Surrounded Regions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0130.Surrounded-Regions)|29.1%|Medium|| |0131|Palindrome Partitioning|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0131.Palindrome-Partitioning)|51.2%|Medium|| |0132|Palindrome Partitioning II||31.0%|Hard|| -|0133|Clone Graph||38.3%|Medium|| +|0133|Clone Graph||38.4%|Medium|| |0134|Gas Station||40.9%|Medium|| |0135|Candy||32.7%|Hard|| |0136|Single Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0136.Single-Number)|66.3%|Easy|| |0137|Single Number II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0137.Single-Number-II)|53.5%|Medium|| -|0138|Copy List with Random Pointer||39.3%|Medium|| +|0138|Copy List with Random Pointer||39.4%|Medium|| |0139|Word Break||41.4%|Medium|| |0140|Word Break II||34.2%|Hard|| -|0141|Linked List Cycle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0141.Linked-List-Cycle)|42.1%|Easy|| -|0142|Linked List Cycle II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0142.Linked-List-Cycle-II)|39.2%|Medium|| -|0143|Reorder List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0143.Reorder-List)|40.1%|Medium|| -|0144|Binary Tree Preorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0144.Binary-Tree-Preorder-Traversal)|57.0%|Medium|| -|0145|Binary Tree Postorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0145.Binary-Tree-Postorder-Traversal)|56.9%|Medium|| -|0146|LRU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0146.LRU-Cache)|35.1%|Medium|| +|0141|Linked List Cycle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0141.Linked-List-Cycle)|42.2%|Easy|| +|0142|Linked List Cycle II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0142.Linked-List-Cycle-II)|39.3%|Medium|| +|0143|Reorder List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0143.Reorder-List)|40.2%|Medium|| +|0144|Binary Tree Preorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0144.Binary-Tree-Preorder-Traversal)|57.1%|Medium|| +|0145|Binary Tree Postorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0145.Binary-Tree-Postorder-Traversal)|57.0%|Medium|| +|0146|LRU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0146.LRU-Cache)|35.2%|Medium|| |0147|Insertion Sort List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0147.Insertion-Sort-List)|44.1%|Medium|| -|0148|Sort List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0148.Sort-List)|45.7%|Medium|| +|0148|Sort List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0148.Sort-List)|45.8%|Medium|| |0149|Max Points on a Line||17.2%|Hard|| |0150|Evaluate Reverse Polish Notation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0150.Evaluate-Reverse-Polish-Notation)|37.5%|Medium|| -|0151|Reverse Words in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0151.Reverse-Words-in-a-String)|23.2%|Medium|| +|0151|Reverse Words in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0151.Reverse-Words-in-a-String)|23.3%|Medium|| |0152|Maximum Product Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0152.Maximum-Product-Subarray)|32.6%|Medium|| -|0153|Find Minimum in Rotated Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0153.Find-Minimum-in-Rotated-Sorted-Array)|45.8%|Medium|| +|0153|Find Minimum in Rotated Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0153.Find-Minimum-in-Rotated-Sorted-Array)|45.9%|Medium|| |0154|Find Minimum in Rotated Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0154.Find-Minimum-in-Rotated-Sorted-Array-II)|41.9%|Hard|| -|0155|Min Stack|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0155.Min-Stack)|45.9%|Easy|| +|0155|Min Stack|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0155.Min-Stack)|46.0%|Easy|| |0156|Binary Tree Upside Down||56.0%|Medium|| -|0157|Read N Characters Given Read4||36.8%|Easy|| -|0158|Read N Characters Given Read4 II - Call multiple times||36.2%|Hard|| +|0157|Read N Characters Given Read4||36.9%|Easy|| +|0158|Read N Characters Given Read4 II - Call multiple times||36.3%|Hard|| |0159|Longest Substring with At Most Two Distinct Characters||50.2%|Medium|| -|0160|Intersection of Two Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0160.Intersection-of-Two-Linked-Lists)|42.5%|Easy|| +|0160|Intersection of Two Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0160.Intersection-of-Two-Linked-Lists)|42.6%|Easy|| |0161|One Edit Distance||32.7%|Medium|| |0162|Find Peak Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0162.Find-Peak-Element)|43.8%|Medium|| -|0163|Missing Ranges||26.3%|Easy|| -|0164|Maximum Gap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0164.Maximum-Gap)|36.5%|Hard|| -|0165|Compare Version Numbers||30.0%|Medium|| +|0163|Missing Ranges||26.4%|Easy|| +|0164|Maximum Gap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0164.Maximum-Gap)|36.6%|Hard|| +|0165|Compare Version Numbers||30.1%|Medium|| |0166|Fraction to Recurring Decimal||22.1%|Medium|| -|0167|Two Sum II - Input array is sorted|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0167.Two-Sum-II---Input-array-is-sorted)|55.3%|Easy|| +|0167|Two Sum II - Input array is sorted|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0167.Two-Sum-II---Input-array-is-sorted)|55.4%|Easy|| |0168|Excel Sheet Column Title|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0168.Excel-Sheet-Column-Title)|31.6%|Easy|| |0169|Majority Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0169.Majority-Element)|59.8%|Easy|| |0170|Two Sum III - Data structure design||34.7%|Easy|| @@ -298,84 +298,84 @@ |0172|Factorial Trailing Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0172.Factorial-Trailing-Zeroes)|38.3%|Easy|| |0173|Binary Search Tree Iterator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0173.Binary-Search-Tree-Iterator)|59.5%|Medium|| |0174|Dungeon Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0174.Dungeon-Game)|33.1%|Hard|| -|0175|Combine Two Tables||63.3%|Easy|| +|0175|Combine Two Tables||63.4%|Easy|| |0176|Second Highest Salary||32.9%|Easy|| -|0177|Nth Highest Salary||32.8%|Medium|| -|0178|Rank Scores||49.0%|Medium|| +|0177|Nth Highest Salary||32.9%|Medium|| +|0178|Rank Scores||49.1%|Medium|| |0179|Largest Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0179.Largest-Number)|30.4%|Medium|| |0180|Consecutive Numbers||41.6%|Medium|| |0181|Employees Earning More Than Their Managers||59.5%|Easy|| |0182|Duplicate Emails||64.0%|Easy|| -|0183|Customers Who Never Order||56.0%|Easy|| -|0184|Department Highest Salary||39.2%|Medium|| -|0185|Department Top Three Salaries||37.8%|Hard|| +|0183|Customers Who Never Order||56.1%|Easy|| +|0184|Department Highest Salary||39.3%|Medium|| +|0185|Department Top Three Salaries||37.9%|Hard|| |0186|Reverse Words in a String II||45.0%|Medium|| |0187|Repeated DNA Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0187.Repeated-DNA-Sequences)|41.2%|Medium|| -|0188|Best Time to Buy and Sell Stock IV||29.2%|Hard|| -|0189|Rotate Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0189.Rotate-Array)|36.3%|Medium|| -|0190|Reverse Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0190.Reverse-Bits)|41.5%|Easy|| -|0191|Number of 1 Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0191.Number-of-1-Bits)|51.8%|Easy|| +|0188|Best Time to Buy and Sell Stock IV||29.3%|Hard|| +|0189|Rotate Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0189.Rotate-Array)|36.4%|Medium|| +|0190|Reverse Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0190.Reverse-Bits)|41.6%|Easy|| +|0191|Number of 1 Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0191.Number-of-1-Bits)|51.9%|Easy|| |0192|Word Frequency||25.8%|Medium|| |0193|Valid Phone Numbers||25.3%|Easy|| |0194|Transpose File||24.5%|Medium|| |0195|Tenth Line||32.9%|Easy|| -|0196|Delete Duplicate Emails||44.2%|Easy|| -|0197|Rising Temperature||39.5%|Easy|| +|0196|Delete Duplicate Emails||44.3%|Easy|| +|0197|Rising Temperature||39.6%|Easy|| |0198|House Robber|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0198.House-Robber)|42.7%|Medium|| -|0199|Binary Tree Right Side View|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0199.Binary-Tree-Right-Side-View)|55.6%|Medium|| +|0199|Binary Tree Right Side View|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0199.Binary-Tree-Right-Side-View)|55.7%|Medium|| |0200|Number of Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0200.Number-of-Islands)|48.5%|Medium|| |0201|Bitwise AND of Numbers Range|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0201.Bitwise-AND-of-Numbers-Range)|39.6%|Medium|| |0202|Happy Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0202.Happy-Number)|51.1%|Easy|| |0203|Remove Linked List Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0203.Remove-Linked-List-Elements)|39.0%|Easy|| |0204|Count Primes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0204.Count-Primes)|32.1%|Easy|| |0205|Isomorphic Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0205.Isomorphic-Strings)|40.3%|Easy|| -|0206|Reverse Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0206.Reverse-Linked-List)|64.6%|Easy|| +|0206|Reverse Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0206.Reverse-Linked-List)|64.7%|Easy|| |0207|Course Schedule|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0207.Course-Schedule)|44.2%|Medium|| -|0208|Implement Trie (Prefix Tree)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0208.Implement-Trie-(Prefix-Tree))|51.4%|Medium|| +|0208|Implement Trie (Prefix Tree)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0208.Implement-Trie-(Prefix-Tree))|51.5%|Medium|| |0209|Minimum Size Subarray Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0209.Minimum-Size-Subarray-Sum)|39.1%|Medium|| |0210|Course Schedule II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0210.Course-Schedule-II)|42.2%|Medium|| |0211|Design Add and Search Words Data Structure|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0211.Design-Add-and-Search-Words-Data-Structure)|39.7%|Medium|| -|0212|Word Search II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0212.Word-Search-II)|36.4%|Hard|| +|0212|Word Search II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0212.Word-Search-II)|36.5%|Hard|| |0213|House Robber II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0213.House-Robber-II)|37.4%|Medium|| -|0214|Shortest Palindrome||30.4%|Hard|| -|0215|Kth Largest Element in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0215.Kth-Largest-Element-in-an-Array)|57.4%|Medium|| -|0216|Combination Sum III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0216.Combination-Sum-III)|59.8%|Medium|| +|0214|Shortest Palindrome||30.5%|Hard|| +|0215|Kth Largest Element in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0215.Kth-Largest-Element-in-an-Array)|57.5%|Medium|| +|0216|Combination Sum III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0216.Combination-Sum-III)|59.9%|Medium|| |0217|Contains Duplicate|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0217.Contains-Duplicate)|56.5%|Easy|| |0218|The Skyline Problem|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0218.The-Skyline-Problem)|36.0%|Hard|| -|0219|Contains Duplicate II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0219.Contains-Duplicate-II)|38.4%|Easy|| +|0219|Contains Duplicate II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0219.Contains-Duplicate-II)|38.5%|Easy|| |0220|Contains Duplicate III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0220.Contains-Duplicate-III)|21.3%|Medium|| -|0221|Maximal Square||38.6%|Medium|| +|0221|Maximal Square||38.7%|Medium|| |0222|Count Complete Tree Nodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0222.Count-Complete-Tree-Nodes)|48.7%|Medium|| |0223|Rectangle Area|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0223.Rectangle-Area)|38.1%|Medium|| -|0224|Basic Calculator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0224.Basic-Calculator)|37.9%|Hard|| -|0225|Implement Stack using Queues|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0225.Implement-Stack-using-Queues)|46.8%|Easy|| +|0224|Basic Calculator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0224.Basic-Calculator)|38.0%|Hard|| +|0225|Implement Stack using Queues|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0225.Implement-Stack-using-Queues)|46.9%|Easy|| |0226|Invert Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0226.Invert-Binary-Tree)|66.5%|Easy|| -|0227|Basic Calculator II||38.2%|Medium|| -|0228|Summary Ranges||42.0%|Easy|| -|0229|Majority Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0229.Majority-Element-II)|38.4%|Medium|| -|0230|Kth Smallest Element in a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0230.Kth-Smallest-Element-in-a-BST)|62.0%|Medium|| +|0227|Basic Calculator II||38.3%|Medium|| +|0228|Summary Ranges|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0228.Summary-Ranges)|42.1%|Easy|| +|0229|Majority Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0229.Majority-Element-II)|38.5%|Medium|| +|0230|Kth Smallest Element in a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0230.Kth-Smallest-Element-in-a-BST)|62.1%|Medium|| |0231|Power of Two|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0231.Power-of-Two)|43.8%|Easy|| -|0232|Implement Queue using Stacks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0232.Implement-Queue-using-Stacks)|51.5%|Easy|| +|0232|Implement Queue using Stacks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0232.Implement-Queue-using-Stacks)|51.6%|Easy|| |0233|Number of Digit One||31.6%|Hard|| |0234|Palindrome Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0234.Palindrome-Linked-List)|40.2%|Easy|| |0235|Lowest Common Ancestor of a Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree)|51.3%|Easy|| -|0236|Lowest Common Ancestor of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree)|48.0%|Medium|| -|0237|Delete Node in a Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0237.Delete-Node-in-a-Linked-List)|66.1%|Easy|| +|0236|Lowest Common Ancestor of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree)|48.1%|Medium|| +|0237|Delete Node in a Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0237.Delete-Node-in-a-Linked-List)|66.2%|Easy|| |0238|Product of Array Except Self||61.2%|Medium|| |0239|Sliding Window Maximum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0239.Sliding-Window-Maximum)|44.5%|Hard|| -|0240|Search a 2D Matrix II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0240.Search-a-2D-Matrix-II)|44.0%|Medium|| +|0240|Search a 2D Matrix II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0240.Search-a-2D-Matrix-II)|44.1%|Medium|| |0241|Different Ways to Add Parentheses||56.9%|Medium|| |0242|Valid Anagram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0242.Valid-Anagram)|57.9%|Easy|| -|0243|Shortest Word Distance||61.7%|Easy|| -|0244|Shortest Word Distance II||53.4%|Medium|| +|0243|Shortest Word Distance||61.8%|Easy|| +|0244|Shortest Word Distance II||53.5%|Medium|| |0245|Shortest Word Distance III||55.8%|Medium|| -|0246|Strobogrammatic Number||45.6%|Easy|| +|0246|Strobogrammatic Number||45.7%|Easy|| |0247|Strobogrammatic Number II||48.3%|Medium|| |0248|Strobogrammatic Number III||40.1%|Hard|| -|0249|Group Shifted Strings||57.5%|Medium|| +|0249|Group Shifted Strings||57.6%|Medium|| |0250|Count Univalue Subtrees||53.0%|Medium|| |0251|Flatten 2D Vector||46.2%|Medium|| -|0252|Meeting Rooms||55.2%|Easy|| +|0252|Meeting Rooms||55.3%|Easy|| |0253|Meeting Rooms II||46.5%|Medium|| |0254|Factor Combinations||47.2%|Medium|| |0255|Verify Preorder Sequence in Binary Search Tree||46.0%|Medium|| @@ -385,53 +385,53 @@ |0259|3Sum Smaller||48.7%|Medium|| |0260|Single Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0260.Single-Number-III)|65.2%|Medium|| |0261|Graph Valid Tree||42.9%|Medium|| -|0262|Trips and Users||35.3%|Hard|| +|0262|Trips and Users||35.4%|Hard|| |0263|Ugly Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0263.Ugly-Number)|41.7%|Easy|| |0264|Ugly Number II||42.7%|Medium|| |0265|Paint House II||45.4%|Hard|| -|0266|Palindrome Permutation||62.6%|Easy|| +|0266|Palindrome Permutation||62.5%|Easy|| |0267|Palindrome Permutation II||37.2%|Medium|| -|0268|Missing Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0268.Missing-Number)|53.2%|Easy|| -|0269|Alien Dictionary||33.5%|Hard|| +|0268|Missing Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0268.Missing-Number)|53.3%|Easy|| +|0269|Alien Dictionary||33.6%|Hard|| |0270|Closest Binary Search Tree Value||49.6%|Easy|| |0271|Encode and Decode Strings||32.4%|Medium|| -|0272|Closest Binary Search Tree Value II||51.7%|Hard|| +|0272|Closest Binary Search Tree Value II||51.9%|Hard|| |0273|Integer to English Words||27.9%|Hard|| |0274|H-Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0274.H-Index)|36.3%|Medium|| |0275|H-Index II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0275.H-Index-II)|36.2%|Medium|| |0276|Paint Fence||38.9%|Easy|| |0277|Find the Celebrity||43.1%|Medium|| |0278|First Bad Version||37.1%|Easy|| -|0279|Perfect Squares||48.5%|Medium|| +|0279|Perfect Squares||48.6%|Medium|| |0280|Wiggle Sort||64.5%|Medium|| |0281|Zigzag Iterator||59.2%|Medium|| |0282|Expression Add Operators||36.5%|Hard|| |0283|Move Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0283.Move-Zeroes)|58.4%|Easy|| -|0284|Peeking Iterator||47.3%|Medium|| -|0285|Inorder Successor in BST||42.2%|Medium|| +|0284|Peeking Iterator||47.4%|Medium|| +|0285|Inorder Successor in BST||42.3%|Medium|| |0286|Walls and Gates||55.9%|Medium|| -|0287|Find the Duplicate Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0287.Find-the-Duplicate-Number)|57.0%|Medium|| -|0288|Unique Word Abbreviation||22.7%|Medium|| -|0289|Game of Life||57.6%|Medium|| +|0287|Find the Duplicate Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0287.Find-the-Duplicate-Number)|57.1%|Medium|| +|0288|Unique Word Abbreviation||22.8%|Medium|| +|0289|Game of Life||57.7%|Medium|| |0290|Word Pattern|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0290.Word-Pattern)|38.2%|Easy|| |0291|Word Pattern II||44.0%|Hard|| -|0292|Nim Game||54.9%|Easy|| +|0292|Nim Game||55.0%|Easy|| |0293|Flip Game||61.2%|Easy|| |0294|Flip Game II||50.5%|Medium|| -|0295|Find Median from Data Stream||46.3%|Hard|| +|0295|Find Median from Data Stream||46.4%|Hard|| |0296|Best Meeting Point||58.0%|Hard|| |0297|Serialize and Deserialize Binary Tree||49.3%|Hard|| |0298|Binary Tree Longest Consecutive Sequence||47.8%|Medium|| -|0299|Bulls and Cows||44.2%|Medium|| -|0300|Longest Increasing Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0300.Longest-Increasing-Subsequence)|43.5%|Medium|| -|0301|Remove Invalid Parentheses||44.3%|Hard|| +|0299|Bulls and Cows||44.3%|Medium|| +|0300|Longest Increasing Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0300.Longest-Increasing-Subsequence)|43.6%|Medium|| +|0301|Remove Invalid Parentheses||44.4%|Hard|| |0302|Smallest Rectangle Enclosing Black Pixels||52.3%|Hard|| -|0303|Range Sum Query - Immutable|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0303.Range-Sum-Query---Immutable)|46.9%|Easy|| -|0304|Range Sum Query 2D - Immutable||40.1%|Medium|| +|0303|Range Sum Query - Immutable|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0303.Range-Sum-Query---Immutable)|47.0%|Easy|| +|0304|Range Sum Query 2D - Immutable||40.2%|Medium|| |0305|Number of Islands II||39.8%|Hard|| -|0306|Additive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0306.Additive-Number)|29.5%|Medium|| -|0307|Range Sum Query - Mutable|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0307.Range-Sum-Query---Mutable)|36.4%|Medium|| -|0308|Range Sum Query 2D - Mutable||37.1%|Hard|| +|0306|Additive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0306.Additive-Number)|29.6%|Medium|| +|0307|Range Sum Query - Mutable|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0307.Range-Sum-Query---Mutable)|36.5%|Medium|| +|0308|Range Sum Query 2D - Mutable||37.2%|Hard|| |0309|Best Time to Buy and Sell Stock with Cooldown|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown)|48.0%|Medium|| |0310|Minimum Height Trees||34.5%|Medium|| |0311|Sparse Matrix Multiplication||63.5%|Medium|| @@ -445,53 +445,53 @@ |0319|Bulb Switcher||45.3%|Medium|| |0320|Generalized Abbreviation||53.3%|Medium|| |0321|Create Maximum Number||27.4%|Hard|| -|0322|Coin Change|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0322.Coin-Change)|36.8%|Medium|| +|0322|Coin Change|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0322.Coin-Change)|36.9%|Medium|| |0323|Number of Connected Components in an Undirected Graph||57.3%|Medium|| |0324|Wiggle Sort II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0324.Wiggle-Sort-II)|30.5%|Medium|| |0325|Maximum Size Subarray Sum Equals k||47.2%|Medium|| -|0326|Power of Three|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0326.Power-of-Three)|42.0%|Easy|| +|0326|Power of Three|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0326.Power-of-Three)|42.1%|Easy|| |0327|Count of Range Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0327.Count-of-Range-Sum)|35.9%|Hard|| |0328|Odd Even Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0328.Odd-Even-Linked-List)|56.8%|Medium|| -|0329|Longest Increasing Path in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0329.Longest-Increasing-Path-in-a-Matrix)|44.3%|Hard|| +|0329|Longest Increasing Path in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0329.Longest-Increasing-Path-in-a-Matrix)|44.4%|Hard|| |0330|Patching Array||34.9%|Hard|| |0331|Verify Preorder Serialization of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree)|40.9%|Medium|| |0332|Reconstruct Itinerary||37.6%|Medium|| |0333|Largest BST Subtree||37.3%|Medium|| -|0334|Increasing Triplet Subsequence||40.5%|Medium|| +|0334|Increasing Triplet Subsequence||40.6%|Medium|| |0335|Self Crossing||28.5%|Hard|| |0336|Palindrome Pairs||34.4%|Hard|| |0337|House Robber III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0337.House-Robber-III)|51.7%|Medium|| |0338|Counting Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0338.Counting-Bits)|70.2%|Medium|| -|0339|Nested List Weight Sum||75.4%|Easy|| -|0340|Longest Substring with At Most K Distinct Characters||45.1%|Medium|| -|0341|Flatten Nested List Iterator||54.1%|Medium|| +|0339|Nested List Weight Sum||75.5%|Easy|| +|0340|Longest Substring with At Most K Distinct Characters||45.2%|Medium|| +|0341|Flatten Nested List Iterator||54.2%|Medium|| |0342|Power of Four|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0342.Power-of-Four)|41.6%|Easy|| |0343|Integer Break|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0343.Integer-Break)|51.0%|Medium|| |0344|Reverse String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0344.Reverse-String)|69.9%|Easy|| |0345|Reverse Vowels of a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0345.Reverse-Vowels-of-a-String)|44.9%|Easy|| -|0346|Moving Average from Data Stream||72.7%|Easy|| -|0347|Top K Frequent Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0347.Top-K-Frequent-Elements)|62.1%|Medium|| +|0346|Moving Average from Data Stream||72.8%|Easy|| +|0347|Top K Frequent Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0347.Top-K-Frequent-Elements)|62.2%|Medium|| |0348|Design Tic-Tac-Toe||55.3%|Medium|| |0349|Intersection of Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0349.Intersection-of-Two-Arrays)|64.3%|Easy|| |0350|Intersection of Two Arrays II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0350.Intersection-of-Two-Arrays-II)|51.9%|Easy|| -|0351|Android Unlock Patterns||49.3%|Medium|| +|0351|Android Unlock Patterns||49.4%|Medium|| |0352|Data Stream as Disjoint Intervals||48.4%|Hard|| -|0353|Design Snake Game||35.1%|Medium|| +|0353|Design Snake Game||35.2%|Medium|| |0354|Russian Doll Envelopes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0354.Russian-Doll-Envelopes)|36.1%|Hard|| -|0355|Design Twitter||31.0%|Medium|| +|0355|Design Twitter||31.1%|Medium|| |0356|Line Reflection||32.6%|Medium|| |0357|Count Numbers with Unique Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0357.Count-Numbers-with-Unique-Digits)|48.7%|Medium|| -|0358|Rearrange String k Distance Apart||35.5%|Hard|| -|0359|Logger Rate Limiter||71.8%|Easy|| +|0358|Rearrange String k Distance Apart||35.6%|Hard|| +|0359|Logger Rate Limiter||71.9%|Easy|| |0360|Sort Transformed Array||49.5%|Medium|| |0361|Bomb Enemy||46.5%|Medium|| |0362|Design Hit Counter||64.9%|Medium|| |0363|Max Sum of Rectangle No Larger Than K||38.3%|Hard|| |0364|Nested List Weight Sum II||63.4%|Medium|| -|0365|Water and Jug Problem||30.9%|Medium|| -|0366|Find Leaves of Binary Tree||71.5%|Medium|| +|0365|Water and Jug Problem||31.0%|Medium|| +|0366|Find Leaves of Binary Tree||71.6%|Medium|| |0367|Valid Perfect Square|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0367.Valid-Perfect-Square)|42.0%|Easy|| -|0368|Largest Divisible Subset||38.1%|Medium|| +|0368|Largest Divisible Subset||38.2%|Medium|| |0369|Plus One Linked List||59.4%|Medium|| |0370|Range Addition||63.4%|Medium|| |0371|Sum of Two Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0371.Sum-of-Two-Integers)|50.6%|Medium|| @@ -500,121 +500,121 @@ |0374|Guess Number Higher or Lower||44.3%|Easy|| |0375|Guess Number Higher or Lower II||41.8%|Medium|| |0376|Wiggle Subsequence||40.1%|Medium|| -|0377|Combination Sum IV||45.8%|Medium|| +|0377|Combination Sum IV||45.9%|Medium|| |0378|Kth Smallest Element in a Sorted Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0378.Kth-Smallest-Element-in-a-Sorted-Matrix)|55.8%|Medium|| -|0379|Design Phone Directory||47.6%|Medium|| -|0380|Insert Delete GetRandom O(1)||48.5%|Medium|| +|0379|Design Phone Directory||47.7%|Medium|| +|0380|Insert Delete GetRandom O(1)||48.6%|Medium|| |0381|Insert Delete GetRandom O(1) - Duplicates allowed||34.7%|Hard|| |0382|Linked List Random Node||53.9%|Medium|| |0383|Ransom Note||53.2%|Easy|| -|0384|Shuffle an Array||53.7%|Medium|| +|0384|Shuffle an Array||53.8%|Medium|| |0385|Mini Parser|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0385.Mini-Parser)|34.3%|Medium|| -|0386|Lexicographical Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0386.Lexicographical-Numbers)|53.5%|Medium|| +|0386|Lexicographical Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0386.Lexicographical-Numbers)|53.6%|Medium|| |0387|First Unique Character in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0387.First-Unique-Character-in-a-String)|53.7%|Easy|| -|0388|Longest Absolute File Path||42.4%|Medium|| -|0389|Find the Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0389.Find-the-Difference)|57.6%|Easy|| -|0390|Elimination Game||44.8%|Medium|| +|0388|Longest Absolute File Path||42.5%|Medium|| +|0389|Find the Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0389.Find-the-Difference)|57.7%|Easy|| +|0390|Elimination Game||44.9%|Medium|| |0391|Perfect Rectangle||31.0%|Hard|| -|0392|Is Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0392.Is-Subsequence)|49.4%|Easy|| +|0392|Is Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0392.Is-Subsequence)|49.5%|Easy|| |0393|UTF-8 Validation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0393.UTF-8-Validation)|37.9%|Medium|| |0394|Decode String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0394.Decode-String)|52.3%|Medium|| |0395|Longest Substring with At Least K Repeating Characters||43.3%|Medium|| |0396|Rotate Function||36.6%|Medium|| -|0397|Integer Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0397.Integer-Replacement)|33.3%|Medium|| +|0397|Integer Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0397.Integer-Replacement)|33.4%|Medium|| |0398|Random Pick Index||57.5%|Medium|| |0399|Evaluate Division|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0399.Evaluate-Division)|53.9%|Medium|| |0400|Nth Digit||32.3%|Medium|| -|0401|Binary Watch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0401.Binary-Watch)|48.2%|Easy|| +|0401|Binary Watch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0401.Binary-Watch)|48.3%|Easy|| |0402|Remove K Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0402.Remove-K-Digits)|28.6%|Medium|| -|0403|Frog Jump||41.0%|Hard|| +|0403|Frog Jump||41.1%|Hard|| |0404|Sum of Left Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0404.Sum-of-Left-Leaves)|52.2%|Easy|| |0405|Convert a Number to Hexadecimal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0405.Convert-a-Number-to-Hexadecimal)|44.3%|Easy|| |0406|Queue Reconstruction by Height||68.0%|Medium|| -|0407|Trapping Rain Water II||43.7%|Hard|| -|0408|Valid Word Abbreviation||31.2%|Easy|| +|0407|Trapping Rain Water II||43.8%|Hard|| +|0408|Valid Word Abbreviation||31.3%|Easy|| |0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.1%|Easy|| |0410|Split Array Largest Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0410.Split-Array-Largest-Sum)|46.0%|Hard|| -|0411|Minimum Unique Word Abbreviation||36.9%|Hard|| +|0411|Minimum Unique Word Abbreviation||37.0%|Hard|| |0412|Fizz Buzz|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0412.Fizz-Buzz)|63.5%|Easy|| |0413|Arithmetic Slices||58.4%|Medium|| |0414|Third Maximum Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0414.Third-Maximum-Number)|30.6%|Easy|| |0415|Add Strings||48.1%|Easy|| |0416|Partition Equal Subset Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0416.Partition-Equal-Subset-Sum)|44.7%|Medium|| -|0417|Pacific Atlantic Water Flow||42.2%|Medium|| -|0418|Sentence Screen Fitting||32.9%|Medium|| -|0419|Battleships in a Board||70.8%|Medium|| +|0417|Pacific Atlantic Water Flow||42.3%|Medium|| +|0418|Sentence Screen Fitting||33.0%|Medium|| +|0419|Battleships in a Board||70.9%|Medium|| |0420|Strong Password Checker||13.8%|Hard|| |0421|Maximum XOR of Two Numbers in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0421.Maximum-XOR-of-Two-Numbers-in-an-Array)|53.9%|Medium|| |0422|Valid Word Square||38.0%|Easy|| -|0423|Reconstruct Original Digits from English||47.3%|Medium|| -|0424|Longest Repeating Character Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0424.Longest-Repeating-Character-Replacement)|47.9%|Medium|| -|0425|Word Squares||49.8%|Hard|| +|0423|Reconstruct Original Digits from English||47.4%|Medium|| +|0424|Longest Repeating Character Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0424.Longest-Repeating-Character-Replacement)|48.0%|Medium|| +|0425|Word Squares||49.9%|Hard|| |0426|Convert Binary Search Tree to Sorted Doubly Linked List||60.7%|Medium|| -|0427|Construct Quad Tree||62.3%|Medium|| -|0428|Serialize and Deserialize N-ary Tree||61.0%|Hard|| +|0427|Construct Quad Tree||62.4%|Medium|| +|0428|Serialize and Deserialize N-ary Tree||61.1%|Hard|| |0429|N-ary Tree Level Order Traversal||66.3%|Medium|| |0430|Flatten a Multilevel Doubly Linked List||56.6%|Medium|| |0431|Encode N-ary Tree to Binary Tree||74.4%|Hard|| |0432|All O`one Data Structure||33.0%|Hard|| -|0433|Minimum Genetic Mutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0433.Minimum-Genetic-Mutation)|42.9%|Medium|| +|0433|Minimum Genetic Mutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0433.Minimum-Genetic-Mutation)|43.0%|Medium|| |0434|Number of Segments in a String||37.8%|Easy|| |0435|Non-overlapping Intervals|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0435.Non-overlapping-Intervals)|43.8%|Medium|| |0436|Find Right Interval|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0436.Find-Right-Interval)|48.4%|Medium|| |0437|Path Sum III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0437.Path-Sum-III)|47.9%|Medium|| |0438|Find All Anagrams in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0438.Find-All-Anagrams-in-a-String)|44.6%|Medium|| |0439|Ternary Expression Parser||56.5%|Medium|| -|0440|K-th Smallest in Lexicographical Order||29.6%|Hard|| +|0440|K-th Smallest in Lexicographical Order||29.7%|Hard|| |0441|Arranging Coins|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0441.Arranging-Coins)|42.3%|Easy|| |0442|Find All Duplicates in an Array||68.7%|Medium|| -|0443|String Compression||42.9%|Medium|| +|0443|String Compression||43.0%|Medium|| |0444|Sequence Reconstruction||23.4%|Medium|| |0445|Add Two Numbers II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0445.Add-Two-Numbers-II)|56.0%|Medium|| |0446|Arithmetic Slices II - Subsequence||33.2%|Hard|| |0447|Number of Boomerangs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0447.Number-of-Boomerangs)|52.3%|Medium|| |0448|Find All Numbers Disappeared in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array)|56.1%|Easy|| -|0449|Serialize and Deserialize BST||53.7%|Medium|| +|0449|Serialize and Deserialize BST||53.8%|Medium|| |0450|Delete Node in a BST||45.1%|Medium|| |0451|Sort Characters By Frequency|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0451.Sort-Characters-By-Frequency)|64.1%|Medium|| |0452|Minimum Number of Arrows to Burst Balloons||49.7%|Medium|| -|0453|Minimum Moves to Equal Array Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0453.Minimum-Moves-to-Equal-Array-Elements)|50.6%|Easy|| +|0453|Minimum Moves to Equal Array Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0453.Minimum-Moves-to-Equal-Array-Elements)|50.7%|Easy|| |0454|4Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0454.4Sum-II)|54.5%|Medium|| -|0455|Assign Cookies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0455.Assign-Cookies)|50.3%|Easy|| +|0455|Assign Cookies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0455.Assign-Cookies)|50.4%|Easy|| |0456|132 Pattern|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0456.132-Pattern)|30.6%|Medium|| -|0457|Circular Array Loop|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0457.Circular-Array-Loop)|29.9%|Medium|| +|0457|Circular Array Loop|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0457.Circular-Array-Loop)|30.0%|Medium|| |0458|Poor Pigs||54.4%|Hard|| |0459|Repeated Substring Pattern||43.2%|Easy|| -|0460|LFU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0460.LFU-Cache)|35.6%|Hard|| +|0460|LFU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0460.LFU-Cache)|35.7%|Hard|| |0461|Hamming Distance|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0461.Hamming-Distance)|73.1%|Easy|| |0462|Minimum Moves to Equal Array Elements II||54.3%|Medium|| |0463|Island Perimeter|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0463.Island-Perimeter)|66.5%|Easy|| -|0464|Can I Win||29.5%|Medium|| -|0465|Optimal Account Balancing||48.0%|Hard|| +|0464|Can I Win||29.6%|Medium|| +|0465|Optimal Account Balancing||48.1%|Hard|| |0466|Count The Repetitions||28.6%|Hard|| |0467|Unique Substrings in Wraparound String||36.0%|Medium|| |0468|Validate IP Address||24.8%|Medium|| -|0469|Convex Polygon||37.3%|Medium|| +|0469|Convex Polygon||37.4%|Medium|| |0470|Implement Rand10() Using Rand7()|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0470.Implement-Rand10()-Using-Rand7())|46.0%|Medium|| -|0471|Encode String with Shortest Length||48.8%|Hard|| +|0471|Encode String with Shortest Length||48.9%|Hard|| |0472|Concatenated Words||44.7%|Hard|| |0473|Matchsticks to Square||38.1%|Medium|| |0474|Ones and Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0474.Ones-and-Zeroes)|43.4%|Medium|| |0475|Heaters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0475.Heaters)|33.5%|Medium|| |0476|Number Complement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0476.Number-Complement)|65.1%|Easy|| |0477|Total Hamming Distance|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0477.Total-Hamming-Distance)|50.6%|Medium|| -|0478|Generate Random Point in a Circle||38.9%|Medium|| -|0479|Largest Palindrome Product||29.4%|Hard|| +|0478|Generate Random Point in a Circle||39.0%|Medium|| +|0479|Largest Palindrome Product||29.5%|Hard|| |0480|Sliding Window Median|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0480.Sliding-Window-Median)|38.4%|Hard|| |0481|Magical String||48.0%|Medium|| |0482|License Key Formatting||43.0%|Easy|| |0483|Smallest Good Base|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0483.Smallest-Good-Base)|36.2%|Hard|| |0484|Find Permutation||64.0%|Medium|| -|0485|Max Consecutive Ones|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0485.Max-Consecutive-Ones)|53.3%|Easy|| +|0485|Max Consecutive Ones|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0485.Max-Consecutive-Ones)|53.2%|Easy|| |0486|Predict the Winner||48.4%|Medium|| |0487|Max Consecutive Ones II||47.8%|Medium|| -|0488|Zuma Game||38.7%|Hard|| -|0489|Robot Room Cleaner||72.0%|Hard|| +|0488|Zuma Game||38.6%|Hard|| +|0489|Robot Room Cleaner||72.1%|Hard|| |0490|The Maze||52.5%|Medium|| -|0491|Increasing Subsequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0491.Increasing-Subsequences)|47.2%|Medium|| +|0491|Increasing Subsequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0491.Increasing-Subsequences)|47.3%|Medium|| |0492|Construct the Rectangle||50.2%|Easy|| |0493|Reverse Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0493.Reverse-Pairs)|26.5%|Hard|| |0494|Target Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0494.Target-Sum)|45.9%|Medium|| @@ -623,7 +623,7 @@ |0497|Random Point in Non-overlapping Rectangles|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles)|39.1%|Medium|| |0498|Diagonal Traverse|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0498.Diagonal-Traverse)|50.1%|Medium|| |0499|The Maze III||42.1%|Hard|| -|0500|Keyboard Row|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0500.Keyboard-Row)|65.4%|Easy|| +|0500|Keyboard Row|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0500.Keyboard-Row)|65.5%|Easy|| |0501|Find Mode in Binary Search Tree||43.2%|Easy|| |0502|IPO||41.3%|Hard|| |0503|Next Greater Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0503.Next-Greater-Element-II)|58.1%|Medium|| @@ -631,24 +631,24 @@ |0505|The Maze II||48.3%|Medium|| |0506|Relative Ranks||51.0%|Easy|| |0507|Perfect Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0507.Perfect-Number)|36.0%|Easy|| -|0508|Most Frequent Subtree Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0508.Most-Frequent-Subtree-Sum)|58.8%|Medium|| +|0508|Most Frequent Subtree Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0508.Most-Frequent-Subtree-Sum)|58.9%|Medium|| |0509|Fibonacci Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0509.Fibonacci-Number)|67.2%|Easy|| |0510|Inorder Successor in BST II||59.8%|Medium|| -|0511|Game Play Analysis I||81.3%|Easy|| -|0512|Game Play Analysis II||55.9%|Easy|| +|0511|Game Play Analysis I||81.2%|Easy|| +|0512|Game Play Analysis II||55.8%|Easy|| |0513|Find Bottom Left Tree Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0513.Find-Bottom-Left-Tree-Value)|62.3%|Medium|| -|0514|Freedom Trail||44.8%|Hard|| +|0514|Freedom Trail||44.7%|Hard|| |0515|Find Largest Value in Each Tree Row|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0515.Find-Largest-Value-in-Each-Tree-Row)|62.0%|Medium|| -|0516|Longest Palindromic Subsequence||54.8%|Medium|| +|0516|Longest Palindromic Subsequence||54.9%|Medium|| |0517|Super Washing Machines||38.5%|Hard|| -|0518|Coin Change 2||51.3%|Medium|| +|0518|Coin Change 2||51.4%|Medium|| |0519|Random Flip Matrix||37.6%|Medium|| -|0520|Detect Capital||53.8%|Easy|| +|0520|Detect Capital||53.9%|Easy|| |0521|Longest Uncommon Subsequence I||58.4%|Easy|| |0522|Longest Uncommon Subsequence II||34.1%|Medium|| |0523|Continuous Subarray Sum||24.7%|Medium|| |0524|Longest Word in Dictionary through Deleting|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0524.Longest-Word-in-Dictionary-through-Deleting)|48.9%|Medium|| -|0525|Contiguous Array||43.3%|Medium|| +|0525|Contiguous Array||43.4%|Medium|| |0526|Beautiful Arrangement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0526.Beautiful-Arrangement)|61.7%|Medium|| |0527|Word Abbreviation||55.9%|Hard|| |0528|Random Pick with Weight|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0528.Random-Pick-with-Weight)|44.5%|Medium|| @@ -657,146 +657,146 @@ |0531|Lonely Pixel I||59.4%|Medium|| |0532|K-diff Pairs in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0532.K-diff-Pairs-in-an-Array)|34.8%|Medium|| |0533|Lonely Pixel II||48.0%|Medium|| -|0534|Game Play Analysis III||78.5%|Medium|| +|0534|Game Play Analysis III||78.6%|Medium|| |0535|Encode and Decode TinyURL||80.7%|Medium|| |0536|Construct Binary Tree from String||50.3%|Medium|| |0537|Complex Number Multiplication|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0537.Complex-Number-Multiplication)|68.3%|Medium|| |0538|Convert BST to Greater Tree||56.5%|Medium|| -|0539|Minimum Time Difference||52.1%|Medium|| +|0539|Minimum Time Difference||52.2%|Medium|| |0540|Single Element in a Sorted Array||57.9%|Medium|| |0541|Reverse String II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0541.Reverse-String-II)|49.0%|Easy|| -|0542|01 Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0542.01-Matrix)|40.5%|Medium|| +|0542|01 Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0542.01-Matrix)|40.6%|Medium|| |0543|Diameter of Binary Tree||49.0%|Easy|| |0544|Output Contest Matches||75.7%|Medium|| |0545|Boundary of Binary Tree||39.4%|Medium|| |0546|Remove Boxes||44.2%|Hard|| -|0547|Number of Provinces|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0547.Number-of-Provinces)|59.9%|Medium|| +|0547|Number of Provinces|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0547.Number-of-Provinces)|60.0%|Medium|| |0548|Split Array with Equal Sum||47.6%|Medium|| |0549|Binary Tree Longest Consecutive Sequence II||47.2%|Medium|| |0550|Game Play Analysis IV||46.1%|Medium|| |0551|Student Attendance Record I||46.0%|Easy|| |0552|Student Attendance Record II||37.2%|Hard|| |0553|Optimal Division||57.3%|Medium|| -|0554|Brick Wall||50.5%|Medium|| +|0554|Brick Wall||50.6%|Medium|| |0555|Split Concatenated Strings||42.7%|Medium|| |0556|Next Greater Element III||33.5%|Medium|| |0557|Reverse Words in a String III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0557.Reverse-Words-in-a-String-III)|71.5%|Easy|| -|0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.4%|Medium|| -|0559|Maximum Depth of N-ary Tree||69.3%|Easy|| +|0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.5%|Medium|| +|0559|Maximum Depth of N-ary Tree||69.4%|Easy|| |0560|Subarray Sum Equals K||43.9%|Medium|| |0561|Array Partition I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0561.Array-Partition-I)|72.8%|Easy|| |0562|Longest Line of Consecutive One in Matrix||46.2%|Medium|| |0563|Binary Tree Tilt|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0563.Binary-Tree-Tilt)|52.6%|Easy|| |0564|Find the Closest Palindrome||20.2%|Hard|| |0565|Array Nesting||55.9%|Medium|| -|0566|Reshape the Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0566.Reshape-the-Matrix)|60.9%|Easy|| -|0567|Permutation in String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0567.Permutation-in-String)|44.5%|Medium|| +|0566|Reshape the Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0566.Reshape-the-Matrix)|61.0%|Easy|| +|0567|Permutation in String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0567.Permutation-in-String)|44.6%|Medium|| |0568|Maximum Vacation Days||41.4%|Hard|| |0569|Median Employee Salary||60.9%|Hard|| |0570|Managers with at Least 5 Direct Reports||66.6%|Medium|| -|0571|Find Median Given Frequency of Numbers||45.5%|Hard|| +|0571|Find Median Given Frequency of Numbers||45.4%|Hard|| |0572|Subtree of Another Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0572.Subtree-of-Another-Tree)|44.4%|Easy|| |0573|Squirrel Simulation||56.0%|Medium|| -|0574|Winning Candidate||51.1%|Medium|| -|0575|Distribute Candies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0575.Distribute-Candies)|61.8%|Easy|| -|0576|Out of Boundary Paths||35.7%|Medium|| -|0577|Employee Bonus||70.7%|Easy|| +|0574|Winning Candidate||51.2%|Medium|| +|0575|Distribute Candies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0575.Distribute-Candies)|61.9%|Easy|| +|0576|Out of Boundary Paths||35.8%|Medium|| +|0577|Employee Bonus||70.8%|Easy|| |0578|Get Highest Answer Rate Question||41.2%|Medium|| |0579|Find Cumulative Salary of an Employee||38.0%|Hard|| -|0580|Count Student Number in Departments||50.9%|Medium|| +|0580|Count Student Number in Departments||51.0%|Medium|| |0581|Shortest Unsorted Continuous Subarray||31.6%|Medium|| -|0582|Kill Process||62.3%|Medium|| +|0582|Kill Process||62.4%|Medium|| |0583|Delete Operation for Two Strings||49.7%|Medium|| |0584|Find Customer Referee||73.6%|Easy|| |0585|Investments in 2016||56.4%|Medium|| -|0586|Customer Placing the Largest Number of Orders||75.0%|Easy|| +|0586|Customer Placing the Largest Number of Orders||74.9%|Easy|| |0587|Erect the Fence||36.3%|Hard|| |0588|Design In-Memory File System||46.5%|Hard|| |0589|N-ary Tree Preorder Traversal||73.1%|Easy|| -|0590|N-ary Tree Postorder Traversal||73.1%|Easy|| +|0590|N-ary Tree Postorder Traversal||73.2%|Easy|| |0591|Tag Validator||34.6%|Hard|| |0592|Fraction Addition and Subtraction||50.0%|Medium|| |0593|Valid Square||43.3%|Medium|| |0594|Longest Harmonious Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0594.Longest-Harmonious-Subsequence)|47.7%|Easy|| |0595|Big Countries||78.2%|Easy|| -|0596|Classes More Than 5 Students||38.6%|Easy|| +|0596|Classes More Than 5 Students||38.7%|Easy|| |0597|Friend Requests I: Overall Acceptance Rate||41.6%|Easy|| -|0598|Range Addition II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0598.Range-Addition-II)|49.9%|Easy|| +|0598|Range Addition II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0598.Range-Addition-II)|50.0%|Easy|| |0599|Minimum Index Sum of Two Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0599.Minimum-Index-Sum-of-Two-Lists)|51.5%|Easy|| |0600|Non-negative Integers without Consecutive Ones||34.5%|Hard|| -|0601|Human Traffic of Stadium||44.2%|Hard|| -|0602|Friend Requests II: Who Has the Most Friends||56.5%|Medium|| +|0601|Human Traffic of Stadium||44.3%|Hard|| +|0602|Friend Requests II: Who Has the Most Friends||56.6%|Medium|| |0603|Consecutive Available Seats||65.6%|Easy|| |0604|Design Compressed String Iterator||38.0%|Easy|| |0605|Can Place Flowers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0605.Can-Place-Flowers)|31.9%|Easy|| |0606|Construct String from Binary Tree||55.0%|Easy|| |0607|Sales Person||64.6%|Easy|| -|0608|Tree Node||68.9%|Medium|| +|0608|Tree Node||69.0%|Medium|| |0609|Find Duplicate File in System||60.8%|Medium|| -|0610|Triangle Judgement||67.8%|Easy|| +|0610|Triangle Judgement||67.9%|Easy|| |0611|Valid Triangle Number||49.0%|Medium|| -|0612|Shortest Distance in a Plane||60.8%|Medium|| +|0612|Shortest Distance in a Plane||60.9%|Medium|| |0613|Shortest Distance in a Line||79.1%|Easy|| -|0614|Second Degree Follower||32.0%|Medium|| -|0615|Average Salary: Departments VS Company||51.2%|Hard|| -|0616|Add Bold Tag in String||44.3%|Medium|| +|0614|Second Degree Follower||32.1%|Medium|| +|0615|Average Salary: Departments VS Company||51.3%|Hard|| +|0616|Add Bold Tag in String||44.4%|Medium|| |0617|Merge Two Binary Trees||75.1%|Easy|| -|0618|Students Report By Geography||58.6%|Hard|| +|0618|Students Report By Geography||58.7%|Hard|| |0619|Biggest Single Number||44.5%|Easy|| -|0620|Not Boring Movies||69.2%|Easy|| +|0620|Not Boring Movies||69.3%|Easy|| |0621|Task Scheduler||51.4%|Medium|| |0622|Design Circular Queue||45.0%|Medium|| |0623|Add One Row to Tree||50.2%|Medium|| |0624|Maximum Distance in Arrays||39.4%|Medium|| |0625|Minimum Factorization||32.9%|Medium|| -|0626|Exchange Seats||64.8%|Medium|| +|0626|Exchange Seats||64.9%|Medium|| |0627|Swap Salary||77.1%|Easy|| |0628|Maximum Product of Three Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0628.Maximum-Product-of-Three-Numbers)|47.0%|Easy|| |0629|K Inverse Pairs Array||31.6%|Hard|| -|0630|Course Schedule III||33.6%|Hard|| +|0630|Course Schedule III||33.7%|Hard|| |0631|Design Excel Sum Formula||32.1%|Hard|| -|0632|Smallest Range Covering Elements from K Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists)|53.8%|Hard|| +|0632|Smallest Range Covering Elements from K Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists)|53.9%|Hard|| |0633|Sum of Square Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0633.Sum-of-Square-Numbers)|32.4%|Medium|| |0634|Find the Derangement of An Array||40.4%|Medium|| |0635|Design Log Storage System||59.3%|Medium|| -|0636|Exclusive Time of Functions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0636.Exclusive-Time-of-Functions)|53.8%|Medium|| +|0636|Exclusive Time of Functions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0636.Exclusive-Time-of-Functions)|53.9%|Medium|| |0637|Average of Levels in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0637.Average-of-Levels-in-Binary-Tree)|64.4%|Easy|| -|0638|Shopping Offers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0638.Shopping-Offers)|52.4%|Medium|| +|0638|Shopping Offers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0638.Shopping-Offers)|52.5%|Medium|| |0639|Decode Ways II||27.4%|Hard|| |0640|Solve the Equation||42.6%|Medium|| -|0641|Design Circular Deque||54.5%|Medium|| -|0642|Design Search Autocomplete System||45.8%|Hard|| +|0641|Design Circular Deque||54.6%|Medium|| +|0642|Design Search Autocomplete System||45.9%|Hard|| |0643|Maximum Average Subarray I||42.0%|Easy|| |0644|Maximum Average Subarray II||33.9%|Hard|| -|0645|Set Mismatch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0645.Set-Mismatch)|42.4%|Easy|| -|0646|Maximum Length of Pair Chain||52.6%|Medium|| -|0647|Palindromic Substrings||61.6%|Medium|| -|0648|Replace Words|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0648.Replace-Words)|58.1%|Medium|| +|0645|Set Mismatch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0645.Set-Mismatch)|42.5%|Easy|| +|0646|Maximum Length of Pair Chain||52.7%|Medium|| +|0647|Palindromic Substrings||61.7%|Medium|| +|0648|Replace Words|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0648.Replace-Words)|58.2%|Medium|| |0649|Dota2 Senate||39.4%|Medium|| |0650|2 Keys Keyboard||49.8%|Medium|| |0651|4 Keys Keyboard||52.9%|Medium|| |0652|Find Duplicate Subtrees||51.9%|Medium|| |0653|Two Sum IV - Input is a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0653.Two-Sum-IV---Input-is-a-BST)|56.1%|Easy|| |0654|Maximum Binary Tree||80.8%|Medium|| -|0655|Print Binary Tree||55.7%|Medium|| +|0655|Print Binary Tree||55.8%|Medium|| |0656|Coin Path||29.5%|Hard|| |0657|Robot Return to Origin||73.6%|Easy|| |0658|Find K Closest Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0658.Find-K-Closest-Elements)|41.7%|Medium|| |0659|Split Array into Consecutive Subsequences||44.2%|Medium|| -|0660|Remove 9||54.0%|Hard|| +|0660|Remove 9||54.1%|Hard|| |0661|Image Smoother|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0661.Image-Smoother)|52.1%|Easy|| |0662|Maximum Width of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0662.Maximum-Width-of-Binary-Tree)|40.0%|Medium|| -|0663|Equal Tree Partition||39.6%|Medium|| +|0663|Equal Tree Partition||39.7%|Medium|| |0664|Strange Printer||41.2%|Hard|| |0665|Non-decreasing Array||19.6%|Easy|| |0666|Path Sum IV||55.6%|Medium|| -|0667|Beautiful Arrangement II||54.9%|Medium|| +|0667|Beautiful Arrangement II||55.0%|Medium|| |0668|Kth Smallest Number in Multiplication Table|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0668.Kth-Smallest-Number-in-Multiplication-Table)|47.6%|Hard|| |0669|Trim a Binary Search Tree||63.3%|Easy|| -|0670|Maximum Swap||44.8%|Medium|| +|0670|Maximum Swap||44.9%|Medium|| |0671|Second Minimum Node In a Binary Tree||42.7%|Easy|| |0672|Bulb Switcher II||51.0%|Medium|| -|0673|Number of Longest Increasing Subsequence||38.3%|Medium|| +|0673|Number of Longest Increasing Subsequence||38.4%|Medium|| |0674|Longest Continuous Increasing Subsequence||46.0%|Easy|| |0675|Cut Off Trees for Golf Event||35.1%|Hard|| |0676|Implement Magic Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0676.Implement-Magic-Dictionary)|55.1%|Medium|| @@ -805,37 +805,37 @@ |0679|24 Game||47.0%|Hard|| |0680|Valid Palindrome II||37.0%|Easy|| |0681|Next Closest Time||45.7%|Medium|| -|0682|Baseball Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0682.Baseball-Game)|65.9%|Easy|| +|0682|Baseball Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0682.Baseball-Game)|66.0%|Easy|| |0683|K Empty Slots||35.9%|Hard|| |0684|Redundant Connection|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0684.Redundant-Connection)|58.7%|Medium|| |0685|Redundant Connection II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0685.Redundant-Connection-II)|32.9%|Hard|| -|0686|Repeated String Match||32.7%|Medium|| -|0687|Longest Univalue Path||37.0%|Medium|| -|0688|Knight Probability in Chessboard||49.8%|Medium|| +|0686|Repeated String Match||32.8%|Medium|| +|0687|Longest Univalue Path||37.1%|Medium|| +|0688|Knight Probability in Chessboard||49.9%|Medium|| |0689|Maximum Sum of 3 Non-Overlapping Subarrays||47.1%|Hard|| |0690|Employee Importance||58.3%|Easy|| -|0691|Stickers to Spell Word||44.1%|Hard|| -|0692|Top K Frequent Words||52.8%|Medium|| +|0691|Stickers to Spell Word||44.2%|Hard|| +|0692|Top K Frequent Words||52.9%|Medium|| |0693|Binary Number with Alternating Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0693.Binary-Number-with-Alternating-Bits)|59.7%|Easy|| -|0694|Number of Distinct Islands||57.2%|Medium|| -|0695|Max Area of Island|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0695.Max-Area-of-Island)|64.2%|Medium|| +|0694|Number of Distinct Islands||57.3%|Medium|| +|0695|Max Area of Island|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0695.Max-Area-of-Island)|64.3%|Medium|| |0696|Count Binary Substrings||57.2%|Easy|| |0697|Degree of an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0697.Degree-of-an-Array)|54.3%|Easy|| |0698|Partition to K Equal Sum Subsets||45.5%|Medium|| |0699|Falling Squares|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0699.Falling-Squares)|42.4%|Hard|| -|0700|Search in a Binary Search Tree||73.3%|Easy|| +|0700|Search in a Binary Search Tree||73.4%|Easy|| |0701|Insert into a Binary Search Tree||75.8%|Medium|| -|0702|Search in a Sorted Array of Unknown Size||68.4%|Medium|| +|0702|Search in a Sorted Array of Unknown Size||68.5%|Medium|| |0703|Kth Largest Element in a Stream||50.5%|Easy|| -|0704|Binary Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0704.Binary-Search)|53.9%|Easy|| +|0704|Binary Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0704.Binary-Search)|54.0%|Easy|| |0705|Design HashSet|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0705.Design-HashSet)|64.5%|Easy|| -|0706|Design HashMap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0706.Design-HashMap)|62.4%|Easy|| -|0707|Design Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0707.Design-Linked-List)|25.6%|Medium|| -|0708|Insert into a Sorted Circular Linked List||32.3%|Medium|| +|0706|Design HashMap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0706.Design-HashMap)|62.5%|Easy|| +|0707|Design Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0707.Design-Linked-List)|25.7%|Medium|| +|0708|Insert into a Sorted Circular Linked List||32.4%|Medium|| |0709|To Lower Case||79.9%|Easy|| |0710|Random Pick with Blacklist|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0710.Random-Pick-with-Blacklist)|32.7%|Hard|| |0711|Number of Distinct Islands II||49.0%|Hard|| -|0712|Minimum ASCII Delete Sum for Two Strings||59.2%|Medium|| +|0712|Minimum ASCII Delete Sum for Two Strings||59.3%|Medium|| |0713|Subarray Product Less Than K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0713.Subarray-Product-Less-Than-K)|40.4%|Medium|| |0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee)|55.8%|Medium|| |0715|Range Module|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0715.Range-Module)|39.9%|Hard|| @@ -844,19 +844,19 @@ |0718|Maximum Length of Repeated Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0718.Maximum-Length-of-Repeated-Subarray)|50.1%|Medium|| |0719|Find K-th Smallest Pair Distance|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0719.Find-K-th-Smallest-Pair-Distance)|32.4%|Hard|| |0720|Longest Word in Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0720.Longest-Word-in-Dictionary)|49.0%|Easy|| -|0721|Accounts Merge|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0721.Accounts-Merge)|51.0%|Medium|| +|0721|Accounts Merge|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0721.Accounts-Merge)|51.1%|Medium|| |0722|Remove Comments||35.8%|Medium|| |0723|Candy Crush||72.2%|Medium|| |0724|Find Pivot Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0724.Find-Pivot-Index)|45.0%|Easy|| |0725|Split Linked List in Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0725.Split-Linked-List-in-Parts)|52.7%|Medium|| |0726|Number of Atoms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0726.Number-of-Atoms)|51.0%|Hard|| |0727|Minimum Window Subsequence||42.1%|Hard|| -|0728|Self Dividing Numbers||75.2%|Easy|| -|0729|My Calendar I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0729.My-Calendar-I)|53.0%|Medium|| -|0730|Count Different Palindromic Subsequences||43.3%|Hard|| -|0731|My Calendar II||50.1%|Medium|| -|0732|My Calendar III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0732.My-Calendar-III)|61.3%|Hard|| -|0733|Flood Fill|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0733.Flood-Fill)|55.7%|Easy|| +|0728|Self Dividing Numbers||75.3%|Easy|| +|0729|My Calendar I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0729.My-Calendar-I)|53.1%|Medium|| +|0730|Count Different Palindromic Subsequences||43.4%|Hard|| +|0731|My Calendar II||50.2%|Medium|| +|0732|My Calendar III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0732.My-Calendar-III)|61.4%|Hard|| +|0733|Flood Fill|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0733.Flood-Fill)|55.8%|Easy|| |0734|Sentence Similarity||42.3%|Easy|| |0735|Asteroid Collision|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0735.Asteroid-Collision)|43.1%|Medium|| |0736|Parse Lisp Expression||49.8%|Hard|| @@ -864,46 +864,46 @@ |0738|Monotone Increasing Digits||45.5%|Medium|| |0739|Daily Temperatures|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0739.Daily-Temperatures)|64.3%|Medium|| |0740|Delete and Earn||49.2%|Medium|| -|0741|Cherry Pickup||34.9%|Hard|| -|0742|Closest Leaf in a Binary Tree||44.1%|Medium|| +|0741|Cherry Pickup||35.0%|Hard|| +|0742|Closest Leaf in a Binary Tree||44.2%|Medium|| |0743|Network Delay Time||45.3%|Medium|| |0744|Find Smallest Letter Greater Than Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0744.Find-Smallest-Letter-Greater-Than-Target)|45.6%|Easy|| -|0745|Prefix and Suffix Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0745.Prefix-and-Suffix-Search)|35.0%|Hard|| +|0745|Prefix and Suffix Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0745.Prefix-and-Suffix-Search)|35.1%|Hard|| |0746|Min Cost Climbing Stairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0746.Min-Cost-Climbing-Stairs)|50.8%|Easy|| |0747|Largest Number At Least Twice of Others||42.8%|Easy|| -|0748|Shortest Completing Word|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0748.Shortest-Completing-Word)|57.3%|Easy|| -|0749|Contain Virus||47.7%|Hard|| +|0748|Shortest Completing Word|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0748.Shortest-Completing-Word)|57.4%|Easy|| +|0749|Contain Virus||47.8%|Hard|| |0750|Number Of Corner Rectangles||66.6%|Medium|| |0751|IP to CIDR||60.1%|Medium|| |0752|Open the Lock||52.5%|Medium|| -|0753|Cracking the Safe|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0753.Cracking-the-Safe)|51.9%|Hard|| +|0753|Cracking the Safe|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0753.Cracking-the-Safe)|52.0%|Hard|| |0754|Reach a Number||40.5%|Medium|| |0755|Pour Water||44.0%|Medium|| |0756|Pyramid Transition Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0756.Pyramid-Transition-Matrix)|55.5%|Medium|| -|0757|Set Intersection Size At Least Two||42.0%|Hard|| -|0758|Bold Words in String||47.0%|Easy|| -|0759|Employee Free Time||67.8%|Hard|| +|0757|Set Intersection Size At Least Two||42.1%|Hard|| +|0758|Bold Words in String||47.1%|Easy|| +|0759|Employee Free Time||67.9%|Hard|| |0760|Find Anagram Mappings||81.6%|Easy|| -|0761|Special Binary String||58.6%|Hard|| +|0761|Special Binary String||58.5%|Hard|| |0762|Prime Number of Set Bits in Binary Representation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation)|64.1%|Easy|| |0763|Partition Labels|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0763.Partition-Labels)|77.9%|Medium|| |0764|Largest Plus Sign||46.3%|Medium|| |0765|Couples Holding Hands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0765.Couples-Holding-Hands)|55.3%|Hard|| -|0766|Toeplitz Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0766.Toeplitz-Matrix)|65.7%|Easy|| -|0767|Reorganize String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0767.Reorganize-String)|49.8%|Medium|| -|0768|Max Chunks To Make Sorted II||49.6%|Hard|| -|0769|Max Chunks To Make Sorted||55.4%|Medium|| +|0766|Toeplitz Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0766.Toeplitz-Matrix)|65.8%|Easy|| +|0767|Reorganize String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0767.Reorganize-String)|49.9%|Medium|| +|0768|Max Chunks To Make Sorted II||49.7%|Hard|| +|0769|Max Chunks To Make Sorted||55.5%|Medium|| |0770|Basic Calculator IV||54.5%|Hard|| |0771|Jewels and Stones|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0771.Jewels-and-Stones)|86.8%|Easy|| -|0772|Basic Calculator III||43.0%|Hard|| +|0772|Basic Calculator III||43.1%|Hard|| |0773|Sliding Puzzle||60.4%|Hard|| |0774|Minimize Max Distance to Gas Station||48.0%|Hard|| -|0775|Global and Local Inversions||42.4%|Medium|| -|0776|Split BST||56.4%|Medium|| -|0777|Swap Adjacent in LR String||35.4%|Medium|| +|0775|Global and Local Inversions||42.5%|Medium|| +|0776|Split BST||56.5%|Medium|| +|0777|Swap Adjacent in LR String||35.5%|Medium|| |0778|Swim in Rising Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0778.Swim-in-Rising-Water)|54.3%|Hard|| |0779|K-th Symbol in Grammar||38.4%|Medium|| -|0780|Reaching Points||30.1%|Hard|| +|0780|Reaching Points||30.2%|Hard|| |0781|Rabbits in Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0781.Rabbits-in-Forest)|55.3%|Medium|| |0782|Transform to Chessboard||46.8%|Hard|| |0783|Minimum Distance Between BST Nodes||53.6%|Easy|| @@ -911,36 +911,36 @@ |0785|Is Graph Bipartite?|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0785.Is-Graph-Bipartite?)|48.2%|Medium|| |0786|K-th Smallest Prime Fraction|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0786.K-th-Smallest-Prime-Fraction)|41.7%|Hard|| |0787|Cheapest Flights Within K Stops||39.5%|Medium|| -|0788|Rotated Digits||57.2%|Easy|| -|0789|Escape The Ghosts||58.0%|Medium|| +|0788|Rotated Digits||57.3%|Easy|| +|0789|Escape The Ghosts||58.1%|Medium|| |0790|Domino and Tromino Tiling||39.8%|Medium|| |0791|Custom Sort String||65.9%|Medium|| -|0792|Number of Matching Subsequences||48.0%|Medium|| +|0792|Number of Matching Subsequences||48.1%|Medium|| |0793|Preimage Size of Factorial Zeroes Function|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0793.Preimage-Size-of-Factorial-Zeroes-Function)|40.6%|Hard|| -|0794|Valid Tic-Tac-Toe State||33.6%|Medium|| -|0795|Number of Subarrays with Bounded Maximum||47.2%|Medium|| +|0794|Valid Tic-Tac-Toe State||33.7%|Medium|| +|0795|Number of Subarrays with Bounded Maximum||47.3%|Medium|| |0796|Rotate String||49.3%|Easy|| -|0797|All Paths From Source to Target||78.3%|Medium|| +|0797|All Paths From Source to Target||78.4%|Medium|| |0798|Smallest Rotation with Highest Score||44.7%|Hard|| -|0799|Champagne Tower||43.9%|Medium|| -|0800|Similar RGB Color||62.1%|Easy|| +|0799|Champagne Tower||44.0%|Medium|| +|0800|Similar RGB Color||62.2%|Easy|| |0801|Minimum Swaps To Make Sequences Increasing||39.0%|Medium|| |0802|Find Eventual Safe States|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0802.Find-Eventual-Safe-States)|49.6%|Medium|| |0803|Bricks Falling When Hit|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0803.Bricks-Falling-When-Hit)|31.2%|Hard|| |0804|Unique Morse Code Words||78.8%|Easy|| -|0805|Split Array With Same Average||26.6%|Hard|| +|0805|Split Array With Same Average||26.7%|Hard|| |0806|Number of Lines To Write String||65.4%|Easy|| |0807|Max Increase to Keep City Skyline||84.2%|Medium|| |0808|Soup Servings||40.8%|Medium|| |0809|Expressive Words||46.6%|Medium|| |0810|Chalkboard XOR Game||49.4%|Hard|| -|0811|Subdomain Visit Count|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0811.Subdomain-Visit-Count)|71.1%|Easy|| +|0811|Subdomain Visit Count|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0811.Subdomain-Visit-Count)|71.2%|Easy|| |0812|Largest Triangle Area|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0812.Largest-Triangle-Area)|58.8%|Easy|| -|0813|Largest Sum of Averages||50.8%|Medium|| -|0814|Binary Tree Pruning||73.0%|Medium|| +|0813|Largest Sum of Averages||50.9%|Medium|| +|0814|Binary Tree Pruning||72.9%|Medium|| |0815|Bus Routes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0815.Bus-Routes)|43.2%|Hard|| |0816|Ambiguous Coordinates||47.8%|Medium|| -|0817|Linked List Components|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0817.Linked-List-Components)|57.5%|Medium|| +|0817|Linked List Components|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0817.Linked-List-Components)|57.6%|Medium|| |0818|Race Car||39.6%|Hard|| |0819|Most Common Word|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0819.Most-Common-Word)|45.4%|Easy|| |0820|Short Encoding of Words||51.3%|Medium|| @@ -950,65 +950,65 @@ |0824|Goat Latin||66.3%|Easy|| |0825|Friends Of Appropriate Ages||43.8%|Medium|| |0826|Most Profit Assigning Work|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0826.Most-Profit-Assigning-Work)|38.9%|Medium|| -|0827|Making A Large Island||47.0%|Hard|| +|0827|Making A Large Island||47.1%|Hard|| |0828|Count Unique Characters of All Substrings of a Given String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String)|46.8%|Hard|| |0829|Consecutive Numbers Sum||39.3%|Hard|| |0830|Positions of Large Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0830.Positions-of-Large-Groups)|50.2%|Easy|| |0831|Masking Personal Information||44.7%|Medium|| -|0832|Flipping an Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0832.Flipping-an-Image)|77.8%|Easy|| -|0833|Find And Replace in String||51.2%|Medium|| +|0832|Flipping an Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0832.Flipping-an-Image)|77.9%|Easy|| +|0833|Find And Replace in String||51.3%|Medium|| |0834|Sum of Distances in Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0834.Sum-of-Distances-in-Tree)|45.5%|Hard|| |0835|Image Overlap||61.9%|Medium|| -|0836|Rectangle Overlap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0836.Rectangle-Overlap)|45.3%|Easy|| +|0836|Rectangle Overlap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0836.Rectangle-Overlap)|45.2%|Easy|| |0837|New 21 Game||35.3%|Medium|| |0838|Push Dominoes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0838.Push-Dominoes)|49.6%|Medium|| |0839|Similar String Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0839.Similar-String-Groups)|39.9%|Hard|| -|0840|Magic Squares In Grid||37.7%|Medium|| -|0841|Keys and Rooms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0841.Keys-and-Rooms)|65.1%|Medium|| +|0840|Magic Squares In Grid||37.8%|Medium|| +|0841|Keys and Rooms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0841.Keys-and-Rooms)|65.2%|Medium|| |0842|Split Array into Fibonacci Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0842.Split-Array-into-Fibonacci-Sequence)|36.6%|Medium|| |0843|Guess the Word||46.4%|Hard|| |0844|Backspace String Compare|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0844.Backspace-String-Compare)|46.8%|Easy|| -|0845|Longest Mountain in Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0845.Longest-Mountain-in-Array)|38.4%|Medium|| +|0845|Longest Mountain in Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0845.Longest-Mountain-in-Array)|38.5%|Medium|| |0846|Hand of Straights||55.2%|Medium|| |0847|Shortest Path Visiting All Nodes||53.2%|Hard|| -|0848|Shifting Letters||45.0%|Medium|| +|0848|Shifting Letters||45.1%|Medium|| |0849|Maximize Distance to Closest Person||44.4%|Medium|| -|0850|Rectangle Area II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0850.Rectangle-Area-II)|48.3%|Hard|| +|0850|Rectangle Area II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0850.Rectangle-Area-II)|48.4%|Hard|| |0851|Loud and Rich|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0851.Loud-and-Rich)|52.4%|Medium|| |0852|Peak Index in a Mountain Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0852.Peak-Index-in-a-Mountain-Array)|71.8%|Easy|| |0853|Car Fleet|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0853.Car-Fleet)|43.5%|Medium|| -|0854|K-Similar Strings||38.6%|Hard|| +|0854|K-Similar Strings||38.7%|Hard|| |0855|Exam Room||43.4%|Medium|| |0856|Score of Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0856.Score-of-Parentheses)|62.1%|Medium|| -|0857|Minimum Cost to Hire K Workers||50.2%|Hard|| +|0857|Minimum Cost to Hire K Workers||50.3%|Hard|| |0858|Mirror Reflection||59.5%|Medium|| |0859|Buddy Strings||29.7%|Easy|| |0860|Lemonade Change||51.9%|Easy|| |0861|Score After Flipping Matrix||73.4%|Medium|| |0862|Shortest Subarray with Sum at Least K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K)|25.1%|Hard|| |0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|57.4%|Medium|| -|0864|Shortest Path to Get All Keys|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0864.Shortest-Path-to-Get-All-Keys)|41.4%|Hard|| +|0864|Shortest Path to Get All Keys|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0864.Shortest-Path-to-Get-All-Keys)|41.5%|Hard|| |0865|Smallest Subtree with all the Deepest Nodes||64.6%|Medium|| |0866|Prime Palindrome||25.1%|Medium|| |0867|Transpose Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0867.Transpose-Matrix)|62.2%|Easy|| |0868|Binary Gap||60.8%|Easy|| |0869|Reordered Power of 2||54.1%|Medium|| -|0870|Advantage Shuffle||46.5%|Medium|| -|0871|Minimum Number of Refueling Stops||32.2%|Hard|| +|0870|Advantage Shuffle||46.6%|Medium|| +|0871|Minimum Number of Refueling Stops||32.1%|Hard|| |0872|Leaf-Similar Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0872.Leaf-Similar-Trees)|64.6%|Easy|| |0873|Length of Longest Fibonacci Subsequence||48.1%|Medium|| |0874|Walking Robot Simulation||36.7%|Easy|| -|0875|Koko Eating Bananas|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0875.Koko-Eating-Bananas)|53.3%|Medium|| +|0875|Koko Eating Bananas|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0875.Koko-Eating-Bananas)|53.4%|Medium|| |0876|Middle of the Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0876.Middle-of-the-Linked-List)|68.9%|Easy|| |0877|Stone Game||66.3%|Medium|| |0878|Nth Magical Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0878.Nth-Magical-Number)|28.9%|Hard|| |0879|Profitable Schemes||40.1%|Hard|| |0880|Decoded String at Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0880.Decoded-String-at-Index)|28.3%|Medium|| |0881|Boats to Save People|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0881.Boats-to-Save-People)|47.6%|Medium|| -|0882|Reachable Nodes In Subdivided Graph||42.2%|Hard|| +|0882|Reachable Nodes In Subdivided Graph||42.3%|Hard|| |0883|Projection Area of 3D Shapes||68.0%|Easy|| |0884|Uncommon Words from Two Sentences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0884.Uncommon-Words-from-Two-Sentences)|63.9%|Easy|| -|0885|Spiral Matrix III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0885.Spiral-Matrix-III)|70.4%|Medium|| +|0885|Spiral Matrix III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0885.Spiral-Matrix-III)|70.5%|Medium|| |0886|Possible Bipartition||44.9%|Medium|| |0887|Super Egg Drop|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0887.Super-Egg-Drop)|27.1%|Hard|| |0888|Fair Candy Swap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0888.Fair-Candy-Swap)|58.7%|Easy|| @@ -1022,17 +1022,17 @@ |0896|Monotonic Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0896.Monotonic-Array)|58.0%|Easy|| |0897|Increasing Order Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0897.Increasing-Order-Search-Tree)|74.3%|Easy|| |0898|Bitwise ORs of Subarrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0898.Bitwise-ORs-of-Subarrays)|34.0%|Medium|| -|0899|Orderly Queue||52.8%|Hard|| +|0899|Orderly Queue||52.9%|Hard|| |0900|RLE Iterator||55.1%|Medium|| |0901|Online Stock Span|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0901.Online-Stock-Span)|61.1%|Medium|| |0902|Numbers At Most N Given Digit Set||36.1%|Hard|| |0903|Valid Permutations for DI Sequence||54.2%|Hard|| -|0904|Fruit Into Baskets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets)|42.8%|Medium|| +|0904|Fruit Into Baskets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets)|42.9%|Medium|| |0905|Sort Array By Parity||74.9%|Easy|| |0906|Super Palindromes||32.9%|Hard|| |0907|Sum of Subarray Minimums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0907.Sum-of-Subarray-Minimums)|33.2%|Medium|| |0908|Smallest Range I||66.4%|Easy|| -|0909|Snakes and Ladders||39.0%|Medium|| +|0909|Snakes and Ladders||39.1%|Medium|| |0910|Smallest Range II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0910.Smallest-Range-II)|31.2%|Medium|| |0911|Online Election|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0911.Online-Election)|51.2%|Medium|| |0912|Sort an Array||64.4%|Medium|| @@ -1042,62 +1042,62 @@ |0916|Word Subsets||48.1%|Medium|| |0917|Reverse Only Letters||58.6%|Easy|| |0918|Maximum Sum Circular Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0918.Maximum-Sum-Circular-Subarray)|34.0%|Medium|| -|0919|Complete Binary Tree Inserter||58.5%|Medium|| +|0919|Complete Binary Tree Inserter||58.6%|Medium|| |0920|Number of Music Playlists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0920.Number-of-Music-Playlists)|47.7%|Hard|| |0921|Minimum Add to Make Parentheses Valid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid)|74.6%|Medium|| |0922|Sort Array By Parity II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0922.Sort-Array-By-Parity-II)|70.2%|Easy|| |0923|3Sum With Multiplicity|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0923.3Sum-With-Multiplicity)|36.0%|Medium|| |0924|Minimize Malware Spread|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0924.Minimize-Malware-Spread)|41.9%|Hard|| |0925|Long Pressed Name|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0925.Long-Pressed-Name)|38.5%|Easy|| -|0926|Flip String to Monotone Increasing||52.9%|Medium|| +|0926|Flip String to Monotone Increasing||53.0%|Medium|| |0927|Three Equal Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0927.Three-Equal-Parts)|34.4%|Hard|| |0928|Minimize Malware Spread II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0928.Minimize-Malware-Spread-II)|41.1%|Hard|| |0929|Unique Email Addresses||67.2%|Easy|| |0930|Binary Subarrays With Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0930.Binary-Subarrays-With-Sum)|44.2%|Medium|| -|0931|Minimum Falling Path Sum||63.1%|Medium|| -|0932|Beautiful Array||61.0%|Medium|| +|0931|Minimum Falling Path Sum||63.2%|Medium|| +|0932|Beautiful Array||61.1%|Medium|| |0933|Number of Recent Calls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0933.Number-of-Recent-Calls)|72.0%|Easy|| |0934|Shortest Bridge||49.3%|Medium|| |0935|Knight Dialer||46.1%|Medium|| -|0936|Stamping The Sequence||47.1%|Hard|| +|0936|Stamping The Sequence||47.2%|Hard|| |0937|Reorder Data in Log Files||54.3%|Easy|| |0938|Range Sum of BST||82.8%|Easy|| |0939|Minimum Area Rectangle||51.8%|Medium|| |0940|Distinct Subsequences II||41.6%|Hard|| |0941|Valid Mountain Array||33.5%|Easy|| -|0942|DI String Match|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0942.DI-String-Match)|73.3%|Easy|| -|0943|Find the Shortest Superstring||43.5%|Hard|| +|0942|DI String Match|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0942.DI-String-Match)|73.4%|Easy|| +|0943|Find the Shortest Superstring||43.4%|Hard|| |0944|Delete Columns to Make Sorted||71.0%|Easy|| |0945|Minimum Increment to Make Array Unique||46.6%|Medium|| -|0946|Validate Stack Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0946.Validate-Stack-Sequences)|63.3%|Medium|| +|0946|Validate Stack Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0946.Validate-Stack-Sequences)|63.4%|Medium|| |0947|Most Stones Removed with Same Row or Column|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0947.Most-Stones-Removed-with-Same-Row-or-Column)|55.4%|Medium|| -|0948|Bag of Tokens||46.2%|Medium|| +|0948|Bag of Tokens||46.1%|Medium|| |0949|Largest Time for Given Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0949.Largest-Time-for-Given-Digits)|36.2%|Medium|| |0950|Reveal Cards In Increasing Order||75.2%|Medium|| |0951|Flip Equivalent Binary Trees||65.6%|Medium|| |0952|Largest Component Size by Common Factor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0952.Largest-Component-Size-by-Common-Factor)|36.1%|Hard|| |0953|Verifying an Alien Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0953.Verifying-an-Alien-Dictionary)|52.6%|Easy|| |0954|Array of Doubled Pairs||35.3%|Medium|| -|0955|Delete Columns to Make Sorted II||33.6%|Medium|| -|0956|Tallest Billboard||39.8%|Hard|| +|0955|Delete Columns to Make Sorted II||33.7%|Medium|| +|0956|Tallest Billboard||39.7%|Hard|| |0957|Prison Cells After N Days||40.2%|Medium|| |0958|Check Completeness of a Binary Tree||52.4%|Medium|| |0959|Regions Cut By Slashes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0959.Regions-Cut-By-Slashes)|66.8%|Medium|| -|0960|Delete Columns to Make Sorted III||54.3%|Hard|| +|0960|Delete Columns to Make Sorted III||54.6%|Hard|| |0961|N-Repeated Element in Size 2N Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0961.N-Repeated-Element-in-Size-2N-Array)|74.3%|Easy|| -|0962|Maximum Width Ramp||46.2%|Medium|| -|0963|Minimum Area Rectangle II||51.6%|Medium|| +|0962|Maximum Width Ramp||46.3%|Medium|| +|0963|Minimum Area Rectangle II||51.7%|Medium|| |0964|Least Operators to Express Number||44.8%|Hard|| |0965|Univalued Binary Tree||67.7%|Easy|| -|0966|Vowel Spellchecker||47.7%|Medium|| -|0967|Numbers With Same Consecutive Differences||44.4%|Medium|| -|0968|Binary Tree Cameras|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0968.Binary-Tree-Cameras)|38.4%|Hard|| +|0966|Vowel Spellchecker||47.6%|Medium|| +|0967|Numbers With Same Consecutive Differences||44.5%|Medium|| +|0968|Binary Tree Cameras|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0968.Binary-Tree-Cameras)|38.5%|Hard|| |0969|Pancake Sorting|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0969.Pancake-Sorting)|68.5%|Medium|| -|0970|Powerful Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0970.Powerful-Integers)|39.9%|Easy|| -|0971|Flip Binary Tree To Match Preorder Traversal||46.1%|Medium|| +|0970|Powerful Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0970.Powerful-Integers)|40.0%|Easy|| +|0971|Flip Binary Tree To Match Preorder Traversal||46.2%|Medium|| |0972|Equal Rational Numbers||41.9%|Hard|| -|0973|K Closest Points to Origin|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0973.K-Closest-Points-to-Origin)|64.4%|Medium|| -|0974|Subarray Sums Divisible by K||50.4%|Medium|| +|0973|K Closest Points to Origin|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0973.K-Closest-Points-to-Origin)|64.5%|Medium|| +|0974|Subarray Sums Divisible by K||50.5%|Medium|| |0975|Odd Even Jump||41.5%|Hard|| |0976|Largest Perimeter Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0976.Largest-Perimeter-Triangle)|58.5%|Easy|| |0977|Squares of a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0977.Squares-of-a-Sorted-Array)|72.3%|Easy|| @@ -1108,34 +1108,34 @@ |0982|Triples with Bitwise AND Equal To Zero||56.1%|Hard|| |0983|Minimum Cost For Tickets||62.6%|Medium|| |0984|String Without AAA or BBB|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0984.String-Without-AAA-or-BBB)|38.4%|Medium|| -|0985|Sum of Even Numbers After Queries|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0985.Sum-of-Even-Numbers-After-Queries)|60.7%|Easy|| -|0986|Interval List Intersections|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0986.Interval-List-Intersections)|68.0%|Medium|| +|0985|Sum of Even Numbers After Queries|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0985.Sum-of-Even-Numbers-After-Queries)|60.8%|Easy|| +|0986|Interval List Intersections|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0986.Interval-List-Intersections)|68.1%|Medium|| |0987|Vertical Order Traversal of a Binary Tree||37.5%|Medium|| |0988|Smallest String Starting From Leaf||46.6%|Medium|| |0989|Add to Array-Form of Integer||44.7%|Easy|| |0990|Satisfiability of Equality Equations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0990.Satisfiability-of-Equality-Equations)|46.4%|Medium|| -|0991|Broken Calculator||46.3%|Medium|| -|0992|Subarrays with K Different Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0992.Subarrays-with-K-Different-Integers)|50.3%|Hard|| +|0991|Broken Calculator||46.4%|Medium|| +|0992|Subarrays with K Different Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0992.Subarrays-with-K-Different-Integers)|50.4%|Hard|| |0993|Cousins in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0993.Cousins-in-Binary-Tree)|52.2%|Easy|| |0994|Rotting Oranges||49.5%|Medium|| |0995|Minimum Number of K Consecutive Bit Flips|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0995.Minimum-Number-of-K-Consecutive-Bit-Flips)|49.5%|Hard|| |0996|Number of Squareful Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0996.Number-of-Squareful-Arrays)|47.9%|Hard|| |0997|Find the Town Judge||49.8%|Easy|| |0998|Maximum Binary Tree II||63.6%|Medium|| -|0999|Available Captures for Rook|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0999.Available-Captures-for-Rook)|66.7%|Easy|| +|0999|Available Captures for Rook|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0999.Available-Captures-for-Rook)|66.8%|Easy|| |1000|Minimum Cost to Merge Stones||40.4%|Hard|| |1001|Grid Illumination||36.5%|Hard|| -|1002|Find Common Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1002.Find-Common-Characters)|68.0%|Easy|| -|1003|Check If Word Is Valid After Substitutions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions)|55.9%|Medium|| +|1002|Find Common Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1002.Find-Common-Characters)|68.1%|Easy|| +|1003|Check If Word Is Valid After Substitutions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions)|56.0%|Medium|| |1004|Max Consecutive Ones III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1004.Max-Consecutive-Ones-III)|60.5%|Medium|| -|1005|Maximize Sum Of Array After K Negations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations)|52.3%|Easy|| -|1006|Clumsy Factorial||53.7%|Medium|| +|1005|Maximize Sum Of Array After K Negations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations)|52.2%|Easy|| +|1006|Clumsy Factorial||53.6%|Medium|| |1007|Minimum Domino Rotations For Equal Row||50.9%|Medium|| |1008|Construct Binary Search Tree from Preorder Traversal||78.7%|Medium|| |1009|Complement of Base 10 Integer||61.5%|Easy|| -|1010|Pairs of Songs With Total Durations Divisible by 60||49.6%|Medium|| +|1010|Pairs of Songs With Total Durations Divisible by 60||49.7%|Medium|| |1011|Capacity To Ship Packages Within D Days|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1011.Capacity-To-Ship-Packages-Within-D-Days)|59.5%|Medium|| -|1012|Numbers With Repeated Digits||37.6%|Hard|| +|1012|Numbers With Repeated Digits||37.7%|Hard|| |1013|Partition Array Into Three Parts With Equal Sum||49.5%|Easy|| |1014|Best Sightseeing Pair||52.8%|Medium|| |1015|Smallest Integer Divisible by K||41.8%|Medium|| @@ -1144,54 +1144,54 @@ |1018|Binary Prefix Divisible By 5||47.8%|Easy|| |1019|Next Greater Node In Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1019.Next-Greater-Node-In-Linked-List)|58.2%|Medium|| |1020|Number of Enclaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1020.Number-of-Enclaves)|58.7%|Medium|| -|1021|Remove Outermost Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1021.Remove-Outermost-Parentheses)|78.6%|Easy|| +|1021|Remove Outermost Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1021.Remove-Outermost-Parentheses)|78.7%|Easy|| |1022|Sum of Root To Leaf Binary Numbers||71.4%|Easy|| |1023|Camelcase Matching||57.3%|Medium|| |1024|Video Stitching||49.2%|Medium|| |1025|Divisor Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1025.Divisor-Game)|66.1%|Easy|| -|1026|Maximum Difference Between Node and Ancestor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor)|69.0%|Medium|| +|1026|Maximum Difference Between Node and Ancestor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor)|69.1%|Medium|| |1027|Longest Arithmetic Subsequence||49.9%|Medium|| |1028|Recover a Tree From Preorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1028.Recover-a-Tree-From-Preorder-Traversal)|70.7%|Hard|| -|1029|Two City Scheduling||57.5%|Medium|| -|1030|Matrix Cells in Distance Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1030.Matrix-Cells-in-Distance-Order)|66.8%|Easy|| +|1029|Two City Scheduling||57.6%|Medium|| +|1030|Matrix Cells in Distance Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1030.Matrix-Cells-in-Distance-Order)|66.9%|Easy|| |1031|Maximum Sum of Two Non-Overlapping Subarrays||58.8%|Medium|| |1032|Stream of Characters||48.6%|Hard|| -|1033|Moving Stones Until Consecutive||42.9%|Easy|| +|1033|Moving Stones Until Consecutive||43.0%|Easy|| |1034|Coloring A Border||45.4%|Medium|| |1035|Uncrossed Lines||56.0%|Medium|| -|1036|Escape a Large Maze||34.9%|Hard|| +|1036|Escape a Large Maze||34.8%|Hard|| |1037|Valid Boomerang|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1037.Valid-Boomerang)|37.8%|Easy|| |1038|Binary Search Tree to Greater Sum Tree||82.0%|Medium|| |1039|Minimum Score Triangulation of Polygon||50.0%|Medium|| -|1040|Moving Stones Until Consecutive II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1040.Moving-Stones-Until-Consecutive-II)|53.8%|Medium|| -|1041|Robot Bounded In Circle||54.6%|Medium|| -|1042|Flower Planting With No Adjacent||48.6%|Medium|| +|1040|Moving Stones Until Consecutive II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1040.Moving-Stones-Until-Consecutive-II)|53.9%|Medium|| +|1041|Robot Bounded In Circle||54.7%|Medium|| +|1042|Flower Planting With No Adjacent||48.7%|Medium|| |1043|Partition Array for Maximum Sum||66.7%|Medium|| |1044|Longest Duplicate Substring||31.6%|Hard|| |1045|Customers Who Bought All Products||68.2%|Medium|| |1046|Last Stone Weight||62.4%|Easy|| |1047|Remove All Adjacent Duplicates In String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String)|70.2%|Easy|| -|1048|Longest String Chain||55.2%|Medium|| -|1049|Last Stone Weight II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II)|44.8%|Medium|| -|1050|Actors and Directors Who Cooperated At Least Three Times||72.1%|Easy|| -|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.8%|Easy|| +|1048|Longest String Chain||55.3%|Medium|| +|1049|Last Stone Weight II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II)|44.9%|Medium|| +|1050|Actors and Directors Who Cooperated At Least Three Times||72.2%|Easy|| +|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.9%|Easy|| |1052|Grumpy Bookstore Owner|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1052.Grumpy-Bookstore-Owner)|55.7%|Medium|| -|1053|Previous Permutation With One Swap||50.7%|Medium|| +|1053|Previous Permutation With One Swap||50.8%|Medium|| |1054|Distant Barcodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1054.Distant-Barcodes)|44.1%|Medium|| |1055|Shortest Way to Form String||57.1%|Medium|| |1056|Confusing Number||47.2%|Easy|| |1057|Campus Bikes||57.6%|Medium|| |1058|Minimize Rounding Error to Meet Target||43.1%|Medium|| -|1059|All Paths from Source Lead to Destination||43.3%|Medium|| +|1059|All Paths from Source Lead to Destination||43.4%|Medium|| |1060|Missing Element in Sorted Array||54.7%|Medium|| -|1061|Lexicographically Smallest Equivalent String||66.5%|Medium|| -|1062|Longest Repeating Substring||57.9%|Medium|| +|1061|Lexicographically Smallest Equivalent String||66.7%|Medium|| +|1062|Longest Repeating Substring||58.0%|Medium|| |1063|Number of Valid Subarrays||72.1%|Hard|| |1064|Fixed Point||65.5%|Easy|| |1065|Index Pairs of a String||60.9%|Easy|| |1066|Campus Bikes II||54.0%|Medium|| -|1067|Digit Count in Range||41.2%|Hard|| -|1068|Product Sales Analysis I||82.4%|Easy|| +|1067|Digit Count in Range||41.1%|Hard|| +|1068|Product Sales Analysis I||82.5%|Easy|| |1069|Product Sales Analysis II||83.2%|Easy|| |1070|Product Sales Analysis III||49.6%|Medium|| |1071|Greatest Common Divisor of Strings||51.4%|Easy|| @@ -1199,17 +1199,17 @@ |1073|Adding Two Negabinary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1073.Adding-Two-Negabinary-Numbers)|34.7%|Medium|| |1074|Number of Submatrices That Sum to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1074.Number-of-Submatrices-That-Sum-to-Target)|61.4%|Hard|| |1075|Project Employees I||66.0%|Easy|| -|1076|Project Employees II||53.3%|Easy|| -|1077|Project Employees III||77.2%|Medium|| +|1076|Project Employees II||53.2%|Easy|| +|1077|Project Employees III||77.3%|Medium|| |1078|Occurrences After Bigram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1078.Occurrences-After-Bigram)|64.9%|Easy|| |1079|Letter Tile Possibilities|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1079.Letter-Tile-Possibilities)|75.8%|Medium|| |1080|Insufficient Nodes in Root to Leaf Paths||49.7%|Medium|| |1081|Smallest Subsequence of Distinct Characters||53.4%|Medium|| |1082|Sales Analysis I||73.2%|Easy|| -|1083|Sales Analysis II||50.7%|Easy|| +|1083|Sales Analysis II||50.8%|Easy|| |1084|Sales Analysis III||54.7%|Easy|| |1085|Sum of Digits in the Minimum Number||75.0%|Easy|| -|1086|High Five||78.9%|Easy|| +|1086|High Five||78.8%|Easy|| |1087|Brace Expansion||63.1%|Medium|| |1088|Confusing Number II||45.1%|Hard|| |1089|Duplicate Zeros|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1089.Duplicate-Zeros)|52.0%|Easy|| @@ -1221,622 +1221,632 @@ |1095|Find in Mountain Array||35.9%|Hard|| |1096|Brace Expansion II||62.4%|Hard|| |1097|Game Play Analysis V||56.3%|Hard|| -|1098|Unpopular Books||45.5%|Medium|| +|1098|Unpopular Books||45.6%|Medium|| |1099|Two Sum Less Than K||60.8%|Easy|| |1100|Find K-Length Substrings With No Repeated Characters||73.3%|Medium|| -|1101|The Earliest Moment When Everyone Become Friends||67.4%|Medium|| +|1101|The Earliest Moment When Everyone Become Friends||67.5%|Medium|| |1102|Path With Maximum Minimum Value||50.1%|Medium|| |1103|Distribute Candies to People||63.6%|Easy|| -|1104|Path In Zigzag Labelled Binary Tree||72.9%|Medium|| +|1104|Path In Zigzag Labelled Binary Tree||73.0%|Medium|| |1105|Filling Bookcase Shelves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1105.Filling-Bookcase-Shelves)|57.8%|Medium|| |1106|Parsing A Boolean Expression||59.0%|Hard|| -|1107|New Users Daily Count||45.7%|Medium|| +|1107|New Users Daily Count||45.8%|Medium|| |1108|Defanging an IP Address|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1108.Defanging-an-IP-Address)|88.5%|Easy|| |1109|Corporate Flight Bookings||54.1%|Medium|| -|1110|Delete Nodes And Return Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1110.Delete-Nodes-And-Return-Forest)|67.5%|Medium|| +|1110|Delete Nodes And Return Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1110.Delete-Nodes-And-Return-Forest)|67.6%|Medium|| |1111|Maximum Nesting Depth of Two Valid Parentheses Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings)|72.4%|Medium|| |1112|Highest Grade For Each Student||71.7%|Medium|| |1113|Reported Posts||65.3%|Easy|| |1114|Print in Order||66.9%|Easy|| |1115|Print FooBar Alternately||59.1%|Medium|| -|1116|Print Zero Even Odd||57.5%|Medium|| -|1117|Building H2O||53.2%|Medium|| -|1118|Number of Days in a Month||57.4%|Easy|| +|1116|Print Zero Even Odd||57.6%|Medium|| +|1117|Building H2O||53.1%|Medium|| +|1118|Number of Days in a Month||57.5%|Easy|| |1119|Remove Vowels from a String||90.4%|Easy|| -|1120|Maximum Average Subtree||63.6%|Medium|| -|1121|Divide Array Into Increasing Sequences||57.9%|Hard|| +|1120|Maximum Average Subtree||63.5%|Medium|| +|1121|Divide Array Into Increasing Sequences||58.0%|Hard|| |1122|Relative Sort Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1122.Relative-Sort-Array)|67.7%|Easy|| |1123|Lowest Common Ancestor of Deepest Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves)|67.8%|Medium|| |1124|Longest Well-Performing Interval||33.2%|Medium|| |1125|Smallest Sufficient Team||46.9%|Hard|| -|1126|Active Businesses||68.6%|Medium|| +|1126|Active Businesses||68.7%|Medium|| |1127|User Purchase Platform||50.3%|Hard|| |1128|Number of Equivalent Domino Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1128.Number-of-Equivalent-Domino-Pairs)|46.6%|Easy|| |1129|Shortest Path with Alternating Colors||40.0%|Medium|| |1130|Minimum Cost Tree From Leaf Values||67.1%|Medium|| -|1131|Maximum of Absolute Value Expression||52.2%|Medium|| -|1132|Reported Posts II||34.5%|Medium|| -|1133|Largest Unique Number||67.1%|Easy|| +|1131|Maximum of Absolute Value Expression||52.1%|Medium|| +|1132|Reported Posts II||34.6%|Medium|| +|1133|Largest Unique Number||67.2%|Easy|| |1134|Armstrong Number||78.2%|Easy|| |1135|Connecting Cities With Minimum Cost||59.0%|Medium|| |1136|Parallel Courses||61.2%|Hard|| |1137|N-th Tribonacci Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1137.N-th-Tribonacci-Number)|56.1%|Easy|| -|1138|Alphabet Board Path||50.4%|Medium|| -|1139|Largest 1-Bordered Square||48.3%|Medium|| +|1138|Alphabet Board Path||50.6%|Medium|| +|1139|Largest 1-Bordered Square||48.4%|Medium|| |1140|Stone Game II||64.8%|Medium|| |1141|User Activity for the Past 30 Days I||54.4%|Easy|| |1142|User Activity for the Past 30 Days II||35.2%|Easy|| |1143|Longest Common Subsequence||58.6%|Medium|| -|1144|Decrease Elements To Make Array Zigzag||45.9%|Medium|| +|1144|Decrease Elements To Make Array Zigzag||46.0%|Medium|| |1145|Binary Tree Coloring Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1145.Binary-Tree-Coloring-Game)|51.4%|Medium|| |1146|Snapshot Array||36.8%|Medium|| -|1147|Longest Chunked Palindrome Decomposition||59.3%|Hard|| -|1148|Article Views I||76.9%|Easy|| +|1147|Longest Chunked Palindrome Decomposition||59.4%|Hard|| +|1148|Article Views I||77.0%|Easy|| |1149|Article Views II||48.4%|Medium|| |1150|Check If a Number Is Majority Element in a Sorted Array||58.0%|Easy|| -|1151|Minimum Swaps to Group All 1's Together||58.4%|Medium|| -|1152|Analyze User Website Visit Pattern||43.3%|Medium|| +|1151|Minimum Swaps to Group All 1's Together||58.2%|Medium|| +|1152|Analyze User Website Visit Pattern||43.4%|Medium|| |1153|String Transforms Into Another String||36.0%|Hard|| |1154|Day of the Year|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1154.Day-of-the-Year)|49.3%|Easy|| |1155|Number of Dice Rolls With Target Sum||47.5%|Medium|| |1156|Swap For Longest Repeated Character Substring||47.5%|Medium|| -|1157|Online Majority Element In Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1157.Online-Majority-Element-In-Subarray)|39.4%|Hard|| +|1157|Online Majority Element In Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1157.Online-Majority-Element-In-Subarray)|39.5%|Hard|| |1158|Market Analysis I||63.4%|Medium|| -|1159|Market Analysis II||55.3%|Hard|| -|1160|Find Words That Can Be Formed by Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters)|67.4%|Easy|| -|1161|Maximum Level Sum of a Binary Tree||70.2%|Medium|| -|1162|As Far from Land as Possible||44.8%|Medium|| +|1159|Market Analysis II||55.1%|Hard|| +|1160|Find Words That Can Be Formed by Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters)|67.5%|Easy|| +|1161|Maximum Level Sum of a Binary Tree||70.1%|Medium|| +|1162|As Far from Land as Possible||44.9%|Medium|| |1163|Last Substring in Lexicographical Order||36.3%|Hard|| -|1164|Product Price at a Given Date||68.0%|Medium|| +|1164|Product Price at a Given Date||67.9%|Medium|| |1165|Single-Row Keyboard||84.7%|Easy|| -|1166|Design File System||58.0%|Medium|| -|1167|Minimum Cost to Connect Sticks||64.0%|Medium|| +|1166|Design File System||58.2%|Medium|| +|1167|Minimum Cost to Connect Sticks||64.1%|Medium|| |1168|Optimize Water Distribution in a Village||62.2%|Hard|| |1169|Invalid Transactions||31.6%|Medium|| |1170|Compare Strings by Frequency of the Smallest Character|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character)|59.5%|Easy|| |1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List)|41.4%|Medium|| |1172|Dinner Plate Stacks||37.8%|Hard|| |1173|Immediate Food Delivery I||82.3%|Easy|| -|1174|Immediate Food Delivery II||60.8%|Medium|| +|1174|Immediate Food Delivery II||60.9%|Medium|| |1175|Prime Arrangements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1175.Prime-Arrangements)|51.8%|Easy|| -|1176|Diet Plan Performance||53.9%|Easy|| +|1176|Diet Plan Performance||54.0%|Easy|| |1177|Can Make Palindrome from Substring||36.0%|Medium|| -|1178|Number of Valid Words for Each Puzzle||38.6%|Hard|| -|1179|Reformat Department Table||82.0%|Easy|| +|1178|Number of Valid Words for Each Puzzle||38.5%|Hard|| +|1179|Reformat Department Table||82.1%|Easy|| |1180|Count Substrings with Only One Distinct Letter||77.5%|Easy|| |1181|Before and After Puzzle||44.5%|Medium|| |1182|Shortest Distance to Target Color||53.4%|Medium|| -|1183|Maximum Number of Ones||56.5%|Hard|| +|1183|Maximum Number of Ones||56.6%|Hard|| |1184|Distance Between Bus Stops|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1184.Distance-Between-Bus-Stops)|54.2%|Easy|| -|1185|Day of the Week|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week)|62.1%|Easy|| +|1185|Day of the Week|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week)|62.0%|Easy|| |1186|Maximum Subarray Sum with One Deletion||38.4%|Medium|| |1187|Make Array Strictly Increasing||41.6%|Hard|| -|1188|Design Bounded Blocking Queue||72.6%|Medium|| +|1188|Design Bounded Blocking Queue||72.7%|Medium|| |1189|Maximum Number of Balloons|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1189.Maximum-Number-of-Balloons)|61.8%|Easy|| |1190|Reverse Substrings Between Each Pair of Parentheses||64.0%|Medium|| -|1191|K-Concatenation Maximum Sum||25.4%|Medium|| -|1192|Critical Connections in a Network||49.7%|Hard|| -|1193|Monthly Transactions I||69.2%|Medium|| -|1194|Tournament Winners||52.1%|Hard|| -|1195|Fizz Buzz Multithreaded||70.3%|Medium|| +|1191|K-Concatenation Maximum Sum||25.5%|Medium|| +|1192|Critical Connections in a Network||49.8%|Hard|| +|1193|Monthly Transactions I||69.0%|Medium|| +|1194|Tournament Winners||52.0%|Hard|| +|1195|Fizz Buzz Multithreaded||70.4%|Medium|| |1196|How Many Apples Can You Put into the Basket||68.1%|Easy|| |1197|Minimum Knight Moves||37.0%|Medium|| -|1198|Find Smallest Common Element in All Rows||75.2%|Medium|| -|1199|Minimum Time to Build Blocks||38.4%|Hard|| +|1198|Find Smallest Common Element in All Rows||75.3%|Medium|| +|1199|Minimum Time to Build Blocks||38.5%|Hard|| |1200|Minimum Absolute Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1200.Minimum-Absolute-Difference)|66.8%|Easy|| |1201|Ugly Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1201.Ugly-Number-III)|26.4%|Medium|| -|1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|47.9%|Medium|| -|1203|Sort Items by Groups Respecting Dependencies||48.8%|Hard|| +|1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|48.2%|Medium|| +|1203|Sort Items by Groups Respecting Dependencies||48.9%|Hard|| |1204|Last Person to Fit in the Elevator||71.4%|Medium|| -|1205|Monthly Transactions II||46.3%|Medium|| -|1206|Design Skiplist||58.6%|Hard|| +|1205|Monthly Transactions II||46.1%|Medium|| +|1206|Design Skiplist||58.8%|Hard|| |1207|Unique Number of Occurrences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1207.Unique-Number-of-Occurrences)|71.6%|Easy|| |1208|Get Equal Substrings Within Budget|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1208.Get-Equal-Substrings-Within-Budget)|43.6%|Medium|| |1209|Remove All Adjacent Duplicates in String II||57.4%|Medium|| -|1210|Minimum Moves to Reach Target with Rotations||46.1%|Hard|| -|1211|Queries Quality and Percentage||69.9%|Easy|| -|1212|Team Scores in Football Tournament||56.8%|Medium|| +|1210|Minimum Moves to Reach Target with Rotations||46.2%|Hard|| +|1211|Queries Quality and Percentage||70.0%|Easy|| +|1212|Team Scores in Football Tournament||56.7%|Medium|| |1213|Intersection of Three Sorted Arrays||79.2%|Easy|| -|1214|Two Sum BSTs||67.8%|Medium|| -|1215|Stepping Numbers||43.0%|Medium|| +|1214|Two Sum BSTs||67.7%|Medium|| +|1215|Stepping Numbers||43.1%|Medium|| |1216|Valid Palindrome III||49.4%|Hard|| -|1217|Minimum Cost to Move Chips to The Same Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position)|71.3%|Easy|| +|1217|Minimum Cost to Move Chips to The Same Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position)|71.2%|Easy|| |1218|Longest Arithmetic Subsequence of Given Difference||46.4%|Medium|| |1219|Path with Maximum Gold||65.5%|Medium|| |1220|Count Vowels Permutation||54.1%|Hard|| |1221|Split a String in Balanced Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1221.Split-a-String-in-Balanced-Strings)|84.0%|Easy|| -|1222|Queens That Can Attack the King||69.2%|Medium|| -|1223|Dice Roll Simulation||46.6%|Medium|| +|1222|Queens That Can Attack the King||69.3%|Medium|| +|1223|Dice Roll Simulation||46.7%|Medium|| |1224|Maximum Equal Frequency||34.4%|Hard|| |1225|Report Contiguous Dates||62.3%|Hard|| -|1226|The Dining Philosophers||58.9%|Medium|| -|1227|Airplane Seat Assignment Probability||61.9%|Medium|| -|1228|Missing Number In Arithmetic Progression||51.8%|Easy|| -|1229|Meeting Scheduler||54.1%|Medium|| +|1226|The Dining Philosophers||58.7%|Medium|| +|1227|Airplane Seat Assignment Probability||62.0%|Medium|| +|1228|Missing Number In Arithmetic Progression||51.7%|Easy|| +|1229|Meeting Scheduler||54.2%|Medium|| |1230|Toss Strange Coins||49.8%|Medium|| |1231|Divide Chocolate||53.4%|Hard|| |1232|Check If It Is a Straight Line|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1232.Check-If-It-Is-a-Straight-Line)|43.9%|Easy|| |1233|Remove Sub-Folders from the Filesystem||61.6%|Medium|| |1234|Replace the Substring for Balanced String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1234.Replace-the-Substring-for-Balanced-String)|34.3%|Medium|| -|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|46.6%|Hard|| +|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|46.8%|Hard|| |1236|Web Crawler||64.5%|Medium|| -|1237|Find Positive Integer Solution for a Given Equation||69.8%|Easy|| -|1238|Circular Permutation in Binary Representation||65.8%|Medium|| +|1237|Find Positive Integer Solution for a Given Equation||69.7%|Easy|| +|1238|Circular Permutation in Binary Representation||65.9%|Medium|| |1239|Maximum Length of a Concatenated String with Unique Characters||49.2%|Medium|| |1240|Tiling a Rectangle with the Fewest Squares||52.4%|Hard|| |1241|Number of Comments per Post||67.5%|Easy|| -|1242|Web Crawler Multithreaded||47.7%|Medium|| -|1243|Array Transformation||50.4%|Easy|| +|1242|Web Crawler Multithreaded||47.8%|Medium|| +|1243|Array Transformation||50.3%|Easy|| |1244|Design A Leaderboard||65.7%|Medium|| -|1245|Tree Diameter||61.1%|Medium|| -|1246|Palindrome Removal||45.8%|Hard|| +|1245|Tree Diameter||61.2%|Medium|| +|1246|Palindrome Removal||45.7%|Hard|| |1247|Minimum Swaps to Make Strings Equal||62.3%|Medium|| |1248|Count Number of Nice Subarrays||56.5%|Medium|| -|1249|Minimum Remove to Make Valid Parentheses||63.4%|Medium|| +|1249|Minimum Remove to Make Valid Parentheses||63.5%|Medium|| |1250|Check If It Is a Good Array||56.3%|Hard|| |1251|Average Selling Price||82.5%|Easy|| -|1252|Cells with Odd Values in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix)|78.4%|Easy|| +|1252|Cells with Odd Values in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix)|78.5%|Easy|| |1253|Reconstruct a 2-Row Binary Matrix||41.3%|Medium|| -|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|61.5%|Medium|| -|1255|Maximum Score Words Formed by Letters||69.9%|Hard|| -|1256|Encode Number||67.3%|Medium|| -|1257|Smallest Common Region||60.2%|Medium|| -|1258|Synonymous Sentences||67.0%|Medium|| +|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|61.4%|Medium|| +|1255|Maximum Score Words Formed by Letters||69.8%|Hard|| +|1256|Encode Number||67.4%|Medium|| +|1257|Smallest Common Region||60.3%|Medium|| +|1258|Synonymous Sentences||65.4%|Medium|| |1259|Handshakes That Don't Cross||54.1%|Hard|| -|1260|Shift 2D Grid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1260.Shift-2D-Grid)|61.7%|Easy|| -|1261|Find Elements in a Contaminated Binary Tree||74.5%|Medium|| +|1260|Shift 2D Grid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1260.Shift-2D-Grid)|61.8%|Easy|| +|1261|Find Elements in a Contaminated Binary Tree||74.4%|Medium|| |1262|Greatest Sum Divisible by Three||49.2%|Medium|| -|1263|Minimum Moves to Move a Box to Their Target Location||42.7%|Hard|| -|1264|Page Recommendations||69.0%|Medium|| +|1263|Minimum Moves to Move a Box to Their Target Location||42.8%|Hard|| +|1264|Page Recommendations||69.1%|Medium|| |1265|Print Immutable Linked List in Reverse||94.4%|Medium|| |1266|Minimum Time Visiting All Points|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1266.Minimum-Time-Visiting-All-Points)|79.3%|Easy|| |1267|Count Servers that Communicate||57.8%|Medium|| |1268|Search Suggestions System||64.4%|Medium|| |1269|Number of Ways to Stay in the Same Place After Some Steps||43.2%|Hard|| -|1270|All People Report to the Given Manager||88.4%|Medium|| -|1271|Hexspeak||55.1%|Easy|| +|1270|All People Report to the Given Manager||88.3%|Medium|| +|1271|Hexspeak||55.2%|Easy|| |1272|Remove Interval||57.8%|Medium|| -|1273|Delete Tree Nodes||62.8%|Medium|| -|1274|Number of Ships in a Rectangle||66.0%|Hard|| -|1275|Find Winner on a Tic Tac Toe Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game)|53.1%|Easy|| +|1273|Delete Tree Nodes||62.6%|Medium|| +|1274|Number of Ships in a Rectangle||66.1%|Hard|| +|1275|Find Winner on a Tic Tac Toe Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game)|53.0%|Easy|| |1276|Number of Burgers with No Waste of Ingredients||49.9%|Medium|| |1277|Count Square Submatrices with All Ones||72.9%|Medium|| -|1278|Palindrome Partitioning III||60.5%|Hard|| -|1279|Traffic Light Controlled Intersection||75.8%|Easy|| +|1278|Palindrome Partitioning III||60.6%|Hard|| +|1279|Traffic Light Controlled Intersection||75.6%|Easy|| |1280|Students and Examinations||74.2%|Easy|| |1281|Subtract the Product and Sum of Digits of an Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer)|85.6%|Easy|| |1282|Group the People Given the Group Size They Belong To||84.3%|Medium|| |1283|Find the Smallest Divisor Given a Threshold|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold)|49.1%|Medium|| |1284|Minimum Number of Flips to Convert Binary Matrix to Zero Matrix||70.0%|Hard|| -|1285|Find the Start and End Number of Continuous Ranges||86.5%|Medium|| +|1285|Find the Start and End Number of Continuous Ranges||86.7%|Medium|| |1286|Iterator for Combination||70.9%|Medium|| |1287|Element Appearing More Than 25% In Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1287.Element-Appearing-More-Than-25%-In-Sorted-Array)|60.2%|Easy|| |1288|Remove Covered Intervals||57.2%|Medium|| |1289|Minimum Falling Path Sum II||62.2%|Hard|| -|1290|Convert Binary Number in a Linked List to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer)|81.7%|Easy|| +|1290|Convert Binary Number in a Linked List to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer)|81.6%|Easy|| |1291|Sequential Digits||57.4%|Medium|| |1292|Maximum Side Length of a Square with Sum Less than or Equal to Threshold||50.4%|Medium|| -|1293|Shortest Path in a Grid with Obstacles Elimination||42.8%|Hard|| -|1294|Weather Type in Each Country||66.0%|Easy|| +|1293|Shortest Path in a Grid with Obstacles Elimination||42.9%|Hard|| +|1294|Weather Type in Each Country||66.1%|Easy|| |1295|Find Numbers with Even Number of Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits)|79.4%|Easy|| -|1296|Divide Array in Sets of K Consecutive Numbers||55.2%|Medium|| -|1297|Maximum Number of Occurrences of a Substring||49.2%|Medium|| +|1296|Divide Array in Sets of K Consecutive Numbers||55.3%|Medium|| +|1297|Maximum Number of Occurrences of a Substring||49.3%|Medium|| |1298|Maximum Candies You Can Get from Boxes||59.6%|Hard|| -|1299|Replace Elements with Greatest Element on Right Side|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side)|74.2%|Easy|| +|1299|Replace Elements with Greatest Element on Right Side|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side)|74.1%|Easy|| |1300|Sum of Mutated Array Closest to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target)|43.3%|Medium|| |1301|Number of Paths with Max Score||38.0%|Hard|| -|1302|Deepest Leaves Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1302.Deepest-Leaves-Sum)|84.0%|Medium|| +|1302|Deepest Leaves Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1302.Deepest-Leaves-Sum)|84.1%|Medium|| |1303|Find the Team Size||89.4%|Easy|| |1304|Find N Unique Integers Sum up to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero)|76.5%|Easy|| |1305|All Elements in Two Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1305.All-Elements-in-Two-Binary-Search-Trees)|77.8%|Medium|| |1306|Jump Game III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1306.Jump-Game-III)|62.6%|Medium|| |1307|Verbal Arithmetic Puzzle||37.2%|Hard|| |1308|Running Total for Different Genders||87.0%|Medium|| -|1309|Decrypt String from Alphabet to Integer Mapping||77.2%|Easy|| +|1309|Decrypt String from Alphabet to Integer Mapping||77.3%|Easy|| |1310|XOR Queries of a Subarray||69.2%|Medium|| -|1311|Get Watched Videos by Your Friends||44.0%|Medium|| -|1312|Minimum Insertion Steps to Make a String Palindrome||59.1%|Hard|| +|1311|Get Watched Videos by Your Friends||44.1%|Medium|| +|1312|Minimum Insertion Steps to Make a String Palindrome||59.2%|Hard|| |1313|Decompress Run-Length Encoded List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1313.Decompress-Run-Length-Encoded-List)|85.3%|Easy|| -|1314|Matrix Block Sum||73.6%|Medium|| +|1314|Matrix Block Sum||73.7%|Medium|| |1315|Sum of Nodes with Even-Valued Grandparent||84.1%|Medium|| |1316|Distinct Echo Substrings||49.6%|Hard|| |1317|Convert Integer to the Sum of Two No-Zero Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers)|56.8%|Easy|| |1318|Minimum Flips to Make a OR b Equal to c||63.7%|Medium|| |1319|Number of Operations to Make Network Connected||54.7%|Medium|| -|1320|Minimum Distance to Type a Word Using Two Fingers||62.7%|Hard|| -|1321|Restaurant Growth||70.3%|Medium|| +|1320|Minimum Distance to Type a Word Using Two Fingers||62.8%|Hard|| +|1321|Restaurant Growth||70.5%|Medium|| |1322|Ads Performance||57.9%|Easy|| |1323|Maximum 69 Number||77.9%|Easy|| |1324|Print Words Vertically||58.6%|Medium|| -|1325|Delete Leaves With a Given Value||73.4%|Medium|| +|1325|Delete Leaves With a Given Value||73.5%|Medium|| |1326|Minimum Number of Taps to Open to Water a Garden||46.1%|Hard|| -|1327|List the Products Ordered in a Period||77.4%|Easy|| -|1328|Break a Palindrome||45.4%|Medium|| +|1327|List the Products Ordered in a Period||77.5%|Easy|| +|1328|Break a Palindrome||45.5%|Medium|| |1329|Sort the Matrix Diagonally||79.3%|Medium|| |1330|Reverse Subarray To Maximize Array Value||36.4%|Hard|| |1331|Rank Transform of an Array||57.7%|Easy|| |1332|Remove Palindromic Subsequences||62.8%|Easy|| |1333|Filter Restaurants by Vegan-Friendly, Price and Distance||57.0%|Medium|| |1334|Find the City With the Smallest Number of Neighbors at a Threshold Distance||46.5%|Medium|| -|1335|Minimum Difficulty of a Job Schedule||57.1%|Hard|| -|1336|Number of Transactions per Visit||47.3%|Hard|| -|1337|The K Weakest Rows in a Matrix||69.6%|Easy|| -|1338|Reduce Array Size to The Half||66.6%|Medium|| -|1339|Maximum Product of Splitted Binary Tree||37.8%|Medium|| +|1335|Minimum Difficulty of a Job Schedule||57.2%|Hard|| +|1336|Number of Transactions per Visit||47.4%|Hard|| +|1337|The K Weakest Rows in a Matrix||69.7%|Easy|| +|1338|Reduce Array Size to The Half||66.7%|Medium|| +|1339|Maximum Product of Splitted Binary Tree||37.9%|Medium|| |1340|Jump Game V||58.9%|Hard|| -|1341|Movie Rating||58.3%|Medium|| +|1341|Movie Rating||58.4%|Medium|| |1342|Number of Steps to Reduce a Number to Zero||85.7%|Easy|| |1343|Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold||64.5%|Medium|| |1344|Angle Between Hands of a Clock||61.3%|Medium|| |1345|Jump Game IV||41.9%|Hard|| |1346|Check If N and Its Double Exist||36.5%|Easy|| -|1347|Minimum Number of Steps to Make Two Strings Anagram||75.3%|Medium|| -|1348|Tweet Counts Per Frequency||33.5%|Medium|| +|1347|Minimum Number of Steps to Make Two Strings Anagram||75.4%|Medium|| +|1348|Tweet Counts Per Frequency||33.8%|Medium|| |1349|Maximum Students Taking Exam||44.0%|Hard|| |1350|Students With Invalid Departments||90.5%|Easy|| |1351|Count Negative Numbers in a Sorted Matrix||75.8%|Easy|| -|1352|Product of the Last K Numbers||43.6%|Medium|| +|1352|Product of the Last K Numbers||43.7%|Medium|| |1353|Maximum Number of Events That Can Be Attended||30.1%|Medium|| -|1354|Construct Target Array With Multiple Sums||31.4%|Hard|| -|1355|Activity Participants||73.8%|Medium|| -|1356|Sort Integers by The Number of 1 Bits||69.5%|Easy|| -|1357|Apply Discount Every n Orders||66.7%|Medium|| +|1354|Construct Target Array With Multiple Sums||31.3%|Hard|| +|1355|Activity Participants||74.0%|Medium|| +|1356|Sort Integers by The Number of 1 Bits||69.6%|Easy|| +|1357|Apply Discount Every n Orders||66.5%|Medium|| |1358|Number of Substrings Containing All Three Characters||60.3%|Medium|| |1359|Count All Valid Pickup and Delivery Options||56.9%|Hard|| -|1360|Number of Days Between Two Dates||47.1%|Easy|| +|1360|Number of Days Between Two Dates||47.0%|Easy|| |1361|Validate Binary Tree Nodes||44.3%|Medium|| |1362|Closest Divisors||57.5%|Medium|| -|1363|Largest Multiple of Three||34.0%|Hard|| -|1364|Number of Trusted Contacts of a Customer||77.8%|Medium|| +|1363|Largest Multiple of Three||33.9%|Hard|| +|1364|Number of Trusted Contacts of a Customer||78.0%|Medium|| |1365|How Many Numbers Are Smaller Than the Current Number||85.9%|Easy|| -|1366|Rank Teams by Votes||54.9%|Medium|| +|1366|Rank Teams by Votes||55.0%|Medium|| |1367|Linked List in Binary Tree||41.1%|Medium|| -|1368|Minimum Cost to Make at Least One Valid Path in a Grid||56.7%|Hard|| +|1368|Minimum Cost to Make at Least One Valid Path in a Grid||56.8%|Hard|| |1369|Get the Second Most Recent Activity||68.4%|Hard|| |1370|Increasing Decreasing String||76.3%|Easy|| -|1371|Find the Longest Substring Containing Vowels in Even Counts||61.4%|Medium|| -|1372|Longest ZigZag Path in a Binary Tree||54.5%|Medium|| -|1373|Maximum Sum BST in Binary Tree||37.7%|Hard|| +|1371|Find the Longest Substring Containing Vowels in Even Counts||61.3%|Medium|| +|1372|Longest ZigZag Path in a Binary Tree||54.6%|Medium|| +|1373|Maximum Sum BST in Binary Tree||37.6%|Hard|| |1374|Generate a String With Characters That Have Odd Counts||76.2%|Easy|| |1375|Bulb Switcher III||64.1%|Medium|| -|1376|Time Needed to Inform All Employees||56.2%|Medium|| +|1376|Time Needed to Inform All Employees||56.3%|Medium|| |1377|Frog Position After T Seconds||34.7%|Hard|| |1378|Replace Employee ID With The Unique Identifier||89.7%|Easy|| -|1379|Find a Corresponding Node of a Binary Tree in a Clone of That Tree||85.4%|Medium|| -|1380|Lucky Numbers in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix)|70.8%|Easy|| -|1381|Design a Stack With Increment Operation||75.7%|Medium|| +|1379|Find a Corresponding Node of a Binary Tree in a Clone of That Tree||85.2%|Medium|| +|1380|Lucky Numbers in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix)|70.9%|Easy|| +|1381|Design a Stack With Increment Operation||75.8%|Medium|| |1382|Balance a Binary Search Tree||76.0%|Medium|| -|1383|Maximum Performance of a Team||34.9%|Hard|| -|1384|Total Sales Amount by Year||63.8%|Hard|| -|1385|Find the Distance Value Between Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays)|66.5%|Easy|| +|1383|Maximum Performance of a Team||35.1%|Hard|| +|1384|Total Sales Amount by Year||64.0%|Hard|| +|1385|Find the Distance Value Between Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays)|66.4%|Easy|| |1386|Cinema Seat Allocation||35.5%|Medium|| |1387|Sort Integers by The Power Value||70.5%|Medium|| |1388|Pizza With 3n Slices||45.4%|Hard|| -|1389|Create Target Array in the Given Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1389.Create-Target-Array-in-the-Given-Order)|84.7%|Easy|| +|1389|Create Target Array in the Given Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1389.Create-Target-Array-in-the-Given-Order)|84.8%|Easy|| |1390|Four Divisors||39.0%|Medium|| |1391|Check if There is a Valid Path in a Grid||44.9%|Medium|| -|1392|Longest Happy Prefix||41.2%|Hard|| -|1393|Capital Gain/Loss||90.5%|Medium|| +|1392|Longest Happy Prefix||41.3%|Hard|| +|1393|Capital Gain/Loss||90.6%|Medium|| |1394|Find Lucky Integer in an Array||63.2%|Easy|| -|1395|Count Number of Teams||81.8%|Medium|| -|1396|Design Underground System||68.6%|Medium|| +|1395|Count Number of Teams||81.9%|Medium|| +|1396|Design Underground System||68.8%|Medium|| |1397|Find All Good Strings||37.9%|Hard|| |1398|Customers Who Bought Products A and B but Not C||82.0%|Medium|| -|1399|Count Largest Group||65.4%|Easy|| +|1399|Count Largest Group||65.3%|Easy|| |1400|Construct K Palindrome Strings||62.8%|Medium|| -|1401|Circle and Rectangle Overlapping||42.2%|Medium|| +|1401|Circle and Rectangle Overlapping||42.3%|Medium|| |1402|Reducing Dishes||72.3%|Hard|| -|1403|Minimum Subsequence in Non-Increasing Order||71.0%|Easy|| +|1403|Minimum Subsequence in Non-Increasing Order||71.1%|Easy|| |1404|Number of Steps to Reduce a Number in Binary Representation to One||49.8%|Medium|| |1405|Longest Happy String||52.2%|Medium|| -|1406|Stone Game III||57.1%|Hard|| -|1407|Top Travellers||83.6%|Easy|| +|1406|Stone Game III||57.2%|Hard|| +|1407|Top Travellers||83.7%|Easy|| |1408|String Matching in an Array||62.7%|Easy|| |1409|Queries on a Permutation With Key||81.4%|Medium|| -|1410|HTML Entity Parser||54.5%|Medium|| +|1410|HTML Entity Parser||54.4%|Medium|| |1411|Number of Ways to Paint N × 3 Grid||60.5%|Hard|| -|1412|Find the Quiet Students in All Exams||65.6%|Hard|| +|1412|Find the Quiet Students in All Exams||65.5%|Hard|| |1413|Minimum Value to Get Positive Step by Step Sum||65.3%|Easy|| -|1414|Find the Minimum Number of Fibonacci Numbers Whose Sum Is K||63.7%|Medium|| +|1414|Find the Minimum Number of Fibonacci Numbers Whose Sum Is K||63.8%|Medium|| |1415|The k-th Lexicographical String of All Happy Strings of Length n||70.0%|Medium|| |1416|Restore The Array||36.3%|Hard|| |1417|Reformat The String||55.4%|Easy|| -|1418|Display Table of Food Orders in a Restaurant||68.1%|Medium|| -|1419|Minimum Number of Frogs Croaking||47.1%|Medium|| -|1420|Build Array Where You Can Find The Maximum Exactly K Comparisons||64.4%|Hard|| +|1418|Display Table of Food Orders in a Restaurant||68.2%|Medium|| +|1419|Minimum Number of Frogs Croaking||47.2%|Medium|| +|1420|Build Array Where You Can Find The Maximum Exactly K Comparisons||64.3%|Hard|| |1421|NPV Queries||81.7%|Medium|| |1422|Maximum Score After Splitting a String||56.0%|Easy|| -|1423|Maximum Points You Can Obtain from Cards||46.1%|Medium|| -|1424|Diagonal Traverse II||45.3%|Medium|| +|1423|Maximum Points You Can Obtain from Cards||46.2%|Medium|| +|1424|Diagonal Traverse II||45.4%|Medium|| |1425|Constrained Subsequence Sum||44.9%|Hard|| |1426|Counting Elements||59.0%|Easy|| |1427|Perform String Shifts||53.4%|Easy|| |1428|Leftmost Column with at Least a One||48.7%|Medium|| |1429|First Unique Number||49.0%|Medium|| |1430|Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree||45.1%|Medium|| -|1431|Kids With the Greatest Number of Candies||88.5%|Easy|| +|1431|Kids With the Greatest Number of Candies||88.6%|Easy|| |1432|Max Difference You Can Get From Changing an Integer||42.9%|Medium|| |1433|Check If a String Can Break Another String||67.0%|Medium|| |1434|Number of Ways to Wear Different Hats to Each Other||39.2%|Hard|| -|1435|Create a Session Bar Chart||77.7%|Easy|| -|1436|Destination City||77.2%|Easy|| +|1435|Create a Session Bar Chart||77.8%|Easy|| +|1436|Destination City||77.1%|Easy|| |1437|Check If All 1's Are at Least Length K Places Away||61.8%|Medium|| -|1438|Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit||43.8%|Medium|| +|1438|Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit||43.9%|Medium|| |1439|Find the Kth Smallest Sum of a Matrix With Sorted Rows||60.0%|Hard|| |1440|Evaluate Boolean Expression||74.4%|Medium|| |1441|Build an Array With Stack Operations||69.0%|Easy|| |1442|Count Triplets That Can Form Two Arrays of Equal XOR||70.9%|Medium|| |1443|Minimum Time to Collect All Apples in a Tree||54.6%|Medium|| -|1444|Number of Ways of Cutting a Pizza||53.6%|Hard|| +|1444|Number of Ways of Cutting a Pizza||53.7%|Hard|| |1445|Apples & Oranges||90.6%|Medium|| -|1446|Consecutive Characters||61.2%|Easy|| -|1447|Simplified Fractions||62.0%|Medium|| +|1446|Consecutive Characters||61.1%|Easy|| +|1447|Simplified Fractions||62.1%|Medium|| |1448|Count Good Nodes in Binary Tree||70.3%|Medium|| -|1449|Form Largest Integer With Digits That Add up to Target||43.6%|Hard|| +|1449|Form Largest Integer With Digits That Add up to Target||43.7%|Hard|| |1450|Number of Students Doing Homework at a Given Time||76.9%|Easy|| |1451|Rearrange Words in a Sentence||59.0%|Medium|| |1452|People Whose List of Favorite Companies Is Not a Subset of Another List||54.8%|Medium|| -|1453|Maximum Number of Darts Inside of a Circular Dartboard||35.1%|Hard|| +|1453|Maximum Number of Darts Inside of a Circular Dartboard||35.2%|Hard|| |1454|Active Users||38.6%|Medium|| |1455|Check If a Word Occurs As a Prefix of Any Word in a Sentence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence)|64.8%|Easy|| -|1456|Maximum Number of Vowels in a Substring of Given Length||54.2%|Medium|| -|1457|Pseudo-Palindromic Paths in a Binary Tree||71.6%|Medium|| +|1456|Maximum Number of Vowels in a Substring of Given Length||54.3%|Medium|| +|1457|Pseudo-Palindromic Paths in a Binary Tree||71.4%|Medium|| |1458|Max Dot Product of Two Subsequences||42.8%|Hard|| -|1459|Rectangles Area||64.2%|Medium|| -|1460|Make Two Arrays Equal by Reversing Sub-arrays||72.2%|Easy|| -|1461|Check If a String Contains All Binary Codes of Size K||46.8%|Medium|| -|1462|Course Schedule IV||44.2%|Medium|| +|1459|Rectangles Area||64.3%|Medium|| +|1460|Make Two Arrays Equal by Reversing Sub-arrays||72.1%|Easy|| +|1461|Check If a String Contains All Binary Codes of Size K||46.9%|Medium|| +|1462|Course Schedule IV||44.3%|Medium|| |1463|Cherry Pickup II||69.5%|Hard|| -|1464|Maximum Product of Two Elements in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array)|76.8%|Easy|| -|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.6%|Medium|| +|1464|Maximum Product of Two Elements in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array)|76.9%|Easy|| +|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.7%|Medium|| |1466|Reorder Routes to Make All Paths Lead to the City Zero||61.3%|Medium|| -|1467|Probability of a Two Boxes Having The Same Number of Distinct Balls||60.9%|Hard|| -|1468|Calculate Salaries||80.9%|Medium|| +|1467|Probability of a Two Boxes Having The Same Number of Distinct Balls||61.0%|Hard|| +|1468|Calculate Salaries||81.1%|Medium|| |1469|Find All The Lonely Nodes||80.6%|Easy|| |1470|Shuffle the Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1470.Shuffle-the-Array)|88.5%|Easy|| |1471|The k Strongest Values in an Array||58.4%|Medium|| -|1472|Design Browser History||70.1%|Medium|| -|1473|Paint House III||48.8%|Hard|| -|1474|Delete N Nodes After M Nodes of a Linked List||74.4%|Easy|| -|1475|Final Prices With a Special Discount in a Shop||74.6%|Easy|| -|1476|Subrectangle Queries||88.7%|Medium|| -|1477|Find Two Non-overlapping Sub-arrays Each With Target Sum||33.9%|Medium|| -|1478|Allocate Mailboxes||54.6%|Hard|| -|1479|Sales by Day of the Week||83.5%|Hard|| -|1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|89.7%|Easy|| -|1481|Least Number of Unique Integers after K Removals||55.4%|Medium|| -|1482|Minimum Number of Days to Make m Bouquets||49.6%|Medium|| -|1483|Kth Ancestor of a Tree Node||30.1%|Hard|| +|1472|Design Browser History||70.2%|Medium|| +|1473|Paint House III||48.7%|Hard|| +|1474|Delete N Nodes After M Nodes of a Linked List||74.6%|Easy|| +|1475|Final Prices With a Special Discount in a Shop||74.7%|Easy|| +|1476|Subrectangle Queries||88.6%|Medium|| +|1477|Find Two Non-overlapping Sub-arrays Each With Target Sum||34.0%|Medium|| +|1478|Allocate Mailboxes||54.4%|Hard|| +|1479|Sales by Day of the Week||83.6%|Hard|| +|1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|89.6%|Easy|| +|1481|Least Number of Unique Integers after K Removals||55.5%|Medium|| +|1482|Minimum Number of Days to Make m Bouquets||49.7%|Medium|| +|1483|Kth Ancestor of a Tree Node||30.2%|Hard|| |1484|Group Sold Products By The Date||86.0%|Easy|| |1485|Clone Binary Tree With Random Pointer||79.7%|Medium|| |1486|XOR Operation in an Array||84.0%|Easy|| |1487|Making File Names Unique||30.4%|Medium|| |1488|Avoid Flood in The City||24.7%|Medium|| -|1489|Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree||52.3%|Hard|| +|1489|Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree||52.4%|Hard|| |1490|Clone N-ary Tree||83.5%|Medium|| |1491|Average Salary Excluding the Minimum and Maximum Salary||68.5%|Easy|| |1492|The kth Factor of n||63.4%|Medium|| |1493|Longest Subarray of 1's After Deleting One Element||58.2%|Medium|| |1494|Parallel Courses II||31.3%|Hard|| -|1495|Friendly Movies Streamed Last Month||51.4%|Easy|| -|1496|Path Crossing||55.4%|Easy|| +|1495|Friendly Movies Streamed Last Month||51.3%|Easy|| +|1496|Path Crossing||55.5%|Easy|| |1497|Check If Array Pairs Are Divisible by k||40.6%|Medium|| |1498|Number of Subsequences That Satisfy the Given Sum Condition||38.2%|Medium|| -|1499|Max Value of Equation||45.2%|Hard|| -|1500|Design a File Sharing System||45.8%|Medium|| +|1499|Max Value of Equation||45.3%|Hard|| +|1500|Design a File Sharing System||46.0%|Medium|| |1501|Countries You Can Safely Invest In||60.0%|Medium|| |1502|Can Make Arithmetic Progression From Sequence||70.8%|Easy|| |1503|Last Moment Before All Ants Fall Out of a Plank||53.0%|Medium|| |1504|Count Submatrices With All Ones||61.0%|Medium|| |1505|Minimum Possible Integer After at Most K Adjacent Swaps On Digits||36.2%|Hard|| -|1506|Find Root of N-Ary Tree||79.5%|Medium|| -|1507|Reformat Date||60.4%|Easy|| +|1506|Find Root of N-Ary Tree||81.0%|Medium|| +|1507|Reformat Date||60.3%|Easy|| |1508|Range Sum of Sorted Subarray Sums||62.1%|Medium|| -|1509|Minimum Difference Between Largest and Smallest Value in Three Moves||51.7%|Medium|| +|1509|Minimum Difference Between Largest and Smallest Value in Three Moves||51.8%|Medium|| |1510|Stone Game IV||58.7%|Hard|| -|1511|Customer Order Frequency||73.5%|Easy|| +|1511|Customer Order Frequency||73.6%|Easy|| |1512|Number of Good Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1512.Number-of-Good-Pairs)|87.9%|Easy|| -|1513|Number of Substrings With Only 1s||41.3%|Medium|| -|1514|Path with Maximum Probability||39.2%|Medium|| +|1513|Number of Substrings With Only 1s||41.4%|Medium|| +|1514|Path with Maximum Probability||39.3%|Medium|| |1515|Best Position for a Service Centre||36.9%|Hard|| -|1516|Move Sub-Tree of N-Ary Tree||62.9%|Hard|| -|1517|Find Users With Valid E-Mails||72.1%|Easy|| +|1516|Move Sub-Tree of N-Ary Tree||62.8%|Hard|| +|1517|Find Users With Valid E-Mails||71.8%|Easy|| |1518|Water Bottles||60.7%|Easy|| |1519|Number of Nodes in the Sub-Tree With the Same Label||36.8%|Medium|| -|1520|Maximum Number of Non-Overlapping Substrings||35.8%|Hard|| +|1520|Maximum Number of Non-Overlapping Substrings||35.9%|Hard|| |1521|Find a Value of a Mysterious Function Closest to Target||44.4%|Hard|| -|1522|Diameter of N-Ary Tree||68.7%|Medium|| +|1522|Diameter of N-Ary Tree||68.8%|Medium|| |1523|Count Odd Numbers in an Interval Range||55.2%|Easy|| |1524|Number of Sub-arrays With Odd Sum||39.4%|Medium|| |1525|Number of Good Ways to Split a String||66.9%|Medium|| |1526|Minimum Number of Increments on Subarrays to Form a Target Array||59.7%|Hard|| -|1527|Patients With a Condition||78.2%|Easy|| +|1527|Patients With a Condition||76.7%|Easy|| |1528|Shuffle String||85.8%|Easy|| -|1529|Bulb Switcher IV||70.9%|Medium|| +|1529|Bulb Switcher IV||70.8%|Medium|| |1530|Number of Good Leaf Nodes Pairs||55.8%|Medium|| -|1531|String Compression II||33.3%|Hard|| -|1532|The Most Recent Three Orders||72.9%|Medium|| -|1533|Find the Index of the Large Integer||54.8%|Medium|| +|1531|String Compression II||33.2%|Hard|| +|1532|The Most Recent Three Orders||73.0%|Medium|| +|1533|Find the Index of the Large Integer||54.7%|Medium|| |1534|Count Good Triplets||80.2%|Easy|| |1535|Find the Winner of an Array Game||47.1%|Medium|| |1536|Minimum Swaps to Arrange a Binary Grid||43.1%|Medium|| |1537|Get the Maximum Score||36.3%|Hard|| -|1538|Guess the Majority in a Hidden Array||61.6%|Medium|| +|1538|Guess the Majority in a Hidden Array||61.4%|Medium|| |1539|Kth Missing Positive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1539.Kth-Missing-Positive-Number)|55.5%|Easy|| -|1540|Can Convert String in K Moves||30.4%|Medium|| -|1541|Minimum Insertions to Balance a Parentheses String||42.4%|Medium|| -|1542|Find Longest Awesome Substring||36.4%|Hard|| -|1543|Fix Product Name Format||68.1%|Easy|| -|1544|Make The String Great||55.0%|Easy|| +|1540|Can Convert String in K Moves||30.5%|Medium|| +|1541|Minimum Insertions to Balance a Parentheses String||42.5%|Medium|| +|1542|Find Longest Awesome Substring||36.5%|Hard|| +|1543|Fix Product Name Format||68.0%|Easy|| +|1544|Make The String Great||55.1%|Easy|| |1545|Find Kth Bit in Nth Binary String||57.2%|Medium|| -|1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||43.6%|Medium|| -|1547|Minimum Cost to Cut a Stick||51.8%|Hard|| -|1548|The Most Similar Path in a Graph||54.3%|Hard|| +|1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||43.7%|Medium|| +|1547|Minimum Cost to Cut a Stick||52.0%|Hard|| +|1548|The Most Similar Path in a Graph||54.1%|Hard|| |1549|The Most Recent Orders for Each Product||66.2%|Medium|| |1550|Three Consecutive Odds||65.3%|Easy|| -|1551|Minimum Operations to Make Array Equal||77.7%|Medium|| +|1551|Minimum Operations to Make Array Equal||77.8%|Medium|| |1552|Magnetic Force Between Two Balls||48.6%|Medium|| |1553|Minimum Number of Days to Eat N Oranges||29.1%|Hard|| -|1554|Strings Differ by One Character||63.6%|Medium|| -|1555|Bank Account Summary||52.2%|Medium|| -|1556|Thousand Separator||58.3%|Easy|| -|1557|Minimum Number of Vertices to Reach All Nodes||75.2%|Medium|| +|1554|Strings Differ by One Character||63.7%|Medium|| +|1555|Bank Account Summary||52.6%|Medium|| +|1556|Thousand Separator||58.2%|Easy|| +|1557|Minimum Number of Vertices to Reach All Nodes||75.3%|Medium|| |1558|Minimum Numbers of Function Calls to Make Target Array||62.5%|Medium|| |1559|Detect Cycles in 2D Grid||44.7%|Hard|| |1560|Most Visited Sector in a Circular Track||56.9%|Easy|| -|1561|Maximum Number of Coins You Can Get||78.1%|Medium|| -|1562|Find Latest Group of Size M||39.3%|Medium|| -|1563|Stone Game V||40.0%|Hard|| -|1564|Put Boxes Into the Warehouse I||66.0%|Medium|| -|1565|Unique Orders and Customers Per Month||83.7%|Easy|| +|1561|Maximum Number of Coins You Can Get||78.0%|Medium|| +|1562|Find Latest Group of Size M||39.4%|Medium|| +|1563|Stone Game V||40.1%|Hard|| +|1564|Put Boxes Into the Warehouse I||66.1%|Medium|| +|1565|Unique Orders and Customers Per Month||83.8%|Easy|| |1566|Detect Pattern of Length M Repeated K or More Times||42.2%|Easy|| |1567|Maximum Length of Subarray With Positive Product||36.4%|Medium|| |1568|Minimum Number of Days to Disconnect Island||50.5%|Hard|| -|1569|Number of Ways to Reorder Array to Get Same BST||50.0%|Hard|| +|1569|Number of Ways to Reorder Array to Get Same BST||50.1%|Hard|| |1570|Dot Product of Two Sparse Vectors||91.5%|Medium|| -|1571|Warehouse Manager||90.1%|Easy|| +|1571|Warehouse Manager||90.0%|Easy|| |1572|Matrix Diagonal Sum||78.2%|Easy|| -|1573|Number of Ways to Split a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1573.Number-of-Ways-to-Split-a-String)|30.7%|Medium|| -|1574|Shortest Subarray to be Removed to Make Array Sorted||32.8%|Medium|| +|1573|Number of Ways to Split a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1573.Number-of-Ways-to-Split-a-String)|30.8%|Medium|| +|1574|Shortest Subarray to be Removed to Make Array Sorted||32.9%|Medium|| |1575|Count All Possible Routes||57.5%|Hard|| -|1576|Replace All ?'s to Avoid Consecutive Repeating Characters||48.0%|Easy|| +|1576|Replace All ?'s to Avoid Consecutive Repeating Characters||48.1%|Easy|| |1577|Number of Ways Where Square of Number Is Equal to Product of Two Numbers||37.2%|Medium|| -|1578|Minimum Deletion Cost to Avoid Repeating Letters||60.2%|Medium|| +|1578|Minimum Deletion Cost to Avoid Repeating Letters||60.3%|Medium|| |1579|Remove Max Number of Edges to Keep Graph Fully Traversable||45.7%|Hard|| -|1580|Put Boxes Into the Warehouse II||62.1%|Medium|| -|1581|Customer Who Visited but Did Not Make Any Transactions||90.1%|Easy|| -|1582|Special Positions in a Binary Matrix||64.0%|Easy|| -|1583|Count Unhappy Friends||53.5%|Medium|| +|1580|Put Boxes Into the Warehouse II||62.2%|Medium|| +|1581|Customer Who Visited but Did Not Make Any Transactions||90.3%|Easy|| +|1582|Special Positions in a Binary Matrix||64.2%|Easy|| +|1583|Count Unhappy Friends||53.6%|Medium|| |1584|Min Cost to Connect All Points||50.2%|Medium|| -|1585|Check If String Is Transformable With Substring Sort Operations||48.1%|Hard|| -|1586|Binary Search Tree Iterator II||66.8%|Medium|| -|1587|Bank Account Summary II||90.5%|Easy|| -|1588|Sum of All Odd Length Subarrays||82.0%|Easy|| -|1589|Maximum Sum Obtained of Any Permutation||34.5%|Medium|| -|1590|Make Sum Divisible by P||27.1%|Medium|| -|1591|Strange Printer II||55.3%|Hard|| +|1585|Check If String Is Transformable With Substring Sort Operations||48.3%|Hard|| +|1586|Binary Search Tree Iterator II||66.5%|Medium|| +|1587|Bank Account Summary II||90.3%|Easy|| +|1588|Sum of All Odd Length Subarrays||82.1%|Easy|| +|1589|Maximum Sum Obtained of Any Permutation||34.6%|Medium|| +|1590|Make Sum Divisible by P||27.2%|Medium|| +|1591|Strange Printer II||55.4%|Hard|| |1592|Rearrange Spaces Between Words||43.7%|Easy|| -|1593|Split a String Into the Max Number of Unique Substrings||48.1%|Medium|| +|1593|Split a String Into the Max Number of Unique Substrings||48.3%|Medium|| |1594|Maximum Non Negative Product in a Matrix||31.9%|Medium|| -|1595|Minimum Cost to Connect Two Groups of Points||42.5%|Hard|| -|1596|The Most Frequently Ordered Products for Each Customer||84.1%|Medium|| -|1597|Build Binary Expression Tree From Infix Expression||65.9%|Hard|| +|1595|Minimum Cost to Connect Two Groups of Points||42.7%|Hard|| +|1596|The Most Frequently Ordered Products for Each Customer||84.4%|Medium|| +|1597|Build Binary Expression Tree From Infix Expression||65.5%|Hard|| |1598|Crawler Log Folder||64.3%|Easy|| -|1599|Maximum Profit of Operating a Centennial Wheel||43.3%|Medium|| +|1599|Maximum Profit of Operating a Centennial Wheel||43.4%|Medium|| |1600|Throne Inheritance||59.7%|Medium|| -|1601|Maximum Number of Achievable Transfer Requests||47.3%|Hard|| -|1602|Find Nearest Right Node in Binary Tree||74.0%|Medium|| -|1603|Design Parking System||86.7%|Easy|| -|1604|Alert Using Same Key-Card Three or More Times in a One Hour Period||42.0%|Medium|| -|1605|Find Valid Matrix Given Row and Column Sums||77.4%|Medium|| +|1601|Maximum Number of Achievable Transfer Requests||47.4%|Hard|| +|1602|Find Nearest Right Node in Binary Tree||74.1%|Medium|| +|1603|Design Parking System||86.8%|Easy|| +|1604|Alert Using Same Key-Card Three or More Times in a One Hour Period||42.1%|Medium|| +|1605|Find Valid Matrix Given Row and Column Sums||77.6%|Medium|| |1606|Find Servers That Handled Most Number of Requests||36.7%|Hard|| |1607|Sellers With No Sales||56.0%|Easy|| -|1608|Special Array With X Elements Greater Than or Equal X||61.7%|Easy|| -|1609|Even Odd Tree||53.4%|Medium|| -|1610|Maximum Number of Visible Points||28.4%|Hard|| +|1608|Special Array With X Elements Greater Than or Equal X||61.8%|Easy|| +|1609|Even Odd Tree||53.3%|Medium|| +|1610|Maximum Number of Visible Points||28.5%|Hard|| |1611|Minimum One Bit Operations to Make Integers Zero||57.0%|Hard|| -|1612|Check If Two Expression Trees are Equivalent||70.0%|Medium|| -|1613|Find the Missing IDs||72.4%|Medium|| -|1614|Maximum Nesting Depth of the Parentheses||83.7%|Easy|| +|1612|Check If Two Expression Trees are Equivalent||69.8%|Medium|| +|1613|Find the Missing IDs||72.1%|Medium|| +|1614|Maximum Nesting Depth of the Parentheses||83.5%|Easy|| |1615|Maximal Network Rank||51.6%|Medium|| |1616|Split Two Strings to Make Palindrome||36.5%|Medium|| -|1617|Count Subtrees With Max Distance Between Cities||63.3%|Hard|| -|1618|Maximum Font to Fit a Sentence in a Screen||57.5%|Medium|| -|1619|Mean of Array After Removing Some Elements||65.6%|Easy|| +|1617|Count Subtrees With Max Distance Between Cities||63.5%|Hard|| +|1618|Maximum Font to Fit a Sentence in a Screen||58.1%|Medium|| +|1619|Mean of Array After Removing Some Elements||65.5%|Easy|| |1620|Coordinate With Maximum Network Quality||37.1%|Medium|| -|1621|Number of Sets of K Non-Overlapping Line Segments||41.3%|Medium|| +|1621|Number of Sets of K Non-Overlapping Line Segments||41.2%|Medium|| |1622|Fancy Sequence||15.5%|Hard|| -|1623|All Valid Triplets That Can Represent a Country||89.3%|Easy|| +|1623|All Valid Triplets That Can Represent a Country||89.1%|Easy|| |1624|Largest Substring Between Two Equal Characters||59.1%|Easy|| -|1625|Lexicographically Smallest String After Applying Operations||63.2%|Medium|| -|1626|Best Team With No Conflicts||37.1%|Medium|| +|1625|Lexicographically Smallest String After Applying Operations||63.3%|Medium|| +|1626|Best Team With No Conflicts||37.2%|Medium|| |1627|Graph Connectivity With Threshold||38.1%|Hard|| -|1628|Design an Expression Tree With Evaluate Function||80.8%|Medium|| -|1629|Slowest Key||58.9%|Easy|| +|1628|Design an Expression Tree With Evaluate Function||80.7%|Medium|| +|1629|Slowest Key||59.0%|Easy|| |1630|Arithmetic Subarrays||77.8%|Medium|| -|1631|Path With Minimum Effort||43.1%|Medium|| -|1632|Rank Transform of a Matrix||30.2%|Hard|| -|1633|Percentage of Users Attended a Contest||73.2%|Easy|| -|1634|Add Two Polynomials Represented as Linked Lists||56.1%|Medium|| -|1635|Hopper Company Queries I||57.7%|Hard|| -|1636|Sort Array by Increasing Frequency||66.4%|Easy|| -|1637|Widest Vertical Area Between Two Points Containing No Points||84.0%|Medium|| +|1631|Path With Minimum Effort||43.2%|Medium|| +|1632|Rank Transform of a Matrix||30.3%|Hard|| +|1633|Percentage of Users Attended a Contest||72.9%|Easy|| +|1634|Add Two Polynomials Represented as Linked Lists||56.3%|Medium|| +|1635|Hopper Company Queries I||56.3%|Hard|| +|1636|Sort Array by Increasing Frequency||66.5%|Easy|| +|1637|Widest Vertical Area Between Two Points Containing No Points||83.9%|Medium|| |1638|Count Substrings That Differ by One Character||67.8%|Medium|| -|1639|Number of Ways to Form a Target String Given a Dictionary||39.5%|Hard|| -|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|64.1%|Easy|| -|1641|Count Sorted Vowel Strings||74.9%|Medium|| -|1642|Furthest Building You Can Reach||51.6%|Medium|| +|1639|Number of Ways to Form a Target String Given a Dictionary||39.3%|Hard|| +|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|63.1%|Easy|| +|1641|Count Sorted Vowel Strings||74.7%|Medium|| +|1642|Furthest Building You Can Reach||51.5%|Medium|| |1643|Kth Smallest Instructions||42.8%|Hard|| |1644|Lowest Common Ancestor of a Binary Tree II||57.5%|Medium|| -|1645|Hopper Company Queries II||41.4%|Hard|| -|1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|48.3%|Easy|| -|1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|53.7%|Medium|| +|1645|Hopper Company Queries II||41.1%|Hard|| +|1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|48.4%|Easy|| +|1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|53.8%|Medium|| |1648|Sell Diminishing-Valued Colored Balls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls)|30.8%|Medium|| -|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|42.5%|Hard|| -|1650|Lowest Common Ancestor of a Binary Tree III||77.4%|Medium|| -|1651|Hopper Company Queries III||67.3%|Hard|| -|1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.6%|Easy|| +|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.9%|Hard|| +|1650|Lowest Common Ancestor of a Binary Tree III||77.3%|Medium|| +|1651|Hopper Company Queries III||67.0%|Hard|| +|1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.5%|Easy|| |1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.5%|Medium|| -|1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.4%|Medium|| -|1655|Distribute Repeating Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1655.Distribute-Repeating-Integers)|40.9%|Hard|| -|1656|Design an Ordered Stream|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1656.Design-an-Ordered-Stream)|82.3%|Easy|| -|1657|Determine if Two Strings Are Close|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1657.Determine-if-Two-Strings-Are-Close)|51.2%|Medium|| -|1658|Minimum Operations to Reduce X to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero)|30.5%|Medium|| -|1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|34.5%|Hard|| -|1660|Correct a Binary Tree||78.9%|Medium|| -|1661|Average Time of Process per Machine||79.1%|Easy|| -|1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|83.8%|Easy|| -|1663|Smallest String With A Given Numeric Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value)|59.9%|Medium|| -|1664|Ways to Make a Fair Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1664.Ways-to-Make-a-Fair-Array)|60.5%|Medium|| -|1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|68.3%|Hard|| -|1666|Change the Root of a Binary Tree||67.4%|Medium|| -|1667|Fix Names in a Table||63.8%|Easy|| +|1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.5%|Medium|| +|1655|Distribute Repeating Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1655.Distribute-Repeating-Integers)|40.6%|Hard|| +|1656|Design an Ordered Stream|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1656.Design-an-Ordered-Stream)|82.5%|Easy|| +|1657|Determine if Two Strings Are Close|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1657.Determine-if-Two-Strings-Are-Close)|51.3%|Medium|| +|1658|Minimum Operations to Reduce X to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero)|30.7%|Medium|| +|1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|35.2%|Hard|| +|1660|Correct a Binary Tree||78.8%|Medium|| +|1661|Average Time of Process per Machine||79.4%|Easy|| +|1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|83.9%|Easy|| +|1663|Smallest String With A Given Numeric Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value)|60.1%|Medium|| +|1664|Ways to Make a Fair Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1664.Ways-to-Make-a-Fair-Array)|60.6%|Medium|| +|1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|68.4%|Hard|| +|1666|Change the Root of a Binary Tree||68.5%|Medium|| +|1667|Fix Names in a Table||64.1%|Easy|| |1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.7%|Easy|| -|1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.7%|Medium|| -|1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.6%|Medium|| -|1671|Minimum Number of Removals to Make Mountain Array||45.9%|Hard|| -|1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.9%|Easy|| -|1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|37.9%|Medium|| +|1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.4%|Medium|| +|1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.5%|Medium|| +|1671|Minimum Number of Removals to Make Mountain Array||45.8%|Hard|| +|1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.8%|Easy|| +|1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|38.0%|Medium|| |1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|34.2%|Medium|| -|1675|Minimize Deviation in Array||44.9%|Hard|| -|1676|Lowest Common Ancestor of a Binary Tree IV||77.6%|Medium|| -|1677|Product's Worth Over Invoices||75.0%|Easy|| +|1675|Minimize Deviation in Array||44.8%|Hard|| +|1676|Lowest Common Ancestor of a Binary Tree IV||77.8%|Medium|| +|1677|Product's Worth Over Invoices||74.6%|Easy|| |1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.9%|Easy|| -|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|52.2%|Medium|| -|1680|Concatenation of Consecutive Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers)|45.0%|Medium|| -|1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|34.6%|Hard|| +|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|52.1%|Medium|| +|1680|Concatenation of Consecutive Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers)|45.1%|Medium|| +|1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|34.8%|Hard|| |1682|Longest Palindromic Subsequence II||51.8%|Medium|| -|1683|Invalid Tweets||91.9%|Easy|| -|1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|84.5%|Easy|| -|1685|Sum of Absolute Differences in a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array)|61.5%|Medium|| -|1686|Stone Game VI||48.7%|Medium|| -|1687|Delivering Boxes from Storage to Ports||34.8%|Hard|| +|1683|Invalid Tweets||91.7%|Easy|| +|1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|84.3%|Easy|| +|1685|Sum of Absolute Differences in a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array)|61.8%|Medium|| +|1686|Stone Game VI||48.9%|Medium|| +|1687|Delivering Boxes from Storage to Ports||34.6%|Hard|| |1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|83.4%|Easy|| -|1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.4%|Medium|| -|1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|46.3%|Medium|| -|1691|Maximum Height by Stacking Cuboids ||48.9%|Hard|| -|1692|Count Ways to Distribute Candies||61.5%|Hard|| -|1693|Daily Leads and Partners||91.9%|Easy|| -|1694|Reformat Phone Number||67.3%|Easy|| -|1695|Maximum Erasure Value||49.1%|Medium|| -|1696|Jump Game VI||56.6%|Medium|| -|1697|Checking Existence of Edge Length Limited Paths||56.4%|Hard|| -|1698|Number of Distinct Substrings in a String||55.4%|Medium|| -|1699|Number of Calls Between Two Persons||85.2%|Medium|| -|1700|Number of Students Unable to Eat Lunch||69.9%|Easy|| -|1701|Average Waiting Time||61.4%|Medium|| -|1702|Maximum Binary String After Change||62.2%|Medium|| -|1703|Minimum Adjacent Swaps for K Consecutive Ones||40.8%|Hard|| +|1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.5%|Medium|| +|1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|46.5%|Medium|| +|1691|Maximum Height by Stacking Cuboids ||49.5%|Hard|| +|1692|Count Ways to Distribute Candies||62.1%|Hard|| +|1693|Daily Leads and Partners||91.6%|Easy|| +|1694|Reformat Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1694.Reformat-Phone-Number)|67.3%|Easy|| +|1695|Maximum Erasure Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1695.Maximum-Erasure-Value)|49.5%|Medium|| +|1696|Jump Game VI||56.3%|Medium|| +|1697|Checking Existence of Edge Length Limited Paths||56.0%|Hard|| +|1698|Number of Distinct Substrings in a String||55.0%|Medium|| +|1699|Number of Calls Between Two Persons||85.6%|Medium|| +|1700|Number of Students Unable to Eat Lunch||70.1%|Easy|| +|1701|Average Waiting Time||61.8%|Medium|| +|1702|Maximum Binary String After Change||61.9%|Medium|| +|1703|Minimum Adjacent Swaps for K Consecutive Ones||40.5%|Hard|| |1704|Determine if String Halves Are Alike||78.4%|Easy|| -|1705|Maximum Number of Eaten Apples||42.8%|Medium|| -|1706|Where Will the Ball Fall||57.6%|Medium|| -|1707|Maximum XOR With an Element From Array||49.0%|Hard|| -|1708|Largest Subarray Length K||65.6%|Easy|| -|1709|Biggest Window Between Visits||83.2%|Medium|| -|1710|Maximum Units on a Truck||72.8%|Easy|| -|1711|Count Good Meals||25.2%|Medium|| -|1712|Ways to Split Array Into Three Subarrays||29.5%|Medium|| -|1713|Minimum Operations to Make a Subsequence||44.7%|Hard|| +|1705|Maximum Number of Eaten Apples||42.5%|Medium|| +|1706|Where Will the Ball Fall||57.9%|Medium|| +|1707|Maximum XOR With an Element From Array||48.6%|Hard|| +|1708|Largest Subarray Length K||64.6%|Easy|| +|1709|Biggest Window Between Visits||81.2%|Medium|| +|1710|Maximum Units on a Truck||72.4%|Easy|| +|1711|Count Good Meals||25.5%|Medium|| +|1712|Ways to Split Array Into Three Subarrays||29.8%|Medium|| +|1713|Minimum Operations to Make a Subsequence||45.0%|Hard|| +|1714|Sum Of Special Evenly-Spaced Elements In Array||44.2%|Hard|| +|1715|Count Apples and Oranges||78.6%|Medium|| +|1716|Calculate Money in Leetcode Bank||70.6%|Easy|| +|1717|Maximum Score From Removing Substrings||35.2%|Medium|| +|1718|Construct the Lexicographically Largest Valid Sequence||38.5%|Medium|| +|1719|Number Of Ways To Reconstruct A Tree||33.0%|Hard|| +|1720|Decode XORed Array||86.1%|Easy|| +|1721|Swapping Nodes in a Linked List||64.8%|Medium|| +|1722|Minimize Hamming Distance After Swap Operations||41.9%|Medium|| +|1723|Find Minimum Time to Finish All Jobs||35.3%|Hard|| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------| ------------------------------------------------------------------ diff --git a/leetcode/0228.Summary-Ranges/228. Summary Ranges.go b/leetcode/0228.Summary-Ranges/228. Summary Ranges.go new file mode 100644 index 00000000..b19c0e86 --- /dev/null +++ b/leetcode/0228.Summary-Ranges/228. Summary Ranges.go @@ -0,0 +1,19 @@ +package leetcode + +import ( + "strconv" +) + +func summaryRanges(nums []int) (ans []string) { + for i, n := 0, len(nums); i < n; { + left := i + for i++; i < n && nums[i-1]+1 == nums[i]; i++ { + } + s := strconv.Itoa(nums[left]) + if left != i-1 { + s += "->" + strconv.Itoa(nums[i-1]) + } + ans = append(ans, s) + } + return +} diff --git a/leetcode/0228.Summary-Ranges/228. Summary Ranges_test.go b/leetcode/0228.Summary-Ranges/228. Summary Ranges_test.go new file mode 100644 index 00000000..dd18d007 --- /dev/null +++ b/leetcode/0228.Summary-Ranges/228. Summary Ranges_test.go @@ -0,0 +1,62 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question228 struct { + para228 + ans228 +} + +// para 是参数 +// one 代表第一个参数 +type para228 struct { + nums []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans228 struct { + ans []string +} + +func Test_Problem228(t *testing.T) { + + qs := []question228{ + + { + para228{[]int{0, 1, 2, 4, 5, 7}}, + ans228{[]string{"0->2", "4->5", "7"}}, + }, + + { + para228{[]int{0, 2, 3, 4, 6, 8, 9}}, + ans228{[]string{"0", "2->4", "6", "8->9"}}, + }, + + { + para228{[]int{}}, + ans228{[]string{}}, + }, + + { + para228{[]int{-1}}, + ans228{[]string{"-1"}}, + }, + + { + para228{[]int{0}}, + ans228{[]string{"0"}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 228------------------------\n") + + for _, q := range qs { + _, p := q.ans228, q.para228 + fmt.Printf("【input】:%v 【output】:%v\n", p, summaryRanges(p.nums)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/0228.Summary-Ranges/README.md b/leetcode/0228.Summary-Ranges/README.md new file mode 100644 index 00000000..85530b5a --- /dev/null +++ b/leetcode/0228.Summary-Ranges/README.md @@ -0,0 +1,107 @@ +# [228. Summary Ranges](https://leetcode.com/problems/summary-ranges/) + +## 题目 + +You are given a **sorted unique** integer array `nums`. + +Return *the **smallest sorted** list of ranges that **cover all the numbers in the array exactly***. That is, each element of `nums` is covered by exactly one of the ranges, and there is no integer `x` such that `x` is in one of the ranges but not in `nums`. + +Each range `[a,b]` in the list should be output as: + +- `"a->b"` if `a != b` +- `"a"` if `a == b` + +**Example 1:** + +``` +Input: nums = [0,1,2,4,5,7] +Output: ["0->2","4->5","7"] +Explanation: The ranges are: +[0,2] --> "0->2" +[4,5] --> "4->5" +[7,7] --> "7" + +``` + +**Example 2:** + +``` +Input: nums = [0,2,3,4,6,8,9] +Output: ["0","2->4","6","8->9"] +Explanation: The ranges are: +[0,0] --> "0" +[2,4] --> "2->4" +[6,6] --> "6" +[8,9] --> "8->9" + +``` + +**Example 3:** + +``` +Input: nums = [] +Output: [] + +``` + +**Example 4:** + +``` +Input: nums = [-1] +Output: ["-1"] + +``` + +**Example 5:** + +``` +Input: nums = [0] +Output: ["0"] + +``` + +**Constraints:** + +- `0 <= nums.length <= 20` +- `231 <= nums[i] <= 231 - 1` +- All the values of `nums` are **unique**. +- `nums` is sorted in ascending order. + +## 题目大意 + +给定一个无重复元素的有序整数数组 nums 。 + +返回 恰好覆盖数组中所有数字 的 最小有序 区间范围列表。也就是说,nums 的每个元素都恰好被某个区间范围所覆盖,并且不存在属于某个范围但不属于 nums 的数字 x 。 + +列表中的每个区间范围 [a,b] 应该按如下格式输出: + +- "a->b" ,如果 a != b +- "a" ,如果 a == b + +## 解题思路 + +- 简单题。按照题意,用一个游标变量累加寻找连续的区间。一旦出现了中断,就按照题意格式输出。输出的规则有多种,带箭头的区间,单个元素区间,空区间。 + +## 代码 + +```go +package leetcode + +import ( + "strconv" +) + +func summaryRanges(nums []int) (ans []string) { + for i, n := 0, len(nums); i < n; { + left := i + for i++; i < n && nums[i-1]+1 == nums[i]; i++ { + } + s := strconv.Itoa(nums[left]) + if left != i-1 { + s += "->" + strconv.Itoa(nums[i-1]) + } + ans = append(ans, s) + } + return +} +``` \ No newline at end of file diff --git a/leetcode/1694.Reformat-Phone-Number/1694. Reformat Phone Number.go b/leetcode/1694.Reformat-Phone-Number/1694. Reformat Phone Number.go new file mode 100644 index 00000000..22a8d666 --- /dev/null +++ b/leetcode/1694.Reformat-Phone-Number/1694. Reformat Phone Number.go @@ -0,0 +1,37 @@ +package leetcode + +import ( + "strings" +) + +func reformatNumber(number string) string { + parts, nums := []string{}, []rune{} + for _, r := range number { + if r != '-' && r != ' ' { + nums = append(nums, r) + } + } + threeDigits, twoDigits := len(nums)/3, 0 + switch len(nums) % 3 { + case 1: + threeDigits-- + twoDigits = 2 + case 2: + twoDigits = 1 + default: + twoDigits = 0 + } + for i := 0; i < threeDigits; i++ { + s := "" + s += string(nums[0:3]) + nums = nums[3:] + parts = append(parts, s) + } + for i := 0; i < twoDigits; i++ { + s := "" + s += string(nums[0:2]) + nums = nums[2:] + parts = append(parts, s) + } + return strings.Join(parts, "-") +} diff --git a/leetcode/1694.Reformat-Phone-Number/1694. Reformat Phone Number_test.go b/leetcode/1694.Reformat-Phone-Number/1694. Reformat Phone Number_test.go new file mode 100644 index 00000000..8eb4f7a1 --- /dev/null +++ b/leetcode/1694.Reformat-Phone-Number/1694. Reformat Phone Number_test.go @@ -0,0 +1,67 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1694 struct { + para1694 + ans1694 +} + +// para 是参数 +// one 代表第一个参数 +type para1694 struct { + number string +} + +// ans 是答案 +// one 代表第一个答案 +type ans1694 struct { + one string +} + +func Test_Problem1694(t *testing.T) { + + qs := []question1694{ + + { + para1694{"1-23-45 6"}, + ans1694{"123-456"}, + }, + + { + para1694{"123 4-567"}, + ans1694{"123-45-67"}, + }, + + { + para1694{"123 4-5678"}, + ans1694{"123-456-78"}, + }, + + { + para1694{"12"}, + ans1694{"12"}, + }, + + { + para1694{"--17-5 229 35-39475 "}, + ans1694{"175-229-353-94-75"}, + }, + + { + para1694{"9964-"}, + ans1694{"99-64"}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1694------------------------\n") + + for _, q := range qs { + _, p := q.ans1694, q.para1694 + fmt.Printf("【input】:%v 【output】:%v\n", p, reformatNumber(p.number)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1694.Reformat-Phone-Number/README.md b/leetcode/1694.Reformat-Phone-Number/README.md new file mode 100644 index 00000000..670aae71 --- /dev/null +++ b/leetcode/1694.Reformat-Phone-Number/README.md @@ -0,0 +1,135 @@ +# [1694. Reformat Phone Number](https://leetcode.com/problems/reformat-phone-number/) + + +## 题目 + +You are given a phone number as a string `number`. `number` consists of digits, spaces `' '`, and/or dashes `'-'`. + +You would like to reformat the phone number in a certain manner. Firstly, **remove** all spaces and dashes. Then, **group** the digits from left to right into blocks of length 3 **until** there are 4 or fewer digits. The final digits are then grouped as follows: + +- 2 digits: A single block of length 2. +- 3 digits: A single block of length 3. +- 4 digits: Two blocks of length 2 each. + +The blocks are then joined by dashes. Notice that the reformatting process should **never** produce any blocks of length 1 and produce **at most** two blocks of length 2. + +Return *the phone number after formatting.* + +**Example 1:** + +``` +Input: number = "1-23-45 6" +Output: "123-456" +Explanation: The digits are "123456". +Step 1: There are more than 4 digits, so group the next 3 digits. The 1st block is "123". +Step 2: There are 3 digits remaining, so put them in a single block of length 3. The 2nd block is "456". +Joining the blocks gives "123-456". + +``` + +**Example 2:** + +``` +Input: number = "123 4-567" +Output: "123-45-67" +Explanation: The digits are "1234567". +Step 1: There are more than 4 digits, so group the next 3 digits. The 1st block is "123". +Step 2: There are 4 digits left, so split them into two blocks of length 2. The blocks are "45" and "67". +Joining the blocks gives "123-45-67". + +``` + +**Example 3:** + +``` +Input: number = "123 4-5678" +Output: "123-456-78" +Explanation: The digits are "12345678". +Step 1: The 1st block is "123". +Step 2: The 2nd block is "456". +Step 3: There are 2 digits left, so put them in a single block of length 2. The 3rd block is "78". +Joining the blocks gives "123-456-78". + +``` + +**Example 4:** + +``` +Input: number = "12" +Output: "12" + +``` + +**Example 5:** + +``` +Input: number = "--17-5 229 35-39475 " +Output: "175-229-353-94-75" + +``` + +**Constraints:** + +- `2 <= number.length <= 100` +- `number` consists of digits and the characters `'-'` and `' '`. +- There are at least **two** digits in `number`. + +## 题目大意 + +给你一个字符串形式的电话号码 number 。number 由数字、空格 ' '、和破折号 '-' 组成。 + +请你按下述方式重新格式化电话号码。 + +- 首先,删除 所有的空格和破折号。 +- 其次,将数组从左到右 每 3 个一组 分块,直到 剩下 4 个或更少数字。剩下的数字将按下述规定再分块: + - 2 个数字:单个含 2 个数字的块。 + - 3 个数字:单个含 3 个数字的块。 + - 4 个数字:两个分别含 2 个数字的块。 + +最后用破折号将这些块连接起来。注意,重新格式化过程中 不应该 生成仅含 1 个数字的块,并且 最多 生成两个含 2 个数字的块。返回格式化后的电话号码。 + +## 解题思路 + +- 简单题。先判断号码是不是 2 位和 4 位,如果是,单独输出这 2 种情况。剩下的都是 3 位以上了,取余,判断剩余的数字是 2 个还是 4 个。这时不可能存在剩 1 位数的情况。除 3 余 1,即剩 4 位的情况,末尾 4 位需要 2 个一组输出。除 3 余 2,即剩 2 位的情况。处理好末尾,再逆序每 3 个一组连接 "-" 即可。可能需要注意的 case 见 test 文件。 + +## 代码 + +```go +package leetcode + +import ( + "strings" +) + +func reformatNumber(number string) string { + parts, nums := []string{}, []rune{} + for _, r := range number { + if r != '-' && r != ' ' { + nums = append(nums, r) + } + } + threeDigits, twoDigits := len(nums)/3, 0 + switch len(nums) % 3 { + case 1: + threeDigits-- + twoDigits = 2 + case 2: + twoDigits = 1 + default: + twoDigits = 0 + } + for i := 0; i < threeDigits; i++ { + s := "" + s += string(nums[0:3]) + nums = nums[3:] + parts = append(parts, s) + } + for i := 0; i < twoDigits; i++ { + s := "" + s += string(nums[0:2]) + nums = nums[2:] + parts = append(parts, s) + } + return strings.Join(parts, "-") +} +``` \ No newline at end of file diff --git a/leetcode/1695.Maximum-Erasure-Value/1695. Maximum Erasure Value.go b/leetcode/1695.Maximum-Erasure-Value/1695. Maximum Erasure Value.go new file mode 100644 index 00000000..ccca3f96 --- /dev/null +++ b/leetcode/1695.Maximum-Erasure-Value/1695. Maximum Erasure Value.go @@ -0,0 +1,30 @@ +package leetcode + +func maximumUniqueSubarray(nums []int) int { + if len(nums) == 0 { + return 0 + } + result, left, right, freq := 0, 0, -1, map[int]int{} + for left < len(nums) { + if right+1 < len(nums) && freq[nums[right+1]] == 0 { + freq[nums[right+1]]++ + right++ + } else { + freq[nums[left]]-- + left++ + } + sum := 0 + for i := left; i <= right; i++ { + sum += nums[i] + } + result = max(result, sum) + } + return result +} + +func max(a int, b int) int { + if a > b { + return a + } + return b +} diff --git a/leetcode/1695.Maximum-Erasure-Value/1695. Maximum Erasure Value_test.go b/leetcode/1695.Maximum-Erasure-Value/1695. Maximum Erasure Value_test.go new file mode 100644 index 00000000..bc088cda --- /dev/null +++ b/leetcode/1695.Maximum-Erasure-Value/1695. Maximum Erasure Value_test.go @@ -0,0 +1,47 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1695 struct { + para1695 + ans1695 +} + +// para 是参数 +// one 代表第一个参数 +type para1695 struct { + nums []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1695 struct { + one int +} + +func Test_Problem1695(t *testing.T) { + + qs := []question1695{ + + { + para1695{[]int{4, 2, 4, 5, 6}}, + ans1695{17}, + }, + + { + para1695{[]int{5, 2, 1, 2, 5, 2, 1, 2, 5}}, + ans1695{8}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1695------------------------\n") + + for _, q := range qs { + _, p := q.ans1695, q.para1695 + fmt.Printf("【input】:%v 【output】:%v\n", p, maximumUniqueSubarray(p.nums)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1695.Maximum-Erasure-Value/README.md b/leetcode/1695.Maximum-Erasure-Value/README.md new file mode 100644 index 00000000..a2dec532 --- /dev/null +++ b/leetcode/1695.Maximum-Erasure-Value/README.md @@ -0,0 +1,74 @@ +# [1695. Maximum Erasure Value](https://leetcode.com/problems/maximum-erasure-value/) + + +## 题目 + +You are given an array of positive integers `nums` and want to erase a subarray containing **unique elements**. The **score** you get by erasing the subarray is equal to the **sum** of its elements. + +Return *the **maximum score** you can get by erasing **exactly one** subarray.* + +An array `b` is called to be a subarray of `a` if it forms a contiguous subsequence of `a`, that is, if it is equal to `a[l],a[l+1],...,a[r]` for some `(l,r)`. + +**Example 1:** + +``` +Input: nums = [4,2,4,5,6] +Output: 17 +Explanation: The optimal subarray here is [2,4,5,6]. +``` + +**Example 2:** + +``` +Input: nums = [5,2,1,2,5,2,1,2,5] +Output: 8 +Explanation: The optimal subarray here is [5,2,1] or [1,2,5]. +``` + +**Constraints:** + +- `1 <= nums.length <= 105` +- `1 <= nums[i] <= 104` + +## 题目大意 + +给你一个正整数数组 nums ,请你从中删除一个含有 若干不同元素 的子数组。删除子数组的 得分 就是子数组各元素之 和 。返回 只删除一个 子数组可获得的 最大得分 。如果数组 b 是数组 a 的一个连续子序列,即如果它等于 a[l],a[l+1],...,a[r] ,那么它就是 a 的一个子数组。 + +## 解题思路 + +- 读完题立马能识别出这是经典的滑动窗口题。利用滑动窗口从左往右滑动窗口,滑动过程中统计频次,如果是不同元素,右边界窗口又移,否则左边窗口缩小。每次移动更新 max 值。最终扫完一遍以后,max 值即为所求。 + +## 代码 + +```go +package leetcode + +func maximumUniqueSubarray(nums []int) int { + if len(nums) == 0 { + return 0 + } + result, left, right, freq := 0, 0, -1, map[int]int{} + for left < len(nums) { + if right+1 < len(nums) && freq[nums[right+1]] == 0 { + freq[nums[right+1]]++ + right++ + } else { + freq[nums[left]]-- + left++ + } + sum := 0 + for i := left; i <= right; i++ { + sum += nums[i] + } + result = max(result, sum) + } + return result +} + +func max(a int, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/leetcode/777777/5629. Reformat Phone Number.go b/leetcode/777777/5629. Reformat Phone Number.go deleted file mode 100644 index 70795214..00000000 --- a/leetcode/777777/5629. Reformat Phone Number.go +++ /dev/null @@ -1,51 +0,0 @@ -package leetcode - -func reformatNumber(number string) string { - str, count := "", 0 - for i := 0; i < len(number); i++ { - if number[i] != '-' && number[i] != ' ' { - str += string(number[i]) - // str = append(str, number[i]) - } - } - if len(str) == 4 { - str = str[:2] + "-" + str[2:] - return str - } - if len(str) > 3 { - if (len(str)-4)%3 == 0 { - for i := len(str) - 5; i >= 0; i-- { - count++ - if count%3 == 0 && i != 0 { - str = str[:i] + "-" + str[i:] - } - } - str = str[:len(str)-2] + "-" + str[len(str)-2:] - str = str[:len(str)-5] + "-" + str[len(str)-5:] - return str - } - if (len(str)-2)%3 == 0 { - for i := len(str) - 3; i >= 0; i-- { - count++ - if count%3 == 0 && i != 0 { - str = str[:i] + "-" + str[i:] - } - } - str = str[:len(str)-2] + "-" + str[len(str)-2:] - return str - } - length := len(str) - count = 0 - for j := 0; j < len(str); j++ { - count++ - if count%3 == 0 && count != length { - // head := - // tail := - str = str[:j+1] + "-" + str[j+1:] - j++ - } - } - - } - return str -} diff --git a/leetcode/777777/5629. Reformat Phone Number_test.go b/leetcode/777777/5629. Reformat Phone Number_test.go deleted file mode 100644 index 8aba62c9..00000000 --- a/leetcode/777777/5629. Reformat Phone Number_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package leetcode - -import ( - "fmt" - "testing" -) - -type question1690 struct { - para1690 - ans1690 -} - -// para 是参数 -// one 代表第一个参数 -type para1690 struct { - number string -} - -// ans 是答案 -// one 代表第一个答案 -type ans1690 struct { - one string -} - -func Test_Problem1690(t *testing.T) { - - qs := []question1690{ - - { - para1690{"1-23-45 6"}, - ans1690{"123-456"}, - }, - - { - para1690{"123 4-567"}, - ans1690{"123-45-67"}, - }, - - { - para1690{"123 4-5678"}, - ans1690{"123-456-78"}, - }, - - { - para1690{"12"}, - ans1690{"12"}, - }, - - { - para1690{"--17-5 229 35-39475 "}, - ans1690{"175-229-353-94-75"}, - }, - - { - para1690{"9964-"}, - ans1690{"99-64"}, - }, - } - - fmt.Printf("------------------------Leetcode Problem 1690------------------------\n") - - for _, q := range qs { - _, p := q.ans1690, q.para1690 - fmt.Printf("【input】:%v 【output】:%v\n", p, reformatNumber(p.number)) - } - fmt.Printf("\n\n\n") -} diff --git a/website/content/ChapterFour/0228.Summary-Ranges.md b/website/content/ChapterFour/0228.Summary-Ranges.md new file mode 100644 index 00000000..e8a2b2e1 --- /dev/null +++ b/website/content/ChapterFour/0228.Summary-Ranges.md @@ -0,0 +1,108 @@ +# [228. Summary Ranges](https://leetcode.com/problems/summary-ranges/) + + +## 题目 + +You are given a **sorted unique** integer array `nums`. + +Return *the **smallest sorted** list of ranges that **cover all the numbers in the array exactly***. That is, each element of `nums` is covered by exactly one of the ranges, and there is no integer `x` such that `x` is in one of the ranges but not in `nums`. + +Each range `[a,b]` in the list should be output as: + +- `"a->b"` if `a != b` +- `"a"` if `a == b` + +**Example 1:** + +``` +Input: nums = [0,1,2,4,5,7] +Output: ["0->2","4->5","7"] +Explanation: The ranges are: +[0,2] --> "0->2" +[4,5] --> "4->5" +[7,7] --> "7" + +``` + +**Example 2:** + +``` +Input: nums = [0,2,3,4,6,8,9] +Output: ["0","2->4","6","8->9"] +Explanation: The ranges are: +[0,0] --> "0" +[2,4] --> "2->4" +[6,6] --> "6" +[8,9] --> "8->9" + +``` + +**Example 3:** + +``` +Input: nums = [] +Output: [] + +``` + +**Example 4:** + +``` +Input: nums = [-1] +Output: ["-1"] + +``` + +**Example 5:** + +``` +Input: nums = [0] +Output: ["0"] + +``` + +**Constraints:** + +- `0 <= nums.length <= 20` +- `231 <= nums[i] <= 231 - 1` +- All the values of `nums` are **unique**. +- `nums` is sorted in ascending order. + +## 题目大意 + +给定一个无重复元素的有序整数数组 nums 。 + +返回 恰好覆盖数组中所有数字 的 最小有序 区间范围列表。也就是说,nums 的每个元素都恰好被某个区间范围所覆盖,并且不存在属于某个范围但不属于 nums 的数字 x 。 + +列表中的每个区间范围 [a,b] 应该按如下格式输出: + +- "a->b" ,如果 a != b +- "a" ,如果 a == b + +## 解题思路 + +- 简单题。按照题意,用一个游标变量累加寻找连续的区间。一旦出现了中断,就按照题意格式输出。输出的规则有多种,带箭头的区间,单个元素区间,空区间。 + +## 代码 + +```go +package leetcode + +import ( + "strconv" +) + +func summaryRanges(nums []int) (ans []string) { + for i, n := 0, len(nums); i < n; { + left := i + for i++; i < n && nums[i-1]+1 == nums[i]; i++ { + } + s := strconv.Itoa(nums[left]) + if left != i-1 { + s += "->" + strconv.Itoa(nums[i-1]) + } + ans = append(ans, s) + } + return +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1694.Reformat-Phone-Number.md b/website/content/ChapterFour/1694.Reformat-Phone-Number.md new file mode 100644 index 00000000..670aae71 --- /dev/null +++ b/website/content/ChapterFour/1694.Reformat-Phone-Number.md @@ -0,0 +1,135 @@ +# [1694. Reformat Phone Number](https://leetcode.com/problems/reformat-phone-number/) + + +## 题目 + +You are given a phone number as a string `number`. `number` consists of digits, spaces `' '`, and/or dashes `'-'`. + +You would like to reformat the phone number in a certain manner. Firstly, **remove** all spaces and dashes. Then, **group** the digits from left to right into blocks of length 3 **until** there are 4 or fewer digits. The final digits are then grouped as follows: + +- 2 digits: A single block of length 2. +- 3 digits: A single block of length 3. +- 4 digits: Two blocks of length 2 each. + +The blocks are then joined by dashes. Notice that the reformatting process should **never** produce any blocks of length 1 and produce **at most** two blocks of length 2. + +Return *the phone number after formatting.* + +**Example 1:** + +``` +Input: number = "1-23-45 6" +Output: "123-456" +Explanation: The digits are "123456". +Step 1: There are more than 4 digits, so group the next 3 digits. The 1st block is "123". +Step 2: There are 3 digits remaining, so put them in a single block of length 3. The 2nd block is "456". +Joining the blocks gives "123-456". + +``` + +**Example 2:** + +``` +Input: number = "123 4-567" +Output: "123-45-67" +Explanation: The digits are "1234567". +Step 1: There are more than 4 digits, so group the next 3 digits. The 1st block is "123". +Step 2: There are 4 digits left, so split them into two blocks of length 2. The blocks are "45" and "67". +Joining the blocks gives "123-45-67". + +``` + +**Example 3:** + +``` +Input: number = "123 4-5678" +Output: "123-456-78" +Explanation: The digits are "12345678". +Step 1: The 1st block is "123". +Step 2: The 2nd block is "456". +Step 3: There are 2 digits left, so put them in a single block of length 2. The 3rd block is "78". +Joining the blocks gives "123-456-78". + +``` + +**Example 4:** + +``` +Input: number = "12" +Output: "12" + +``` + +**Example 5:** + +``` +Input: number = "--17-5 229 35-39475 " +Output: "175-229-353-94-75" + +``` + +**Constraints:** + +- `2 <= number.length <= 100` +- `number` consists of digits and the characters `'-'` and `' '`. +- There are at least **two** digits in `number`. + +## 题目大意 + +给你一个字符串形式的电话号码 number 。number 由数字、空格 ' '、和破折号 '-' 组成。 + +请你按下述方式重新格式化电话号码。 + +- 首先,删除 所有的空格和破折号。 +- 其次,将数组从左到右 每 3 个一组 分块,直到 剩下 4 个或更少数字。剩下的数字将按下述规定再分块: + - 2 个数字:单个含 2 个数字的块。 + - 3 个数字:单个含 3 个数字的块。 + - 4 个数字:两个分别含 2 个数字的块。 + +最后用破折号将这些块连接起来。注意,重新格式化过程中 不应该 生成仅含 1 个数字的块,并且 最多 生成两个含 2 个数字的块。返回格式化后的电话号码。 + +## 解题思路 + +- 简单题。先判断号码是不是 2 位和 4 位,如果是,单独输出这 2 种情况。剩下的都是 3 位以上了,取余,判断剩余的数字是 2 个还是 4 个。这时不可能存在剩 1 位数的情况。除 3 余 1,即剩 4 位的情况,末尾 4 位需要 2 个一组输出。除 3 余 2,即剩 2 位的情况。处理好末尾,再逆序每 3 个一组连接 "-" 即可。可能需要注意的 case 见 test 文件。 + +## 代码 + +```go +package leetcode + +import ( + "strings" +) + +func reformatNumber(number string) string { + parts, nums := []string{}, []rune{} + for _, r := range number { + if r != '-' && r != ' ' { + nums = append(nums, r) + } + } + threeDigits, twoDigits := len(nums)/3, 0 + switch len(nums) % 3 { + case 1: + threeDigits-- + twoDigits = 2 + case 2: + twoDigits = 1 + default: + twoDigits = 0 + } + for i := 0; i < threeDigits; i++ { + s := "" + s += string(nums[0:3]) + nums = nums[3:] + parts = append(parts, s) + } + for i := 0; i < twoDigits; i++ { + s := "" + s += string(nums[0:2]) + nums = nums[2:] + parts = append(parts, s) + } + return strings.Join(parts, "-") +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1695.Maximum-Erasure-Value.md b/website/content/ChapterFour/1695.Maximum-Erasure-Value.md new file mode 100644 index 00000000..a2dec532 --- /dev/null +++ b/website/content/ChapterFour/1695.Maximum-Erasure-Value.md @@ -0,0 +1,74 @@ +# [1695. Maximum Erasure Value](https://leetcode.com/problems/maximum-erasure-value/) + + +## 题目 + +You are given an array of positive integers `nums` and want to erase a subarray containing **unique elements**. The **score** you get by erasing the subarray is equal to the **sum** of its elements. + +Return *the **maximum score** you can get by erasing **exactly one** subarray.* + +An array `b` is called to be a subarray of `a` if it forms a contiguous subsequence of `a`, that is, if it is equal to `a[l],a[l+1],...,a[r]` for some `(l,r)`. + +**Example 1:** + +``` +Input: nums = [4,2,4,5,6] +Output: 17 +Explanation: The optimal subarray here is [2,4,5,6]. +``` + +**Example 2:** + +``` +Input: nums = [5,2,1,2,5,2,1,2,5] +Output: 8 +Explanation: The optimal subarray here is [5,2,1] or [1,2,5]. +``` + +**Constraints:** + +- `1 <= nums.length <= 105` +- `1 <= nums[i] <= 104` + +## 题目大意 + +给你一个正整数数组 nums ,请你从中删除一个含有 若干不同元素 的子数组。删除子数组的 得分 就是子数组各元素之 和 。返回 只删除一个 子数组可获得的 最大得分 。如果数组 b 是数组 a 的一个连续子序列,即如果它等于 a[l],a[l+1],...,a[r] ,那么它就是 a 的一个子数组。 + +## 解题思路 + +- 读完题立马能识别出这是经典的滑动窗口题。利用滑动窗口从左往右滑动窗口,滑动过程中统计频次,如果是不同元素,右边界窗口又移,否则左边窗口缩小。每次移动更新 max 值。最终扫完一遍以后,max 值即为所求。 + +## 代码 + +```go +package leetcode + +func maximumUniqueSubarray(nums []int) int { + if len(nums) == 0 { + return 0 + } + result, left, right, freq := 0, 0, -1, map[int]int{} + for left < len(nums) { + if right+1 < len(nums) && freq[nums[right+1]] == 0 { + freq[nums[right+1]]++ + right++ + } else { + freq[nums[left]]-- + left++ + } + sum := 0 + for i := left; i <= right; i++ { + sum += nums[i] + } + result = max(result, sum) + } + return result +} + +func max(a int, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index deaabf5e..ffb80195 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -198,6 +198,7 @@ headless: true - [0224.Basic-Calculator]({{< relref "/ChapterFour/0224.Basic-Calculator.md" >}}) - [0225.Implement-Stack-using-Queues]({{< relref "/ChapterFour/0225.Implement-Stack-using-Queues.md" >}}) - [0226.Invert-Binary-Tree]({{< relref "/ChapterFour/0226.Invert-Binary-Tree.md" >}}) + - [0228.Summary-Ranges]({{< relref "/ChapterFour/0228.Summary-Ranges.md" >}}) - [0229.Majority-Element-II]({{< relref "/ChapterFour/0229.Majority-Element-II.md" >}}) - [0230.Kth-Smallest-Element-in-a-BST]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}}) - [0231.Power-of-Two]({{< relref "/ChapterFour/0231.Power-of-Two.md" >}}) @@ -590,4 +591,6 @@ headless: true - [1688.Count-of-Matches-in-Tournament]({{< relref "/ChapterFour/1688.Count-of-Matches-in-Tournament.md" >}}) - [1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers]({{< relref "/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md" >}}) - [1690.Stone-Game-VII]({{< relref "/ChapterFour/1690.Stone-Game-VII.md" >}}) + - [1694.Reformat-Phone-Number]({{< relref "/ChapterFour/1694.Reformat-Phone-Number.md" >}}) + - [1695.Maximum-Erasure-Value]({{< relref "/ChapterFour/1695.Maximum-Erasure-Value.md" >}})
From 4067a7858db038b6a7907236030d684b4745986e Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 12 Jan 2021 23:34:07 +0800 Subject: [PATCH 70/82] Add person data statistic --- .gitignore | 1 + README.md | 572 +++++++++++++------------- automation/models/lcproblems.go | 43 -- automation/render.go | 190 --------- ctl/config.go | 31 ++ ctl/models/lcproblems.go | 103 +++++ {automation => ctl}/models/mdrow.go | 19 +- ctl/models/user.go | 44 ++ ctl/rangking.go | 36 ++ ctl/render.go | 108 +++++ ctl/request.go | 72 ++++ ctl/statistic.go | 40 ++ {automation => ctl}/template.markdown | 11 +- ctl/template_render.go | 37 ++ ctl/util.go | 58 +++ 15 files changed, 843 insertions(+), 522 deletions(-) create mode 100644 .gitignore delete mode 100644 automation/models/lcproblems.go delete mode 100644 automation/render.go create mode 100644 ctl/config.go create mode 100644 ctl/models/lcproblems.go rename {automation => ctl}/models/mdrow.go (75%) create mode 100644 ctl/models/user.go create mode 100644 ctl/rangking.go create mode 100644 ctl/render.go create mode 100644 ctl/request.go create mode 100644 ctl/statistic.go rename {automation => ctl}/template.markdown (99%) create mode 100644 ctl/template_render.go create mode 100644 ctl/util.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..405ec2c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.toml diff --git a/README.md b/README.md index 3be41f97..4050896c 100755 --- a/README.md +++ b/README.md @@ -82,6 +82,9 @@ * [✅ Segment Tree](#segment-tree) * [✅ Binary Indexed Tree](#binary-indexed-tree) +
+
+ | 数据结构 | 变种 | 相关题目 | 讲解文章 | |:-------:|:-------|:------|:------| |顺序线性表:向量|||| @@ -118,9 +121,20 @@ ## LeetCode Problems -## 一. 目录 +## 一. 个人数据 -以下已经收录了 559 道题的题解,还有 11 道题在尝试优化到 beats 100% +| | Easy | Medium | Hard | Total | +|:--------:|:--------:|:--------:|:--------:|:--------:| +|Optimizing|39|44|15|98| +|Accepted|**249**|**314**|**95**|**658**| +|Total|457|901|365|1723| +|Perfection Rate|84.3%|86.0%|84.2%|85.1%| +|Completion Rate|54.5%|34.9%|26.0%|38.2%| +|------------|----------------------------|----------------------------|----------------------------|----------------------------| + +## 二. 目录 + +以下已经收录了 560 道题的题解,还有 11 道题在尝试优化到 beats 100% | No. | Title | Solution | Acceptance | Difficulty | Frequency | |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| @@ -134,9 +148,9 @@ |0008|String to Integer (atoi)||15.6%|Medium|| |0009|Palindrome Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0009.Palindrome-Number)|49.4%|Easy|| |0010|Regular Expression Matching||27.2%|Hard|| -|0011|Container With Most Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0011.Container-With-Most-Water)|52.1%|Medium|| +|0011|Container With Most Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0011.Container-With-Most-Water)|52.2%|Medium|| |0012|Integer to Roman||55.9%|Medium|| -|0013|Roman to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0013.Roman-to-Integer)|56.3%|Easy|| +|0013|Roman to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0013.Roman-to-Integer)|56.4%|Easy|| |0014|Longest Common Prefix||36.0%|Easy|| |0015|3Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0015.3Sum)|27.7%|Medium|| |0016|3Sum Closest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0016.3Sum-Closest)|46.2%|Medium|| @@ -159,7 +173,7 @@ |0033|Search in Rotated Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0033.Search-in-Rotated-Sorted-Array)|35.6%|Medium|| |0034|Find First and Last Position of Element in Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array)|37.1%|Medium|| |0035|Search Insert Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0035.Search-Insert-Position)|42.8%|Easy|| -|0036|Valid Sudoku|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0036.Valid-Sudoku)|50.1%|Medium|| +|0036|Valid Sudoku|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0036.Valid-Sudoku)|50.2%|Medium|| |0037|Sudoku Solver|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0037.Sudoku-Solver)|45.9%|Hard|| |0038|Count and Say||45.8%|Easy|| |0039|Combination Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0039.Combination-Sum)|58.7%|Medium|| @@ -175,10 +189,10 @@ |0049|Group Anagrams|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams)|58.8%|Medium|| |0050|Pow(x, n)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0050.Pow(x,-n))|30.8%|Medium|| |0051|N-Queens|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0051.N-Queens)|49.0%|Hard|| -|0052|N-Queens II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0052.N-Queens-II)|59.6%|Hard|| +|0052|N-Queens II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0052.N-Queens-II)|59.7%|Hard|| |0053|Maximum Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0053.Maximum-Subarray)|47.5%|Easy|| |0054|Spiral Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0054.Spiral-Matrix)|35.5%|Medium|| -|0055|Jump Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0055.Jump-Game)|35.0%|Medium|| +|0055|Jump Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0055.Jump-Game)|35.1%|Medium|| |0056|Merge Intervals|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0056.Merge-Intervals)|40.6%|Medium|| |0057|Insert Interval|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0057.Insert-Interval)|34.8%|Medium|| |0058|Length of Last Word||33.4%|Easy|| @@ -195,29 +209,29 @@ |0069|Sqrt(x)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0069.Sqrt(x))|34.8%|Easy|| |0070|Climbing Stairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0070.Climbing-Stairs)|48.5%|Easy|| |0071|Simplify Path|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0071.Simplify-Path)|33.6%|Medium|| -|0072|Edit Distance||46.3%|Hard|| +|0072|Edit Distance||46.4%|Hard|| |0073|Set Matrix Zeroes||44.0%|Medium|| |0074|Search a 2D Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0074.Search-a-2D-Matrix)|37.3%|Medium|| |0075|Sort Colors|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0075.Sort-Colors)|48.9%|Medium|| |0076|Minimum Window Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0076.Minimum-Window-Substring)|35.7%|Hard|| -|0077|Combinations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0077.Combinations)|56.8%|Medium|| +|0077|Combinations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0077.Combinations)|56.9%|Medium|| |0078|Subsets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0078.Subsets)|64.4%|Medium|| |0079|Word Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0079.Word-Search)|36.5%|Medium|| |0080|Remove Duplicates from Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II)|45.8%|Medium|| -|0081|Search in Rotated Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0081.Search-in-Rotated-Sorted-Array-II)|33.4%|Medium|| +|0081|Search in Rotated Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0081.Search-in-Rotated-Sorted-Array-II)|33.5%|Medium|| |0082|Remove Duplicates from Sorted List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II)|38.9%|Medium|| |0083|Remove Duplicates from Sorted List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0083.Remove-Duplicates-from-Sorted-List)|46.3%|Easy|| |0084|Largest Rectangle in Histogram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0084.Largest-Rectangle-in-Histogram)|36.7%|Hard|| |0085|Maximal Rectangle||39.1%|Hard|| |0086|Partition List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0086.Partition-List)|43.0%|Medium|| |0087|Scramble String||34.5%|Hard|| -|0088|Merge Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0088.Merge-Sorted-Array)|40.3%|Easy|| +|0088|Merge Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0088.Merge-Sorted-Array)|40.5%|Easy|| |0089|Gray Code|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0089.Gray-Code)|50.0%|Medium|| |0090|Subsets II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0090.Subsets-II)|48.5%|Medium|| |0091|Decode Ways|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0091.Decode-Ways)|26.2%|Medium|| |0092|Reverse Linked List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0092.Reverse-Linked-List-II)|40.2%|Medium|| |0093|Restore IP Addresses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0093.Restore-IP-Addresses)|37.2%|Medium|| -|0094|Binary Tree Inorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0094.Binary-Tree-Inorder-Traversal)|65.3%|Medium|| +|0094|Binary Tree Inorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0094.Binary-Tree-Inorder-Traversal)|65.4%|Medium|| |0095|Unique Binary Search Trees II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0095.Unique-Binary-Search-Trees-II)|42.0%|Medium|| |0096|Unique Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0096.Unique-Binary-Search-Trees)|54.1%|Medium|| |0097|Interleaving String||32.4%|Hard|| @@ -228,7 +242,7 @@ |0102|Binary Tree Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0102.Binary-Tree-Level-Order-Traversal)|56.2%|Medium|| |0103|Binary Tree Zigzag Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal)|49.7%|Medium|| |0104|Maximum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0104.Maximum-Depth-of-Binary-Tree)|67.7%|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)|51.1%|Medium|| +|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)|51.2%|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)|49.1%|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)|54.8%|Easy|| |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)|59.9%|Easy|| @@ -240,7 +254,7 @@ |0114|Flatten Binary Tree to Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0114.Flatten-Binary-Tree-to-Linked-List)|51.4%|Medium|| |0115|Distinct Subsequences||39.4%|Hard|| |0116|Populating Next Right Pointers in Each Node||48.4%|Medium|| -|0117|Populating Next Right Pointers in Each Node II||41.6%|Medium|| +|0117|Populating Next Right Pointers in Each Node II||41.7%|Medium|| |0118|Pascal's Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0118.Pascal's-Triangle)|54.3%|Easy|| |0119|Pascal's Triangle II||51.8%|Easy|| |0120|Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0120.Triangle)|45.4%|Medium|| @@ -254,7 +268,7 @@ |0128|Longest Consecutive Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0128.Longest-Consecutive-Sequence)|46.0%|Hard|| |0129|Sum Root to Leaf Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0129.Sum-Root-to-Leaf-Numbers)|50.5%|Medium|| |0130|Surrounded Regions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0130.Surrounded-Regions)|29.1%|Medium|| -|0131|Palindrome Partitioning|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0131.Palindrome-Partitioning)|51.2%|Medium|| +|0131|Palindrome Partitioning|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0131.Palindrome-Partitioning)|51.3%|Medium|| |0132|Palindrome Partitioning II||31.0%|Hard|| |0133|Clone Graph||38.4%|Medium|| |0134|Gas Station||40.9%|Medium|| @@ -272,8 +286,8 @@ |0146|LRU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0146.LRU-Cache)|35.2%|Medium|| |0147|Insertion Sort List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0147.Insertion-Sort-List)|44.1%|Medium|| |0148|Sort List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0148.Sort-List)|45.8%|Medium|| -|0149|Max Points on a Line||17.2%|Hard|| -|0150|Evaluate Reverse Polish Notation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0150.Evaluate-Reverse-Polish-Notation)|37.5%|Medium|| +|0149|Max Points on a Line||17.3%|Hard|| +|0150|Evaluate Reverse Polish Notation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0150.Evaluate-Reverse-Polish-Notation)|37.6%|Medium|| |0151|Reverse Words in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0151.Reverse-Words-in-a-String)|23.3%|Medium|| |0152|Maximum Product Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0152.Maximum-Product-Subarray)|32.6%|Medium|| |0153|Find Minimum in Rotated Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0153.Find-Minimum-in-Rotated-Sorted-Array)|45.9%|Medium|| @@ -289,26 +303,26 @@ |0163|Missing Ranges||26.4%|Easy|| |0164|Maximum Gap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0164.Maximum-Gap)|36.6%|Hard|| |0165|Compare Version Numbers||30.1%|Medium|| -|0166|Fraction to Recurring Decimal||22.1%|Medium|| +|0166|Fraction to Recurring Decimal||22.2%|Medium|| |0167|Two Sum II - Input array is sorted|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0167.Two-Sum-II---Input-array-is-sorted)|55.4%|Easy|| |0168|Excel Sheet Column Title|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0168.Excel-Sheet-Column-Title)|31.6%|Easy|| |0169|Majority Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0169.Majority-Element)|59.8%|Easy|| |0170|Two Sum III - Data structure design||34.7%|Easy|| |0171|Excel Sheet Column Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0171.Excel-Sheet-Column-Number)|56.7%|Easy|| |0172|Factorial Trailing Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0172.Factorial-Trailing-Zeroes)|38.3%|Easy|| -|0173|Binary Search Tree Iterator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0173.Binary-Search-Tree-Iterator)|59.5%|Medium|| +|0173|Binary Search Tree Iterator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0173.Binary-Search-Tree-Iterator)|59.6%|Medium|| |0174|Dungeon Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0174.Dungeon-Game)|33.1%|Hard|| |0175|Combine Two Tables||63.4%|Easy|| |0176|Second Highest Salary||32.9%|Easy|| |0177|Nth Highest Salary||32.9%|Medium|| -|0178|Rank Scores||49.1%|Medium|| +|0178|Rank Scores||49.2%|Medium|| |0179|Largest Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0179.Largest-Number)|30.4%|Medium|| -|0180|Consecutive Numbers||41.6%|Medium|| -|0181|Employees Earning More Than Their Managers||59.5%|Easy|| +|0180|Consecutive Numbers||41.7%|Medium|| +|0181|Employees Earning More Than Their Managers||59.6%|Easy|| |0182|Duplicate Emails||64.0%|Easy|| |0183|Customers Who Never Order||56.1%|Easy|| |0184|Department Highest Salary||39.3%|Medium|| -|0185|Department Top Three Salaries||37.9%|Hard|| +|0185|Department Top Three Salaries||38.0%|Hard|| |0186|Reverse Words in a String II||45.0%|Medium|| |0187|Repeated DNA Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0187.Repeated-DNA-Sequences)|41.2%|Medium|| |0188|Best Time to Buy and Sell Stock IV||29.3%|Hard|| @@ -345,11 +359,11 @@ |0219|Contains Duplicate II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0219.Contains-Duplicate-II)|38.5%|Easy|| |0220|Contains Duplicate III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0220.Contains-Duplicate-III)|21.3%|Medium|| |0221|Maximal Square||38.7%|Medium|| -|0222|Count Complete Tree Nodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0222.Count-Complete-Tree-Nodes)|48.7%|Medium|| +|0222|Count Complete Tree Nodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0222.Count-Complete-Tree-Nodes)|48.8%|Medium|| |0223|Rectangle Area|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0223.Rectangle-Area)|38.1%|Medium|| |0224|Basic Calculator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0224.Basic-Calculator)|38.0%|Hard|| |0225|Implement Stack using Queues|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0225.Implement-Stack-using-Queues)|46.9%|Easy|| -|0226|Invert Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0226.Invert-Binary-Tree)|66.5%|Easy|| +|0226|Invert Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0226.Invert-Binary-Tree)|66.6%|Easy|| |0227|Basic Calculator II||38.3%|Medium|| |0228|Summary Ranges|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0228.Summary-Ranges)|42.1%|Easy|| |0229|Majority Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0229.Majority-Element-II)|38.5%|Medium|| @@ -373,10 +387,10 @@ |0247|Strobogrammatic Number II||48.3%|Medium|| |0248|Strobogrammatic Number III||40.1%|Hard|| |0249|Group Shifted Strings||57.6%|Medium|| -|0250|Count Univalue Subtrees||53.0%|Medium|| +|0250|Count Univalue Subtrees||53.1%|Medium|| |0251|Flatten 2D Vector||46.2%|Medium|| |0252|Meeting Rooms||55.3%|Easy|| -|0253|Meeting Rooms II||46.5%|Medium|| +|0253|Meeting Rooms II||46.6%|Medium|| |0254|Factor Combinations||47.2%|Medium|| |0255|Verify Preorder Sequence in Binary Search Tree||46.0%|Medium|| |0256|Paint House||53.2%|Medium|| @@ -394,7 +408,7 @@ |0268|Missing Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0268.Missing-Number)|53.3%|Easy|| |0269|Alien Dictionary||33.6%|Hard|| |0270|Closest Binary Search Tree Value||49.6%|Easy|| -|0271|Encode and Decode Strings||32.4%|Medium|| +|0271|Encode and Decode Strings||32.5%|Medium|| |0272|Closest Binary Search Tree Value II||51.9%|Hard|| |0273|Integer to English Words||27.9%|Hard|| |0274|H-Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0274.H-Index)|36.3%|Medium|| @@ -438,24 +452,24 @@ |0312|Burst Balloons||53.6%|Hard|| |0313|Super Ugly Number||45.9%|Medium|| |0314|Binary Tree Vertical Order Traversal||46.6%|Medium|| -|0315|Count of Smaller Numbers After Self|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0315.Count-of-Smaller-Numbers-After-Self)|42.5%|Hard|| +|0315|Count of Smaller Numbers After Self|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0315.Count-of-Smaller-Numbers-After-Self)|42.6%|Hard|| |0316|Remove Duplicate Letters||38.8%|Medium|| -|0317|Shortest Distance from All Buildings||42.4%|Hard|| +|0317|Shortest Distance from All Buildings||42.5%|Hard|| |0318|Maximum Product of Word Lengths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0318.Maximum-Product-of-Word-Lengths)|52.0%|Medium|| |0319|Bulb Switcher||45.3%|Medium|| |0320|Generalized Abbreviation||53.3%|Medium|| |0321|Create Maximum Number||27.4%|Hard|| |0322|Coin Change|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0322.Coin-Change)|36.9%|Medium|| -|0323|Number of Connected Components in an Undirected Graph||57.3%|Medium|| +|0323|Number of Connected Components in an Undirected Graph||57.4%|Medium|| |0324|Wiggle Sort II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0324.Wiggle-Sort-II)|30.5%|Medium|| |0325|Maximum Size Subarray Sum Equals k||47.2%|Medium|| |0326|Power of Three|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0326.Power-of-Three)|42.1%|Easy|| |0327|Count of Range Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0327.Count-of-Range-Sum)|35.9%|Hard|| -|0328|Odd Even Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0328.Odd-Even-Linked-List)|56.8%|Medium|| +|0328|Odd Even Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0328.Odd-Even-Linked-List)|56.9%|Medium|| |0329|Longest Increasing Path in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0329.Longest-Increasing-Path-in-a-Matrix)|44.4%|Hard|| |0330|Patching Array||34.9%|Hard|| |0331|Verify Preorder Serialization of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree)|40.9%|Medium|| -|0332|Reconstruct Itinerary||37.6%|Medium|| +|0332|Reconstruct Itinerary||37.7%|Medium|| |0333|Largest BST Subtree||37.3%|Medium|| |0334|Increasing Triplet Subsequence||40.6%|Medium|| |0335|Self Crossing||28.5%|Hard|| @@ -467,12 +481,12 @@ |0341|Flatten Nested List Iterator||54.2%|Medium|| |0342|Power of Four|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0342.Power-of-Four)|41.6%|Easy|| |0343|Integer Break|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0343.Integer-Break)|51.0%|Medium|| -|0344|Reverse String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0344.Reverse-String)|69.9%|Easy|| +|0344|Reverse String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0344.Reverse-String)|70.0%|Easy|| |0345|Reverse Vowels of a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0345.Reverse-Vowels-of-a-String)|44.9%|Easy|| |0346|Moving Average from Data Stream||72.8%|Easy|| |0347|Top K Frequent Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0347.Top-K-Frequent-Elements)|62.2%|Medium|| -|0348|Design Tic-Tac-Toe||55.3%|Medium|| -|0349|Intersection of Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0349.Intersection-of-Two-Arrays)|64.3%|Easy|| +|0348|Design Tic-Tac-Toe||55.4%|Medium|| +|0349|Intersection of Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0349.Intersection-of-Two-Arrays)|64.4%|Easy|| |0350|Intersection of Two Arrays II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0350.Intersection-of-Two-Arrays-II)|51.9%|Easy|| |0351|Android Unlock Patterns||49.4%|Medium|| |0352|Data Stream as Disjoint Intervals||48.4%|Hard|| @@ -481,7 +495,7 @@ |0355|Design Twitter||31.1%|Medium|| |0356|Line Reflection||32.6%|Medium|| |0357|Count Numbers with Unique Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0357.Count-Numbers-with-Unique-Digits)|48.7%|Medium|| -|0358|Rearrange String k Distance Apart||35.6%|Hard|| +|0358|Rearrange String k Distance Apart||35.5%|Hard|| |0359|Logger Rate Limiter||71.9%|Easy|| |0360|Sort Transformed Array||49.5%|Medium|| |0361|Bomb Enemy||46.5%|Medium|| @@ -498,7 +512,7 @@ |0372|Super Pow|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0372.Super-Pow)|36.6%|Medium|| |0373|Find K Pairs with Smallest Sums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0373.Find-K-Pairs-with-Smallest-Sums)|37.4%|Medium|| |0374|Guess Number Higher or Lower||44.3%|Easy|| -|0375|Guess Number Higher or Lower II||41.8%|Medium|| +|0375|Guess Number Higher or Lower II||41.9%|Medium|| |0376|Wiggle Subsequence||40.1%|Medium|| |0377|Combination Sum IV||45.9%|Medium|| |0378|Kth Smallest Element in a Sorted Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0378.Kth-Smallest-Element-in-a-Sorted-Matrix)|55.8%|Medium|| @@ -522,14 +536,14 @@ |0396|Rotate Function||36.6%|Medium|| |0397|Integer Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0397.Integer-Replacement)|33.4%|Medium|| |0398|Random Pick Index||57.5%|Medium|| -|0399|Evaluate Division|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0399.Evaluate-Division)|53.9%|Medium|| +|0399|Evaluate Division|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0399.Evaluate-Division)|54.0%|Medium|| |0400|Nth Digit||32.3%|Medium|| |0401|Binary Watch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0401.Binary-Watch)|48.3%|Easy|| |0402|Remove K Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0402.Remove-K-Digits)|28.6%|Medium|| |0403|Frog Jump||41.1%|Hard|| |0404|Sum of Left Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0404.Sum-of-Left-Leaves)|52.2%|Easy|| |0405|Convert a Number to Hexadecimal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0405.Convert-a-Number-to-Hexadecimal)|44.3%|Easy|| -|0406|Queue Reconstruction by Height||68.0%|Medium|| +|0406|Queue Reconstruction by Height||68.1%|Medium|| |0407|Trapping Rain Water II||43.8%|Hard|| |0408|Valid Word Abbreviation||31.3%|Easy|| |0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.1%|Easy|| @@ -549,10 +563,10 @@ |0423|Reconstruct Original Digits from English||47.4%|Medium|| |0424|Longest Repeating Character Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0424.Longest-Repeating-Character-Replacement)|48.0%|Medium|| |0425|Word Squares||49.9%|Hard|| -|0426|Convert Binary Search Tree to Sorted Doubly Linked List||60.7%|Medium|| +|0426|Convert Binary Search Tree to Sorted Doubly Linked List||60.8%|Medium|| |0427|Construct Quad Tree||62.4%|Medium|| |0428|Serialize and Deserialize N-ary Tree||61.1%|Hard|| -|0429|N-ary Tree Level Order Traversal||66.3%|Medium|| +|0429|N-ary Tree Level Order Traversal||66.4%|Medium|| |0430|Flatten a Multilevel Doubly Linked List||56.6%|Medium|| |0431|Encode N-ary Tree to Binary Tree||74.4%|Hard|| |0432|All O`one Data Structure||33.0%|Hard|| @@ -562,7 +576,7 @@ |0436|Find Right Interval|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0436.Find-Right-Interval)|48.4%|Medium|| |0437|Path Sum III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0437.Path-Sum-III)|47.9%|Medium|| |0438|Find All Anagrams in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0438.Find-All-Anagrams-in-a-String)|44.6%|Medium|| -|0439|Ternary Expression Parser||56.5%|Medium|| +|0439|Ternary Expression Parser||56.6%|Medium|| |0440|K-th Smallest in Lexicographical Order||29.7%|Hard|| |0441|Arranging Coins|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0441.Arranging-Coins)|42.3%|Easy|| |0442|Find All Duplicates in an Array||68.7%|Medium|| @@ -582,7 +596,7 @@ |0456|132 Pattern|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0456.132-Pattern)|30.6%|Medium|| |0457|Circular Array Loop|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0457.Circular-Array-Loop)|30.0%|Medium|| |0458|Poor Pigs||54.4%|Hard|| -|0459|Repeated Substring Pattern||43.2%|Easy|| +|0459|Repeated Substring Pattern||43.3%|Easy|| |0460|LFU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0460.LFU-Cache)|35.7%|Hard|| |0461|Hamming Distance|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0461.Hamming-Distance)|73.1%|Easy|| |0462|Minimum Moves to Equal Array Elements II||54.3%|Medium|| @@ -607,10 +621,10 @@ |0481|Magical String||48.0%|Medium|| |0482|License Key Formatting||43.0%|Easy|| |0483|Smallest Good Base|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0483.Smallest-Good-Base)|36.2%|Hard|| -|0484|Find Permutation||64.0%|Medium|| +|0484|Find Permutation||64.1%|Medium|| |0485|Max Consecutive Ones|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0485.Max-Consecutive-Ones)|53.2%|Easy|| |0486|Predict the Winner||48.4%|Medium|| -|0487|Max Consecutive Ones II||47.8%|Medium|| +|0487|Max Consecutive Ones II||47.9%|Medium|| |0488|Zuma Game||38.6%|Hard|| |0489|Robot Room Cleaner||72.1%|Hard|| |0490|The Maze||52.5%|Medium|| @@ -642,7 +656,7 @@ |0516|Longest Palindromic Subsequence||54.9%|Medium|| |0517|Super Washing Machines||38.5%|Hard|| |0518|Coin Change 2||51.4%|Medium|| -|0519|Random Flip Matrix||37.6%|Medium|| +|0519|Random Flip Matrix||37.7%|Medium|| |0520|Detect Capital||53.9%|Easy|| |0521|Longest Uncommon Subsequence I||58.4%|Easy|| |0522|Longest Uncommon Subsequence II||34.1%|Medium|| @@ -670,18 +684,18 @@ |0544|Output Contest Matches||75.7%|Medium|| |0545|Boundary of Binary Tree||39.4%|Medium|| |0546|Remove Boxes||44.2%|Hard|| -|0547|Number of Provinces|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0547.Number-of-Provinces)|60.0%|Medium|| -|0548|Split Array with Equal Sum||47.6%|Medium|| +|0547|Number of Provinces|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0547.Number-of-Provinces)|60.1%|Medium|| +|0548|Split Array with Equal Sum||47.7%|Medium|| |0549|Binary Tree Longest Consecutive Sequence II||47.2%|Medium|| -|0550|Game Play Analysis IV||46.1%|Medium|| +|0550|Game Play Analysis IV||46.0%|Medium|| |0551|Student Attendance Record I||46.0%|Easy|| |0552|Student Attendance Record II||37.2%|Hard|| |0553|Optimal Division||57.3%|Medium|| |0554|Brick Wall||50.6%|Medium|| -|0555|Split Concatenated Strings||42.7%|Medium|| +|0555|Split Concatenated Strings||42.8%|Medium|| |0556|Next Greater Element III||33.5%|Medium|| |0557|Reverse Words in a String III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0557.Reverse-Words-in-a-String-III)|71.5%|Easy|| -|0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.5%|Medium|| +|0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.4%|Medium|| |0559|Maximum Depth of N-ary Tree||69.4%|Easy|| |0560|Subarray Sum Equals K||43.9%|Medium|| |0561|Array Partition I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0561.Array-Partition-I)|72.8%|Easy|| @@ -694,7 +708,7 @@ |0568|Maximum Vacation Days||41.4%|Hard|| |0569|Median Employee Salary||60.9%|Hard|| |0570|Managers with at Least 5 Direct Reports||66.6%|Medium|| -|0571|Find Median Given Frequency of Numbers||45.4%|Hard|| +|0571|Find Median Given Frequency of Numbers||45.5%|Hard|| |0572|Subtree of Another Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0572.Subtree-of-Another-Tree)|44.4%|Easy|| |0573|Squirrel Simulation||56.0%|Medium|| |0574|Winning Candidate||51.2%|Medium|| @@ -713,28 +727,28 @@ |0587|Erect the Fence||36.3%|Hard|| |0588|Design In-Memory File System||46.5%|Hard|| |0589|N-ary Tree Preorder Traversal||73.1%|Easy|| -|0590|N-ary Tree Postorder Traversal||73.2%|Easy|| +|0590|N-ary Tree Postorder Traversal||73.1%|Easy|| |0591|Tag Validator||34.6%|Hard|| |0592|Fraction Addition and Subtraction||50.0%|Medium|| |0593|Valid Square||43.3%|Medium|| |0594|Longest Harmonious Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0594.Longest-Harmonious-Subsequence)|47.7%|Easy|| |0595|Big Countries||78.2%|Easy|| -|0596|Classes More Than 5 Students||38.7%|Easy|| -|0597|Friend Requests I: Overall Acceptance Rate||41.6%|Easy|| +|0596|Classes More Than 5 Students||38.6%|Easy|| +|0597|Friend Requests I: Overall Acceptance Rate||41.7%|Easy|| |0598|Range Addition II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0598.Range-Addition-II)|50.0%|Easy|| |0599|Minimum Index Sum of Two Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0599.Minimum-Index-Sum-of-Two-Lists)|51.5%|Easy|| |0600|Non-negative Integers without Consecutive Ones||34.5%|Hard|| |0601|Human Traffic of Stadium||44.3%|Hard|| |0602|Friend Requests II: Who Has the Most Friends||56.6%|Medium|| |0603|Consecutive Available Seats||65.6%|Easy|| -|0604|Design Compressed String Iterator||38.0%|Easy|| +|0604|Design Compressed String Iterator||38.1%|Easy|| |0605|Can Place Flowers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0605.Can-Place-Flowers)|31.9%|Easy|| |0606|Construct String from Binary Tree||55.0%|Easy|| |0607|Sales Person||64.6%|Easy|| |0608|Tree Node||69.0%|Medium|| |0609|Find Duplicate File in System||60.8%|Medium|| |0610|Triangle Judgement||67.9%|Easy|| -|0611|Valid Triangle Number||49.0%|Medium|| +|0611|Valid Triangle Number||49.1%|Medium|| |0612|Shortest Distance in a Plane||60.9%|Medium|| |0613|Shortest Distance in a Line||79.1%|Easy|| |0614|Second Degree Follower||32.1%|Medium|| @@ -742,15 +756,15 @@ |0616|Add Bold Tag in String||44.4%|Medium|| |0617|Merge Two Binary Trees||75.1%|Easy|| |0618|Students Report By Geography||58.7%|Hard|| -|0619|Biggest Single Number||44.5%|Easy|| +|0619|Biggest Single Number||44.6%|Easy|| |0620|Not Boring Movies||69.3%|Easy|| -|0621|Task Scheduler||51.4%|Medium|| +|0621|Task Scheduler||51.5%|Medium|| |0622|Design Circular Queue||45.0%|Medium|| -|0623|Add One Row to Tree||50.2%|Medium|| +|0623|Add One Row to Tree||50.3%|Medium|| |0624|Maximum Distance in Arrays||39.4%|Medium|| |0625|Minimum Factorization||32.9%|Medium|| |0626|Exchange Seats||64.9%|Medium|| -|0627|Swap Salary||77.1%|Easy|| +|0627|Swap Salary||77.2%|Easy|| |0628|Maximum Product of Three Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0628.Maximum-Product-of-Three-Numbers)|47.0%|Easy|| |0629|K Inverse Pairs Array||31.6%|Hard|| |0630|Course Schedule III||33.7%|Hard|| @@ -758,13 +772,13 @@ |0632|Smallest Range Covering Elements from K Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists)|53.9%|Hard|| |0633|Sum of Square Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0633.Sum-of-Square-Numbers)|32.4%|Medium|| |0634|Find the Derangement of An Array||40.4%|Medium|| -|0635|Design Log Storage System||59.3%|Medium|| +|0635|Design Log Storage System||59.4%|Medium|| |0636|Exclusive Time of Functions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0636.Exclusive-Time-of-Functions)|53.9%|Medium|| -|0637|Average of Levels in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0637.Average-of-Levels-in-Binary-Tree)|64.4%|Easy|| +|0637|Average of Levels in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0637.Average-of-Levels-in-Binary-Tree)|64.5%|Easy|| |0638|Shopping Offers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0638.Shopping-Offers)|52.5%|Medium|| |0639|Decode Ways II||27.4%|Hard|| |0640|Solve the Equation||42.6%|Medium|| -|0641|Design Circular Deque||54.6%|Medium|| +|0641|Design Circular Deque||54.5%|Medium|| |0642|Design Search Autocomplete System||45.9%|Hard|| |0643|Maximum Average Subarray I||42.0%|Easy|| |0644|Maximum Average Subarray II||33.9%|Hard|| @@ -777,7 +791,7 @@ |0651|4 Keys Keyboard||52.9%|Medium|| |0652|Find Duplicate Subtrees||51.9%|Medium|| |0653|Two Sum IV - Input is a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0653.Two-Sum-IV---Input-is-a-BST)|56.1%|Easy|| -|0654|Maximum Binary Tree||80.8%|Medium|| +|0654|Maximum Binary Tree||80.9%|Medium|| |0655|Print Binary Tree||55.8%|Medium|| |0656|Coin Path||29.5%|Hard|| |0657|Robot Return to Origin||73.6%|Easy|| @@ -794,7 +808,7 @@ |0668|Kth Smallest Number in Multiplication Table|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0668.Kth-Smallest-Number-in-Multiplication-Table)|47.6%|Hard|| |0669|Trim a Binary Search Tree||63.3%|Easy|| |0670|Maximum Swap||44.9%|Medium|| -|0671|Second Minimum Node In a Binary Tree||42.7%|Easy|| +|0671|Second Minimum Node In a Binary Tree||42.8%|Easy|| |0672|Bulb Switcher II||51.0%|Medium|| |0673|Number of Longest Increasing Subsequence||38.4%|Medium|| |0674|Longest Continuous Increasing Subsequence||46.0%|Easy|| @@ -802,7 +816,7 @@ |0676|Implement Magic Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0676.Implement-Magic-Dictionary)|55.1%|Medium|| |0677|Map Sum Pairs||53.9%|Medium|| |0678|Valid Parenthesis String||31.5%|Medium|| -|0679|24 Game||47.0%|Hard|| +|0679|24 Game||47.1%|Hard|| |0680|Valid Palindrome II||37.0%|Easy|| |0681|Next Closest Time||45.7%|Medium|| |0682|Baseball Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0682.Baseball-Game)|66.0%|Easy|| @@ -838,7 +852,7 @@ |0712|Minimum ASCII Delete Sum for Two Strings||59.3%|Medium|| |0713|Subarray Product Less Than K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0713.Subarray-Product-Less-Than-K)|40.4%|Medium|| |0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee)|55.8%|Medium|| -|0715|Range Module|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0715.Range-Module)|39.9%|Hard|| +|0715|Range Module|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0715.Range-Module)|40.0%|Hard|| |0716|Max Stack||42.9%|Easy|| |0717|1-bit and 2-bit Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0717.1-bit-and-2-bit-Characters)|47.6%|Easy|| |0718|Maximum Length of Repeated Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0718.Maximum-Length-of-Repeated-Subarray)|50.1%|Medium|| @@ -846,7 +860,7 @@ |0720|Longest Word in Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0720.Longest-Word-in-Dictionary)|49.0%|Easy|| |0721|Accounts Merge|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0721.Accounts-Merge)|51.1%|Medium|| |0722|Remove Comments||35.8%|Medium|| -|0723|Candy Crush||72.2%|Medium|| +|0723|Candy Crush||72.3%|Medium|| |0724|Find Pivot Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0724.Find-Pivot-Index)|45.0%|Easy|| |0725|Split Linked List in Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0725.Split-Linked-List-in-Parts)|52.7%|Medium|| |0726|Number of Atoms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0726.Number-of-Atoms)|51.0%|Hard|| @@ -858,7 +872,7 @@ |0732|My Calendar III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0732.My-Calendar-III)|61.4%|Hard|| |0733|Flood Fill|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0733.Flood-Fill)|55.8%|Easy|| |0734|Sentence Similarity||42.3%|Easy|| -|0735|Asteroid Collision|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0735.Asteroid-Collision)|43.1%|Medium|| +|0735|Asteroid Collision|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0735.Asteroid-Collision)|43.2%|Medium|| |0736|Parse Lisp Expression||49.8%|Hard|| |0737|Sentence Similarity II||46.4%|Medium|| |0738|Monotone Increasing Digits||45.5%|Medium|| @@ -869,7 +883,7 @@ |0743|Network Delay Time||45.3%|Medium|| |0744|Find Smallest Letter Greater Than Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0744.Find-Smallest-Letter-Greater-Than-Target)|45.6%|Easy|| |0745|Prefix and Suffix Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0745.Prefix-and-Suffix-Search)|35.1%|Hard|| -|0746|Min Cost Climbing Stairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0746.Min-Cost-Climbing-Stairs)|50.8%|Easy|| +|0746|Min Cost Climbing Stairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0746.Min-Cost-Climbing-Stairs)|50.9%|Easy|| |0747|Largest Number At Least Twice of Others||42.8%|Easy|| |0748|Shortest Completing Word|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0748.Shortest-Completing-Word)|57.4%|Easy|| |0749|Contain Virus||47.8%|Hard|| @@ -902,7 +916,7 @@ |0776|Split BST||56.5%|Medium|| |0777|Swap Adjacent in LR String||35.5%|Medium|| |0778|Swim in Rising Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0778.Swim-in-Rising-Water)|54.3%|Hard|| -|0779|K-th Symbol in Grammar||38.4%|Medium|| +|0779|K-th Symbol in Grammar||38.5%|Medium|| |0780|Reaching Points||30.2%|Hard|| |0781|Rabbits in Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0781.Rabbits-in-Forest)|55.3%|Medium|| |0782|Transform to Chessboard||46.8%|Hard|| @@ -951,7 +965,7 @@ |0825|Friends Of Appropriate Ages||43.8%|Medium|| |0826|Most Profit Assigning Work|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0826.Most-Profit-Assigning-Work)|38.9%|Medium|| |0827|Making A Large Island||47.1%|Hard|| -|0828|Count Unique Characters of All Substrings of a Given String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String)|46.8%|Hard|| +|0828|Count Unique Characters of All Substrings of a Given String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String)|46.7%|Hard|| |0829|Consecutive Numbers Sum||39.3%|Hard|| |0830|Positions of Large Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0830.Positions-of-Large-Groups)|50.2%|Easy|| |0831|Masking Personal Information||44.7%|Medium|| @@ -962,7 +976,7 @@ |0836|Rectangle Overlap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0836.Rectangle-Overlap)|45.2%|Easy|| |0837|New 21 Game||35.3%|Medium|| |0838|Push Dominoes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0838.Push-Dominoes)|49.6%|Medium|| -|0839|Similar String Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0839.Similar-String-Groups)|39.9%|Hard|| +|0839|Similar String Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0839.Similar-String-Groups)|40.0%|Hard|| |0840|Magic Squares In Grid||37.8%|Medium|| |0841|Keys and Rooms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0841.Keys-and-Rooms)|65.2%|Medium|| |0842|Split Array into Fibonacci Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0842.Split-Array-into-Fibonacci-Sequence)|36.6%|Medium|| @@ -979,14 +993,14 @@ |0853|Car Fleet|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0853.Car-Fleet)|43.5%|Medium|| |0854|K-Similar Strings||38.7%|Hard|| |0855|Exam Room||43.4%|Medium|| -|0856|Score of Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0856.Score-of-Parentheses)|62.1%|Medium|| +|0856|Score of Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0856.Score-of-Parentheses)|62.2%|Medium|| |0857|Minimum Cost to Hire K Workers||50.3%|Hard|| |0858|Mirror Reflection||59.5%|Medium|| |0859|Buddy Strings||29.7%|Easy|| |0860|Lemonade Change||51.9%|Easy|| |0861|Score After Flipping Matrix||73.4%|Medium|| |0862|Shortest Subarray with Sum at Least K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K)|25.1%|Hard|| -|0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|57.4%|Medium|| +|0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|57.5%|Medium|| |0864|Shortest Path to Get All Keys|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0864.Shortest-Path-to-Get-All-Keys)|41.5%|Hard|| |0865|Smallest Subtree with all the Deepest Nodes||64.6%|Medium|| |0866|Prime Palindrome||25.1%|Medium|| @@ -1026,8 +1040,8 @@ |0900|RLE Iterator||55.1%|Medium|| |0901|Online Stock Span|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0901.Online-Stock-Span)|61.1%|Medium|| |0902|Numbers At Most N Given Digit Set||36.1%|Hard|| -|0903|Valid Permutations for DI Sequence||54.2%|Hard|| -|0904|Fruit Into Baskets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets)|42.9%|Medium|| +|0903|Valid Permutations for DI Sequence||54.1%|Hard|| +|0904|Fruit Into Baskets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets)|42.8%|Medium|| |0905|Sort Array By Parity||74.9%|Easy|| |0906|Super Palindromes||32.9%|Hard|| |0907|Sum of Subarray Minimums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0907.Sum-of-Subarray-Minimums)|33.2%|Medium|| @@ -1035,7 +1049,7 @@ |0909|Snakes and Ladders||39.1%|Medium|| |0910|Smallest Range II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0910.Smallest-Range-II)|31.2%|Medium|| |0911|Online Election|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0911.Online-Election)|51.2%|Medium|| -|0912|Sort an Array||64.4%|Medium|| +|0912|Sort an Array||64.5%|Medium|| |0913|Cat and Mouse||33.8%|Hard|| |0914|X of a Kind in a Deck of Cards|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0914.X-of-a-Kind-in-a-Deck-of-Cards)|34.4%|Easy|| |0915|Partition Array into Disjoint Intervals||45.9%|Medium|| @@ -1043,7 +1057,7 @@ |0917|Reverse Only Letters||58.6%|Easy|| |0918|Maximum Sum Circular Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0918.Maximum-Sum-Circular-Subarray)|34.0%|Medium|| |0919|Complete Binary Tree Inserter||58.6%|Medium|| -|0920|Number of Music Playlists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0920.Number-of-Music-Playlists)|47.7%|Hard|| +|0920|Number of Music Playlists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0920.Number-of-Music-Playlists)|47.6%|Hard|| |0921|Minimum Add to Make Parentheses Valid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid)|74.6%|Medium|| |0922|Sort Array By Parity II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0922.Sort-Array-By-Parity-II)|70.2%|Easy|| |0923|3Sum With Multiplicity|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0923.3Sum-With-Multiplicity)|36.0%|Medium|| @@ -1055,9 +1069,9 @@ |0929|Unique Email Addresses||67.2%|Easy|| |0930|Binary Subarrays With Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0930.Binary-Subarrays-With-Sum)|44.2%|Medium|| |0931|Minimum Falling Path Sum||63.2%|Medium|| -|0932|Beautiful Array||61.1%|Medium|| +|0932|Beautiful Array||61.0%|Medium|| |0933|Number of Recent Calls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0933.Number-of-Recent-Calls)|72.0%|Easy|| -|0934|Shortest Bridge||49.3%|Medium|| +|0934|Shortest Bridge||49.4%|Medium|| |0935|Knight Dialer||46.1%|Medium|| |0936|Stamping The Sequence||47.2%|Hard|| |0937|Reorder Data in Log Files||54.3%|Easy|| @@ -1066,7 +1080,7 @@ |0940|Distinct Subsequences II||41.6%|Hard|| |0941|Valid Mountain Array||33.5%|Easy|| |0942|DI String Match|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0942.DI-String-Match)|73.4%|Easy|| -|0943|Find the Shortest Superstring||43.4%|Hard|| +|0943|Find the Shortest Superstring||43.5%|Hard|| |0944|Delete Columns to Make Sorted||71.0%|Easy|| |0945|Minimum Increment to Make Array Unique||46.6%|Medium|| |0946|Validate Stack Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0946.Validate-Stack-Sequences)|63.4%|Medium|| @@ -1089,15 +1103,15 @@ |0963|Minimum Area Rectangle II||51.7%|Medium|| |0964|Least Operators to Express Number||44.8%|Hard|| |0965|Univalued Binary Tree||67.7%|Easy|| -|0966|Vowel Spellchecker||47.6%|Medium|| +|0966|Vowel Spellchecker||47.7%|Medium|| |0967|Numbers With Same Consecutive Differences||44.5%|Medium|| |0968|Binary Tree Cameras|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0968.Binary-Tree-Cameras)|38.5%|Hard|| |0969|Pancake Sorting|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0969.Pancake-Sorting)|68.5%|Medium|| -|0970|Powerful Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0970.Powerful-Integers)|40.0%|Easy|| +|0970|Powerful Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0970.Powerful-Integers)|39.9%|Easy|| |0971|Flip Binary Tree To Match Preorder Traversal||46.2%|Medium|| |0972|Equal Rational Numbers||41.9%|Hard|| |0973|K Closest Points to Origin|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0973.K-Closest-Points-to-Origin)|64.5%|Medium|| -|0974|Subarray Sums Divisible by K||50.5%|Medium|| +|0974|Subarray Sums Divisible by K||50.6%|Medium|| |0975|Odd Even Jump||41.5%|Hard|| |0976|Largest Perimeter Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0976.Largest-Perimeter-Triangle)|58.5%|Easy|| |0977|Squares of a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0977.Squares-of-a-Sorted-Array)|72.3%|Easy|| @@ -1110,7 +1124,7 @@ |0984|String Without AAA or BBB|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0984.String-Without-AAA-or-BBB)|38.4%|Medium|| |0985|Sum of Even Numbers After Queries|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0985.Sum-of-Even-Numbers-After-Queries)|60.8%|Easy|| |0986|Interval List Intersections|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0986.Interval-List-Intersections)|68.1%|Medium|| -|0987|Vertical Order Traversal of a Binary Tree||37.5%|Medium|| +|0987|Vertical Order Traversal of a Binary Tree||37.6%|Medium|| |0988|Smallest String Starting From Leaf||46.6%|Medium|| |0989|Add to Array-Form of Integer||44.7%|Easy|| |0990|Satisfiability of Equality Equations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0990.Satisfiability-of-Equality-Equations)|46.4%|Medium|| @@ -1118,19 +1132,19 @@ |0992|Subarrays with K Different Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0992.Subarrays-with-K-Different-Integers)|50.4%|Hard|| |0993|Cousins in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0993.Cousins-in-Binary-Tree)|52.2%|Easy|| |0994|Rotting Oranges||49.5%|Medium|| -|0995|Minimum Number of K Consecutive Bit Flips|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0995.Minimum-Number-of-K-Consecutive-Bit-Flips)|49.5%|Hard|| +|0995|Minimum Number of K Consecutive Bit Flips|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0995.Minimum-Number-of-K-Consecutive-Bit-Flips)|49.6%|Hard|| |0996|Number of Squareful Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0996.Number-of-Squareful-Arrays)|47.9%|Hard|| |0997|Find the Town Judge||49.8%|Easy|| |0998|Maximum Binary Tree II||63.6%|Medium|| |0999|Available Captures for Rook|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0999.Available-Captures-for-Rook)|66.8%|Easy|| |1000|Minimum Cost to Merge Stones||40.4%|Hard|| -|1001|Grid Illumination||36.5%|Hard|| +|1001|Grid Illumination||36.6%|Hard|| |1002|Find Common Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1002.Find-Common-Characters)|68.1%|Easy|| |1003|Check If Word Is Valid After Substitutions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions)|56.0%|Medium|| |1004|Max Consecutive Ones III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1004.Max-Consecutive-Ones-III)|60.5%|Medium|| |1005|Maximize Sum Of Array After K Negations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations)|52.2%|Easy|| |1006|Clumsy Factorial||53.6%|Medium|| -|1007|Minimum Domino Rotations For Equal Row||50.9%|Medium|| +|1007|Minimum Domino Rotations For Equal Row||51.0%|Medium|| |1008|Construct Binary Search Tree from Preorder Traversal||78.7%|Medium|| |1009|Complement of Base 10 Integer||61.5%|Easy|| |1010|Pairs of Songs With Total Durations Divisible by 60||49.7%|Medium|| @@ -1140,14 +1154,14 @@ |1014|Best Sightseeing Pair||52.8%|Medium|| |1015|Smallest Integer Divisible by K||41.8%|Medium|| |1016|Binary String With Substrings Representing 1 To N||59.1%|Medium|| -|1017|Convert to Base -2|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1017.Convert-to-Base--2)|59.5%|Medium|| +|1017|Convert to Base -2|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1017.Convert-to-Base--2)|59.6%|Medium|| |1018|Binary Prefix Divisible By 5||47.8%|Easy|| |1019|Next Greater Node In Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1019.Next-Greater-Node-In-Linked-List)|58.2%|Medium|| |1020|Number of Enclaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1020.Number-of-Enclaves)|58.7%|Medium|| |1021|Remove Outermost Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1021.Remove-Outermost-Parentheses)|78.7%|Easy|| |1022|Sum of Root To Leaf Binary Numbers||71.4%|Easy|| |1023|Camelcase Matching||57.3%|Medium|| -|1024|Video Stitching||49.2%|Medium|| +|1024|Video Stitching||49.1%|Medium|| |1025|Divisor Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1025.Divisor-Game)|66.1%|Easy|| |1026|Maximum Difference Between Node and Ancestor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor)|69.1%|Medium|| |1027|Longest Arithmetic Subsequence||49.9%|Medium|| @@ -1163,11 +1177,11 @@ |1037|Valid Boomerang|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1037.Valid-Boomerang)|37.8%|Easy|| |1038|Binary Search Tree to Greater Sum Tree||82.0%|Medium|| |1039|Minimum Score Triangulation of Polygon||50.0%|Medium|| -|1040|Moving Stones Until Consecutive II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1040.Moving-Stones-Until-Consecutive-II)|53.9%|Medium|| +|1040|Moving Stones Until Consecutive II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1040.Moving-Stones-Until-Consecutive-II)|54.0%|Medium|| |1041|Robot Bounded In Circle||54.7%|Medium|| |1042|Flower Planting With No Adjacent||48.7%|Medium|| |1043|Partition Array for Maximum Sum||66.7%|Medium|| -|1044|Longest Duplicate Substring||31.6%|Hard|| +|1044|Longest Duplicate Substring||31.5%|Hard|| |1045|Customers Who Bought All Products||68.2%|Medium|| |1046|Last Stone Weight||62.4%|Easy|| |1047|Remove All Adjacent Duplicates In String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String)|70.2%|Easy|| @@ -1176,7 +1190,7 @@ |1050|Actors and Directors Who Cooperated At Least Three Times||72.2%|Easy|| |1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.9%|Easy|| |1052|Grumpy Bookstore Owner|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1052.Grumpy-Bookstore-Owner)|55.7%|Medium|| -|1053|Previous Permutation With One Swap||50.8%|Medium|| +|1053|Previous Permutation With One Swap||50.7%|Medium|| |1054|Distant Barcodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1054.Distant-Barcodes)|44.1%|Medium|| |1055|Shortest Way to Form String||57.1%|Medium|| |1056|Confusing Number||47.2%|Easy|| @@ -1184,14 +1198,14 @@ |1058|Minimize Rounding Error to Meet Target||43.1%|Medium|| |1059|All Paths from Source Lead to Destination||43.4%|Medium|| |1060|Missing Element in Sorted Array||54.7%|Medium|| -|1061|Lexicographically Smallest Equivalent String||66.7%|Medium|| +|1061|Lexicographically Smallest Equivalent String||66.6%|Medium|| |1062|Longest Repeating Substring||58.0%|Medium|| |1063|Number of Valid Subarrays||72.1%|Hard|| |1064|Fixed Point||65.5%|Easy|| -|1065|Index Pairs of a String||60.9%|Easy|| +|1065|Index Pairs of a String||61.0%|Easy|| |1066|Campus Bikes II||54.0%|Medium|| |1067|Digit Count in Range||41.1%|Hard|| -|1068|Product Sales Analysis I||82.5%|Easy|| +|1068|Product Sales Analysis I||82.4%|Easy|| |1069|Product Sales Analysis II||83.2%|Easy|| |1070|Product Sales Analysis III||49.6%|Medium|| |1071|Greatest Common Divisor of Strings||51.4%|Easy|| @@ -1205,9 +1219,9 @@ |1079|Letter Tile Possibilities|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1079.Letter-Tile-Possibilities)|75.8%|Medium|| |1080|Insufficient Nodes in Root to Leaf Paths||49.7%|Medium|| |1081|Smallest Subsequence of Distinct Characters||53.4%|Medium|| -|1082|Sales Analysis I||73.2%|Easy|| -|1083|Sales Analysis II||50.8%|Easy|| -|1084|Sales Analysis III||54.7%|Easy|| +|1082|Sales Analysis I||73.3%|Easy|| +|1083|Sales Analysis II||50.7%|Easy|| +|1084|Sales Analysis III||54.6%|Easy|| |1085|Sum of Digits in the Minimum Number||75.0%|Easy|| |1086|High Five||78.8%|Easy|| |1087|Brace Expansion||63.1%|Medium|| @@ -1215,12 +1229,12 @@ |1089|Duplicate Zeros|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1089.Duplicate-Zeros)|52.0%|Easy|| |1090|Largest Values From Labels||60.0%|Medium|| |1091|Shortest Path in Binary Matrix||39.0%|Medium|| -|1092|Shortest Common Supersequence ||52.7%|Hard|| +|1092|Shortest Common Supersequence ||52.8%|Hard|| |1093|Statistics from a Large Sample|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1093.Statistics-from-a-Large-Sample)|49.3%|Medium|| -|1094|Car Pooling||59.0%|Medium|| +|1094|Car Pooling||59.1%|Medium|| |1095|Find in Mountain Array||35.9%|Hard|| |1096|Brace Expansion II||62.4%|Hard|| -|1097|Game Play Analysis V||56.3%|Hard|| +|1097|Game Play Analysis V||56.4%|Hard|| |1098|Unpopular Books||45.6%|Medium|| |1099|Two Sum Less Than K||60.8%|Easy|| |1100|Find K-Length Substrings With No Repeated Characters||73.3%|Medium|| @@ -1236,7 +1250,7 @@ |1110|Delete Nodes And Return Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1110.Delete-Nodes-And-Return-Forest)|67.6%|Medium|| |1111|Maximum Nesting Depth of Two Valid Parentheses Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings)|72.4%|Medium|| |1112|Highest Grade For Each Student||71.7%|Medium|| -|1113|Reported Posts||65.3%|Easy|| +|1113|Reported Posts||65.4%|Easy|| |1114|Print in Order||66.9%|Easy|| |1115|Print FooBar Alternately||59.1%|Medium|| |1116|Print Zero Even Odd||57.6%|Medium|| @@ -1248,11 +1262,11 @@ |1122|Relative Sort Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1122.Relative-Sort-Array)|67.7%|Easy|| |1123|Lowest Common Ancestor of Deepest Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves)|67.8%|Medium|| |1124|Longest Well-Performing Interval||33.2%|Medium|| -|1125|Smallest Sufficient Team||46.9%|Hard|| +|1125|Smallest Sufficient Team||47.0%|Hard|| |1126|Active Businesses||68.7%|Medium|| |1127|User Purchase Platform||50.3%|Hard|| |1128|Number of Equivalent Domino Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1128.Number-of-Equivalent-Domino-Pairs)|46.6%|Easy|| -|1129|Shortest Path with Alternating Colors||40.0%|Medium|| +|1129|Shortest Path with Alternating Colors||40.1%|Medium|| |1130|Minimum Cost Tree From Leaf Values||67.1%|Medium|| |1131|Maximum of Absolute Value Expression||52.1%|Medium|| |1132|Reported Posts II||34.6%|Medium|| @@ -1262,26 +1276,26 @@ |1136|Parallel Courses||61.2%|Hard|| |1137|N-th Tribonacci Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1137.N-th-Tribonacci-Number)|56.1%|Easy|| |1138|Alphabet Board Path||50.6%|Medium|| -|1139|Largest 1-Bordered Square||48.4%|Medium|| +|1139|Largest 1-Bordered Square||48.5%|Medium|| |1140|Stone Game II||64.8%|Medium|| -|1141|User Activity for the Past 30 Days I||54.4%|Easy|| -|1142|User Activity for the Past 30 Days II||35.2%|Easy|| +|1141|User Activity for the Past 30 Days I||54.3%|Easy|| +|1142|User Activity for the Past 30 Days II||35.3%|Easy|| |1143|Longest Common Subsequence||58.6%|Medium|| |1144|Decrease Elements To Make Array Zigzag||46.0%|Medium|| |1145|Binary Tree Coloring Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1145.Binary-Tree-Coloring-Game)|51.4%|Medium|| |1146|Snapshot Array||36.8%|Medium|| |1147|Longest Chunked Palindrome Decomposition||59.4%|Hard|| -|1148|Article Views I||77.0%|Easy|| +|1148|Article Views I||76.9%|Easy|| |1149|Article Views II||48.4%|Medium|| |1150|Check If a Number Is Majority Element in a Sorted Array||58.0%|Easy|| |1151|Minimum Swaps to Group All 1's Together||58.2%|Medium|| |1152|Analyze User Website Visit Pattern||43.4%|Medium|| |1153|String Transforms Into Another String||36.0%|Hard|| |1154|Day of the Year|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1154.Day-of-the-Year)|49.3%|Easy|| -|1155|Number of Dice Rolls With Target Sum||47.5%|Medium|| +|1155|Number of Dice Rolls With Target Sum||47.6%|Medium|| |1156|Swap For Longest Repeated Character Substring||47.5%|Medium|| |1157|Online Majority Element In Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1157.Online-Majority-Element-In-Subarray)|39.5%|Hard|| -|1158|Market Analysis I||63.4%|Medium|| +|1158|Market Analysis I||63.5%|Medium|| |1159|Market Analysis II||55.1%|Hard|| |1160|Find Words That Can Be Formed by Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters)|67.5%|Easy|| |1161|Maximum Level Sum of a Binary Tree||70.1%|Medium|| @@ -1296,7 +1310,7 @@ |1170|Compare Strings by Frequency of the Smallest Character|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character)|59.5%|Easy|| |1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List)|41.4%|Medium|| |1172|Dinner Plate Stacks||37.8%|Hard|| -|1173|Immediate Food Delivery I||82.3%|Easy|| +|1173|Immediate Food Delivery I||82.2%|Easy|| |1174|Immediate Food Delivery II||60.9%|Medium|| |1175|Prime Arrangements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1175.Prime-Arrangements)|51.8%|Easy|| |1176|Diet Plan Performance||54.0%|Easy|| @@ -1306,50 +1320,50 @@ |1180|Count Substrings with Only One Distinct Letter||77.5%|Easy|| |1181|Before and After Puzzle||44.5%|Medium|| |1182|Shortest Distance to Target Color||53.4%|Medium|| -|1183|Maximum Number of Ones||56.6%|Hard|| +|1183|Maximum Number of Ones||56.7%|Hard|| |1184|Distance Between Bus Stops|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1184.Distance-Between-Bus-Stops)|54.2%|Easy|| |1185|Day of the Week|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week)|62.0%|Easy|| -|1186|Maximum Subarray Sum with One Deletion||38.4%|Medium|| +|1186|Maximum Subarray Sum with One Deletion||38.5%|Medium|| |1187|Make Array Strictly Increasing||41.6%|Hard|| |1188|Design Bounded Blocking Queue||72.7%|Medium|| |1189|Maximum Number of Balloons|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1189.Maximum-Number-of-Balloons)|61.8%|Easy|| |1190|Reverse Substrings Between Each Pair of Parentheses||64.0%|Medium|| -|1191|K-Concatenation Maximum Sum||25.5%|Medium|| +|1191|K-Concatenation Maximum Sum||25.4%|Medium|| |1192|Critical Connections in a Network||49.8%|Hard|| |1193|Monthly Transactions I||69.0%|Medium|| -|1194|Tournament Winners||52.0%|Hard|| +|1194|Tournament Winners||52.1%|Hard|| |1195|Fizz Buzz Multithreaded||70.4%|Medium|| |1196|How Many Apples Can You Put into the Basket||68.1%|Easy|| |1197|Minimum Knight Moves||37.0%|Medium|| |1198|Find Smallest Common Element in All Rows||75.3%|Medium|| -|1199|Minimum Time to Build Blocks||38.5%|Hard|| +|1199|Minimum Time to Build Blocks||38.4%|Hard|| |1200|Minimum Absolute Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1200.Minimum-Absolute-Difference)|66.8%|Easy|| |1201|Ugly Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1201.Ugly-Number-III)|26.4%|Medium|| -|1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|48.2%|Medium|| -|1203|Sort Items by Groups Respecting Dependencies||48.9%|Hard|| +|1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|48.3%|Medium|| +|1203|Sort Items by Groups Respecting Dependencies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies)|49.0%|Hard|| |1204|Last Person to Fit in the Elevator||71.4%|Medium|| |1205|Monthly Transactions II||46.1%|Medium|| -|1206|Design Skiplist||58.8%|Hard|| +|1206|Design Skiplist||58.9%|Hard|| |1207|Unique Number of Occurrences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1207.Unique-Number-of-Occurrences)|71.6%|Easy|| |1208|Get Equal Substrings Within Budget|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1208.Get-Equal-Substrings-Within-Budget)|43.6%|Medium|| -|1209|Remove All Adjacent Duplicates in String II||57.4%|Medium|| +|1209|Remove All Adjacent Duplicates in String II||57.5%|Medium|| |1210|Minimum Moves to Reach Target with Rotations||46.2%|Hard|| |1211|Queries Quality and Percentage||70.0%|Easy|| |1212|Team Scores in Football Tournament||56.7%|Medium|| |1213|Intersection of Three Sorted Arrays||79.2%|Easy|| |1214|Two Sum BSTs||67.7%|Medium|| |1215|Stepping Numbers||43.1%|Medium|| -|1216|Valid Palindrome III||49.4%|Hard|| +|1216|Valid Palindrome III||49.5%|Hard|| |1217|Minimum Cost to Move Chips to The Same Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position)|71.2%|Easy|| |1218|Longest Arithmetic Subsequence of Given Difference||46.4%|Medium|| |1219|Path with Maximum Gold||65.5%|Medium|| -|1220|Count Vowels Permutation||54.1%|Hard|| +|1220|Count Vowels Permutation||54.2%|Hard|| |1221|Split a String in Balanced Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1221.Split-a-String-in-Balanced-Strings)|84.0%|Easy|| |1222|Queens That Can Attack the King||69.3%|Medium|| -|1223|Dice Roll Simulation||46.7%|Medium|| -|1224|Maximum Equal Frequency||34.4%|Hard|| -|1225|Report Contiguous Dates||62.3%|Hard|| -|1226|The Dining Philosophers||58.7%|Medium|| +|1223|Dice Roll Simulation||46.6%|Medium|| +|1224|Maximum Equal Frequency||34.5%|Hard|| +|1225|Report Contiguous Dates||62.4%|Hard|| +|1226|The Dining Philosophers||58.3%|Medium|| |1227|Airplane Seat Assignment Probability||62.0%|Medium|| |1228|Missing Number In Arithmetic Progression||51.7%|Easy|| |1229|Meeting Scheduler||54.2%|Medium|| @@ -1358,30 +1372,30 @@ |1232|Check If It Is a Straight Line|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1232.Check-If-It-Is-a-Straight-Line)|43.9%|Easy|| |1233|Remove Sub-Folders from the Filesystem||61.6%|Medium|| |1234|Replace the Substring for Balanced String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1234.Replace-the-Substring-for-Balanced-String)|34.3%|Medium|| -|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|46.8%|Hard|| +|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|46.9%|Hard|| |1236|Web Crawler||64.5%|Medium|| |1237|Find Positive Integer Solution for a Given Equation||69.7%|Easy|| -|1238|Circular Permutation in Binary Representation||65.9%|Medium|| +|1238|Circular Permutation in Binary Representation||65.8%|Medium|| |1239|Maximum Length of a Concatenated String with Unique Characters||49.2%|Medium|| |1240|Tiling a Rectangle with the Fewest Squares||52.4%|Hard|| |1241|Number of Comments per Post||67.5%|Easy|| -|1242|Web Crawler Multithreaded||47.8%|Medium|| +|1242|Web Crawler Multithreaded||47.9%|Medium|| |1243|Array Transformation||50.3%|Easy|| |1244|Design A Leaderboard||65.7%|Medium|| |1245|Tree Diameter||61.2%|Medium|| |1246|Palindrome Removal||45.7%|Hard|| |1247|Minimum Swaps to Make Strings Equal||62.3%|Medium|| -|1248|Count Number of Nice Subarrays||56.5%|Medium|| +|1248|Count Number of Nice Subarrays||56.4%|Medium|| |1249|Minimum Remove to Make Valid Parentheses||63.5%|Medium|| |1250|Check If It Is a Good Array||56.3%|Hard|| |1251|Average Selling Price||82.5%|Easy|| |1252|Cells with Odd Values in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix)|78.5%|Easy|| -|1253|Reconstruct a 2-Row Binary Matrix||41.3%|Medium|| -|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|61.4%|Medium|| +|1253|Reconstruct a 2-Row Binary Matrix||41.4%|Medium|| +|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|61.5%|Medium|| |1255|Maximum Score Words Formed by Letters||69.8%|Hard|| |1256|Encode Number||67.4%|Medium|| |1257|Smallest Common Region||60.3%|Medium|| -|1258|Synonymous Sentences||65.4%|Medium|| +|1258|Synonymous Sentences||65.3%|Medium|| |1259|Handshakes That Don't Cross||54.1%|Hard|| |1260|Shift 2D Grid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1260.Shift-2D-Grid)|61.8%|Easy|| |1261|Find Elements in a Contaminated Binary Tree||74.4%|Medium|| @@ -1396,14 +1410,14 @@ |1270|All People Report to the Given Manager||88.3%|Medium|| |1271|Hexspeak||55.2%|Easy|| |1272|Remove Interval||57.8%|Medium|| -|1273|Delete Tree Nodes||62.6%|Medium|| -|1274|Number of Ships in a Rectangle||66.1%|Hard|| +|1273|Delete Tree Nodes||62.5%|Medium|| +|1274|Number of Ships in a Rectangle||66.2%|Hard|| |1275|Find Winner on a Tic Tac Toe Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game)|53.0%|Easy|| -|1276|Number of Burgers with No Waste of Ingredients||49.9%|Medium|| +|1276|Number of Burgers with No Waste of Ingredients||50.0%|Medium|| |1277|Count Square Submatrices with All Ones||72.9%|Medium|| |1278|Palindrome Partitioning III||60.6%|Hard|| |1279|Traffic Light Controlled Intersection||75.6%|Easy|| -|1280|Students and Examinations||74.2%|Easy|| +|1280|Students and Examinations||74.3%|Easy|| |1281|Subtract the Product and Sum of Digits of an Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer)|85.6%|Easy|| |1282|Group the People Given the Group Size They Belong To||84.3%|Medium|| |1283|Find the Smallest Divisor Given a Threshold|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold)|49.1%|Medium|| @@ -1415,9 +1429,9 @@ |1289|Minimum Falling Path Sum II||62.2%|Hard|| |1290|Convert Binary Number in a Linked List to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer)|81.6%|Easy|| |1291|Sequential Digits||57.4%|Medium|| -|1292|Maximum Side Length of a Square with Sum Less than or Equal to Threshold||50.4%|Medium|| +|1292|Maximum Side Length of a Square with Sum Less than or Equal to Threshold||50.5%|Medium|| |1293|Shortest Path in a Grid with Obstacles Elimination||42.9%|Hard|| -|1294|Weather Type in Each Country||66.1%|Easy|| +|1294|Weather Type in Each Country||66.0%|Easy|| |1295|Find Numbers with Even Number of Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits)|79.4%|Easy|| |1296|Divide Array in Sets of K Consecutive Numbers||55.3%|Medium|| |1297|Maximum Number of Occurrences of a Substring||49.3%|Medium|| @@ -1431,8 +1445,8 @@ |1305|All Elements in Two Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1305.All-Elements-in-Two-Binary-Search-Trees)|77.8%|Medium|| |1306|Jump Game III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1306.Jump-Game-III)|62.6%|Medium|| |1307|Verbal Arithmetic Puzzle||37.2%|Hard|| -|1308|Running Total for Different Genders||87.0%|Medium|| -|1309|Decrypt String from Alphabet to Integer Mapping||77.3%|Easy|| +|1308|Running Total for Different Genders||87.1%|Medium|| +|1309|Decrypt String from Alphabet to Integer Mapping||77.2%|Easy|| |1310|XOR Queries of a Subarray||69.2%|Medium|| |1311|Get Watched Videos by Your Friends||44.1%|Medium|| |1312|Minimum Insertion Steps to Make a String Palindrome||59.2%|Hard|| @@ -1440,19 +1454,19 @@ |1314|Matrix Block Sum||73.7%|Medium|| |1315|Sum of Nodes with Even-Valued Grandparent||84.1%|Medium|| |1316|Distinct Echo Substrings||49.6%|Hard|| -|1317|Convert Integer to the Sum of Two No-Zero Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers)|56.8%|Easy|| +|1317|Convert Integer to the Sum of Two No-Zero Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers)|56.9%|Easy|| |1318|Minimum Flips to Make a OR b Equal to c||63.7%|Medium|| |1319|Number of Operations to Make Network Connected||54.7%|Medium|| |1320|Minimum Distance to Type a Word Using Two Fingers||62.8%|Hard|| -|1321|Restaurant Growth||70.5%|Medium|| +|1321|Restaurant Growth||70.4%|Medium|| |1322|Ads Performance||57.9%|Easy|| -|1323|Maximum 69 Number||77.9%|Easy|| +|1323|Maximum 69 Number||78.0%|Easy|| |1324|Print Words Vertically||58.6%|Medium|| |1325|Delete Leaves With a Given Value||73.5%|Medium|| |1326|Minimum Number of Taps to Open to Water a Garden||46.1%|Hard|| |1327|List the Products Ordered in a Period||77.5%|Easy|| |1328|Break a Palindrome||45.5%|Medium|| -|1329|Sort the Matrix Diagonally||79.3%|Medium|| +|1329|Sort the Matrix Diagonally||79.4%|Medium|| |1330|Reverse Subarray To Maximize Array Value||36.4%|Hard|| |1331|Rank Transform of an Array||57.7%|Easy|| |1332|Remove Palindromic Subsequences||62.8%|Easy|| @@ -1466,7 +1480,7 @@ |1340|Jump Game V||58.9%|Hard|| |1341|Movie Rating||58.4%|Medium|| |1342|Number of Steps to Reduce a Number to Zero||85.7%|Easy|| -|1343|Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold||64.5%|Medium|| +|1343|Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold||64.6%|Medium|| |1344|Angle Between Hands of a Clock||61.3%|Medium|| |1345|Jump Game IV||41.9%|Hard|| |1346|Check If N and Its Double Exist||36.5%|Easy|| @@ -1480,19 +1494,19 @@ |1354|Construct Target Array With Multiple Sums||31.3%|Hard|| |1355|Activity Participants||74.0%|Medium|| |1356|Sort Integers by The Number of 1 Bits||69.6%|Easy|| -|1357|Apply Discount Every n Orders||66.5%|Medium|| +|1357|Apply Discount Every n Orders||66.6%|Medium|| |1358|Number of Substrings Containing All Three Characters||60.3%|Medium|| |1359|Count All Valid Pickup and Delivery Options||56.9%|Hard|| -|1360|Number of Days Between Two Dates||47.0%|Easy|| +|1360|Number of Days Between Two Dates||46.9%|Easy|| |1361|Validate Binary Tree Nodes||44.3%|Medium|| -|1362|Closest Divisors||57.5%|Medium|| +|1362|Closest Divisors||57.6%|Medium|| |1363|Largest Multiple of Three||33.9%|Hard|| -|1364|Number of Trusted Contacts of a Customer||78.0%|Medium|| +|1364|Number of Trusted Contacts of a Customer||77.9%|Medium|| |1365|How Many Numbers Are Smaller Than the Current Number||85.9%|Easy|| |1366|Rank Teams by Votes||55.0%|Medium|| |1367|Linked List in Binary Tree||41.1%|Medium|| |1368|Minimum Cost to Make at Least One Valid Path in a Grid||56.8%|Hard|| -|1369|Get the Second Most Recent Activity||68.4%|Hard|| +|1369|Get the Second Most Recent Activity||68.5%|Hard|| |1370|Increasing Decreasing String||76.3%|Easy|| |1371|Find the Longest Substring Containing Vowels in Even Counts||61.3%|Medium|| |1372|Longest ZigZag Path in a Binary Tree||54.6%|Medium|| @@ -1500,8 +1514,8 @@ |1374|Generate a String With Characters That Have Odd Counts||76.2%|Easy|| |1375|Bulb Switcher III||64.1%|Medium|| |1376|Time Needed to Inform All Employees||56.3%|Medium|| -|1377|Frog Position After T Seconds||34.7%|Hard|| -|1378|Replace Employee ID With The Unique Identifier||89.7%|Easy|| +|1377|Frog Position After T Seconds||34.8%|Hard|| +|1378|Replace Employee ID With The Unique Identifier||89.8%|Easy|| |1379|Find a Corresponding Node of a Binary Tree in a Clone of That Tree||85.2%|Medium|| |1380|Lucky Numbers in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix)|70.9%|Easy|| |1381|Design a Stack With Increment Operation||75.8%|Medium|| @@ -1511,18 +1525,18 @@ |1385|Find the Distance Value Between Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays)|66.4%|Easy|| |1386|Cinema Seat Allocation||35.5%|Medium|| |1387|Sort Integers by The Power Value||70.5%|Medium|| -|1388|Pizza With 3n Slices||45.4%|Hard|| +|1388|Pizza With 3n Slices||45.3%|Hard|| |1389|Create Target Array in the Given Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1389.Create-Target-Array-in-the-Given-Order)|84.8%|Easy|| |1390|Four Divisors||39.0%|Medium|| |1391|Check if There is a Valid Path in a Grid||44.9%|Medium|| |1392|Longest Happy Prefix||41.3%|Hard|| |1393|Capital Gain/Loss||90.6%|Medium|| |1394|Find Lucky Integer in an Array||63.2%|Easy|| -|1395|Count Number of Teams||81.9%|Medium|| +|1395|Count Number of Teams||81.8%|Medium|| |1396|Design Underground System||68.8%|Medium|| -|1397|Find All Good Strings||37.9%|Hard|| +|1397|Find All Good Strings||38.0%|Hard|| |1398|Customers Who Bought Products A and B but Not C||82.0%|Medium|| -|1399|Count Largest Group||65.3%|Easy|| +|1399|Count Largest Group||65.4%|Easy|| |1400|Construct K Palindrome Strings||62.8%|Medium|| |1401|Circle and Rectangle Overlapping||42.3%|Medium|| |1402|Reducing Dishes||72.3%|Hard|| @@ -1534,7 +1548,7 @@ |1408|String Matching in an Array||62.7%|Easy|| |1409|Queries on a Permutation With Key||81.4%|Medium|| |1410|HTML Entity Parser||54.4%|Medium|| -|1411|Number of Ways to Paint N × 3 Grid||60.5%|Hard|| +|1411|Number of Ways to Paint N × 3 Grid||60.4%|Hard|| |1412|Find the Quiet Students in All Exams||65.5%|Hard|| |1413|Minimum Value to Get Positive Step by Step Sum||65.3%|Easy|| |1414|Find the Minimum Number of Fibonacci Numbers Whose Sum Is K||63.8%|Medium|| @@ -1551,7 +1565,7 @@ |1425|Constrained Subsequence Sum||44.9%|Hard|| |1426|Counting Elements||59.0%|Easy|| |1427|Perform String Shifts||53.4%|Easy|| -|1428|Leftmost Column with at Least a One||48.7%|Medium|| +|1428|Leftmost Column with at Least a One||48.8%|Medium|| |1429|First Unique Number||49.0%|Medium|| |1430|Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree||45.1%|Medium|| |1431|Kids With the Greatest Number of Candies||88.6%|Easy|| @@ -1562,15 +1576,15 @@ |1436|Destination City||77.1%|Easy|| |1437|Check If All 1's Are at Least Length K Places Away||61.8%|Medium|| |1438|Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit||43.9%|Medium|| -|1439|Find the Kth Smallest Sum of a Matrix With Sorted Rows||60.0%|Hard|| -|1440|Evaluate Boolean Expression||74.4%|Medium|| +|1439|Find the Kth Smallest Sum of a Matrix With Sorted Rows||59.9%|Hard|| +|1440|Evaluate Boolean Expression||74.5%|Medium|| |1441|Build an Array With Stack Operations||69.0%|Easy|| |1442|Count Triplets That Can Form Two Arrays of Equal XOR||70.9%|Medium|| |1443|Minimum Time to Collect All Apples in a Tree||54.6%|Medium|| |1444|Number of Ways of Cutting a Pizza||53.7%|Hard|| -|1445|Apples & Oranges||90.6%|Medium|| +|1445|Apples & Oranges||90.7%|Medium|| |1446|Consecutive Characters||61.1%|Easy|| -|1447|Simplified Fractions||62.1%|Medium|| +|1447|Simplified Fractions||62.2%|Medium|| |1448|Count Good Nodes in Binary Tree||70.3%|Medium|| |1449|Form Largest Integer With Digits That Add up to Target||43.7%|Hard|| |1450|Number of Students Doing Homework at a Given Time||76.9%|Easy|| @@ -1581,18 +1595,18 @@ |1455|Check If a Word Occurs As a Prefix of Any Word in a Sentence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence)|64.8%|Easy|| |1456|Maximum Number of Vowels in a Substring of Given Length||54.3%|Medium|| |1457|Pseudo-Palindromic Paths in a Binary Tree||71.4%|Medium|| -|1458|Max Dot Product of Two Subsequences||42.8%|Hard|| +|1458|Max Dot Product of Two Subsequences||42.9%|Hard|| |1459|Rectangles Area||64.3%|Medium|| |1460|Make Two Arrays Equal by Reversing Sub-arrays||72.1%|Easy|| |1461|Check If a String Contains All Binary Codes of Size K||46.9%|Medium|| |1462|Course Schedule IV||44.3%|Medium|| -|1463|Cherry Pickup II||69.5%|Hard|| +|1463|Cherry Pickup II||69.4%|Hard|| |1464|Maximum Product of Two Elements in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array)|76.9%|Easy|| |1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.7%|Medium|| |1466|Reorder Routes to Make All Paths Lead to the City Zero||61.3%|Medium|| |1467|Probability of a Two Boxes Having The Same Number of Distinct Balls||61.0%|Hard|| |1468|Calculate Salaries||81.1%|Medium|| -|1469|Find All The Lonely Nodes||80.6%|Easy|| +|1469|Find All The Lonely Nodes||80.5%|Easy|| |1470|Shuffle the Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1470.Shuffle-the-Array)|88.5%|Easy|| |1471|The k Strongest Values in an Array||58.4%|Medium|| |1472|Design Browser History||70.2%|Medium|| @@ -1600,41 +1614,41 @@ |1474|Delete N Nodes After M Nodes of a Linked List||74.6%|Easy|| |1475|Final Prices With a Special Discount in a Shop||74.7%|Easy|| |1476|Subrectangle Queries||88.6%|Medium|| -|1477|Find Two Non-overlapping Sub-arrays Each With Target Sum||34.0%|Medium|| -|1478|Allocate Mailboxes||54.4%|Hard|| +|1477|Find Two Non-overlapping Sub-arrays Each With Target Sum||34.1%|Medium|| +|1478|Allocate Mailboxes||54.2%|Hard|| |1479|Sales by Day of the Week||83.6%|Hard|| |1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|89.6%|Easy|| |1481|Least Number of Unique Integers after K Removals||55.5%|Medium|| |1482|Minimum Number of Days to Make m Bouquets||49.7%|Medium|| |1483|Kth Ancestor of a Tree Node||30.2%|Hard|| |1484|Group Sold Products By The Date||86.0%|Easy|| -|1485|Clone Binary Tree With Random Pointer||79.7%|Medium|| +|1485|Clone Binary Tree With Random Pointer||79.5%|Medium|| |1486|XOR Operation in an Array||84.0%|Easy|| -|1487|Making File Names Unique||30.4%|Medium|| +|1487|Making File Names Unique||30.5%|Medium|| |1488|Avoid Flood in The City||24.7%|Medium|| -|1489|Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree||52.4%|Hard|| -|1490|Clone N-ary Tree||83.5%|Medium|| +|1489|Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree||52.3%|Hard|| +|1490|Clone N-ary Tree||83.4%|Medium|| |1491|Average Salary Excluding the Minimum and Maximum Salary||68.5%|Easy|| |1492|The kth Factor of n||63.4%|Medium|| |1493|Longest Subarray of 1's After Deleting One Element||58.2%|Medium|| |1494|Parallel Courses II||31.3%|Hard|| |1495|Friendly Movies Streamed Last Month||51.3%|Easy|| -|1496|Path Crossing||55.5%|Easy|| +|1496|Path Crossing||55.4%|Easy|| |1497|Check If Array Pairs Are Divisible by k||40.6%|Medium|| |1498|Number of Subsequences That Satisfy the Given Sum Condition||38.2%|Medium|| -|1499|Max Value of Equation||45.3%|Hard|| +|1499|Max Value of Equation||45.2%|Hard|| |1500|Design a File Sharing System||46.0%|Medium|| |1501|Countries You Can Safely Invest In||60.0%|Medium|| |1502|Can Make Arithmetic Progression From Sequence||70.8%|Easy|| |1503|Last Moment Before All Ants Fall Out of a Plank||53.0%|Medium|| |1504|Count Submatrices With All Ones||61.0%|Medium|| |1505|Minimum Possible Integer After at Most K Adjacent Swaps On Digits||36.2%|Hard|| -|1506|Find Root of N-Ary Tree||81.0%|Medium|| +|1506|Find Root of N-Ary Tree||80.8%|Medium|| |1507|Reformat Date||60.3%|Easy|| |1508|Range Sum of Sorted Subarray Sums||62.1%|Medium|| |1509|Minimum Difference Between Largest and Smallest Value in Three Moves||51.8%|Medium|| |1510|Stone Game IV||58.7%|Hard|| -|1511|Customer Order Frequency||73.6%|Easy|| +|1511|Customer Order Frequency||73.2%|Easy|| |1512|Number of Good Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1512.Number-of-Good-Pairs)|87.9%|Easy|| |1513|Number of Substrings With Only 1s||41.4%|Medium|| |1514|Path with Maximum Probability||39.3%|Medium|| @@ -1647,14 +1661,14 @@ |1521|Find a Value of a Mysterious Function Closest to Target||44.4%|Hard|| |1522|Diameter of N-Ary Tree||68.8%|Medium|| |1523|Count Odd Numbers in an Interval Range||55.2%|Easy|| -|1524|Number of Sub-arrays With Odd Sum||39.4%|Medium|| +|1524|Number of Sub-arrays With Odd Sum||39.5%|Medium|| |1525|Number of Good Ways to Split a String||66.9%|Medium|| |1526|Minimum Number of Increments on Subarrays to Form a Target Array||59.7%|Hard|| -|1527|Patients With a Condition||76.7%|Easy|| +|1527|Patients With a Condition||76.4%|Easy|| |1528|Shuffle String||85.8%|Easy|| |1529|Bulb Switcher IV||70.8%|Medium|| |1530|Number of Good Leaf Nodes Pairs||55.8%|Medium|| -|1531|String Compression II||33.2%|Hard|| +|1531|String Compression II||33.3%|Hard|| |1532|The Most Recent Three Orders||73.0%|Medium|| |1533|Find the Index of the Large Integer||54.7%|Medium|| |1534|Count Good Triplets||80.2%|Easy|| @@ -1664,189 +1678,189 @@ |1538|Guess the Majority in a Hidden Array||61.4%|Medium|| |1539|Kth Missing Positive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1539.Kth-Missing-Positive-Number)|55.5%|Easy|| |1540|Can Convert String in K Moves||30.5%|Medium|| -|1541|Minimum Insertions to Balance a Parentheses String||42.5%|Medium|| +|1541|Minimum Insertions to Balance a Parentheses String||42.4%|Medium|| |1542|Find Longest Awesome Substring||36.5%|Hard|| |1543|Fix Product Name Format||68.0%|Easy|| |1544|Make The String Great||55.1%|Easy|| -|1545|Find Kth Bit in Nth Binary String||57.2%|Medium|| +|1545|Find Kth Bit in Nth Binary String||57.3%|Medium|| |1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||43.7%|Medium|| |1547|Minimum Cost to Cut a Stick||52.0%|Hard|| -|1548|The Most Similar Path in a Graph||54.1%|Hard|| +|1548|The Most Similar Path in a Graph||54.2%|Hard|| |1549|The Most Recent Orders for Each Product||66.2%|Medium|| |1550|Three Consecutive Odds||65.3%|Easy|| |1551|Minimum Operations to Make Array Equal||77.8%|Medium|| |1552|Magnetic Force Between Two Balls||48.6%|Medium|| |1553|Minimum Number of Days to Eat N Oranges||29.1%|Hard|| -|1554|Strings Differ by One Character||63.7%|Medium|| +|1554|Strings Differ by One Character||63.5%|Medium|| |1555|Bank Account Summary||52.6%|Medium|| |1556|Thousand Separator||58.2%|Easy|| |1557|Minimum Number of Vertices to Reach All Nodes||75.3%|Medium|| |1558|Minimum Numbers of Function Calls to Make Target Array||62.5%|Medium|| |1559|Detect Cycles in 2D Grid||44.7%|Hard|| -|1560|Most Visited Sector in a Circular Track||56.9%|Easy|| -|1561|Maximum Number of Coins You Can Get||78.0%|Medium|| +|1560|Most Visited Sector in a Circular Track||57.1%|Easy|| +|1561|Maximum Number of Coins You Can Get||78.1%|Medium|| |1562|Find Latest Group of Size M||39.4%|Medium|| -|1563|Stone Game V||40.1%|Hard|| -|1564|Put Boxes Into the Warehouse I||66.1%|Medium|| +|1563|Stone Game V||40.0%|Hard|| +|1564|Put Boxes Into the Warehouse I||66.2%|Medium|| |1565|Unique Orders and Customers Per Month||83.8%|Easy|| -|1566|Detect Pattern of Length M Repeated K or More Times||42.2%|Easy|| +|1566|Detect Pattern of Length M Repeated K or More Times||42.3%|Easy|| |1567|Maximum Length of Subarray With Positive Product||36.4%|Medium|| -|1568|Minimum Number of Days to Disconnect Island||50.5%|Hard|| -|1569|Number of Ways to Reorder Array to Get Same BST||50.1%|Hard|| +|1568|Minimum Number of Days to Disconnect Island||50.4%|Hard|| +|1569|Number of Ways to Reorder Array to Get Same BST||50.0%|Hard|| |1570|Dot Product of Two Sparse Vectors||91.5%|Medium|| -|1571|Warehouse Manager||90.0%|Easy|| +|1571|Warehouse Manager||89.9%|Easy|| |1572|Matrix Diagonal Sum||78.2%|Easy|| |1573|Number of Ways to Split a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1573.Number-of-Ways-to-Split-a-String)|30.8%|Medium|| -|1574|Shortest Subarray to be Removed to Make Array Sorted||32.9%|Medium|| +|1574|Shortest Subarray to be Removed to Make Array Sorted||33.0%|Medium|| |1575|Count All Possible Routes||57.5%|Hard|| |1576|Replace All ?'s to Avoid Consecutive Repeating Characters||48.1%|Easy|| |1577|Number of Ways Where Square of Number Is Equal to Product of Two Numbers||37.2%|Medium|| |1578|Minimum Deletion Cost to Avoid Repeating Letters||60.3%|Medium|| -|1579|Remove Max Number of Edges to Keep Graph Fully Traversable||45.7%|Hard|| +|1579|Remove Max Number of Edges to Keep Graph Fully Traversable||45.8%|Hard|| |1580|Put Boxes Into the Warehouse II||62.2%|Medium|| -|1581|Customer Who Visited but Did Not Make Any Transactions||90.3%|Easy|| +|1581|Customer Who Visited but Did Not Make Any Transactions||90.2%|Easy|| |1582|Special Positions in a Binary Matrix||64.2%|Easy|| -|1583|Count Unhappy Friends||53.6%|Medium|| +|1583|Count Unhappy Friends||53.7%|Medium|| |1584|Min Cost to Connect All Points||50.2%|Medium|| |1585|Check If String Is Transformable With Substring Sort Operations||48.3%|Hard|| |1586|Binary Search Tree Iterator II||66.5%|Medium|| -|1587|Bank Account Summary II||90.3%|Easy|| +|1587|Bank Account Summary II||90.2%|Easy|| |1588|Sum of All Odd Length Subarrays||82.1%|Easy|| |1589|Maximum Sum Obtained of Any Permutation||34.6%|Medium|| |1590|Make Sum Divisible by P||27.2%|Medium|| |1591|Strange Printer II||55.4%|Hard|| -|1592|Rearrange Spaces Between Words||43.7%|Easy|| +|1592|Rearrange Spaces Between Words||43.8%|Easy|| |1593|Split a String Into the Max Number of Unique Substrings||48.3%|Medium|| |1594|Maximum Non Negative Product in a Matrix||31.9%|Medium|| |1595|Minimum Cost to Connect Two Groups of Points||42.7%|Hard|| |1596|The Most Frequently Ordered Products for Each Customer||84.4%|Medium|| -|1597|Build Binary Expression Tree From Infix Expression||65.5%|Hard|| +|1597|Build Binary Expression Tree From Infix Expression||65.4%|Hard|| |1598|Crawler Log Folder||64.3%|Easy|| |1599|Maximum Profit of Operating a Centennial Wheel||43.4%|Medium|| -|1600|Throne Inheritance||59.7%|Medium|| +|1600|Throne Inheritance||59.8%|Medium|| |1601|Maximum Number of Achievable Transfer Requests||47.4%|Hard|| |1602|Find Nearest Right Node in Binary Tree||74.1%|Medium|| |1603|Design Parking System||86.8%|Easy|| |1604|Alert Using Same Key-Card Three or More Times in a One Hour Period||42.1%|Medium|| -|1605|Find Valid Matrix Given Row and Column Sums||77.6%|Medium|| -|1606|Find Servers That Handled Most Number of Requests||36.7%|Hard|| +|1605|Find Valid Matrix Given Row and Column Sums||77.7%|Medium|| +|1606|Find Servers That Handled Most Number of Requests||36.8%|Hard|| |1607|Sellers With No Sales||56.0%|Easy|| |1608|Special Array With X Elements Greater Than or Equal X||61.8%|Easy|| -|1609|Even Odd Tree||53.3%|Medium|| +|1609|Even Odd Tree||53.2%|Medium|| |1610|Maximum Number of Visible Points||28.5%|Hard|| |1611|Minimum One Bit Operations to Make Integers Zero||57.0%|Hard|| |1612|Check If Two Expression Trees are Equivalent||69.8%|Medium|| |1613|Find the Missing IDs||72.1%|Medium|| -|1614|Maximum Nesting Depth of the Parentheses||83.5%|Easy|| -|1615|Maximal Network Rank||51.6%|Medium|| -|1616|Split Two Strings to Make Palindrome||36.5%|Medium|| +|1614|Maximum Nesting Depth of the Parentheses||83.6%|Easy|| +|1615|Maximal Network Rank||51.7%|Medium|| +|1616|Split Two Strings to Make Palindrome||36.4%|Medium|| |1617|Count Subtrees With Max Distance Between Cities||63.5%|Hard|| |1618|Maximum Font to Fit a Sentence in a Screen||58.1%|Medium|| -|1619|Mean of Array After Removing Some Elements||65.5%|Easy|| -|1620|Coordinate With Maximum Network Quality||37.1%|Medium|| +|1619|Mean of Array After Removing Some Elements||65.6%|Easy|| +|1620|Coordinate With Maximum Network Quality||37.0%|Medium|| |1621|Number of Sets of K Non-Overlapping Line Segments||41.2%|Medium|| -|1622|Fancy Sequence||15.5%|Hard|| +|1622|Fancy Sequence||15.6%|Hard|| |1623|All Valid Triplets That Can Represent a Country||89.1%|Easy|| -|1624|Largest Substring Between Two Equal Characters||59.1%|Easy|| -|1625|Lexicographically Smallest String After Applying Operations||63.3%|Medium|| -|1626|Best Team With No Conflicts||37.2%|Medium|| -|1627|Graph Connectivity With Threshold||38.1%|Hard|| -|1628|Design an Expression Tree With Evaluate Function||80.7%|Medium|| +|1624|Largest Substring Between Two Equal Characters||59.2%|Easy|| +|1625|Lexicographically Smallest String After Applying Operations||63.4%|Medium|| +|1626|Best Team With No Conflicts||37.1%|Medium|| +|1627|Graph Connectivity With Threshold||38.2%|Hard|| +|1628|Design an Expression Tree With Evaluate Function||80.5%|Medium|| |1629|Slowest Key||59.0%|Easy|| -|1630|Arithmetic Subarrays||77.8%|Medium|| -|1631|Path With Minimum Effort||43.2%|Medium|| +|1630|Arithmetic Subarrays||77.7%|Medium|| +|1631|Path With Minimum Effort||43.3%|Medium|| |1632|Rank Transform of a Matrix||30.3%|Hard|| -|1633|Percentage of Users Attended a Contest||72.9%|Easy|| -|1634|Add Two Polynomials Represented as Linked Lists||56.3%|Medium|| -|1635|Hopper Company Queries I||56.3%|Hard|| -|1636|Sort Array by Increasing Frequency||66.5%|Easy|| -|1637|Widest Vertical Area Between Two Points Containing No Points||83.9%|Medium|| +|1633|Percentage of Users Attended a Contest||73.1%|Easy|| +|1634|Add Two Polynomials Represented as Linked Lists||56.0%|Medium|| +|1635|Hopper Company Queries I||56.0%|Hard|| +|1636|Sort Array by Increasing Frequency||66.6%|Easy|| +|1637|Widest Vertical Area Between Two Points Containing No Points||83.8%|Medium|| |1638|Count Substrings That Differ by One Character||67.8%|Medium|| |1639|Number of Ways to Form a Target String Given a Dictionary||39.3%|Hard|| -|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|63.1%|Easy|| -|1641|Count Sorted Vowel Strings||74.7%|Medium|| +|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.8%|Easy|| +|1641|Count Sorted Vowel Strings||74.6%|Medium|| |1642|Furthest Building You Can Reach||51.5%|Medium|| |1643|Kth Smallest Instructions||42.8%|Hard|| |1644|Lowest Common Ancestor of a Binary Tree II||57.5%|Medium|| -|1645|Hopper Company Queries II||41.1%|Hard|| +|1645|Hopper Company Queries II||41.3%|Hard|| |1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|48.4%|Easy|| |1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|53.8%|Medium|| -|1648|Sell Diminishing-Valued Colored Balls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls)|30.8%|Medium|| -|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.9%|Hard|| -|1650|Lowest Common Ancestor of a Binary Tree III||77.3%|Medium|| -|1651|Hopper Company Queries III||67.0%|Hard|| -|1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.5%|Easy|| -|1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.5%|Medium|| -|1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.5%|Medium|| +|1648|Sell Diminishing-Valued Colored Balls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls)|30.9%|Medium|| +|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.5%|Hard|| +|1650|Lowest Common Ancestor of a Binary Tree III||77.4%|Medium|| +|1651|Hopper Company Queries III||66.8%|Hard|| +|1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.4%|Easy|| +|1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.6%|Medium|| +|1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.4%|Medium|| |1655|Distribute Repeating Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1655.Distribute-Repeating-Integers)|40.6%|Hard|| |1656|Design an Ordered Stream|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1656.Design-an-Ordered-Stream)|82.5%|Easy|| |1657|Determine if Two Strings Are Close|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1657.Determine-if-Two-Strings-Are-Close)|51.3%|Medium|| |1658|Minimum Operations to Reduce X to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero)|30.7%|Medium|| -|1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|35.2%|Hard|| -|1660|Correct a Binary Tree||78.8%|Medium|| -|1661|Average Time of Process per Machine||79.4%|Easy|| -|1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|83.9%|Easy|| +|1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|35.1%|Hard|| +|1660|Correct a Binary Tree||78.9%|Medium|| +|1661|Average Time of Process per Machine||79.5%|Easy|| +|1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|83.8%|Easy|| |1663|Smallest String With A Given Numeric Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value)|60.1%|Medium|| |1664|Ways to Make a Fair Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1664.Ways-to-Make-a-Fair-Array)|60.6%|Medium|| -|1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|68.4%|Hard|| -|1666|Change the Root of a Binary Tree||68.5%|Medium|| -|1667|Fix Names in a Table||64.1%|Easy|| +|1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|68.3%|Hard|| +|1666|Change the Root of a Binary Tree||68.7%|Medium|| +|1667|Fix Names in a Table||63.9%|Easy|| |1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.7%|Easy|| -|1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.4%|Medium|| -|1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.5%|Medium|| +|1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.3%|Medium|| +|1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.6%|Medium|| |1671|Minimum Number of Removals to Make Mountain Array||45.8%|Hard|| |1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.8%|Easy|| -|1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|38.0%|Medium|| -|1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|34.2%|Medium|| -|1675|Minimize Deviation in Array||44.8%|Hard|| +|1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|38.1%|Medium|| +|1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|34.3%|Medium|| +|1675|Minimize Deviation in Array||44.9%|Hard|| |1676|Lowest Common Ancestor of a Binary Tree IV||77.8%|Medium|| -|1677|Product's Worth Over Invoices||74.6%|Easy|| -|1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.9%|Easy|| -|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|52.1%|Medium|| +|1677|Product's Worth Over Invoices||74.7%|Easy|| +|1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.8%|Easy|| +|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|52.0%|Medium|| |1680|Concatenation of Consecutive Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers)|45.1%|Medium|| |1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|34.8%|Hard|| -|1682|Longest Palindromic Subsequence II||51.8%|Medium|| +|1682|Longest Palindromic Subsequence II||52.0%|Medium|| |1683|Invalid Tweets||91.7%|Easy|| |1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|84.3%|Easy|| |1685|Sum of Absolute Differences in a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array)|61.8%|Medium|| -|1686|Stone Game VI||48.9%|Medium|| -|1687|Delivering Boxes from Storage to Ports||34.6%|Hard|| +|1686|Stone Game VI||48.8%|Medium|| +|1687|Delivering Boxes from Storage to Ports||34.7%|Hard|| |1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|83.4%|Easy|| -|1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.5%|Medium|| +|1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.4%|Medium|| |1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|46.5%|Medium|| -|1691|Maximum Height by Stacking Cuboids ||49.5%|Hard|| -|1692|Count Ways to Distribute Candies||62.1%|Hard|| -|1693|Daily Leads and Partners||91.6%|Easy|| -|1694|Reformat Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1694.Reformat-Phone-Number)|67.3%|Easy|| +|1691|Maximum Height by Stacking Cuboids ||49.7%|Hard|| +|1692|Count Ways to Distribute Candies||62.7%|Hard|| +|1693|Daily Leads and Partners||91.3%|Easy|| +|1694|Reformat Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1694.Reformat-Phone-Number)|67.1%|Easy|| |1695|Maximum Erasure Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1695.Maximum-Erasure-Value)|49.5%|Medium|| |1696|Jump Game VI||56.3%|Medium|| -|1697|Checking Existence of Edge Length Limited Paths||56.0%|Hard|| -|1698|Number of Distinct Substrings in a String||55.0%|Medium|| -|1699|Number of Calls Between Two Persons||85.6%|Medium|| +|1697|Checking Existence of Edge Length Limited Paths||55.9%|Hard|| +|1698|Number of Distinct Substrings in a String||55.3%|Medium|| +|1699|Number of Calls Between Two Persons||85.8%|Medium|| |1700|Number of Students Unable to Eat Lunch||70.1%|Easy|| |1701|Average Waiting Time||61.8%|Medium|| |1702|Maximum Binary String After Change||61.9%|Medium|| -|1703|Minimum Adjacent Swaps for K Consecutive Ones||40.5%|Hard|| -|1704|Determine if String Halves Are Alike||78.4%|Easy|| +|1703|Minimum Adjacent Swaps for K Consecutive Ones||40.6%|Hard|| +|1704|Determine if String Halves Are Alike||78.2%|Easy|| |1705|Maximum Number of Eaten Apples||42.5%|Medium|| -|1706|Where Will the Ball Fall||57.9%|Medium|| -|1707|Maximum XOR With an Element From Array||48.6%|Hard|| -|1708|Largest Subarray Length K||64.6%|Easy|| -|1709|Biggest Window Between Visits||81.2%|Medium|| -|1710|Maximum Units on a Truck||72.4%|Easy|| +|1706|Where Will the Ball Fall||58.1%|Medium|| +|1707|Maximum XOR With an Element From Array||48.5%|Hard|| +|1708|Largest Subarray Length K||64.5%|Easy|| +|1709|Biggest Window Between Visits||81.1%|Medium|| +|1710|Maximum Units on a Truck||72.3%|Easy|| |1711|Count Good Meals||25.5%|Medium|| |1712|Ways to Split Array Into Three Subarrays||29.8%|Medium|| -|1713|Minimum Operations to Make a Subsequence||45.0%|Hard|| -|1714|Sum Of Special Evenly-Spaced Elements In Array||44.2%|Hard|| -|1715|Count Apples and Oranges||78.6%|Medium|| -|1716|Calculate Money in Leetcode Bank||70.6%|Easy|| -|1717|Maximum Score From Removing Substrings||35.2%|Medium|| -|1718|Construct the Lexicographically Largest Valid Sequence||38.5%|Medium|| -|1719|Number Of Ways To Reconstruct A Tree||33.0%|Hard|| -|1720|Decode XORed Array||86.1%|Easy|| -|1721|Swapping Nodes in a Linked List||64.8%|Medium|| -|1722|Minimize Hamming Distance After Swap Operations||41.9%|Medium|| -|1723|Find Minimum Time to Finish All Jobs||35.3%|Hard|| +|1713|Minimum Operations to Make a Subsequence||45.3%|Hard|| +|1714|Sum Of Special Evenly-Spaced Elements In Array||44.8%|Hard|| +|1715|Count Apples and Oranges||77.2%|Medium|| +|1716|Calculate Money in Leetcode Bank||70.5%|Easy|| +|1717|Maximum Score From Removing Substrings||36.3%|Medium|| +|1718|Construct the Lexicographically Largest Valid Sequence||40.6%|Medium|| +|1719|Number Of Ways To Reconstruct A Tree||34.9%|Hard|| +|1720|Decode XORed Array||86.5%|Easy|| +|1721|Swapping Nodes in a Linked List||65.3%|Medium|| +|1722|Minimize Hamming Distance After Swap Operations||43.2%|Medium|| +|1723|Find Minimum Time to Finish All Jobs||37.8%|Hard|| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------| ------------------------------------------------------------------ @@ -1858,7 +1872,7 @@ ------------------------------------------------------------------ -## 二.分类 +## 三.分类 ## Array diff --git a/automation/models/lcproblems.go b/automation/models/lcproblems.go deleted file mode 100644 index 5efb9962..00000000 --- a/automation/models/lcproblems.go +++ /dev/null @@ -1,43 +0,0 @@ -package models - -type LeetCodeProblemAll struct { - UserName string `json:"user_name"` - NumSolved int32 `json:"num_solved"` - NumTotal int32 `json:"num_total"` - AcEasy int32 `json:"ac_easy"` - AcMedium int32 `json:"ac_medium"` - AcHard int32 `json:"ac_hard"` - StatStatusPairs []StatStatusPairs `json:"stat_status_pairs"` - FrequencyHigh int32 `json:"frequency_high"` - FrequencyMid int32 `json:"frequency_mid"` - CategorySlug string `json:"category_slug"` -} - -type StatStatusPairs struct { - Stat Stat `json:"stat"` - Difficulty Difficulty `json:"difficulty"` - PaidOnly bool `json:"paid_only"` - IsFavor bool `json:"is_favor"` - Frequency float64 `json:"frequency"` - Progress float64 `json:"progress"` -} - -type Stat struct { - QuestionTitle string `json:"question__title"` - QuestionTitleSlug string `json:"question__title_slug"` - TotalAcs float64 `json:"total_acs"` - TotalSubmitted float64 `json:"total_submitted"` - Acceptance string - Difficulty string - FrontendQuestionId int32 `json:"frontend_question_id"` -} - -type Difficulty struct { - Level int32 `json:"level"` -} - -var DifficultyMap = map[int32]string{ - 1: "Easy", - 2: "Medium", - 3: "Hard", -} diff --git a/automation/render.go b/automation/render.go deleted file mode 100644 index 263d121e..00000000 --- a/automation/render.go +++ /dev/null @@ -1,190 +0,0 @@ -package main - -import ( - "bufio" - "bytes" - "encoding/json" - "fmt" - m "github.com/halfrost/LeetCode-Go/automation/models" - "html/template" - "io" - "io/ioutil" - "net/http" - "os" - "regexp" - "sort" - "strconv" - "strings" -) - -var try int - -func main() { - var ( - result []m.StatStatusPairs - lpa m.LeetCodeProblemAll - ) - - body := getProblemAllList() - err := json.Unmarshal(body, &lpa) - if err != nil { - fmt.Println(err) - return - } - result = lpa.StatStatusPairs - mdrows := []m.Mdrow{} - for i := 0; i < len(result); i++ { - mdrows = append(mdrows, convertModel(result[i])) - } - sort.Sort(m.SortByQuestionId(mdrows)) - solutionIds := loadSolutionsDir() - generateMdRows(solutionIds, mdrows) - // res, _ := json.Marshal(mdrows) - //writeFile("leetcode_problem", res) - mds := m.Mdrows{Mdrows: mdrows} - res, err := readFile("./template.markdown", "{{.AvailableTable}}", len(solutionIds), try, mds) - if err != nil { - fmt.Println(err) - return - } - writeFile("../README.md", res) - //makeReadmeFile(mds) -} - -func getProblemAllList() []byte { - resp, err := http.Get("https://leetcode.com/api/problems/all/") - if err != nil { - fmt.Println(err) - return []byte{} - } - defer resp.Body.Close() - - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - fmt.Println(err) - return []byte{} - } - if resp.StatusCode == 200 { - fmt.Println("ok") - } - return body -} - -func writeFile(fileName string, content []byte) { - file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0777) - if err != nil { - fmt.Println(err) - } - defer file.Close() - - _, err = file.Write(content) - if err != nil { - fmt.Println(err) - } - fmt.Println("write file successful") -} - -func convertModel(ssp m.StatStatusPairs) m.Mdrow { - res := m.Mdrow{} - res.FrontendQuestionId = ssp.Stat.FrontendQuestionId - res.QuestionTitle = ssp.Stat.QuestionTitle - res.QuestionTitleSlug = ssp.Stat.QuestionTitleSlug - res.Acceptance = fmt.Sprintf("%.1f%%", (ssp.Stat.TotalAcs/ssp.Stat.TotalSubmitted)*100) - res.Difficulty = m.DifficultyMap[ssp.Difficulty.Level] - res.Frequency = fmt.Sprintf("%f", ssp.Frequency) - return res -} - -func loadSolutionsDir() []int { - files, err := ioutil.ReadDir("../leetcode/") - if err != nil { - fmt.Println(err) - } - solutionIds := []int{} - for _, f := range files { - if f.Name()[4] == '.' { - tmp, err := strconv.Atoi(f.Name()[:4]) - if err != nil { - fmt.Println(err) - } - solutionIds = append(solutionIds, tmp) - } - } - sort.Ints(solutionIds) - try = len(files) - len(solutionIds) - fmt.Printf("读取了 %v 道题的题解,当前目录下有 %v 个文件(可能包含 .DS_Store),有 %v 道题在尝试中\n", len(solutionIds), len(files), len(files)-len(solutionIds)) - return solutionIds -} - -func generateMdRows(solutionIds []int, mdrows []m.Mdrow) { - for i := 0; i < len(solutionIds); i++ { - id := mdrows[solutionIds[i]-1].FrontendQuestionId - if solutionIds[i] == int(id) { - //fmt.Printf("id = %v i = %v solutionIds = %v\n", id, i, solutionIds[i]) - mdrows[id-1].SolutionPath = fmt.Sprintf("[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/%v)", fmt.Sprintf("%04d.%v", id, strings.Replace(mdrows[id-1].QuestionTitle, " ", "-", -1))) - } else { - fmt.Printf("序号出错了 solutionIds = %v id = %v\n", solutionIds[i], id) - } - } - fmt.Printf("") -} - -func makeReadmeFile(mdrows m.Mdrows) { - file := "./README.md" - os.Remove(file) - var b bytes.Buffer - tmpl := template.Must(template.New("readme").Parse(readTMPL("template.markdown"))) - err := tmpl.Execute(&b, mdrows) - if err != nil { - fmt.Println(err) - } - // 保存 README.md 文件 - writeFile(file, b.Bytes()) -} - -func readTMPL(path string) string { - file, err := os.Open(path) - if err != nil { - fmt.Println(err) - } - defer file.Close() - - data, err := ioutil.ReadAll(file) - if err != nil { - fmt.Println(err) - } - return string(data) -} - -func readFile(filePath, template string, total, try int, mdrows m.Mdrows) ([]byte, error) { - f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) - if err != nil { - return nil, err - } - defer f.Close() - reader, output := bufio.NewReader(f), []byte{} - - for { - line, _, err := reader.ReadLine() - if err != nil { - if err == io.EOF { - return output, nil - } - return nil, err - } - if ok, _ := regexp.Match(template, line); ok { - reg := regexp.MustCompile(template) - newByte := reg.ReplaceAll(line, []byte(mdrows.AvailableTable())) - output = append(output, newByte...) - output = append(output, []byte("\n")...) - } else if ok, _ := regexp.Match("{{.TotalNum}}", line); ok { - reg := regexp.MustCompile("{{.TotalNum}}") - newByte := reg.ReplaceAll(line, []byte(fmt.Sprintf("以下已经收录了 %v 道题的题解,还有 %v 道题在尝试优化到 beats 100%%", total, try))) - output = append(output, newByte...) - output = append(output, []byte("\n")...) - } else { - output = append(output, line...) - output = append(output, []byte("\n")...) - } - } -} diff --git a/ctl/config.go b/ctl/config.go new file mode 100644 index 00000000..8743ad75 --- /dev/null +++ b/ctl/config.go @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "log" + + "github.com/BurntSushi/toml" +) + +const ( + configTOML = "config.toml" +) + +type config struct { + Username string + Password string + Cookie string +} + +func (c config) String() string { + return fmt.Sprintf("Username: %s, Password: %s", c.Username, c.Password) +} + +func getConfig() *config { + cfg := new(config) + if _, err := toml.DecodeFile(configTOML, &cfg); err != nil { + log.Panicf(err.Error()) + } + // log.Printf("get config: %s", cfg) + return cfg +} diff --git a/ctl/models/lcproblems.go b/ctl/models/lcproblems.go new file mode 100644 index 00000000..aad80cd1 --- /dev/null +++ b/ctl/models/lcproblems.go @@ -0,0 +1,103 @@ +package models + +import ( + "fmt" +) + +// LeetCodeProblemAll define +type LeetCodeProblemAll struct { + UserName string `json:"user_name"` + NumSolved int32 `json:"num_solved"` + NumTotal int32 `json:"num_total"` + AcEasy int32 `json:"ac_easy"` + AcMedium int32 `json:"ac_medium"` + AcHard int32 `json:"ac_hard"` + StatStatusPairs []StatStatusPairs `json:"stat_status_pairs"` + FrequencyHigh int32 `json:"frequency_high"` + FrequencyMid int32 `json:"frequency_mid"` + CategorySlug string `json:"category_slug"` + AcEasyTotal int32 + AcMediumTotal int32 + AcHardTotal int32 +} + +// ConvertUserInfoModel define +func ConvertUserInfoModel(lpa LeetCodeProblemAll) UserInfo { + info := UserInfo{} + info.UserName = lpa.UserName + info.NumSolved = lpa.NumSolved + info.NumTotal = lpa.NumTotal + info.AcEasy = lpa.AcEasy + info.AcMedium = lpa.AcMedium + info.AcHard = lpa.AcHard + info.FrequencyHigh = lpa.FrequencyHigh + info.FrequencyMid = lpa.FrequencyMid + info.CategorySlug = lpa.CategorySlug + return info +} + +// StatStatusPairs define +type StatStatusPairs struct { + Stat Stat `json:"stat"` + Status string `json:"status"` + Difficulty Difficulty `json:"difficulty"` + PaidOnly bool `json:"paid_only"` + IsFavor bool `json:"is_favor"` + Frequency float64 `json:"frequency"` + Progress float64 `json:"progress"` +} + +// ConvertMdModel define +func ConvertMdModel(problems []StatStatusPairs) []Mdrow { + mdrows := []Mdrow{} + for _, problem := range problems { + res := Mdrow{} + res.FrontendQuestionID = problem.Stat.FrontendQuestionID + res.QuestionTitle = problem.Stat.QuestionTitle + res.QuestionTitleSlug = problem.Stat.QuestionTitleSlug + res.Acceptance = fmt.Sprintf("%.1f%%", (problem.Stat.TotalAcs/problem.Stat.TotalSubmitted)*100) + res.Difficulty = DifficultyMap[problem.Difficulty.Level] + res.Frequency = fmt.Sprintf("%f", problem.Frequency) + mdrows = append(mdrows, res) + } + return mdrows +} + +// ConvertMdModelFromIds define +func ConvertMdModelFromIds(problemsMap map[int]StatStatusPairs, ids []int) []Mdrow { + mdrows := []Mdrow{} + for _, v := range ids { + res, problem := Mdrow{}, problemsMap[v] + res.FrontendQuestionID = problem.Stat.FrontendQuestionID + res.QuestionTitle = problem.Stat.QuestionTitle + res.QuestionTitleSlug = problem.Stat.QuestionTitleSlug + res.Acceptance = fmt.Sprintf("%.1f%%", (problem.Stat.TotalAcs/problem.Stat.TotalSubmitted)*100) + res.Difficulty = DifficultyMap[problem.Difficulty.Level] + res.Frequency = fmt.Sprintf("%f", problem.Frequency) + mdrows = append(mdrows, res) + } + return mdrows +} + +// Stat define +type Stat struct { + QuestionTitle string `json:"question__title"` + QuestionTitleSlug string `json:"question__title_slug"` + TotalAcs float64 `json:"total_acs"` + TotalSubmitted float64 `json:"total_submitted"` + Acceptance string + Difficulty string + FrontendQuestionID int32 `json:"frontend_question_id"` +} + +// Difficulty define +type Difficulty struct { + Level int32 `json:"level"` +} + +// DifficultyMap define +var DifficultyMap = map[int32]string{ + 1: "Easy", + 2: "Medium", + 3: "Hard", +} diff --git a/automation/models/mdrow.go b/ctl/models/mdrow.go similarity index 75% rename from automation/models/mdrow.go rename to ctl/models/mdrow.go index 8070df19..8b6b6bbc 100644 --- a/automation/models/mdrow.go +++ b/ctl/models/mdrow.go @@ -4,8 +4,9 @@ import ( "fmt" ) +// Mdrow define type Mdrow struct { - FrontendQuestionId int32 `json:"question_id"` + FrontendQuestionID int32 `json:"question_id"` QuestionTitle string `json:"question__title"` QuestionTitleSlug string `json:"question__title_slug"` SolutionPath string `json:"solution_path"` @@ -16,18 +17,19 @@ type Mdrow struct { // | 0001 | Two Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum)| 45.6% | Easy | | func (m Mdrow) tableLine() string { - return fmt.Sprintf("|%04d|%v|%v|%v|%v||\n", m.FrontendQuestionId, m.QuestionTitle, m.SolutionPath, m.Acceptance, m.Difficulty) + return fmt.Sprintf("|%04d|%v|%v|%v|%v||\n", m.FrontendQuestionID, m.QuestionTitle, m.SolutionPath, m.Acceptance, m.Difficulty) } -// SortByQuestionId define -type SortByQuestionId []Mdrow +// SortByQuestionID define +type SortByQuestionID []Mdrow -func (a SortByQuestionId) Len() int { return len(a) } -func (a SortByQuestionId) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a SortByQuestionId) Less(i, j int) bool { - return a[i].FrontendQuestionId < a[j].FrontendQuestionId +func (a SortByQuestionID) Len() int { return len(a) } +func (a SortByQuestionID) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a SortByQuestionID) Less(i, j int) bool { + return a[i].FrontendQuestionID < a[j].FrontendQuestionID } +// Mdrows define type Mdrows struct { Mdrows []Mdrow } @@ -45,6 +47,7 @@ func (mds Mdrows) table() string { return res } +// AvailableTable define func (mds Mdrows) AvailableTable() string { return mds.table() } diff --git a/ctl/models/user.go b/ctl/models/user.go new file mode 100644 index 00000000..2f296458 --- /dev/null +++ b/ctl/models/user.go @@ -0,0 +1,44 @@ +package models + +import ( + "fmt" +) + +// UserInfo define +type UserInfo struct { + UserName string `json:"user_name"` + NumSolved int32 `json:"num_solved"` + NumTotal int32 `json:"num_total"` + AcEasy int32 `json:"ac_easy"` + AcMedium int32 `json:"ac_medium"` + AcHard int32 `json:"ac_hard"` + EasyTotal int32 + MediumTotal int32 + HardTotal int32 + OptimizingEasy int32 + OptimizingMedium int32 + OptimizingHard int32 + FrequencyHigh int32 `json:"frequency_high"` + FrequencyMid int32 `json:"frequency_mid"` + CategorySlug string `json:"category_slug"` +} + +// | | Easy | Medium | Hard | Total | optimizing | +// |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| +func (ui UserInfo) table() string { + res := "| | Easy | Medium | Hard | Total |\n" + res += "|:--------:|:--------:|:--------:|:--------:|:--------:|\n" + res += fmt.Sprintf("|Optimizing|%v|%v|%v|%v|\n", ui.OptimizingEasy, ui.OptimizingMedium, ui.OptimizingHard, ui.OptimizingEasy+ui.OptimizingMedium+ui.OptimizingHard) + res += fmt.Sprintf("|Accepted|**%v**|**%v**|**%v**|**%v**|\n", ui.AcEasy, ui.AcMedium, ui.AcHard, ui.AcEasy+ui.AcMedium+ui.AcHard) + res += fmt.Sprintf("|Total|%v|%v|%v|%v|\n", ui.EasyTotal, ui.MediumTotal, ui.HardTotal, ui.EasyTotal+ui.MediumTotal+ui.HardTotal) + res += fmt.Sprintf("|Perfection Rate|%.1f%%|%.1f%%|%.1f%%|%.1f%%|\n", (1-float64(ui.OptimizingEasy)/float64(ui.AcEasy))*100, (1-float64(ui.OptimizingMedium)/float64(ui.AcMedium))*100, (1-float64(ui.OptimizingHard)/float64(ui.AcHard))*100, (1-float64(ui.OptimizingEasy+ui.OptimizingMedium+ui.OptimizingHard)/float64(ui.AcEasy+ui.AcMedium+ui.AcHard))*100) + res += fmt.Sprintf("|Completion Rate|%.1f%%|%.1f%%|%.1f%%|%.1f%%|\n", float64(ui.AcEasy)/float64(ui.EasyTotal)*100, float64(ui.AcMedium)/float64(ui.MediumTotal)*100, float64(ui.AcHard)/float64(ui.HardTotal)*100, float64(ui.AcEasy+ui.AcMedium+ui.AcHard)/float64(ui.EasyTotal+ui.MediumTotal+ui.HardTotal)*100) + // 加这一行是为了撑开整个表格 + res += "|------------|----------------------------|----------------------------|----------------------------|----------------------------|" + return res +} + +// PersonalData define +func (ui UserInfo) PersonalData() string { + return ui.table() +} diff --git a/ctl/rangking.go b/ctl/rangking.go new file mode 100644 index 00000000..3e819691 --- /dev/null +++ b/ctl/rangking.go @@ -0,0 +1,36 @@ +package main + +import ( + "fmt" + "strconv" + "strings" +) + +// getRanking 让这个方法优雅一点 +func getRanking() int { + // 获取网页数据 + URL := fmt.Sprintf("https://leetcode.com/%s/", getConfig().Username) + data := getRaw(URL) + str := string(data) + // 通过不断裁剪 str 获取排名信息 + fmt.Println(str) + i := strings.Index(str, "ng-init") + j := i + strings.Index(str[i:], "ng-cloak") + str = str[i:j] + i = strings.Index(str, "(") + j = strings.Index(str, ")") + str = str[i:j] + // fmt.Println("2\n", str) + strs := strings.Split(str, ",") + str = strs[6] + // fmt.Println("1\n", str) + i = strings.Index(str, "'") + j = 2 + strings.Index(str[2:], "'") + // fmt.Println("0\n", str) + str = str[i+1 : j] + r, err := strconv.Atoi(str) + if err != nil { + fmt.Printf("无法把 %s 转换成数字Ranking", str) + } + return r +} diff --git a/ctl/render.go b/ctl/render.go new file mode 100644 index 00000000..55fbfe73 --- /dev/null +++ b/ctl/render.go @@ -0,0 +1,108 @@ +package main + +import ( + "bufio" + "encoding/json" + "fmt" + m "github.com/halfrost/LeetCode-Go/ctl/models" + "io" + "os" + "regexp" + "sort" + "strings" +) + +func main() { + var ( + problems []m.StatStatusPairs + lpa m.LeetCodeProblemAll + info m.UserInfo + ) + // 请求所有题目信息 + body := getProblemAllList(AllProblemURL) + problemsMap, optimizingIds := map[int]m.StatStatusPairs{}, []int{} + err := json.Unmarshal(body, &lpa) + if err != nil { + fmt.Println(err) + return + } + //writeFile("leetcode_problem.json", body) + + // 拼凑 README 需要渲染的数据 + problems = lpa.StatStatusPairs + info = m.ConvertUserInfoModel(lpa) + for _, v := range problems { + problemsMap[int(v.Stat.FrontendQuestionID)] = v + } + mdrows := m.ConvertMdModel(problems) + sort.Sort(m.SortByQuestionID(mdrows)) + solutionIds, try := loadSolutionsDir() + generateMdRows(solutionIds, mdrows) + info.EasyTotal, info.MediumTotal, info.HardTotal, info.OptimizingEasy, info.OptimizingMedium, info.OptimizingHard, optimizingIds = statisticalData(problemsMap, solutionIds) + omdrows := m.ConvertMdModelFromIds(problemsMap, optimizingIds) + sort.Sort(m.SortByQuestionID(omdrows)) + + // 按照模板渲染 README + res, err := renderReadme("./template.markdown", len(solutionIds), try, m.Mdrows{Mdrows: mdrows}, m.Mdrows{Mdrows: omdrows}, info) + if err != nil { + fmt.Println(err) + return + } + writeFile("../README.md", res) + //makeReadmeFile(mds) +} + +func generateMdRows(solutionIds []int, mdrows []m.Mdrow) { + for i := 0; i < len(solutionIds); i++ { + id := mdrows[solutionIds[i]-1].FrontendQuestionID + if solutionIds[i] == int(id) { + //fmt.Printf("id = %v i = %v solutionIds = %v\n", id, i, solutionIds[i]) + mdrows[id-1].SolutionPath = fmt.Sprintf("[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/%v)", fmt.Sprintf("%04d.%v", id, strings.Replace(mdrows[id-1].QuestionTitle, " ", "-", -1))) + } else { + fmt.Printf("序号出错了 solutionIds = %v id = %v\n", solutionIds[i], id) + } + } +} + +func renderReadme(filePath string, total, try int, mdrows, omdrows m.Mdrows, user m.UserInfo) ([]byte, error) { + f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) + if err != nil { + return nil, err + } + defer f.Close() + reader, output := bufio.NewReader(f), []byte{} + + for { + line, _, err := reader.ReadLine() + if err != nil { + if err == io.EOF { + return output, nil + } + return nil, err + } + if ok, _ := regexp.Match("{{.AvailableTable}}", line); ok { + reg := regexp.MustCompile("{{.AvailableTable}}") + newByte := reg.ReplaceAll(line, []byte(mdrows.AvailableTable())) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else if ok, _ := regexp.Match("{{.TotalNum}}", line); ok { + reg := regexp.MustCompile("{{.TotalNum}}") + newByte := reg.ReplaceAll(line, []byte(fmt.Sprintf("以下已经收录了 %v 道题的题解,还有 %v 道题在尝试优化到 beats 100%%", total, try))) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else if ok, _ := regexp.Match("{{.PersonalData}}", line); ok { + reg := regexp.MustCompile("{{.PersonalData}}") + newByte := reg.ReplaceAll(line, []byte(user.PersonalData())) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else if ok, _ := regexp.Match("{{.OptimizingTable}}", line); ok { + reg := regexp.MustCompile("{{.OptimizingTable}}") + newByte := reg.ReplaceAll(line, []byte(fmt.Sprintf("以下 %v 道题还需要优化到 100%% 的题目列表\n\n%v", (user.OptimizingEasy+user.OptimizingMedium+user.OptimizingHard), omdrows.AvailableTable()))) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else { + output = append(output, line...) + output = append(output, []byte("\n")...) + } + } +} diff --git a/ctl/request.go b/ctl/request.go new file mode 100644 index 00000000..3b876595 --- /dev/null +++ b/ctl/request.go @@ -0,0 +1,72 @@ +package main + +import ( + "fmt" + "github.com/mozillazg/request" + "io/ioutil" + "net/http" +) + +const ( + // AllProblemURL define + AllProblemURL = "https://leetcode.com/api/problems/all/" + // LoginPageURL define + LoginPageURL = "https://leetcode.com/accounts/login/" + // AlgorithmsURL define + AlgorithmsURL = "https://leetcode.com/api/problems/Algorithms/" +) + +var req *request.Request + +func newReq() *request.Request { + if req == nil { + req = signin() + } + return req +} + +func signin() *request.Request { + cfg := getConfig() + req := request.NewRequest(new(http.Client)) + req.Headers = map[string]string{ + "Content-Type": "application/json", + "Accept-Encoding": "", + "cookie": cfg.Cookie, + "Referer": "https://leetcode.com/accounts/login/", + "origin": "https://leetcode.com", + } + return req +} + +func getRaw(URL string) []byte { + req := newReq() + resp, err := req.Get(URL) + if err != nil { + fmt.Printf("getRaw: Get Error: " + err.Error()) + } + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + fmt.Printf("getRaw: Read Error: " + err.Error()) + } + return body +} + +func getProblemAllList(URL string) []byte { + req := newReq() + resp, err := req.Get(URL) + if err != nil { + fmt.Println(err) + return []byte{} + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + fmt.Println(err) + return []byte{} + } + if resp.StatusCode == 200 { + fmt.Println("ok") + } + return body +} diff --git a/ctl/statistic.go b/ctl/statistic.go new file mode 100644 index 00000000..036204a2 --- /dev/null +++ b/ctl/statistic.go @@ -0,0 +1,40 @@ +package main + +import ( + m "github.com/halfrost/LeetCode-Go/ctl/models" + "sort" +) + +func statisticalData(problemsMap map[int]m.StatStatusPairs, solutionIds []int) (easyTotal, mediumTotal, hardTotal, optimizingEasy, optimizingMedium, optimizingHard int32, optimizingIds []int) { + easyTotal, mediumTotal, hardTotal, optimizingEasy, optimizingMedium, optimizingHard, optimizingIds = 0, 0, 0, 0, 0, 0, []int{} + for _, v := range problemsMap { + switch m.DifficultyMap[v.Difficulty.Level] { + case "Easy": + { + easyTotal++ + if v.Status == "ac" && binarySearch(solutionIds, int(v.Stat.FrontendQuestionID)) == -1 { + optimizingEasy++ + optimizingIds = append(optimizingIds, int(v.Stat.FrontendQuestionID)) + } + } + case "Medium": + { + mediumTotal++ + if v.Status == "ac" && binarySearch(solutionIds, int(v.Stat.FrontendQuestionID)) == -1 { + optimizingMedium++ + optimizingIds = append(optimizingIds, int(v.Stat.FrontendQuestionID)) + } + } + case "Hard": + { + hardTotal++ + if v.Status == "ac" && binarySearch(solutionIds, int(v.Stat.FrontendQuestionID)) == -1 { + optimizingHard++ + optimizingIds = append(optimizingIds, int(v.Stat.FrontendQuestionID)) + } + } + } + } + sort.Ints(optimizingIds) + return easyTotal, mediumTotal, hardTotal, optimizingEasy, optimizingMedium, optimizingHard, optimizingIds +} diff --git a/automation/template.markdown b/ctl/template.markdown similarity index 99% rename from automation/template.markdown rename to ctl/template.markdown index 5562ab4a..34939dea 100644 --- a/automation/template.markdown +++ b/ctl/template.markdown @@ -82,6 +82,9 @@ * [✅ Segment Tree](#segment-tree) * [✅ Binary Indexed Tree](#binary-indexed-tree) +
+
+ | 数据结构 | 变种 | 相关题目 | 讲解文章 | |:-------:|:-------|:------|:------| |顺序线性表:向量|||| @@ -118,7 +121,11 @@ ## LeetCode Problems -## 一. 目录 +## 一. 个人数据 + +{{.PersonalData}} + +## 二. 目录 {{.TotalNum}} @@ -133,7 +140,7 @@ ------------------------------------------------------------------ -## 二.分类 +## 三.分类 ## Array diff --git a/ctl/template_render.go b/ctl/template_render.go new file mode 100644 index 00000000..ed3d123f --- /dev/null +++ b/ctl/template_render.go @@ -0,0 +1,37 @@ +package main + +import ( + "bytes" + "fmt" + m "github.com/halfrost/LeetCode-Go/ctl/models" + "html/template" + "io/ioutil" + "os" +) + +func makeReadmeFile(mdrows m.Mdrows) { + file := "./README.md" + os.Remove(file) + var b bytes.Buffer + tmpl := template.Must(template.New("readme").Parse(readTMPL("template.markdown"))) + err := tmpl.Execute(&b, mdrows) + if err != nil { + fmt.Println(err) + } + // 保存 README.md 文件 + writeFile(file, b.Bytes()) +} + +func readTMPL(path string) string { + file, err := os.Open(path) + if err != nil { + fmt.Println(err) + } + defer file.Close() + + data, err := ioutil.ReadAll(file) + if err != nil { + fmt.Println(err) + } + return string(data) +} diff --git a/ctl/util.go b/ctl/util.go new file mode 100644 index 00000000..d33ea074 --- /dev/null +++ b/ctl/util.go @@ -0,0 +1,58 @@ +package main + +import ( + "fmt" + "io/ioutil" + "os" + "sort" + "strconv" +) + +func loadSolutionsDir() ([]int, int) { + files, err := ioutil.ReadDir("../leetcode/") + if err != nil { + fmt.Println(err) + } + solutionIds := []int{} + for _, f := range files { + if f.Name()[4] == '.' { + tmp, err := strconv.Atoi(f.Name()[:4]) + if err != nil { + fmt.Println(err) + } + solutionIds = append(solutionIds, tmp) + } + } + sort.Ints(solutionIds) + fmt.Printf("读取了 %v 道题的题解,当前目录下有 %v 个文件(可能包含 .DS_Store),目录中有 %v 道题在尝试中\n", len(solutionIds), len(files), len(files)-len(solutionIds)) + return solutionIds, len(files) - len(solutionIds) +} + +func writeFile(fileName string, content []byte) { + file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0777) + if err != nil { + fmt.Println(err) + } + defer file.Close() + + _, err = file.Write(content) + if err != nil { + fmt.Println(err) + } + fmt.Println("write file successful") +} + +func binarySearch(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + (high-low)>>1 + if nums[mid] == target { + return mid + } else if nums[mid] > target { + high = mid - 1 + } else { + low = mid + 1 + } + } + return -1 +} From e3ba2d3153713b0ca5288b0f8b469a53f174e891 Mon Sep 17 00:00:00 2001 From: YDZ Date: Thu, 14 Jan 2021 01:25:19 +0800 Subject: [PATCH 71/82] Add solution 1018 --- README.md | 524 +++++++++--------- .../1018. Binary Prefix Divisible By 5.go | 10 + ...1018. Binary Prefix Divisible By 5_test.go | 57 ++ .../README.md | 70 +++ .../1018.Binary-Prefix-Divisible-By-5.md | 70 +++ website/content/menu/index.md | 1 + 6 files changed, 470 insertions(+), 262 deletions(-) create mode 100644 leetcode/1018.Binary-Prefix-Divisible-By-5/1018. Binary Prefix Divisible By 5.go create mode 100644 leetcode/1018.Binary-Prefix-Divisible-By-5/1018. Binary Prefix Divisible By 5_test.go create mode 100644 leetcode/1018.Binary-Prefix-Divisible-By-5/README.md create mode 100644 website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md diff --git a/README.md b/README.md index 4050896c..5c10d2de 100755 --- a/README.md +++ b/README.md @@ -126,22 +126,22 @@ | | Easy | Medium | Hard | Total | |:--------:|:--------:|:--------:|:--------:|:--------:| |Optimizing|39|44|15|98| -|Accepted|**249**|**314**|**95**|**658**| +|Accepted|**250**|**314**|**95**|**659**| |Total|457|901|365|1723| -|Perfection Rate|84.3%|86.0%|84.2%|85.1%| -|Completion Rate|54.5%|34.9%|26.0%|38.2%| +|Perfection Rate|84.4%|86.0%|84.2%|85.1%| +|Completion Rate|54.7%|34.9%|26.0%|38.2%| |------------|----------------------------|----------------------------|----------------------------|----------------------------| ## 二. 目录 -以下已经收录了 560 道题的题解,还有 11 道题在尝试优化到 beats 100% +以下已经收录了 561 道题的题解,还有 11 道题在尝试优化到 beats 100% | No. | Title | Solution | Acceptance | Difficulty | Frequency | |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| |0001|Two Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum)|46.2%|Easy|| -|0002|Add Two Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0002.Add-Two-Numbers)|35.0%|Medium|| +|0002|Add Two Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0002.Add-Two-Numbers)|35.1%|Medium|| |0003|Longest Substring Without Repeating Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0003.Longest-Substring-Without-Repeating-Characters)|31.2%|Medium|| -|0004|Median of Two Sorted Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0004.Median-of-Two-Sorted-Arrays)|30.7%|Hard|| +|0004|Median of Two Sorted Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0004.Median-of-Two-Sorted-Arrays)|30.8%|Hard|| |0005|Longest Palindromic Substring||30.1%|Medium|| |0006|ZigZag Conversion||37.6%|Medium|| |0007|Reverse Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0007.Reverse-Integer)|25.8%|Easy|| @@ -184,7 +184,7 @@ |0044|Wildcard Matching||25.3%|Hard|| |0045|Jump Game II||31.3%|Hard|| |0046|Permutations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0046.Permutations)|66.0%|Medium|| -|0047|Permutations II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0047.Permutations-II)|48.9%|Medium|| +|0047|Permutations II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0047.Permutations-II)|49.0%|Medium|| |0048|Rotate Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0048.Rotate-Image)|59.3%|Medium|| |0049|Group Anagrams|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams)|58.8%|Medium|| |0050|Pow(x, n)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0050.Pow(x,-n))|30.8%|Medium|| @@ -201,16 +201,16 @@ |0061|Rotate List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0061.Rotate-List)|31.5%|Medium|| |0062|Unique Paths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0062.Unique-Paths)|55.6%|Medium|| |0063|Unique Paths II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0063.Unique-Paths-II)|35.1%|Medium|| -|0064|Minimum Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0064.Minimum-Path-Sum)|55.8%|Medium|| +|0064|Minimum Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0064.Minimum-Path-Sum)|55.9%|Medium|| |0065|Valid Number||15.7%|Hard|| -|0066|Plus One|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0066.Plus-One)|42.6%|Easy|| +|0066|Plus One|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0066.Plus-One)|42.5%|Easy|| |0067|Add Binary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0067.Add-Binary)|46.6%|Easy|| |0068|Text Justification||29.2%|Hard|| |0069|Sqrt(x)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0069.Sqrt(x))|34.8%|Easy|| |0070|Climbing Stairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0070.Climbing-Stairs)|48.5%|Easy|| |0071|Simplify Path|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0071.Simplify-Path)|33.6%|Medium|| |0072|Edit Distance||46.4%|Hard|| -|0073|Set Matrix Zeroes||44.0%|Medium|| +|0073|Set Matrix Zeroes||44.1%|Medium|| |0074|Search a 2D Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0074.Search-a-2D-Matrix)|37.3%|Medium|| |0075|Sort Colors|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0075.Sort-Colors)|48.9%|Medium|| |0076|Minimum Window Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0076.Minimum-Window-Substring)|35.7%|Hard|| @@ -221,7 +221,7 @@ |0081|Search in Rotated Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0081.Search-in-Rotated-Sorted-Array-II)|33.5%|Medium|| |0082|Remove Duplicates from Sorted List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II)|38.9%|Medium|| |0083|Remove Duplicates from Sorted List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0083.Remove-Duplicates-from-Sorted-List)|46.3%|Easy|| -|0084|Largest Rectangle in Histogram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0084.Largest-Rectangle-in-Histogram)|36.7%|Hard|| +|0084|Largest Rectangle in Histogram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0084.Largest-Rectangle-in-Histogram)|36.8%|Hard|| |0085|Maximal Rectangle||39.1%|Hard|| |0086|Partition List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0086.Partition-List)|43.0%|Medium|| |0087|Scramble String||34.5%|Hard|| @@ -296,7 +296,7 @@ |0156|Binary Tree Upside Down||56.0%|Medium|| |0157|Read N Characters Given Read4||36.9%|Easy|| |0158|Read N Characters Given Read4 II - Call multiple times||36.3%|Hard|| -|0159|Longest Substring with At Most Two Distinct Characters||50.2%|Medium|| +|0159|Longest Substring with At Most Two Distinct Characters||50.3%|Medium|| |0160|Intersection of Two Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0160.Intersection-of-Two-Linked-Lists)|42.6%|Easy|| |0161|One Edit Distance||32.7%|Medium|| |0162|Find Peak Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0162.Find-Peak-Element)|43.8%|Medium|| @@ -313,13 +313,13 @@ |0173|Binary Search Tree Iterator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0173.Binary-Search-Tree-Iterator)|59.6%|Medium|| |0174|Dungeon Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0174.Dungeon-Game)|33.1%|Hard|| |0175|Combine Two Tables||63.4%|Easy|| -|0176|Second Highest Salary||32.9%|Easy|| +|0176|Second Highest Salary||33.0%|Easy|| |0177|Nth Highest Salary||32.9%|Medium|| |0178|Rank Scores||49.2%|Medium|| |0179|Largest Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0179.Largest-Number)|30.4%|Medium|| |0180|Consecutive Numbers||41.7%|Medium|| |0181|Employees Earning More Than Their Managers||59.6%|Easy|| -|0182|Duplicate Emails||64.0%|Easy|| +|0182|Duplicate Emails||64.1%|Easy|| |0183|Customers Who Never Order||56.1%|Easy|| |0184|Department Highest Salary||39.3%|Medium|| |0185|Department Top Three Salaries||38.0%|Hard|| @@ -337,7 +337,7 @@ |0197|Rising Temperature||39.6%|Easy|| |0198|House Robber|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0198.House-Robber)|42.7%|Medium|| |0199|Binary Tree Right Side View|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0199.Binary-Tree-Right-Side-View)|55.7%|Medium|| -|0200|Number of Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0200.Number-of-Islands)|48.5%|Medium|| +|0200|Number of Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0200.Number-of-Islands)|48.6%|Medium|| |0201|Bitwise AND of Numbers Range|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0201.Bitwise-AND-of-Numbers-Range)|39.6%|Medium|| |0202|Happy Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0202.Happy-Number)|51.1%|Easy|| |0203|Remove Linked List Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0203.Remove-Linked-List-Elements)|39.0%|Easy|| @@ -346,16 +346,16 @@ |0206|Reverse Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0206.Reverse-Linked-List)|64.7%|Easy|| |0207|Course Schedule|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0207.Course-Schedule)|44.2%|Medium|| |0208|Implement Trie (Prefix Tree)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0208.Implement-Trie-(Prefix-Tree))|51.5%|Medium|| -|0209|Minimum Size Subarray Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0209.Minimum-Size-Subarray-Sum)|39.1%|Medium|| +|0209|Minimum Size Subarray Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0209.Minimum-Size-Subarray-Sum)|39.2%|Medium|| |0210|Course Schedule II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0210.Course-Schedule-II)|42.2%|Medium|| -|0211|Design Add and Search Words Data Structure|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0211.Design-Add-and-Search-Words-Data-Structure)|39.7%|Medium|| +|0211|Design Add and Search Words Data Structure|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0211.Design-Add-and-Search-Words-Data-Structure)|39.8%|Medium|| |0212|Word Search II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0212.Word-Search-II)|36.5%|Hard|| |0213|House Robber II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0213.House-Robber-II)|37.4%|Medium|| |0214|Shortest Palindrome||30.5%|Hard|| |0215|Kth Largest Element in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0215.Kth-Largest-Element-in-an-Array)|57.5%|Medium|| |0216|Combination Sum III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0216.Combination-Sum-III)|59.9%|Medium|| |0217|Contains Duplicate|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0217.Contains-Duplicate)|56.5%|Easy|| -|0218|The Skyline Problem|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0218.The-Skyline-Problem)|36.0%|Hard|| +|0218|The Skyline Problem|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0218.The-Skyline-Problem)|36.1%|Hard|| |0219|Contains Duplicate II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0219.Contains-Duplicate-II)|38.5%|Easy|| |0220|Contains Duplicate III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0220.Contains-Duplicate-III)|21.3%|Medium|| |0221|Maximal Square||38.7%|Medium|| @@ -372,7 +372,7 @@ |0232|Implement Queue using Stacks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0232.Implement-Queue-using-Stacks)|51.6%|Easy|| |0233|Number of Digit One||31.6%|Hard|| |0234|Palindrome Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0234.Palindrome-Linked-List)|40.2%|Easy|| -|0235|Lowest Common Ancestor of a Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree)|51.3%|Easy|| +|0235|Lowest Common Ancestor of a Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree)|51.4%|Easy|| |0236|Lowest Common Ancestor of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree)|48.1%|Medium|| |0237|Delete Node in a Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0237.Delete-Node-in-a-Linked-List)|66.2%|Easy|| |0238|Product of Array Except Self||61.2%|Medium|| @@ -422,8 +422,8 @@ |0282|Expression Add Operators||36.5%|Hard|| |0283|Move Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0283.Move-Zeroes)|58.4%|Easy|| |0284|Peeking Iterator||47.4%|Medium|| -|0285|Inorder Successor in BST||42.3%|Medium|| -|0286|Walls and Gates||55.9%|Medium|| +|0285|Inorder Successor in BST||42.4%|Medium|| +|0286|Walls and Gates||56.0%|Medium|| |0287|Find the Duplicate Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0287.Find-the-Duplicate-Number)|57.1%|Medium|| |0288|Unique Word Abbreviation||22.8%|Medium|| |0289|Game of Life||57.7%|Medium|| @@ -448,7 +448,7 @@ |0308|Range Sum Query 2D - Mutable||37.2%|Hard|| |0309|Best Time to Buy and Sell Stock with Cooldown|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown)|48.0%|Medium|| |0310|Minimum Height Trees||34.5%|Medium|| -|0311|Sparse Matrix Multiplication||63.5%|Medium|| +|0311|Sparse Matrix Multiplication||63.6%|Medium|| |0312|Burst Balloons||53.6%|Hard|| |0313|Super Ugly Number||45.9%|Medium|| |0314|Binary Tree Vertical Order Traversal||46.6%|Medium|| @@ -457,7 +457,7 @@ |0317|Shortest Distance from All Buildings||42.5%|Hard|| |0318|Maximum Product of Word Lengths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0318.Maximum-Product-of-Word-Lengths)|52.0%|Medium|| |0319|Bulb Switcher||45.3%|Medium|| -|0320|Generalized Abbreviation||53.3%|Medium|| +|0320|Generalized Abbreviation||53.4%|Medium|| |0321|Create Maximum Number||27.4%|Hard|| |0322|Coin Change|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0322.Coin-Change)|36.9%|Medium|| |0323|Number of Connected Components in an Undirected Graph||57.4%|Medium|| @@ -470,7 +470,7 @@ |0330|Patching Array||34.9%|Hard|| |0331|Verify Preorder Serialization of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree)|40.9%|Medium|| |0332|Reconstruct Itinerary||37.7%|Medium|| -|0333|Largest BST Subtree||37.3%|Medium|| +|0333|Largest BST Subtree||37.4%|Medium|| |0334|Increasing Triplet Subsequence||40.6%|Medium|| |0335|Self Crossing||28.5%|Hard|| |0336|Palindrome Pairs||34.4%|Hard|| @@ -511,7 +511,7 @@ |0371|Sum of Two Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0371.Sum-of-Two-Integers)|50.6%|Medium|| |0372|Super Pow|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0372.Super-Pow)|36.6%|Medium|| |0373|Find K Pairs with Smallest Sums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0373.Find-K-Pairs-with-Smallest-Sums)|37.4%|Medium|| -|0374|Guess Number Higher or Lower||44.3%|Easy|| +|0374|Guess Number Higher or Lower||44.4%|Easy|| |0375|Guess Number Higher or Lower II||41.9%|Medium|| |0376|Wiggle Subsequence||40.1%|Medium|| |0377|Combination Sum IV||45.9%|Medium|| @@ -523,7 +523,7 @@ |0383|Ransom Note||53.2%|Easy|| |0384|Shuffle an Array||53.8%|Medium|| |0385|Mini Parser|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0385.Mini-Parser)|34.3%|Medium|| -|0386|Lexicographical Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0386.Lexicographical-Numbers)|53.6%|Medium|| +|0386|Lexicographical Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0386.Lexicographical-Numbers)|53.7%|Medium|| |0387|First Unique Character in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0387.First-Unique-Character-in-a-String)|53.7%|Easy|| |0388|Longest Absolute File Path||42.5%|Medium|| |0389|Find the Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0389.Find-the-Difference)|57.7%|Easy|| @@ -532,7 +532,7 @@ |0392|Is Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0392.Is-Subsequence)|49.5%|Easy|| |0393|UTF-8 Validation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0393.UTF-8-Validation)|37.9%|Medium|| |0394|Decode String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0394.Decode-String)|52.3%|Medium|| -|0395|Longest Substring with At Least K Repeating Characters||43.3%|Medium|| +|0395|Longest Substring with At Least K Repeating Characters||43.4%|Medium|| |0396|Rotate Function||36.6%|Medium|| |0397|Integer Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0397.Integer-Replacement)|33.4%|Medium|| |0398|Random Pick Index||57.5%|Medium|| @@ -547,10 +547,10 @@ |0407|Trapping Rain Water II||43.8%|Hard|| |0408|Valid Word Abbreviation||31.3%|Easy|| |0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.1%|Easy|| -|0410|Split Array Largest Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0410.Split-Array-Largest-Sum)|46.0%|Hard|| +|0410|Split Array Largest Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0410.Split-Array-Largest-Sum)|46.1%|Hard|| |0411|Minimum Unique Word Abbreviation||37.0%|Hard|| |0412|Fizz Buzz|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0412.Fizz-Buzz)|63.5%|Easy|| -|0413|Arithmetic Slices||58.4%|Medium|| +|0413|Arithmetic Slices||58.5%|Medium|| |0414|Third Maximum Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0414.Third-Maximum-Number)|30.6%|Easy|| |0415|Add Strings||48.1%|Easy|| |0416|Partition Equal Subset Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0416.Partition-Equal-Subset-Sum)|44.7%|Medium|| @@ -609,7 +609,7 @@ |0469|Convex Polygon||37.4%|Medium|| |0470|Implement Rand10() Using Rand7()|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0470.Implement-Rand10()-Using-Rand7())|46.0%|Medium|| |0471|Encode String with Shortest Length||48.9%|Hard|| -|0472|Concatenated Words||44.7%|Hard|| +|0472|Concatenated Words||44.6%|Hard|| |0473|Matchsticks to Square||38.1%|Medium|| |0474|Ones and Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0474.Ones-and-Zeroes)|43.4%|Medium|| |0475|Heaters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0475.Heaters)|33.5%|Medium|| @@ -619,18 +619,18 @@ |0479|Largest Palindrome Product||29.5%|Hard|| |0480|Sliding Window Median|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0480.Sliding-Window-Median)|38.4%|Hard|| |0481|Magical String||48.0%|Medium|| -|0482|License Key Formatting||43.0%|Easy|| +|0482|License Key Formatting||43.1%|Easy|| |0483|Smallest Good Base|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0483.Smallest-Good-Base)|36.2%|Hard|| |0484|Find Permutation||64.1%|Medium|| |0485|Max Consecutive Ones|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0485.Max-Consecutive-Ones)|53.2%|Easy|| |0486|Predict the Winner||48.4%|Medium|| -|0487|Max Consecutive Ones II||47.9%|Medium|| +|0487|Max Consecutive Ones II||47.8%|Medium|| |0488|Zuma Game||38.6%|Hard|| |0489|Robot Room Cleaner||72.1%|Hard|| |0490|The Maze||52.5%|Medium|| |0491|Increasing Subsequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0491.Increasing-Subsequences)|47.3%|Medium|| |0492|Construct the Rectangle||50.2%|Easy|| -|0493|Reverse Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0493.Reverse-Pairs)|26.5%|Hard|| +|0493|Reverse Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0493.Reverse-Pairs)|26.6%|Hard|| |0494|Target Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0494.Target-Sum)|45.9%|Medium|| |0495|Teemo Attacking||56.1%|Medium|| |0496|Next Greater Element I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0496.Next-Greater-Element-I)|65.1%|Easy|| @@ -646,9 +646,9 @@ |0506|Relative Ranks||51.0%|Easy|| |0507|Perfect Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0507.Perfect-Number)|36.0%|Easy|| |0508|Most Frequent Subtree Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0508.Most-Frequent-Subtree-Sum)|58.9%|Medium|| -|0509|Fibonacci Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0509.Fibonacci-Number)|67.2%|Easy|| +|0509|Fibonacci Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0509.Fibonacci-Number)|67.3%|Easy|| |0510|Inorder Successor in BST II||59.8%|Medium|| -|0511|Game Play Analysis I||81.2%|Easy|| +|0511|Game Play Analysis I||81.3%|Easy|| |0512|Game Play Analysis II||55.8%|Easy|| |0513|Find Bottom Left Tree Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0513.Find-Bottom-Left-Tree-Value)|62.3%|Medium|| |0514|Freedom Trail||44.7%|Hard|| @@ -669,7 +669,7 @@ |0529|Minesweeper|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0529.Minesweeper)|60.6%|Medium|| |0530|Minimum Absolute Difference in BST||54.6%|Easy|| |0531|Lonely Pixel I||59.4%|Medium|| -|0532|K-diff Pairs in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0532.K-diff-Pairs-in-an-Array)|34.8%|Medium|| +|0532|K-diff Pairs in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0532.K-diff-Pairs-in-an-Array)|34.9%|Medium|| |0533|Lonely Pixel II||48.0%|Medium|| |0534|Game Play Analysis III||78.6%|Medium|| |0535|Encode and Decode TinyURL||80.7%|Medium|| @@ -695,7 +695,7 @@ |0555|Split Concatenated Strings||42.8%|Medium|| |0556|Next Greater Element III||33.5%|Medium|| |0557|Reverse Words in a String III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0557.Reverse-Words-in-a-String-III)|71.5%|Easy|| -|0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.4%|Medium|| +|0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.5%|Medium|| |0559|Maximum Depth of N-ary Tree||69.4%|Easy|| |0560|Subarray Sum Equals K||43.9%|Medium|| |0561|Array Partition I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0561.Array-Partition-I)|72.8%|Easy|| @@ -715,32 +715,32 @@ |0575|Distribute Candies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0575.Distribute-Candies)|61.9%|Easy|| |0576|Out of Boundary Paths||35.8%|Medium|| |0577|Employee Bonus||70.8%|Easy|| -|0578|Get Highest Answer Rate Question||41.2%|Medium|| +|0578|Get Highest Answer Rate Question||41.3%|Medium|| |0579|Find Cumulative Salary of an Employee||38.0%|Hard|| |0580|Count Student Number in Departments||51.0%|Medium|| |0581|Shortest Unsorted Continuous Subarray||31.6%|Medium|| |0582|Kill Process||62.4%|Medium|| |0583|Delete Operation for Two Strings||49.7%|Medium|| -|0584|Find Customer Referee||73.6%|Easy|| -|0585|Investments in 2016||56.4%|Medium|| -|0586|Customer Placing the Largest Number of Orders||74.9%|Easy|| +|0584|Find Customer Referee||73.7%|Easy|| +|0585|Investments in 2016||56.5%|Medium|| +|0586|Customer Placing the Largest Number of Orders||75.0%|Easy|| |0587|Erect the Fence||36.3%|Hard|| |0588|Design In-Memory File System||46.5%|Hard|| |0589|N-ary Tree Preorder Traversal||73.1%|Easy|| -|0590|N-ary Tree Postorder Traversal||73.1%|Easy|| -|0591|Tag Validator||34.6%|Hard|| -|0592|Fraction Addition and Subtraction||50.0%|Medium|| +|0590|N-ary Tree Postorder Traversal||73.2%|Easy|| +|0591|Tag Validator||34.7%|Hard|| +|0592|Fraction Addition and Subtraction||50.1%|Medium|| |0593|Valid Square||43.3%|Medium|| |0594|Longest Harmonious Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0594.Longest-Harmonious-Subsequence)|47.7%|Easy|| |0595|Big Countries||78.2%|Easy|| -|0596|Classes More Than 5 Students||38.6%|Easy|| +|0596|Classes More Than 5 Students||38.7%|Easy|| |0597|Friend Requests I: Overall Acceptance Rate||41.7%|Easy|| |0598|Range Addition II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0598.Range-Addition-II)|50.0%|Easy|| |0599|Minimum Index Sum of Two Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0599.Minimum-Index-Sum-of-Two-Lists)|51.5%|Easy|| |0600|Non-negative Integers without Consecutive Ones||34.5%|Hard|| |0601|Human Traffic of Stadium||44.3%|Hard|| |0602|Friend Requests II: Who Has the Most Friends||56.6%|Medium|| -|0603|Consecutive Available Seats||65.6%|Easy|| +|0603|Consecutive Available Seats||65.7%|Easy|| |0604|Design Compressed String Iterator||38.1%|Easy|| |0605|Can Place Flowers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0605.Can-Place-Flowers)|31.9%|Easy|| |0606|Construct String from Binary Tree||55.0%|Easy|| @@ -752,14 +752,14 @@ |0612|Shortest Distance in a Plane||60.9%|Medium|| |0613|Shortest Distance in a Line||79.1%|Easy|| |0614|Second Degree Follower||32.1%|Medium|| -|0615|Average Salary: Departments VS Company||51.3%|Hard|| +|0615|Average Salary: Departments VS Company||51.4%|Hard|| |0616|Add Bold Tag in String||44.4%|Medium|| |0617|Merge Two Binary Trees||75.1%|Easy|| |0618|Students Report By Geography||58.7%|Hard|| |0619|Biggest Single Number||44.6%|Easy|| |0620|Not Boring Movies||69.3%|Easy|| |0621|Task Scheduler||51.5%|Medium|| -|0622|Design Circular Queue||45.0%|Medium|| +|0622|Design Circular Queue||45.1%|Medium|| |0623|Add One Row to Tree||50.3%|Medium|| |0624|Maximum Distance in Arrays||39.4%|Medium|| |0625|Minimum Factorization||32.9%|Medium|| @@ -787,9 +787,9 @@ |0647|Palindromic Substrings||61.7%|Medium|| |0648|Replace Words|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0648.Replace-Words)|58.2%|Medium|| |0649|Dota2 Senate||39.4%|Medium|| -|0650|2 Keys Keyboard||49.8%|Medium|| +|0650|2 Keys Keyboard||49.9%|Medium|| |0651|4 Keys Keyboard||52.9%|Medium|| -|0652|Find Duplicate Subtrees||51.9%|Medium|| +|0652|Find Duplicate Subtrees||52.0%|Medium|| |0653|Two Sum IV - Input is a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0653.Two-Sum-IV---Input-is-a-BST)|56.1%|Easy|| |0654|Maximum Binary Tree||80.9%|Medium|| |0655|Print Binary Tree||55.8%|Medium|| @@ -862,7 +862,7 @@ |0722|Remove Comments||35.8%|Medium|| |0723|Candy Crush||72.3%|Medium|| |0724|Find Pivot Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0724.Find-Pivot-Index)|45.0%|Easy|| -|0725|Split Linked List in Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0725.Split-Linked-List-in-Parts)|52.7%|Medium|| +|0725|Split Linked List in Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0725.Split-Linked-List-in-Parts)|52.8%|Medium|| |0726|Number of Atoms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0726.Number-of-Atoms)|51.0%|Hard|| |0727|Minimum Window Subsequence||42.1%|Hard|| |0728|Self Dividing Numbers||75.3%|Easy|| @@ -879,19 +879,19 @@ |0739|Daily Temperatures|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0739.Daily-Temperatures)|64.3%|Medium|| |0740|Delete and Earn||49.2%|Medium|| |0741|Cherry Pickup||35.0%|Hard|| -|0742|Closest Leaf in a Binary Tree||44.2%|Medium|| +|0742|Closest Leaf in a Binary Tree||44.1%|Medium|| |0743|Network Delay Time||45.3%|Medium|| |0744|Find Smallest Letter Greater Than Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0744.Find-Smallest-Letter-Greater-Than-Target)|45.6%|Easy|| |0745|Prefix and Suffix Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0745.Prefix-and-Suffix-Search)|35.1%|Hard|| |0746|Min Cost Climbing Stairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0746.Min-Cost-Climbing-Stairs)|50.9%|Easy|| |0747|Largest Number At Least Twice of Others||42.8%|Easy|| |0748|Shortest Completing Word|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0748.Shortest-Completing-Word)|57.4%|Easy|| -|0749|Contain Virus||47.8%|Hard|| +|0749|Contain Virus||47.9%|Hard|| |0750|Number Of Corner Rectangles||66.6%|Medium|| |0751|IP to CIDR||60.1%|Medium|| |0752|Open the Lock||52.5%|Medium|| |0753|Cracking the Safe|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0753.Cracking-the-Safe)|52.0%|Hard|| -|0754|Reach a Number||40.5%|Medium|| +|0754|Reach a Number||40.4%|Medium|| |0755|Pour Water||44.0%|Medium|| |0756|Pyramid Transition Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0756.Pyramid-Transition-Matrix)|55.5%|Medium|| |0757|Set Intersection Size At Least Two||42.1%|Hard|| @@ -920,14 +920,14 @@ |0780|Reaching Points||30.2%|Hard|| |0781|Rabbits in Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0781.Rabbits-in-Forest)|55.3%|Medium|| |0782|Transform to Chessboard||46.8%|Hard|| -|0783|Minimum Distance Between BST Nodes||53.6%|Easy|| -|0784|Letter Case Permutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0784.Letter-Case-Permutation)|66.1%|Medium|| +|0783|Minimum Distance Between BST Nodes||53.7%|Easy|| +|0784|Letter Case Permutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0784.Letter-Case-Permutation)|66.2%|Medium|| |0785|Is Graph Bipartite?|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0785.Is-Graph-Bipartite?)|48.2%|Medium|| |0786|K-th Smallest Prime Fraction|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0786.K-th-Smallest-Prime-Fraction)|41.7%|Hard|| |0787|Cheapest Flights Within K Stops||39.5%|Medium|| |0788|Rotated Digits||57.3%|Easy|| |0789|Escape The Ghosts||58.1%|Medium|| -|0790|Domino and Tromino Tiling||39.8%|Medium|| +|0790|Domino and Tromino Tiling||39.9%|Medium|| |0791|Custom Sort String||65.9%|Medium|| |0792|Number of Matching Subsequences||48.1%|Medium|| |0793|Preimage Size of Factorial Zeroes Function|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0793.Preimage-Size-of-Factorial-Zeroes-Function)|40.6%|Hard|| @@ -957,7 +957,7 @@ |0817|Linked List Components|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0817.Linked-List-Components)|57.6%|Medium|| |0818|Race Car||39.6%|Hard|| |0819|Most Common Word|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0819.Most-Common-Word)|45.4%|Easy|| -|0820|Short Encoding of Words||51.3%|Medium|| +|0820|Short Encoding of Words||51.4%|Medium|| |0821|Shortest Distance to a Character||67.7%|Easy|| |0822|Card Flipping Game||43.5%|Medium|| |0823|Binary Trees With Factors||36.3%|Medium|| @@ -982,15 +982,15 @@ |0842|Split Array into Fibonacci Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0842.Split-Array-into-Fibonacci-Sequence)|36.6%|Medium|| |0843|Guess the Word||46.4%|Hard|| |0844|Backspace String Compare|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0844.Backspace-String-Compare)|46.8%|Easy|| -|0845|Longest Mountain in Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0845.Longest-Mountain-in-Array)|38.5%|Medium|| +|0845|Longest Mountain in Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0845.Longest-Mountain-in-Array)|38.4%|Medium|| |0846|Hand of Straights||55.2%|Medium|| -|0847|Shortest Path Visiting All Nodes||53.2%|Hard|| +|0847|Shortest Path Visiting All Nodes||53.3%|Hard|| |0848|Shifting Letters||45.1%|Medium|| |0849|Maximize Distance to Closest Person||44.4%|Medium|| |0850|Rectangle Area II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0850.Rectangle-Area-II)|48.4%|Hard|| |0851|Loud and Rich|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0851.Loud-and-Rich)|52.4%|Medium|| |0852|Peak Index in a Mountain Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0852.Peak-Index-in-a-Mountain-Array)|71.8%|Easy|| -|0853|Car Fleet|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0853.Car-Fleet)|43.5%|Medium|| +|0853|Car Fleet|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0853.Car-Fleet)|43.6%|Medium|| |0854|K-Similar Strings||38.7%|Hard|| |0855|Exam Room||43.4%|Medium|| |0856|Score of Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0856.Score-of-Parentheses)|62.2%|Medium|| @@ -1000,7 +1000,7 @@ |0860|Lemonade Change||51.9%|Easy|| |0861|Score After Flipping Matrix||73.4%|Medium|| |0862|Shortest Subarray with Sum at Least K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K)|25.1%|Hard|| -|0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|57.5%|Medium|| +|0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|57.4%|Medium|| |0864|Shortest Path to Get All Keys|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0864.Shortest-Path-to-Get-All-Keys)|41.5%|Hard|| |0865|Smallest Subtree with all the Deepest Nodes||64.6%|Medium|| |0866|Prime Palindrome||25.1%|Medium|| @@ -1009,7 +1009,7 @@ |0869|Reordered Power of 2||54.1%|Medium|| |0870|Advantage Shuffle||46.6%|Medium|| |0871|Minimum Number of Refueling Stops||32.1%|Hard|| -|0872|Leaf-Similar Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0872.Leaf-Similar-Trees)|64.6%|Easy|| +|0872|Leaf-Similar Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0872.Leaf-Similar-Trees)|64.5%|Easy|| |0873|Length of Longest Fibonacci Subsequence||48.1%|Medium|| |0874|Walking Robot Simulation||36.7%|Easy|| |0875|Koko Eating Bananas|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0875.Koko-Eating-Bananas)|53.4%|Medium|| @@ -1018,9 +1018,9 @@ |0878|Nth Magical Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0878.Nth-Magical-Number)|28.9%|Hard|| |0879|Profitable Schemes||40.1%|Hard|| |0880|Decoded String at Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0880.Decoded-String-at-Index)|28.3%|Medium|| -|0881|Boats to Save People|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0881.Boats-to-Save-People)|47.6%|Medium|| +|0881|Boats to Save People|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0881.Boats-to-Save-People)|48.5%|Medium|| |0882|Reachable Nodes In Subdivided Graph||42.3%|Hard|| -|0883|Projection Area of 3D Shapes||68.0%|Easy|| +|0883|Projection Area of 3D Shapes||68.1%|Easy|| |0884|Uncommon Words from Two Sentences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0884.Uncommon-Words-from-Two-Sentences)|63.9%|Easy|| |0885|Spiral Matrix III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0885.Spiral-Matrix-III)|70.5%|Medium|| |0886|Possible Bipartition||44.9%|Medium|| @@ -1040,7 +1040,7 @@ |0900|RLE Iterator||55.1%|Medium|| |0901|Online Stock Span|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0901.Online-Stock-Span)|61.1%|Medium|| |0902|Numbers At Most N Given Digit Set||36.1%|Hard|| -|0903|Valid Permutations for DI Sequence||54.1%|Hard|| +|0903|Valid Permutations for DI Sequence||54.2%|Hard|| |0904|Fruit Into Baskets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets)|42.8%|Medium|| |0905|Sort Array By Parity||74.9%|Easy|| |0906|Super Palindromes||32.9%|Hard|| @@ -1050,9 +1050,9 @@ |0910|Smallest Range II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0910.Smallest-Range-II)|31.2%|Medium|| |0911|Online Election|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0911.Online-Election)|51.2%|Medium|| |0912|Sort an Array||64.5%|Medium|| -|0913|Cat and Mouse||33.8%|Hard|| +|0913|Cat and Mouse||33.9%|Hard|| |0914|X of a Kind in a Deck of Cards|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0914.X-of-a-Kind-in-a-Deck-of-Cards)|34.4%|Easy|| -|0915|Partition Array into Disjoint Intervals||45.9%|Medium|| +|0915|Partition Array into Disjoint Intervals||46.0%|Medium|| |0916|Word Subsets||48.1%|Medium|| |0917|Reverse Only Letters||58.6%|Easy|| |0918|Maximum Sum Circular Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0918.Maximum-Sum-Circular-Subarray)|34.0%|Medium|| @@ -1061,8 +1061,8 @@ |0921|Minimum Add to Make Parentheses Valid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid)|74.6%|Medium|| |0922|Sort Array By Parity II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0922.Sort-Array-By-Parity-II)|70.2%|Easy|| |0923|3Sum With Multiplicity|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0923.3Sum-With-Multiplicity)|36.0%|Medium|| -|0924|Minimize Malware Spread|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0924.Minimize-Malware-Spread)|41.9%|Hard|| -|0925|Long Pressed Name|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0925.Long-Pressed-Name)|38.5%|Easy|| +|0924|Minimize Malware Spread|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0924.Minimize-Malware-Spread)|41.8%|Hard|| +|0925|Long Pressed Name|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0925.Long-Pressed-Name)|38.4%|Easy|| |0926|Flip String to Monotone Increasing||53.0%|Medium|| |0927|Three Equal Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0927.Three-Equal-Parts)|34.4%|Hard|| |0928|Minimize Malware Spread II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0928.Minimize-Malware-Spread-II)|41.1%|Hard|| @@ -1072,11 +1072,11 @@ |0932|Beautiful Array||61.0%|Medium|| |0933|Number of Recent Calls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0933.Number-of-Recent-Calls)|72.0%|Easy|| |0934|Shortest Bridge||49.4%|Medium|| -|0935|Knight Dialer||46.1%|Medium|| +|0935|Knight Dialer||46.2%|Medium|| |0936|Stamping The Sequence||47.2%|Hard|| |0937|Reorder Data in Log Files||54.3%|Easy|| |0938|Range Sum of BST||82.8%|Easy|| -|0939|Minimum Area Rectangle||51.8%|Medium|| +|0939|Minimum Area Rectangle||51.9%|Medium|| |0940|Distinct Subsequences II||41.6%|Hard|| |0941|Valid Mountain Array||33.5%|Easy|| |0942|DI String Match|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0942.DI-String-Match)|73.4%|Easy|| @@ -1092,15 +1092,15 @@ |0952|Largest Component Size by Common Factor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0952.Largest-Component-Size-by-Common-Factor)|36.1%|Hard|| |0953|Verifying an Alien Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0953.Verifying-an-Alien-Dictionary)|52.6%|Easy|| |0954|Array of Doubled Pairs||35.3%|Medium|| -|0955|Delete Columns to Make Sorted II||33.7%|Medium|| -|0956|Tallest Billboard||39.7%|Hard|| +|0955|Delete Columns to Make Sorted II||33.8%|Medium|| +|0956|Tallest Billboard||39.8%|Hard|| |0957|Prison Cells After N Days||40.2%|Medium|| |0958|Check Completeness of a Binary Tree||52.4%|Medium|| |0959|Regions Cut By Slashes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0959.Regions-Cut-By-Slashes)|66.8%|Medium|| |0960|Delete Columns to Make Sorted III||54.6%|Hard|| -|0961|N-Repeated Element in Size 2N Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0961.N-Repeated-Element-in-Size-2N-Array)|74.3%|Easy|| +|0961|N-Repeated Element in Size 2N Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0961.N-Repeated-Element-in-Size-2N-Array)|74.4%|Easy|| |0962|Maximum Width Ramp||46.3%|Medium|| -|0963|Minimum Area Rectangle II||51.7%|Medium|| +|0963|Minimum Area Rectangle II||51.6%|Medium|| |0964|Least Operators to Express Number||44.8%|Hard|| |0965|Univalued Binary Tree||67.7%|Easy|| |0966|Vowel Spellchecker||47.7%|Medium|| @@ -1108,15 +1108,15 @@ |0968|Binary Tree Cameras|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0968.Binary-Tree-Cameras)|38.5%|Hard|| |0969|Pancake Sorting|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0969.Pancake-Sorting)|68.5%|Medium|| |0970|Powerful Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0970.Powerful-Integers)|39.9%|Easy|| -|0971|Flip Binary Tree To Match Preorder Traversal||46.2%|Medium|| +|0971|Flip Binary Tree To Match Preorder Traversal||46.1%|Medium|| |0972|Equal Rational Numbers||41.9%|Hard|| |0973|K Closest Points to Origin|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0973.K-Closest-Points-to-Origin)|64.5%|Medium|| -|0974|Subarray Sums Divisible by K||50.6%|Medium|| +|0974|Subarray Sums Divisible by K||50.5%|Medium|| |0975|Odd Even Jump||41.5%|Hard|| |0976|Largest Perimeter Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0976.Largest-Perimeter-Triangle)|58.5%|Easy|| |0977|Squares of a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0977.Squares-of-a-Sorted-Array)|72.3%|Easy|| |0978|Longest Turbulent Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0978.Longest-Turbulent-Subarray)|46.6%|Medium|| -|0979|Distribute Coins in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0979.Distribute-Coins-in-Binary-Tree)|69.4%|Medium|| +|0979|Distribute Coins in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0979.Distribute-Coins-in-Binary-Tree)|69.5%|Medium|| |0980|Unique Paths III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0980.Unique-Paths-III)|77.1%|Hard|| |0981|Time Based Key-Value Store|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0981.Time-Based-Key-Value-Store)|53.9%|Medium|| |0982|Triples with Bitwise AND Equal To Zero||56.1%|Hard|| @@ -1142,20 +1142,20 @@ |1002|Find Common Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1002.Find-Common-Characters)|68.1%|Easy|| |1003|Check If Word Is Valid After Substitutions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions)|56.0%|Medium|| |1004|Max Consecutive Ones III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1004.Max-Consecutive-Ones-III)|60.5%|Medium|| -|1005|Maximize Sum Of Array After K Negations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations)|52.2%|Easy|| -|1006|Clumsy Factorial||53.6%|Medium|| -|1007|Minimum Domino Rotations For Equal Row||51.0%|Medium|| +|1005|Maximize Sum Of Array After K Negations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations)|52.3%|Easy|| +|1006|Clumsy Factorial||53.7%|Medium|| +|1007|Minimum Domino Rotations For Equal Row||50.9%|Medium|| |1008|Construct Binary Search Tree from Preorder Traversal||78.7%|Medium|| |1009|Complement of Base 10 Integer||61.5%|Easy|| -|1010|Pairs of Songs With Total Durations Divisible by 60||49.7%|Medium|| +|1010|Pairs of Songs With Total Durations Divisible by 60||49.8%|Medium|| |1011|Capacity To Ship Packages Within D Days|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1011.Capacity-To-Ship-Packages-Within-D-Days)|59.5%|Medium|| |1012|Numbers With Repeated Digits||37.7%|Hard|| -|1013|Partition Array Into Three Parts With Equal Sum||49.5%|Easy|| -|1014|Best Sightseeing Pair||52.8%|Medium|| +|1013|Partition Array Into Three Parts With Equal Sum||49.4%|Easy|| +|1014|Best Sightseeing Pair||52.9%|Medium|| |1015|Smallest Integer Divisible by K||41.8%|Medium|| |1016|Binary String With Substrings Representing 1 To N||59.1%|Medium|| |1017|Convert to Base -2|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1017.Convert-to-Base--2)|59.6%|Medium|| -|1018|Binary Prefix Divisible By 5||47.8%|Easy|| +|1018|Binary Prefix Divisible By 5|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1018.Binary-Prefix-Divisible-By-5)|47.8%|Easy|| |1019|Next Greater Node In Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1019.Next-Greater-Node-In-Linked-List)|58.2%|Medium|| |1020|Number of Enclaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1020.Number-of-Enclaves)|58.7%|Medium|| |1021|Remove Outermost Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1021.Remove-Outermost-Parentheses)|78.7%|Easy|| @@ -1182,32 +1182,32 @@ |1042|Flower Planting With No Adjacent||48.7%|Medium|| |1043|Partition Array for Maximum Sum||66.7%|Medium|| |1044|Longest Duplicate Substring||31.5%|Hard|| -|1045|Customers Who Bought All Products||68.2%|Medium|| +|1045|Customers Who Bought All Products||68.3%|Medium|| |1046|Last Stone Weight||62.4%|Easy|| |1047|Remove All Adjacent Duplicates In String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String)|70.2%|Easy|| |1048|Longest String Chain||55.3%|Medium|| -|1049|Last Stone Weight II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II)|44.9%|Medium|| -|1050|Actors and Directors Who Cooperated At Least Three Times||72.2%|Easy|| +|1049|Last Stone Weight II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II)|45.0%|Medium|| +|1050|Actors and Directors Who Cooperated At Least Three Times||72.1%|Easy|| |1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.9%|Easy|| |1052|Grumpy Bookstore Owner|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1052.Grumpy-Bookstore-Owner)|55.7%|Medium|| -|1053|Previous Permutation With One Swap||50.7%|Medium|| -|1054|Distant Barcodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1054.Distant-Barcodes)|44.1%|Medium|| +|1053|Previous Permutation With One Swap||50.8%|Medium|| +|1054|Distant Barcodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1054.Distant-Barcodes)|44.2%|Medium|| |1055|Shortest Way to Form String||57.1%|Medium|| |1056|Confusing Number||47.2%|Easy|| |1057|Campus Bikes||57.6%|Medium|| -|1058|Minimize Rounding Error to Meet Target||43.1%|Medium|| -|1059|All Paths from Source Lead to Destination||43.4%|Medium|| +|1058|Minimize Rounding Error to Meet Target||43.2%|Medium|| +|1059|All Paths from Source Lead to Destination||43.3%|Medium|| |1060|Missing Element in Sorted Array||54.7%|Medium|| |1061|Lexicographically Smallest Equivalent String||66.6%|Medium|| |1062|Longest Repeating Substring||58.0%|Medium|| -|1063|Number of Valid Subarrays||72.1%|Hard|| +|1063|Number of Valid Subarrays||72.2%|Hard|| |1064|Fixed Point||65.5%|Easy|| |1065|Index Pairs of a String||61.0%|Easy|| |1066|Campus Bikes II||54.0%|Medium|| |1067|Digit Count in Range||41.1%|Hard|| |1068|Product Sales Analysis I||82.4%|Easy|| |1069|Product Sales Analysis II||83.2%|Easy|| -|1070|Product Sales Analysis III||49.6%|Medium|| +|1070|Product Sales Analysis III||49.7%|Medium|| |1071|Greatest Common Divisor of Strings||51.4%|Easy|| |1072|Flip Columns For Maximum Number of Equal Rows||61.2%|Medium|| |1073|Adding Two Negabinary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1073.Adding-Two-Negabinary-Numbers)|34.7%|Medium|| @@ -1221,7 +1221,7 @@ |1081|Smallest Subsequence of Distinct Characters||53.4%|Medium|| |1082|Sales Analysis I||73.3%|Easy|| |1083|Sales Analysis II||50.7%|Easy|| -|1084|Sales Analysis III||54.6%|Easy|| +|1084|Sales Analysis III||54.7%|Easy|| |1085|Sum of Digits in the Minimum Number||75.0%|Easy|| |1086|High Five||78.8%|Easy|| |1087|Brace Expansion||63.1%|Medium|| @@ -1229,17 +1229,17 @@ |1089|Duplicate Zeros|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1089.Duplicate-Zeros)|52.0%|Easy|| |1090|Largest Values From Labels||60.0%|Medium|| |1091|Shortest Path in Binary Matrix||39.0%|Medium|| -|1092|Shortest Common Supersequence ||52.8%|Hard|| +|1092|Shortest Common Supersequence ||52.7%|Hard|| |1093|Statistics from a Large Sample|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1093.Statistics-from-a-Large-Sample)|49.3%|Medium|| -|1094|Car Pooling||59.1%|Medium|| +|1094|Car Pooling||59.0%|Medium|| |1095|Find in Mountain Array||35.9%|Hard|| |1096|Brace Expansion II||62.4%|Hard|| |1097|Game Play Analysis V||56.4%|Hard|| |1098|Unpopular Books||45.6%|Medium|| |1099|Two Sum Less Than K||60.8%|Easy|| -|1100|Find K-Length Substrings With No Repeated Characters||73.3%|Medium|| +|1100|Find K-Length Substrings With No Repeated Characters||73.2%|Medium|| |1101|The Earliest Moment When Everyone Become Friends||67.5%|Medium|| -|1102|Path With Maximum Minimum Value||50.1%|Medium|| +|1102|Path With Maximum Minimum Value||50.2%|Medium|| |1103|Distribute Candies to People||63.6%|Easy|| |1104|Path In Zigzag Labelled Binary Tree||73.0%|Medium|| |1105|Filling Bookcase Shelves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1105.Filling-Bookcase-Shelves)|57.8%|Medium|| @@ -1252,7 +1252,7 @@ |1112|Highest Grade For Each Student||71.7%|Medium|| |1113|Reported Posts||65.4%|Easy|| |1114|Print in Order||66.9%|Easy|| -|1115|Print FooBar Alternately||59.1%|Medium|| +|1115|Print FooBar Alternately||59.0%|Medium|| |1116|Print Zero Even Odd||57.6%|Medium|| |1117|Building H2O||53.1%|Medium|| |1118|Number of Days in a Month||57.5%|Easy|| @@ -1267,27 +1267,27 @@ |1127|User Purchase Platform||50.3%|Hard|| |1128|Number of Equivalent Domino Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1128.Number-of-Equivalent-Domino-Pairs)|46.6%|Easy|| |1129|Shortest Path with Alternating Colors||40.1%|Medium|| -|1130|Minimum Cost Tree From Leaf Values||67.1%|Medium|| +|1130|Minimum Cost Tree From Leaf Values||67.2%|Medium|| |1131|Maximum of Absolute Value Expression||52.1%|Medium|| |1132|Reported Posts II||34.6%|Medium|| |1133|Largest Unique Number||67.2%|Easy|| |1134|Armstrong Number||78.2%|Easy|| |1135|Connecting Cities With Minimum Cost||59.0%|Medium|| -|1136|Parallel Courses||61.2%|Hard|| +|1136|Parallel Courses||61.3%|Hard|| |1137|N-th Tribonacci Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1137.N-th-Tribonacci-Number)|56.1%|Easy|| |1138|Alphabet Board Path||50.6%|Medium|| |1139|Largest 1-Bordered Square||48.5%|Medium|| |1140|Stone Game II||64.8%|Medium|| -|1141|User Activity for the Past 30 Days I||54.3%|Easy|| +|1141|User Activity for the Past 30 Days I||54.4%|Easy|| |1142|User Activity for the Past 30 Days II||35.3%|Easy|| |1143|Longest Common Subsequence||58.6%|Medium|| |1144|Decrease Elements To Make Array Zigzag||46.0%|Medium|| |1145|Binary Tree Coloring Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1145.Binary-Tree-Coloring-Game)|51.4%|Medium|| |1146|Snapshot Array||36.8%|Medium|| |1147|Longest Chunked Palindrome Decomposition||59.4%|Hard|| -|1148|Article Views I||76.9%|Easy|| +|1148|Article Views I||77.0%|Easy|| |1149|Article Views II||48.4%|Medium|| -|1150|Check If a Number Is Majority Element in a Sorted Array||58.0%|Easy|| +|1150|Check If a Number Is Majority Element in a Sorted Array||57.9%|Easy|| |1151|Minimum Swaps to Group All 1's Together||58.2%|Medium|| |1152|Analyze User Website Visit Pattern||43.4%|Medium|| |1153|String Transforms Into Another String||36.0%|Hard|| @@ -1301,7 +1301,7 @@ |1161|Maximum Level Sum of a Binary Tree||70.1%|Medium|| |1162|As Far from Land as Possible||44.9%|Medium|| |1163|Last Substring in Lexicographical Order||36.3%|Hard|| -|1164|Product Price at a Given Date||67.9%|Medium|| +|1164|Product Price at a Given Date||68.0%|Medium|| |1165|Single-Row Keyboard||84.7%|Easy|| |1166|Design File System||58.2%|Medium|| |1167|Minimum Cost to Connect Sticks||64.1%|Medium|| @@ -1311,47 +1311,47 @@ |1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List)|41.4%|Medium|| |1172|Dinner Plate Stacks||37.8%|Hard|| |1173|Immediate Food Delivery I||82.2%|Easy|| -|1174|Immediate Food Delivery II||60.9%|Medium|| +|1174|Immediate Food Delivery II||61.0%|Medium|| |1175|Prime Arrangements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1175.Prime-Arrangements)|51.8%|Easy|| |1176|Diet Plan Performance||54.0%|Easy|| -|1177|Can Make Palindrome from Substring||36.0%|Medium|| +|1177|Can Make Palindrome from Substring||36.1%|Medium|| |1178|Number of Valid Words for Each Puzzle||38.5%|Hard|| -|1179|Reformat Department Table||82.1%|Easy|| +|1179|Reformat Department Table||82.0%|Easy|| |1180|Count Substrings with Only One Distinct Letter||77.5%|Easy|| |1181|Before and After Puzzle||44.5%|Medium|| |1182|Shortest Distance to Target Color||53.4%|Medium|| |1183|Maximum Number of Ones||56.7%|Hard|| |1184|Distance Between Bus Stops|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1184.Distance-Between-Bus-Stops)|54.2%|Easy|| |1185|Day of the Week|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week)|62.0%|Easy|| -|1186|Maximum Subarray Sum with One Deletion||38.5%|Medium|| -|1187|Make Array Strictly Increasing||41.6%|Hard|| -|1188|Design Bounded Blocking Queue||72.7%|Medium|| +|1186|Maximum Subarray Sum with One Deletion||38.4%|Medium|| +|1187|Make Array Strictly Increasing||41.7%|Hard|| +|1188|Design Bounded Blocking Queue||72.6%|Medium|| |1189|Maximum Number of Balloons|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1189.Maximum-Number-of-Balloons)|61.8%|Easy|| |1190|Reverse Substrings Between Each Pair of Parentheses||64.0%|Medium|| -|1191|K-Concatenation Maximum Sum||25.4%|Medium|| +|1191|K-Concatenation Maximum Sum||25.5%|Medium|| |1192|Critical Connections in a Network||49.8%|Hard|| |1193|Monthly Transactions I||69.0%|Medium|| |1194|Tournament Winners||52.1%|Hard|| |1195|Fizz Buzz Multithreaded||70.4%|Medium|| -|1196|How Many Apples Can You Put into the Basket||68.1%|Easy|| -|1197|Minimum Knight Moves||37.0%|Medium|| -|1198|Find Smallest Common Element in All Rows||75.3%|Medium|| +|1196|How Many Apples Can You Put into the Basket||68.2%|Easy|| +|1197|Minimum Knight Moves||37.1%|Medium|| +|1198|Find Smallest Common Element in All Rows||75.2%|Medium|| |1199|Minimum Time to Build Blocks||38.4%|Hard|| |1200|Minimum Absolute Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1200.Minimum-Absolute-Difference)|66.8%|Easy|| |1201|Ugly Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1201.Ugly-Number-III)|26.4%|Medium|| |1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|48.3%|Medium|| |1203|Sort Items by Groups Respecting Dependencies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies)|49.0%|Hard|| |1204|Last Person to Fit in the Elevator||71.4%|Medium|| -|1205|Monthly Transactions II||46.1%|Medium|| +|1205|Monthly Transactions II||46.0%|Medium|| |1206|Design Skiplist||58.9%|Hard|| |1207|Unique Number of Occurrences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1207.Unique-Number-of-Occurrences)|71.6%|Easy|| |1208|Get Equal Substrings Within Budget|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1208.Get-Equal-Substrings-Within-Budget)|43.6%|Medium|| -|1209|Remove All Adjacent Duplicates in String II||57.5%|Medium|| +|1209|Remove All Adjacent Duplicates in String II||57.4%|Medium|| |1210|Minimum Moves to Reach Target with Rotations||46.2%|Hard|| -|1211|Queries Quality and Percentage||70.0%|Easy|| +|1211|Queries Quality and Percentage||69.9%|Easy|| |1212|Team Scores in Football Tournament||56.7%|Medium|| |1213|Intersection of Three Sorted Arrays||79.2%|Easy|| -|1214|Two Sum BSTs||67.7%|Medium|| +|1214|Two Sum BSTs||67.8%|Medium|| |1215|Stepping Numbers||43.1%|Medium|| |1216|Valid Palindrome III||49.5%|Hard|| |1217|Minimum Cost to Move Chips to The Same Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position)|71.2%|Easy|| @@ -1360,30 +1360,30 @@ |1220|Count Vowels Permutation||54.2%|Hard|| |1221|Split a String in Balanced Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1221.Split-a-String-in-Balanced-Strings)|84.0%|Easy|| |1222|Queens That Can Attack the King||69.3%|Medium|| -|1223|Dice Roll Simulation||46.6%|Medium|| -|1224|Maximum Equal Frequency||34.5%|Hard|| +|1223|Dice Roll Simulation||46.7%|Medium|| +|1224|Maximum Equal Frequency||34.4%|Hard|| |1225|Report Contiguous Dates||62.4%|Hard|| -|1226|The Dining Philosophers||58.3%|Medium|| +|1226|The Dining Philosophers||58.5%|Medium|| |1227|Airplane Seat Assignment Probability||62.0%|Medium|| |1228|Missing Number In Arithmetic Progression||51.7%|Easy|| |1229|Meeting Scheduler||54.2%|Medium|| |1230|Toss Strange Coins||49.8%|Medium|| |1231|Divide Chocolate||53.4%|Hard|| |1232|Check If It Is a Straight Line|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1232.Check-If-It-Is-a-Straight-Line)|43.9%|Easy|| -|1233|Remove Sub-Folders from the Filesystem||61.6%|Medium|| -|1234|Replace the Substring for Balanced String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1234.Replace-the-Substring-for-Balanced-String)|34.3%|Medium|| +|1233|Remove Sub-Folders from the Filesystem||61.7%|Medium|| +|1234|Replace the Substring for Balanced String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1234.Replace-the-Substring-for-Balanced-String)|34.4%|Medium|| |1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|46.9%|Hard|| |1236|Web Crawler||64.5%|Medium|| |1237|Find Positive Integer Solution for a Given Equation||69.7%|Easy|| |1238|Circular Permutation in Binary Representation||65.8%|Medium|| |1239|Maximum Length of a Concatenated String with Unique Characters||49.2%|Medium|| |1240|Tiling a Rectangle with the Fewest Squares||52.4%|Hard|| -|1241|Number of Comments per Post||67.5%|Easy|| +|1241|Number of Comments per Post||67.6%|Easy|| |1242|Web Crawler Multithreaded||47.9%|Medium|| |1243|Array Transformation||50.3%|Easy|| -|1244|Design A Leaderboard||65.7%|Medium|| +|1244|Design A Leaderboard||65.8%|Medium|| |1245|Tree Diameter||61.2%|Medium|| -|1246|Palindrome Removal||45.7%|Hard|| +|1246|Palindrome Removal||45.8%|Hard|| |1247|Minimum Swaps to Make Strings Equal||62.3%|Medium|| |1248|Count Number of Nice Subarrays||56.4%|Medium|| |1249|Minimum Remove to Make Valid Parentheses||63.5%|Medium|| @@ -1391,14 +1391,14 @@ |1251|Average Selling Price||82.5%|Easy|| |1252|Cells with Odd Values in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix)|78.5%|Easy|| |1253|Reconstruct a 2-Row Binary Matrix||41.4%|Medium|| -|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|61.5%|Medium|| +|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|61.4%|Medium|| |1255|Maximum Score Words Formed by Letters||69.8%|Hard|| |1256|Encode Number||67.4%|Medium|| |1257|Smallest Common Region||60.3%|Medium|| -|1258|Synonymous Sentences||65.3%|Medium|| +|1258|Synonymous Sentences||65.2%|Medium|| |1259|Handshakes That Don't Cross||54.1%|Hard|| |1260|Shift 2D Grid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1260.Shift-2D-Grid)|61.8%|Easy|| -|1261|Find Elements in a Contaminated Binary Tree||74.4%|Medium|| +|1261|Find Elements in a Contaminated Binary Tree||74.5%|Medium|| |1262|Greatest Sum Divisible by Three||49.2%|Medium|| |1263|Minimum Moves to Move a Box to Their Target Location||42.8%|Hard|| |1264|Page Recommendations||69.1%|Medium|| @@ -1421,7 +1421,7 @@ |1281|Subtract the Product and Sum of Digits of an Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer)|85.6%|Easy|| |1282|Group the People Given the Group Size They Belong To||84.3%|Medium|| |1283|Find the Smallest Divisor Given a Threshold|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold)|49.1%|Medium|| -|1284|Minimum Number of Flips to Convert Binary Matrix to Zero Matrix||70.0%|Hard|| +|1284|Minimum Number of Flips to Convert Binary Matrix to Zero Matrix||70.1%|Hard|| |1285|Find the Start and End Number of Continuous Ranges||86.7%|Medium|| |1286|Iterator for Combination||70.9%|Medium|| |1287|Element Appearing More Than 25% In Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1287.Element-Appearing-More-Than-25%-In-Sorted-Array)|60.2%|Easy|| @@ -1431,10 +1431,10 @@ |1291|Sequential Digits||57.4%|Medium|| |1292|Maximum Side Length of a Square with Sum Less than or Equal to Threshold||50.5%|Medium|| |1293|Shortest Path in a Grid with Obstacles Elimination||42.9%|Hard|| -|1294|Weather Type in Each Country||66.0%|Easy|| +|1294|Weather Type in Each Country||66.1%|Easy|| |1295|Find Numbers with Even Number of Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits)|79.4%|Easy|| |1296|Divide Array in Sets of K Consecutive Numbers||55.3%|Medium|| -|1297|Maximum Number of Occurrences of a Substring||49.3%|Medium|| +|1297|Maximum Number of Occurrences of a Substring||49.2%|Medium|| |1298|Maximum Candies You Can Get from Boxes||59.6%|Hard|| |1299|Replace Elements with Greatest Element on Right Side|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side)|74.1%|Easy|| |1300|Sum of Mutated Array Closest to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target)|43.3%|Medium|| @@ -1446,7 +1446,7 @@ |1306|Jump Game III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1306.Jump-Game-III)|62.6%|Medium|| |1307|Verbal Arithmetic Puzzle||37.2%|Hard|| |1308|Running Total for Different Genders||87.1%|Medium|| -|1309|Decrypt String from Alphabet to Integer Mapping||77.2%|Easy|| +|1309|Decrypt String from Alphabet to Integer Mapping||77.3%|Easy|| |1310|XOR Queries of a Subarray||69.2%|Medium|| |1311|Get Watched Videos by Your Friends||44.1%|Medium|| |1312|Minimum Insertion Steps to Make a String Palindrome||59.2%|Hard|| @@ -1454,27 +1454,27 @@ |1314|Matrix Block Sum||73.7%|Medium|| |1315|Sum of Nodes with Even-Valued Grandparent||84.1%|Medium|| |1316|Distinct Echo Substrings||49.6%|Hard|| -|1317|Convert Integer to the Sum of Two No-Zero Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers)|56.9%|Easy|| +|1317|Convert Integer to the Sum of Two No-Zero Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers)|56.8%|Easy|| |1318|Minimum Flips to Make a OR b Equal to c||63.7%|Medium|| |1319|Number of Operations to Make Network Connected||54.7%|Medium|| |1320|Minimum Distance to Type a Word Using Two Fingers||62.8%|Hard|| -|1321|Restaurant Growth||70.4%|Medium|| -|1322|Ads Performance||57.9%|Easy|| +|1321|Restaurant Growth||70.5%|Medium|| +|1322|Ads Performance||57.8%|Easy|| |1323|Maximum 69 Number||78.0%|Easy|| |1324|Print Words Vertically||58.6%|Medium|| |1325|Delete Leaves With a Given Value||73.5%|Medium|| |1326|Minimum Number of Taps to Open to Water a Garden||46.1%|Hard|| |1327|List the Products Ordered in a Period||77.5%|Easy|| -|1328|Break a Palindrome||45.5%|Medium|| +|1328|Break a Palindrome||45.6%|Medium|| |1329|Sort the Matrix Diagonally||79.4%|Medium|| |1330|Reverse Subarray To Maximize Array Value||36.4%|Hard|| |1331|Rank Transform of an Array||57.7%|Easy|| |1332|Remove Palindromic Subsequences||62.8%|Easy|| |1333|Filter Restaurants by Vegan-Friendly, Price and Distance||57.0%|Medium|| -|1334|Find the City With the Smallest Number of Neighbors at a Threshold Distance||46.5%|Medium|| -|1335|Minimum Difficulty of a Job Schedule||57.2%|Hard|| -|1336|Number of Transactions per Visit||47.4%|Hard|| -|1337|The K Weakest Rows in a Matrix||69.7%|Easy|| +|1334|Find the City With the Smallest Number of Neighbors at a Threshold Distance||46.6%|Medium|| +|1335|Minimum Difficulty of a Job Schedule||57.3%|Hard|| +|1336|Number of Transactions per Visit||47.3%|Hard|| +|1337|The K Weakest Rows in a Matrix||69.6%|Easy|| |1338|Reduce Array Size to The Half||66.7%|Medium|| |1339|Maximum Product of Splitted Binary Tree||37.9%|Medium|| |1340|Jump Game V||58.9%|Hard|| @@ -1484,22 +1484,22 @@ |1344|Angle Between Hands of a Clock||61.3%|Medium|| |1345|Jump Game IV||41.9%|Hard|| |1346|Check If N and Its Double Exist||36.5%|Easy|| -|1347|Minimum Number of Steps to Make Two Strings Anagram||75.4%|Medium|| +|1347|Minimum Number of Steps to Make Two Strings Anagram||75.3%|Medium|| |1348|Tweet Counts Per Frequency||33.8%|Medium|| |1349|Maximum Students Taking Exam||44.0%|Hard|| -|1350|Students With Invalid Departments||90.5%|Easy|| +|1350|Students With Invalid Departments||90.6%|Easy|| |1351|Count Negative Numbers in a Sorted Matrix||75.8%|Easy|| -|1352|Product of the Last K Numbers||43.7%|Medium|| +|1352|Product of the Last K Numbers||43.8%|Medium|| |1353|Maximum Number of Events That Can Be Attended||30.1%|Medium|| |1354|Construct Target Array With Multiple Sums||31.3%|Hard|| -|1355|Activity Participants||74.0%|Medium|| +|1355|Activity Participants||74.1%|Medium|| |1356|Sort Integers by The Number of 1 Bits||69.6%|Easy|| |1357|Apply Discount Every n Orders||66.6%|Medium|| |1358|Number of Substrings Containing All Three Characters||60.3%|Medium|| |1359|Count All Valid Pickup and Delivery Options||56.9%|Hard|| |1360|Number of Days Between Two Dates||46.9%|Easy|| |1361|Validate Binary Tree Nodes||44.3%|Medium|| -|1362|Closest Divisors||57.6%|Medium|| +|1362|Closest Divisors||57.5%|Medium|| |1363|Largest Multiple of Three||33.9%|Hard|| |1364|Number of Trusted Contacts of a Customer||77.9%|Medium|| |1365|How Many Numbers Are Smaller Than the Current Number||85.9%|Easy|| @@ -1507,7 +1507,7 @@ |1367|Linked List in Binary Tree||41.1%|Medium|| |1368|Minimum Cost to Make at Least One Valid Path in a Grid||56.8%|Hard|| |1369|Get the Second Most Recent Activity||68.5%|Hard|| -|1370|Increasing Decreasing String||76.3%|Easy|| +|1370|Increasing Decreasing String||76.4%|Easy|| |1371|Find the Longest Substring Containing Vowels in Even Counts||61.3%|Medium|| |1372|Longest ZigZag Path in a Binary Tree||54.6%|Medium|| |1373|Maximum Sum BST in Binary Tree||37.6%|Hard|| @@ -1521,22 +1521,22 @@ |1381|Design a Stack With Increment Operation||75.8%|Medium|| |1382|Balance a Binary Search Tree||76.0%|Medium|| |1383|Maximum Performance of a Team||35.1%|Hard|| -|1384|Total Sales Amount by Year||64.0%|Hard|| +|1384|Total Sales Amount by Year||64.1%|Hard|| |1385|Find the Distance Value Between Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays)|66.4%|Easy|| |1386|Cinema Seat Allocation||35.5%|Medium|| |1387|Sort Integers by The Power Value||70.5%|Medium|| -|1388|Pizza With 3n Slices||45.3%|Hard|| +|1388|Pizza With 3n Slices||45.4%|Hard|| |1389|Create Target Array in the Given Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1389.Create-Target-Array-in-the-Given-Order)|84.8%|Easy|| |1390|Four Divisors||39.0%|Medium|| |1391|Check if There is a Valid Path in a Grid||44.9%|Medium|| |1392|Longest Happy Prefix||41.3%|Hard|| |1393|Capital Gain/Loss||90.6%|Medium|| |1394|Find Lucky Integer in an Array||63.2%|Easy|| -|1395|Count Number of Teams||81.8%|Medium|| +|1395|Count Number of Teams||81.7%|Medium|| |1396|Design Underground System||68.8%|Medium|| -|1397|Find All Good Strings||38.0%|Hard|| -|1398|Customers Who Bought Products A and B but Not C||82.0%|Medium|| -|1399|Count Largest Group||65.4%|Easy|| +|1397|Find All Good Strings||38.1%|Hard|| +|1398|Customers Who Bought Products A and B but Not C||82.1%|Medium|| +|1399|Count Largest Group||65.3%|Easy|| |1400|Construct K Palindrome Strings||62.8%|Medium|| |1401|Circle and Rectangle Overlapping||42.3%|Medium|| |1402|Reducing Dishes||72.3%|Hard|| @@ -1549,7 +1549,7 @@ |1409|Queries on a Permutation With Key||81.4%|Medium|| |1410|HTML Entity Parser||54.4%|Medium|| |1411|Number of Ways to Paint N × 3 Grid||60.4%|Hard|| -|1412|Find the Quiet Students in All Exams||65.5%|Hard|| +|1412|Find the Quiet Students in All Exams||65.6%|Hard|| |1413|Minimum Value to Get Positive Step by Step Sum||65.3%|Easy|| |1414|Find the Minimum Number of Fibonacci Numbers Whose Sum Is K||63.8%|Medium|| |1415|The k-th Lexicographical String of All Happy Strings of Length n||70.0%|Medium|| @@ -1558,19 +1558,19 @@ |1418|Display Table of Food Orders in a Restaurant||68.2%|Medium|| |1419|Minimum Number of Frogs Croaking||47.2%|Medium|| |1420|Build Array Where You Can Find The Maximum Exactly K Comparisons||64.3%|Hard|| -|1421|NPV Queries||81.7%|Medium|| -|1422|Maximum Score After Splitting a String||56.0%|Easy|| -|1423|Maximum Points You Can Obtain from Cards||46.2%|Medium|| -|1424|Diagonal Traverse II||45.4%|Medium|| +|1421|NPV Queries||81.8%|Medium|| +|1422|Maximum Score After Splitting a String||56.1%|Easy|| +|1423|Maximum Points You Can Obtain from Cards||46.3%|Medium|| +|1424|Diagonal Traverse II||45.5%|Medium|| |1425|Constrained Subsequence Sum||44.9%|Hard|| |1426|Counting Elements||59.0%|Easy|| |1427|Perform String Shifts||53.4%|Easy|| |1428|Leftmost Column with at Least a One||48.8%|Medium|| -|1429|First Unique Number||49.0%|Medium|| +|1429|First Unique Number||49.1%|Medium|| |1430|Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree||45.1%|Medium|| |1431|Kids With the Greatest Number of Candies||88.6%|Easy|| |1432|Max Difference You Can Get From Changing an Integer||42.9%|Medium|| -|1433|Check If a String Can Break Another String||67.0%|Medium|| +|1433|Check If a String Can Break Another String||66.9%|Medium|| |1434|Number of Ways to Wear Different Hats to Each Other||39.2%|Hard|| |1435|Create a Session Bar Chart||77.8%|Easy|| |1436|Destination City||77.1%|Easy|| @@ -1578,7 +1578,7 @@ |1438|Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit||43.9%|Medium|| |1439|Find the Kth Smallest Sum of a Matrix With Sorted Rows||59.9%|Hard|| |1440|Evaluate Boolean Expression||74.5%|Medium|| -|1441|Build an Array With Stack Operations||69.0%|Easy|| +|1441|Build an Array With Stack Operations||69.1%|Easy|| |1442|Count Triplets That Can Form Two Arrays of Equal XOR||70.9%|Medium|| |1443|Minimum Time to Collect All Apples in a Tree||54.6%|Medium|| |1444|Number of Ways of Cutting a Pizza||53.7%|Hard|| @@ -1596,11 +1596,11 @@ |1456|Maximum Number of Vowels in a Substring of Given Length||54.3%|Medium|| |1457|Pseudo-Palindromic Paths in a Binary Tree||71.4%|Medium|| |1458|Max Dot Product of Two Subsequences||42.9%|Hard|| -|1459|Rectangles Area||64.3%|Medium|| +|1459|Rectangles Area||64.2%|Medium|| |1460|Make Two Arrays Equal by Reversing Sub-arrays||72.1%|Easy|| |1461|Check If a String Contains All Binary Codes of Size K||46.9%|Medium|| |1462|Course Schedule IV||44.3%|Medium|| -|1463|Cherry Pickup II||69.4%|Hard|| +|1463|Cherry Pickup II||69.5%|Hard|| |1464|Maximum Product of Two Elements in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array)|76.9%|Easy|| |1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.7%|Medium|| |1466|Reorder Routes to Make All Paths Lead to the City Zero||61.3%|Medium|| @@ -1609,9 +1609,9 @@ |1469|Find All The Lonely Nodes||80.5%|Easy|| |1470|Shuffle the Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1470.Shuffle-the-Array)|88.5%|Easy|| |1471|The k Strongest Values in an Array||58.4%|Medium|| -|1472|Design Browser History||70.2%|Medium|| -|1473|Paint House III||48.7%|Hard|| -|1474|Delete N Nodes After M Nodes of a Linked List||74.6%|Easy|| +|1472|Design Browser History||70.3%|Medium|| +|1473|Paint House III||48.8%|Hard|| +|1474|Delete N Nodes After M Nodes of a Linked List||74.7%|Easy|| |1475|Final Prices With a Special Discount in a Shop||74.7%|Easy|| |1476|Subrectangle Queries||88.6%|Medium|| |1477|Find Two Non-overlapping Sub-arrays Each With Target Sum||34.1%|Medium|| @@ -1620,7 +1620,7 @@ |1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|89.6%|Easy|| |1481|Least Number of Unique Integers after K Removals||55.5%|Medium|| |1482|Minimum Number of Days to Make m Bouquets||49.7%|Medium|| -|1483|Kth Ancestor of a Tree Node||30.2%|Hard|| +|1483|Kth Ancestor of a Tree Node||30.3%|Hard|| |1484|Group Sold Products By The Date||86.0%|Easy|| |1485|Clone Binary Tree With Random Pointer||79.5%|Medium|| |1486|XOR Operation in an Array||84.0%|Easy|| @@ -1628,13 +1628,13 @@ |1488|Avoid Flood in The City||24.7%|Medium|| |1489|Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree||52.3%|Hard|| |1490|Clone N-ary Tree||83.4%|Medium|| -|1491|Average Salary Excluding the Minimum and Maximum Salary||68.5%|Easy|| +|1491|Average Salary Excluding the Minimum and Maximum Salary||68.4%|Easy|| |1492|The kth Factor of n||63.4%|Medium|| |1493|Longest Subarray of 1's After Deleting One Element||58.2%|Medium|| -|1494|Parallel Courses II||31.3%|Hard|| +|1494|Parallel Courses II||31.2%|Hard|| |1495|Friendly Movies Streamed Last Month||51.3%|Easy|| -|1496|Path Crossing||55.4%|Easy|| -|1497|Check If Array Pairs Are Divisible by k||40.6%|Medium|| +|1496|Path Crossing||55.5%|Easy|| +|1497|Check If Array Pairs Are Divisible by k||40.5%|Medium|| |1498|Number of Subsequences That Satisfy the Given Sum Condition||38.2%|Medium|| |1499|Max Value of Equation||45.2%|Hard|| |1500|Design a File Sharing System||46.0%|Medium|| @@ -1645,26 +1645,26 @@ |1505|Minimum Possible Integer After at Most K Adjacent Swaps On Digits||36.2%|Hard|| |1506|Find Root of N-Ary Tree||80.8%|Medium|| |1507|Reformat Date||60.3%|Easy|| -|1508|Range Sum of Sorted Subarray Sums||62.1%|Medium|| +|1508|Range Sum of Sorted Subarray Sums||62.0%|Medium|| |1509|Minimum Difference Between Largest and Smallest Value in Three Moves||51.8%|Medium|| -|1510|Stone Game IV||58.7%|Hard|| +|1510|Stone Game IV||58.8%|Hard|| |1511|Customer Order Frequency||73.2%|Easy|| |1512|Number of Good Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1512.Number-of-Good-Pairs)|87.9%|Easy|| |1513|Number of Substrings With Only 1s||41.4%|Medium|| -|1514|Path with Maximum Probability||39.3%|Medium|| -|1515|Best Position for a Service Centre||36.9%|Hard|| +|1514|Path with Maximum Probability||39.4%|Medium|| +|1515|Best Position for a Service Centre||37.0%|Hard|| |1516|Move Sub-Tree of N-Ary Tree||62.8%|Hard|| -|1517|Find Users With Valid E-Mails||71.8%|Easy|| +|1517|Find Users With Valid E-Mails||71.9%|Easy|| |1518|Water Bottles||60.7%|Easy|| |1519|Number of Nodes in the Sub-Tree With the Same Label||36.8%|Medium|| |1520|Maximum Number of Non-Overlapping Substrings||35.9%|Hard|| |1521|Find a Value of a Mysterious Function Closest to Target||44.4%|Hard|| |1522|Diameter of N-Ary Tree||68.8%|Medium|| -|1523|Count Odd Numbers in an Interval Range||55.2%|Easy|| +|1523|Count Odd Numbers in an Interval Range||55.1%|Easy|| |1524|Number of Sub-arrays With Odd Sum||39.5%|Medium|| |1525|Number of Good Ways to Split a String||66.9%|Medium|| |1526|Minimum Number of Increments on Subarrays to Form a Target Array||59.7%|Hard|| -|1527|Patients With a Condition||76.4%|Easy|| +|1527|Patients With a Condition||76.1%|Easy|| |1528|Shuffle String||85.8%|Easy|| |1529|Bulb Switcher IV||70.8%|Medium|| |1530|Number of Good Leaf Nodes Pairs||55.8%|Medium|| @@ -1672,51 +1672,51 @@ |1532|The Most Recent Three Orders||73.0%|Medium|| |1533|Find the Index of the Large Integer||54.7%|Medium|| |1534|Count Good Triplets||80.2%|Easy|| -|1535|Find the Winner of an Array Game||47.1%|Medium|| +|1535|Find the Winner of an Array Game||47.2%|Medium|| |1536|Minimum Swaps to Arrange a Binary Grid||43.1%|Medium|| |1537|Get the Maximum Score||36.3%|Hard|| |1538|Guess the Majority in a Hidden Array||61.4%|Medium|| -|1539|Kth Missing Positive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1539.Kth-Missing-Positive-Number)|55.5%|Easy|| +|1539|Kth Missing Positive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1539.Kth-Missing-Positive-Number)|55.4%|Easy|| |1540|Can Convert String in K Moves||30.5%|Medium|| |1541|Minimum Insertions to Balance a Parentheses String||42.4%|Medium|| |1542|Find Longest Awesome Substring||36.5%|Hard|| |1543|Fix Product Name Format||68.0%|Easy|| |1544|Make The String Great||55.1%|Easy|| -|1545|Find Kth Bit in Nth Binary String||57.3%|Medium|| +|1545|Find Kth Bit in Nth Binary String||57.2%|Medium|| |1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||43.7%|Medium|| |1547|Minimum Cost to Cut a Stick||52.0%|Hard|| -|1548|The Most Similar Path in a Graph||54.2%|Hard|| +|1548|The Most Similar Path in a Graph||54.1%|Hard|| |1549|The Most Recent Orders for Each Product||66.2%|Medium|| |1550|Three Consecutive Odds||65.3%|Easy|| |1551|Minimum Operations to Make Array Equal||77.8%|Medium|| |1552|Magnetic Force Between Two Balls||48.6%|Medium|| |1553|Minimum Number of Days to Eat N Oranges||29.1%|Hard|| -|1554|Strings Differ by One Character||63.5%|Medium|| -|1555|Bank Account Summary||52.6%|Medium|| +|1554|Strings Differ by One Character||63.6%|Medium|| +|1555|Bank Account Summary||52.7%|Medium|| |1556|Thousand Separator||58.2%|Easy|| |1557|Minimum Number of Vertices to Reach All Nodes||75.3%|Medium|| |1558|Minimum Numbers of Function Calls to Make Target Array||62.5%|Medium|| |1559|Detect Cycles in 2D Grid||44.7%|Hard|| -|1560|Most Visited Sector in a Circular Track||57.1%|Easy|| -|1561|Maximum Number of Coins You Can Get||78.1%|Medium|| -|1562|Find Latest Group of Size M||39.4%|Medium|| +|1560|Most Visited Sector in a Circular Track||57.0%|Easy|| +|1561|Maximum Number of Coins You Can Get||78.0%|Medium|| +|1562|Find Latest Group of Size M||39.3%|Medium|| |1563|Stone Game V||40.0%|Hard|| -|1564|Put Boxes Into the Warehouse I||66.2%|Medium|| -|1565|Unique Orders and Customers Per Month||83.8%|Easy|| +|1564|Put Boxes Into the Warehouse I||66.1%|Medium|| +|1565|Unique Orders and Customers Per Month||83.9%|Easy|| |1566|Detect Pattern of Length M Repeated K or More Times||42.3%|Easy|| |1567|Maximum Length of Subarray With Positive Product||36.4%|Medium|| |1568|Minimum Number of Days to Disconnect Island||50.4%|Hard|| |1569|Number of Ways to Reorder Array to Get Same BST||50.0%|Hard|| -|1570|Dot Product of Two Sparse Vectors||91.5%|Medium|| +|1570|Dot Product of Two Sparse Vectors||91.4%|Medium|| |1571|Warehouse Manager||89.9%|Easy|| |1572|Matrix Diagonal Sum||78.2%|Easy|| |1573|Number of Ways to Split a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1573.Number-of-Ways-to-Split-a-String)|30.8%|Medium|| -|1574|Shortest Subarray to be Removed to Make Array Sorted||33.0%|Medium|| +|1574|Shortest Subarray to be Removed to Make Array Sorted||32.9%|Medium|| |1575|Count All Possible Routes||57.5%|Hard|| |1576|Replace All ?'s to Avoid Consecutive Repeating Characters||48.1%|Easy|| |1577|Number of Ways Where Square of Number Is Equal to Product of Two Numbers||37.2%|Medium|| |1578|Minimum Deletion Cost to Avoid Repeating Letters||60.3%|Medium|| -|1579|Remove Max Number of Edges to Keep Graph Fully Traversable||45.8%|Hard|| +|1579|Remove Max Number of Edges to Keep Graph Fully Traversable||45.7%|Hard|| |1580|Put Boxes Into the Warehouse II||62.2%|Medium|| |1581|Customer Who Visited but Did Not Make Any Transactions||90.2%|Easy|| |1582|Special Positions in a Binary Matrix||64.2%|Easy|| @@ -1724,19 +1724,19 @@ |1584|Min Cost to Connect All Points||50.2%|Medium|| |1585|Check If String Is Transformable With Substring Sort Operations||48.3%|Hard|| |1586|Binary Search Tree Iterator II||66.5%|Medium|| -|1587|Bank Account Summary II||90.2%|Easy|| -|1588|Sum of All Odd Length Subarrays||82.1%|Easy|| +|1587|Bank Account Summary II||90.3%|Easy|| +|1588|Sum of All Odd Length Subarrays||82.0%|Easy|| |1589|Maximum Sum Obtained of Any Permutation||34.6%|Medium|| -|1590|Make Sum Divisible by P||27.2%|Medium|| +|1590|Make Sum Divisible by P||27.3%|Medium|| |1591|Strange Printer II||55.4%|Hard|| |1592|Rearrange Spaces Between Words||43.8%|Easy|| |1593|Split a String Into the Max Number of Unique Substrings||48.3%|Medium|| |1594|Maximum Non Negative Product in a Matrix||31.9%|Medium|| |1595|Minimum Cost to Connect Two Groups of Points||42.7%|Hard|| |1596|The Most Frequently Ordered Products for Each Customer||84.4%|Medium|| -|1597|Build Binary Expression Tree From Infix Expression||65.4%|Hard|| +|1597|Build Binary Expression Tree From Infix Expression||65.3%|Hard|| |1598|Crawler Log Folder||64.3%|Easy|| -|1599|Maximum Profit of Operating a Centennial Wheel||43.4%|Medium|| +|1599|Maximum Profit of Operating a Centennial Wheel||43.5%|Medium|| |1600|Throne Inheritance||59.8%|Medium|| |1601|Maximum Number of Achievable Transfer Requests||47.4%|Hard|| |1602|Find Nearest Right Node in Binary Tree||74.1%|Medium|| @@ -1744,16 +1744,16 @@ |1604|Alert Using Same Key-Card Three or More Times in a One Hour Period||42.1%|Medium|| |1605|Find Valid Matrix Given Row and Column Sums||77.7%|Medium|| |1606|Find Servers That Handled Most Number of Requests||36.8%|Hard|| -|1607|Sellers With No Sales||56.0%|Easy|| +|1607|Sellers With No Sales||56.1%|Easy|| |1608|Special Array With X Elements Greater Than or Equal X||61.8%|Easy|| |1609|Even Odd Tree||53.2%|Medium|| |1610|Maximum Number of Visible Points||28.5%|Hard|| -|1611|Minimum One Bit Operations to Make Integers Zero||57.0%|Hard|| -|1612|Check If Two Expression Trees are Equivalent||69.8%|Medium|| -|1613|Find the Missing IDs||72.1%|Medium|| -|1614|Maximum Nesting Depth of the Parentheses||83.6%|Easy|| -|1615|Maximal Network Rank||51.7%|Medium|| -|1616|Split Two Strings to Make Palindrome||36.4%|Medium|| +|1611|Minimum One Bit Operations to Make Integers Zero||57.1%|Hard|| +|1612|Check If Two Expression Trees are Equivalent||69.9%|Medium|| +|1613|Find the Missing IDs||72.2%|Medium|| +|1614|Maximum Nesting Depth of the Parentheses||83.5%|Easy|| +|1615|Maximal Network Rank||51.8%|Medium|| +|1616|Split Two Strings to Make Palindrome||36.5%|Medium|| |1617|Count Subtrees With Max Distance Between Cities||63.5%|Hard|| |1618|Maximum Font to Fit a Sentence in a Screen||58.1%|Medium|| |1619|Mean of Array After Removing Some Elements||65.6%|Easy|| @@ -1764,103 +1764,103 @@ |1624|Largest Substring Between Two Equal Characters||59.2%|Easy|| |1625|Lexicographically Smallest String After Applying Operations||63.4%|Medium|| |1626|Best Team With No Conflicts||37.1%|Medium|| -|1627|Graph Connectivity With Threshold||38.2%|Hard|| -|1628|Design an Expression Tree With Evaluate Function||80.5%|Medium|| +|1627|Graph Connectivity With Threshold||38.3%|Hard|| +|1628|Design an Expression Tree With Evaluate Function||80.4%|Medium|| |1629|Slowest Key||59.0%|Easy|| |1630|Arithmetic Subarrays||77.7%|Medium|| -|1631|Path With Minimum Effort||43.3%|Medium|| +|1631|Path With Minimum Effort||43.4%|Medium|| |1632|Rank Transform of a Matrix||30.3%|Hard|| -|1633|Percentage of Users Attended a Contest||73.1%|Easy|| -|1634|Add Two Polynomials Represented as Linked Lists||56.0%|Medium|| -|1635|Hopper Company Queries I||56.0%|Hard|| +|1633|Percentage of Users Attended a Contest||73.2%|Easy|| +|1634|Add Two Polynomials Represented as Linked Lists||55.9%|Medium|| +|1635|Hopper Company Queries I||56.1%|Hard|| |1636|Sort Array by Increasing Frequency||66.6%|Easy|| |1637|Widest Vertical Area Between Two Points Containing No Points||83.8%|Medium|| -|1638|Count Substrings That Differ by One Character||67.8%|Medium|| +|1638|Count Substrings That Differ by One Character||67.9%|Medium|| |1639|Number of Ways to Form a Target String Given a Dictionary||39.3%|Hard|| -|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.8%|Easy|| +|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.6%|Easy|| |1641|Count Sorted Vowel Strings||74.6%|Medium|| -|1642|Furthest Building You Can Reach||51.5%|Medium|| +|1642|Furthest Building You Can Reach||51.4%|Medium|| |1643|Kth Smallest Instructions||42.8%|Hard|| -|1644|Lowest Common Ancestor of a Binary Tree II||57.5%|Medium|| -|1645|Hopper Company Queries II||41.3%|Hard|| +|1644|Lowest Common Ancestor of a Binary Tree II||57.7%|Medium|| +|1645|Hopper Company Queries II||41.2%|Hard|| |1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|48.4%|Easy|| -|1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|53.8%|Medium|| +|1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|53.9%|Medium|| |1648|Sell Diminishing-Valued Colored Balls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls)|30.9%|Medium|| -|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.5%|Hard|| +|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.4%|Hard|| |1650|Lowest Common Ancestor of a Binary Tree III||77.4%|Medium|| |1651|Hopper Company Queries III||66.8%|Hard|| |1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.4%|Easy|| -|1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.6%|Medium|| +|1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.7%|Medium|| |1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.4%|Medium|| -|1655|Distribute Repeating Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1655.Distribute-Repeating-Integers)|40.6%|Hard|| -|1656|Design an Ordered Stream|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1656.Design-an-Ordered-Stream)|82.5%|Easy|| +|1655|Distribute Repeating Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1655.Distribute-Repeating-Integers)|40.7%|Hard|| +|1656|Design an Ordered Stream|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1656.Design-an-Ordered-Stream)|82.6%|Easy|| |1657|Determine if Two Strings Are Close|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1657.Determine-if-Two-Strings-Are-Close)|51.3%|Medium|| |1658|Minimum Operations to Reduce X to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero)|30.7%|Medium|| |1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|35.1%|Hard|| -|1660|Correct a Binary Tree||78.9%|Medium|| -|1661|Average Time of Process per Machine||79.5%|Easy|| +|1660|Correct a Binary Tree||79.1%|Medium|| +|1661|Average Time of Process per Machine||79.6%|Easy|| |1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|83.8%|Easy|| |1663|Smallest String With A Given Numeric Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value)|60.1%|Medium|| |1664|Ways to Make a Fair Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1664.Ways-to-Make-a-Fair-Array)|60.6%|Medium|| -|1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|68.3%|Hard|| -|1666|Change the Root of a Binary Tree||68.7%|Medium|| -|1667|Fix Names in a Table||63.9%|Easy|| +|1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|68.2%|Hard|| +|1666|Change the Root of a Binary Tree||68.5%|Medium|| +|1667|Fix Names in a Table||64.0%|Easy|| |1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.7%|Easy|| -|1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.3%|Medium|| +|1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.4%|Medium|| |1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.6%|Medium|| |1671|Minimum Number of Removals to Make Mountain Array||45.8%|Hard|| |1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.8%|Easy|| |1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|38.1%|Medium|| |1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|34.3%|Medium|| |1675|Minimize Deviation in Array||44.9%|Hard|| -|1676|Lowest Common Ancestor of a Binary Tree IV||77.8%|Medium|| -|1677|Product's Worth Over Invoices||74.7%|Easy|| +|1676|Lowest Common Ancestor of a Binary Tree IV||77.6%|Medium|| +|1677|Product's Worth Over Invoices||74.4%|Easy|| |1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.8%|Easy|| -|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|52.0%|Medium|| +|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|51.9%|Medium|| |1680|Concatenation of Consecutive Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers)|45.1%|Medium|| -|1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|34.8%|Hard|| -|1682|Longest Palindromic Subsequence II||52.0%|Medium|| -|1683|Invalid Tweets||91.7%|Easy|| -|1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|84.3%|Easy|| +|1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|34.9%|Hard|| +|1682|Longest Palindromic Subsequence II||51.8%|Medium|| +|1683|Invalid Tweets||91.5%|Easy|| +|1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|84.2%|Easy|| |1685|Sum of Absolute Differences in a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array)|61.8%|Medium|| |1686|Stone Game VI||48.8%|Medium|| |1687|Delivering Boxes from Storage to Ports||34.7%|Hard|| -|1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|83.4%|Easy|| -|1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.4%|Medium|| +|1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|83.3%|Easy|| +|1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.2%|Medium|| |1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|46.5%|Medium|| -|1691|Maximum Height by Stacking Cuboids ||49.7%|Hard|| -|1692|Count Ways to Distribute Candies||62.7%|Hard|| +|1691|Maximum Height by Stacking Cuboids ||49.8%|Hard|| +|1692|Count Ways to Distribute Candies||62.4%|Hard|| |1693|Daily Leads and Partners||91.3%|Easy|| |1694|Reformat Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1694.Reformat-Phone-Number)|67.1%|Easy|| |1695|Maximum Erasure Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1695.Maximum-Erasure-Value)|49.5%|Medium|| -|1696|Jump Game VI||56.3%|Medium|| -|1697|Checking Existence of Edge Length Limited Paths||55.9%|Hard|| -|1698|Number of Distinct Substrings in a String||55.3%|Medium|| +|1696|Jump Game VI||56.0%|Medium|| +|1697|Checking Existence of Edge Length Limited Paths||55.8%|Hard|| +|1698|Number of Distinct Substrings in a String||55.1%|Medium|| |1699|Number of Calls Between Two Persons||85.8%|Medium|| -|1700|Number of Students Unable to Eat Lunch||70.1%|Easy|| +|1700|Number of Students Unable to Eat Lunch||70.3%|Easy|| |1701|Average Waiting Time||61.8%|Medium|| -|1702|Maximum Binary String After Change||61.9%|Medium|| -|1703|Minimum Adjacent Swaps for K Consecutive Ones||40.6%|Hard|| +|1702|Maximum Binary String After Change||61.8%|Medium|| +|1703|Minimum Adjacent Swaps for K Consecutive Ones||40.7%|Hard|| |1704|Determine if String Halves Are Alike||78.2%|Easy|| -|1705|Maximum Number of Eaten Apples||42.5%|Medium|| -|1706|Where Will the Ball Fall||58.1%|Medium|| +|1705|Maximum Number of Eaten Apples||42.4%|Medium|| +|1706|Where Will the Ball Fall||58.2%|Medium|| |1707|Maximum XOR With an Element From Array||48.5%|Hard|| -|1708|Largest Subarray Length K||64.5%|Easy|| +|1708|Largest Subarray Length K||64.4%|Easy|| |1709|Biggest Window Between Visits||81.1%|Medium|| |1710|Maximum Units on a Truck||72.3%|Easy|| -|1711|Count Good Meals||25.5%|Medium|| -|1712|Ways to Split Array Into Three Subarrays||29.8%|Medium|| -|1713|Minimum Operations to Make a Subsequence||45.3%|Hard|| -|1714|Sum Of Special Evenly-Spaced Elements In Array||44.8%|Hard|| -|1715|Count Apples and Oranges||77.2%|Medium|| -|1716|Calculate Money in Leetcode Bank||70.5%|Easy|| -|1717|Maximum Score From Removing Substrings||36.3%|Medium|| -|1718|Construct the Lexicographically Largest Valid Sequence||40.6%|Medium|| -|1719|Number Of Ways To Reconstruct A Tree||34.9%|Hard|| -|1720|Decode XORed Array||86.5%|Easy|| -|1721|Swapping Nodes in a Linked List||65.3%|Medium|| -|1722|Minimize Hamming Distance After Swap Operations||43.2%|Medium|| -|1723|Find Minimum Time to Finish All Jobs||37.8%|Hard|| +|1711|Count Good Meals||25.6%|Medium|| +|1712|Ways to Split Array Into Three Subarrays||29.9%|Medium|| +|1713|Minimum Operations to Make a Subsequence||45.4%|Hard|| +|1714|Sum Of Special Evenly-Spaced Elements In Array||45.0%|Hard|| +|1715|Count Apples and Oranges||79.3%|Medium|| +|1716|Calculate Money in Leetcode Bank||70.4%|Easy|| +|1717|Maximum Score From Removing Substrings||36.8%|Medium|| +|1718|Construct the Lexicographically Largest Valid Sequence||41.4%|Medium|| +|1719|Number Of Ways To Reconstruct A Tree||37.9%|Hard|| +|1720|Decode XORed Array||86.6%|Easy|| +|1721|Swapping Nodes in a Linked List||66.1%|Medium|| +|1722|Minimize Hamming Distance After Swap Operations||57.8%|Medium|| +|1723|Find Minimum Time to Finish All Jobs||43.7%|Hard|| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------| ------------------------------------------------------------------ diff --git a/leetcode/1018.Binary-Prefix-Divisible-By-5/1018. Binary Prefix Divisible By 5.go b/leetcode/1018.Binary-Prefix-Divisible-By-5/1018. Binary Prefix Divisible By 5.go new file mode 100644 index 00000000..8d88763f --- /dev/null +++ b/leetcode/1018.Binary-Prefix-Divisible-By-5/1018. Binary Prefix Divisible By 5.go @@ -0,0 +1,10 @@ +package leetcode + +func prefixesDivBy5(a []int) []bool { + res, num := make([]bool, len(a)), 0 + for i, v := range a { + num = (num<<1 | v) % 5 + res[i] = num == 0 + } + return res +} diff --git a/leetcode/1018.Binary-Prefix-Divisible-By-5/1018. Binary Prefix Divisible By 5_test.go b/leetcode/1018.Binary-Prefix-Divisible-By-5/1018. Binary Prefix Divisible By 5_test.go new file mode 100644 index 00000000..2903210e --- /dev/null +++ b/leetcode/1018.Binary-Prefix-Divisible-By-5/1018. Binary Prefix Divisible By 5_test.go @@ -0,0 +1,57 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1018 struct { + para1018 + ans1018 +} + +// para 是参数 +// one 代表第一个参数 +type para1018 struct { + a []int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1018 struct { + one []bool +} + +func Test_Problem1018(t *testing.T) { + + qs := []question1018{ + + { + para1018{[]int{0, 1, 1}}, + ans1018{[]bool{true, false, false}}, + }, + + { + para1018{[]int{1, 1, 1}}, + ans1018{[]bool{false, false, false}}, + }, + + { + para1018{[]int{0, 1, 1, 1, 1, 1}}, + ans1018{[]bool{true, false, false, false, true, false}}, + }, + + { + para1018{[]int{1, 1, 1, 0, 1}}, + ans1018{[]bool{false, false, false, false, false}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1018------------------------\n") + + for _, q := range qs { + _, p := q.ans1018, q.para1018 + fmt.Printf("【input】:%v 【output】:%v\n", p, prefixesDivBy5(p.a)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1018.Binary-Prefix-Divisible-By-5/README.md b/leetcode/1018.Binary-Prefix-Divisible-By-5/README.md new file mode 100644 index 00000000..5559c7e9 --- /dev/null +++ b/leetcode/1018.Binary-Prefix-Divisible-By-5/README.md @@ -0,0 +1,70 @@ +# [1018. Binary Prefix Divisible By 5](https://leetcode.com/problems/binary-prefix-divisible-by-5/) + + +## 题目 + +Given an array `A` of `0`s and `1`s, consider `N_i`: the i-th subarray from `A[0]` to `A[i]` interpreted as a binary number (from most-significant-bit to least-significant-bit.) + +Return a list of booleans `answer`, where `answer[i]` is `true` if and only if `N_i` is divisible by 5. + +**Example 1:** + +``` +Input: [0,1,1] +Output: [true,false,false] +Explanation: +The input numbers in binary are 0, 01, 011; which are 0, 1, and 3 in base-10. Only the first number is divisible by 5, so answer[0] is true. + +``` + +**Example 2:** + +``` +Input: [1,1,1] +Output: [false,false,false] + +``` + +**Example 3:** + +``` +Input: [0,1,1,1,1,1] +Output: [true,false,false,false,true,false] + +``` + +**Example 4:** + +``` +Input: [1,1,1,0,1] +Output: [false,false,false,false,false] + +``` + +**Note:** + +1. `1 <= A.length <= 30000` +2. `A[i]` is `0` or `1` + +## 题目大意 + +给定由若干 0 和 1 组成的数组 A。我们定义 N_i:从 A[0] 到 A[i] 的第 i 个子数组被解释为一个二进制数(从最高有效位到最低有效位)。返回布尔值列表 answer,只有当 N_i 可以被 5 整除时,答案 answer[i] 为 true,否则为 false。 + +## 解题思路 + +- 简单题。每扫描数组中的一个数字,累计转换成二进制数对 5 取余,如果余数为 0,则存入 true,否则存入 false。 + +## 代码 + +```go +package leetcode + +func prefixesDivBy5(a []int) []bool { + res, num := make([]bool, len(a)), 0 + for i, v := range a { + num = (num<<1 | v) % 5 + res[i] = num == 0 + } + return res +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md b/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md new file mode 100644 index 00000000..5559c7e9 --- /dev/null +++ b/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md @@ -0,0 +1,70 @@ +# [1018. Binary Prefix Divisible By 5](https://leetcode.com/problems/binary-prefix-divisible-by-5/) + + +## 题目 + +Given an array `A` of `0`s and `1`s, consider `N_i`: the i-th subarray from `A[0]` to `A[i]` interpreted as a binary number (from most-significant-bit to least-significant-bit.) + +Return a list of booleans `answer`, where `answer[i]` is `true` if and only if `N_i` is divisible by 5. + +**Example 1:** + +``` +Input: [0,1,1] +Output: [true,false,false] +Explanation: +The input numbers in binary are 0, 01, 011; which are 0, 1, and 3 in base-10. Only the first number is divisible by 5, so answer[0] is true. + +``` + +**Example 2:** + +``` +Input: [1,1,1] +Output: [false,false,false] + +``` + +**Example 3:** + +``` +Input: [0,1,1,1,1,1] +Output: [true,false,false,false,true,false] + +``` + +**Example 4:** + +``` +Input: [1,1,1,0,1] +Output: [false,false,false,false,false] + +``` + +**Note:** + +1. `1 <= A.length <= 30000` +2. `A[i]` is `0` or `1` + +## 题目大意 + +给定由若干 0 和 1 组成的数组 A。我们定义 N_i:从 A[0] 到 A[i] 的第 i 个子数组被解释为一个二进制数(从最高有效位到最低有效位)。返回布尔值列表 answer,只有当 N_i 可以被 5 整除时,答案 answer[i] 为 true,否则为 false。 + +## 解题思路 + +- 简单题。每扫描数组中的一个数字,累计转换成二进制数对 5 取余,如果余数为 0,则存入 true,否则存入 false。 + +## 代码 + +```go +package leetcode + +func prefixesDivBy5(a []int) []bool { + res, num := make([]bool, len(a)), 0 + for i, v := range a { + num = (num<<1 | v) % 5 + res[i] = num == 0 + } + return res +} +``` \ No newline at end of file diff --git a/website/content/menu/index.md b/website/content/menu/index.md index ffb80195..78729367 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -483,6 +483,7 @@ headless: true - [1005.Maximize-Sum-Of-Array-After-K-Negations]({{< relref "/ChapterFour/1005.Maximize-Sum-Of-Array-After-K-Negations.md" >}}) - [1011.Capacity-To-Ship-Packages-Within-D-Days]({{< relref "/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md" >}}) - [1017.Convert-to-Base--2]({{< relref "/ChapterFour/1017.Convert-to-Base--2.md" >}}) + - [1018.Binary-Prefix-Divisible-By-5]({{< relref "/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md" >}}) - [1019.Next-Greater-Node-In-Linked-List]({{< relref "/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md" >}}) - [1020.Number-of-Enclaves]({{< relref "/ChapterFour/1020.Number-of-Enclaves.md" >}}) - [1021.Remove-Outermost-Parentheses]({{< relref "/ChapterFour/1021.Remove-Outermost-Parentheses.md" >}}) From 5b58e62176e958ed8da7d528a0806b62d793c349 Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 15 Jan 2021 22:32:12 +0800 Subject: [PATCH 72/82] Ctl add build chapter-two --- ctl/README.md | 16 ++ ctl/command.go | 29 ++++ ctl/config.go | 7 +- ctl/error.go | 21 +++ ctl/label.go | 43 +++++ ctl/main.go | 5 + ctl/meta/Array | 52 ++++++ ctl/meta/Backtracking | 30 ++++ ctl/meta/Binary_Indexed_Tree | 0 ctl/meta/Binary_Search | 13 ++ ctl/meta/Bit_Manipulation | 29 ++++ ctl/meta/Breadth_First_Search | 14 ++ ctl/meta/Depth_First_Search | 23 +++ ctl/meta/Dynamic_Programming | 26 +++ ctl/meta/Hash_Table | 33 ++++ ctl/meta/Linked_List | 29 ++++ ctl/meta/Math | 18 ++ ctl/meta/Segment_Tree | 10 ++ ctl/meta/Sliding_Window | 13 ++ ctl/meta/Sort | 23 +++ ctl/meta/Stack | 37 ++++ ctl/meta/String | 20 +++ ctl/meta/Tree | 33 ++++ ctl/meta/Two_Pointers | 50 ++++++ ctl/meta/Union_Find | 18 ++ ctl/meta/meta | 2 + ctl/models/lcproblems.go | 4 +- ctl/models/mdrow.go | 14 ++ ctl/models/tagproblem.go | 243 +++++++++++++++++++++++++++ ctl/pdf.go | 17 ++ ctl/render.go | 172 ++++++++++++++++--- ctl/request.go | 67 ++++++-- ctl/statistic.go | 7 +- ctl/template/Array.md | 8 + ctl/template/Backtracking.md | 100 +++++++++++ ctl/template/Binary_Indexed_Tree.md | 10 ++ ctl/template/Binary_Search.md | 131 +++++++++++++++ ctl/template/Bit_Manipulation.md | 44 +++++ ctl/template/Breadth_First_Search.md | 9 + ctl/template/Depth_First_Search.md | 9 + ctl/template/Dynamic_Programming.md | 9 + ctl/template/Hash_Table.md | 9 + ctl/template/Linked_List.md | 23 +++ ctl/template/Math.md | 9 + ctl/template/Segment_Tree.md | 37 ++++ ctl/template/Sliding_Window.md | 29 ++++ ctl/template/Sort.md | 18 ++ ctl/template/Stack.md | 17 ++ ctl/template/String.md | 9 + ctl/template/Tree.md | 9 + ctl/template/Two_Pointers.md | 32 ++++ ctl/template/Union_Find.md | 19 +++ ctl/{ => template}/template.markdown | 0 ctl/template_render.go | 3 +- ctl/{ => util}/util.go | 11 +- ctl/version.go | 18 ++ 56 files changed, 1634 insertions(+), 47 deletions(-) create mode 100644 ctl/README.md create mode 100644 ctl/command.go create mode 100644 ctl/error.go create mode 100644 ctl/label.go create mode 100644 ctl/main.go create mode 100644 ctl/meta/Array create mode 100644 ctl/meta/Backtracking create mode 100644 ctl/meta/Binary_Indexed_Tree create mode 100644 ctl/meta/Binary_Search create mode 100644 ctl/meta/Bit_Manipulation create mode 100644 ctl/meta/Breadth_First_Search create mode 100644 ctl/meta/Depth_First_Search create mode 100644 ctl/meta/Dynamic_Programming create mode 100644 ctl/meta/Hash_Table create mode 100644 ctl/meta/Linked_List create mode 100644 ctl/meta/Math create mode 100644 ctl/meta/Segment_Tree create mode 100644 ctl/meta/Sliding_Window create mode 100644 ctl/meta/Sort create mode 100644 ctl/meta/Stack create mode 100644 ctl/meta/String create mode 100644 ctl/meta/Tree create mode 100644 ctl/meta/Two_Pointers create mode 100644 ctl/meta/Union_Find create mode 100644 ctl/meta/meta create mode 100644 ctl/models/tagproblem.go create mode 100644 ctl/pdf.go create mode 100644 ctl/template/Array.md create mode 100644 ctl/template/Backtracking.md create mode 100644 ctl/template/Binary_Indexed_Tree.md create mode 100644 ctl/template/Binary_Search.md create mode 100644 ctl/template/Bit_Manipulation.md create mode 100644 ctl/template/Breadth_First_Search.md create mode 100644 ctl/template/Depth_First_Search.md create mode 100644 ctl/template/Dynamic_Programming.md create mode 100644 ctl/template/Hash_Table.md create mode 100644 ctl/template/Linked_List.md create mode 100644 ctl/template/Math.md create mode 100644 ctl/template/Segment_Tree.md create mode 100644 ctl/template/Sliding_Window.md create mode 100644 ctl/template/Sort.md create mode 100644 ctl/template/Stack.md create mode 100644 ctl/template/String.md create mode 100644 ctl/template/Tree.md create mode 100644 ctl/template/Two_Pointers.md create mode 100644 ctl/template/Union_Find.md rename ctl/{ => template}/template.markdown (100%) rename ctl/{ => util}/util.go (83%) create mode 100644 ctl/version.go diff --git a/ctl/README.md b/ctl/README.md new file mode 100644 index 00000000..4ed13ce1 --- /dev/null +++ b/ctl/README.md @@ -0,0 +1,16 @@ +# LeetCode-Go ctl + +## 配置方法 + +1. 在`.gitignore`中,添加一行`*.toml` +2. 在`LeetCode-Go`目录下,添加文本文件`config.toml`。 +3. 把以下内容复制到`config.toml`中。 +4. 把`config.toml`中的`test`分别修改为你的 leetcode `用户名`和`密码`。 +5. 去 leetcode 登录后,把网站 cookie 复制 (需要复制 csrftoken 和 LEETCODE_SESSION) 并替换 `config.toml`中的`Cookie`。 + +```toml +Username="test" +Password="test" +Cookie="csrftoken=XXXXXXXXX; LEETCODE_SESSION=YYYYYYYY;" +CSRFtoken="ZZZZZZZZ" +``` \ No newline at end of file diff --git a/ctl/command.go b/ctl/command.go new file mode 100644 index 00000000..c54fb184 --- /dev/null +++ b/ctl/command.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "leetcode-go", + Short: "A simple command line client for leetcode-go.", +} + +func execute() { + if err := rootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(-1) + } +} + +func init() { + rootCmd.AddCommand( + versionCmd, + newBuildCommand(), + newLabelCommand(), + newPDFCommand(), + ) +} diff --git a/ctl/config.go b/ctl/config.go index 8743ad75..4288c3d2 100644 --- a/ctl/config.go +++ b/ctl/config.go @@ -12,9 +12,10 @@ const ( ) type config struct { - Username string - Password string - Cookie string + Username string + Password string + Cookie string + CSRFtoken string } func (c config) String() string { diff --git a/ctl/error.go b/ctl/error.go new file mode 100644 index 00000000..903460a8 --- /dev/null +++ b/ctl/error.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + "os" +) + +const ( + // ExitSuccess define + ExitSuccess = iota + // ExitError define + ExitError + // ExitBadArgs define + ExitBadArgs +) + +// ExitWithError define +func ExitWithError(code int, err error) { + fmt.Fprintln(os.Stderr, "Error: ", err) + os.Exit(code) +} diff --git a/ctl/label.go b/ctl/label.go new file mode 100644 index 00000000..d8fd94d4 --- /dev/null +++ b/ctl/label.go @@ -0,0 +1,43 @@ +package main + +import ( + "github.com/spf13/cobra" +) + +func newLabelCommand() *cobra.Command { + mc := &cobra.Command{ + Use: "label ", + Short: "Label related commands", + } + //mc.PersistentFlags().StringVar(&logicEndpoint, "endpoint", "localhost:5880", "endpoint of logic service") + mc.AddCommand( + newAddPreNext(), + newDeletePreNext(), + ) + return mc +} + +func newAddPreNext() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-pre-next", + Short: "Add pre-next label", + Run: func(cmd *cobra.Command, args []string) { + + }, + } + // cmd.Flags().StringVar(&alias, "alias", "", "alias") + // cmd.Flags().StringVar(&appId, "appid", "", "appid") + return cmd +} + +func newDeletePreNext() *cobra.Command { + cmd := &cobra.Command{ + Use: "delete-pre-next", + Short: "Delete pre-next label", + Run: func(cmd *cobra.Command, args []string) { + }, + } + // cmd.Flags().StringVar(&alias, "alias", "", "alias") + // cmd.Flags().StringVar(&appId, "appid", "", "appid") + return cmd +} diff --git a/ctl/main.go b/ctl/main.go new file mode 100644 index 00000000..f7d07b01 --- /dev/null +++ b/ctl/main.go @@ -0,0 +1,5 @@ +package main + +func main() { + execute() +} diff --git a/ctl/meta/Array b/ctl/meta/Array new file mode 100644 index 00000000..6611e480 --- /dev/null +++ b/ctl/meta/Array @@ -0,0 +1,52 @@ +|1. Two Sum| [Go]({{< relref "/ChapterFour/0001.Two-Sum.md" >}})| Easy | O(n)| O(n)|| +|11. Container With Most Water| [Go]({{< relref "/ChapterFour/0011.Container-With-Most-Water.md" >}})| Medium | O(n)| O(1)|| +|15. 3Sum | [Go]({{< relref "/ChapterFour/0015.3Sum.md" >}})| Medium | O(n^2)| O(n)|❤️| +|16. 3Sum Closest | [Go]({{< relref "/ChapterFour/0016.3Sum-Closest.md" >}})| Medium | O(n^2)| O(1)|❤️| +|18. 4Sum | [Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})| Medium | O(n^3)| O(n^2)|❤️| +|26. Remove Duplicates from Sorted Array | [Go]({{< relref "/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md" >}})| Easy | O(n)| O(1)|| +|27. Remove Element | [Go]({{< relref "/ChapterFour/0027.Remove-Element.md" >}})| Easy | O(n)| O(1)|| +|39. Combination Sum | [Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})| Medium | O(n log n)| O(n)|| +|40. Combination Sum II | [Go]({{< relref "/ChapterFour/0040.Combination-Sum-II.md" >}})| Medium | O(n log n)| O(n)|| +|41. First Missing Positive | [Go]({{< relref "/ChapterFour/0041.First-Missing-Positive.md" >}})| Hard | O(n)| O(n)|| +|42. Trapping Rain Water | [Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})| Hard | O(n)| O(1)|❤️| +|48. Rotate Image | [Go]({{< relref "/ChapterFour/0048.Rotate-Image.md" >}})| Medium | O(n)| O(1)|| +|53. Maximum Subarray| [Go]({{< relref "/ChapterFour/0053.Maximum-Subarray.md" >}})| Easy | O(n)| O(n)|| +|54. Spiral Matrix| [Go]({{< relref "/ChapterFour/0054.Spiral-Matrix.md" >}})| Medium | O(n)| O(n^2)|| +|56. Merge Intervals | [Go]({{< relref "/ChapterFour/0056.Merge-Intervals.md" >}})| Medium | O(n log n)| O(1)|| +|57. Insert Interval | [Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})| Hard | O(n)| O(1)|| +|59. Spiral Matrix II | [Go]({{< relref "/ChapterFour/0059.Spiral-Matrix-II.md" >}})| Medium | O(n)| O(n^2)|| +|62. Unique Paths | [Go]({{< relref "/ChapterFour/0062.Unique-Paths.md" >}})| Medium | O(n^2)| O(n^2)|| +|63. Unique Paths II | [Go]({{< relref "/ChapterFour/0063.Unique-Paths-II.md" >}})| Medium | O(n^2)| O(n^2)|| +|64. Minimum Path Sum | [Go]({{< relref "/ChapterFour/0064.Minimum-Path-Sum.md" >}})| Medium | O(n^2)| O(n^2)|| +|75. Sort Colors | [Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})| Medium| O(n)| O(1)|❤️| +|78. Subsets| [Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})| Medium | O(n^2)| O(n)|❤️| +|79. Word Search | [Go]({{< relref "/ChapterFour/0079.Word-Search.md" >}})| Medium | O(n^2)| O(n^2)|❤️| +|80. Remove Duplicates from Sorted Array II| [Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})| Medium | O(n)| O(1|| +|84. Largest Rectangle in Histogram | [Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}})| Medium | O(n)| O(n)|❤️| +|88. Merge Sorted Array | [Go]({{< relref "/ChapterFour/0088.Merge-Sorted-Array.md" >}})| Easy | O(n)| O(1)|❤️| +|90. Subsets II | [Go]({{< relref "/ChapterFour/0090.Subsets-II.md" >}})| Medium | O(n^2)| O(n)|❤️| +|120. Triangle | [Go]({{< relref "/ChapterFour/0120.Triangle.md" >}})| Medium | O(n^2)| O(n)|| +|121. Best Time to Buy and Sell Stock | [Go]({{< relref "/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})| Easy | O(n)| O(1)|| +|122. Best Time to Buy and Sell Stock II | [Go]({{< relref "/ChapterFour/0122.Best-Time-to-Buy-and-Sell-Stock-II.md" >}})| Easy | O(n)| O(1)|| +|126. Word Ladder II | [Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})| Hard | O(n)| O(n^2)|❤️| +|152. Maximum Product Subarray | [Go]({{< relref "/ChapterFour/0152.Maximum-Product-Subarray.md" >}})| Medium | O(n)| O(1)|| +|167. Two Sum II - Input array is sorted | [Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})| Easy | O(n)| O(1)|| +|209. Minimum Size Subarray Sum | [Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})| Medium | O(n)| O(1)|| +|216. Combination Sum III | [Go]({{< relref "/ChapterFour/0216.Combination-Sum-III.md" >}})| Medium | O(n)| O(1)|❤️| +|217. Contains Duplicate | [Go]({{< relref "/ChapterFour/0217.Contains-Duplicate.md" >}})| Easy | O(n)| O(n)|| +|219. Contains Duplicate II | [Go]({{< relref "/ChapterFour/0219.Contains-Duplicate-II.md" >}})| Easy | O(n)| O(n)|| +|283. Move Zeroes | [Go]({{< relref "/ChapterFour/0283.Move-Zeroes.md" >}})| Easy | O(n)| O(1)|| +|287. Find the Duplicate Number | [Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})| Easy | O(n)| O(1)|❤️| +|532. K-diff Pairs in an Array | [Go]({{< relref "/ChapterFour/0532.K-diff-Pairs-in-an-Array.md" >}})| Easy | O(n)| O(n)|| +|566. Reshape the Matrix | [Go]({{< relref "/ChapterFour/0566.Reshape-the-Matrix.md" >}})| Easy | O(n^2)| O(n^2)|| +|628. Maximum Product of Three Numbers | [Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})| Easy | O(n)| O(1)|| +|713. Subarray Product Less Than K | [Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})| Medium | O(n)| O(1)|| +|714. Best Time to Buy and Sell Stock with Transaction Fee| [Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})| Medium | O(n)| O(1)|| +|746. Min Cost Climbing Stairs | [Go]({{< relref "/ChapterFour/0746.Min-Cost-Climbing-Stairs.md" >}})| Easy | O(n)| O(1)|| +|766. Toeplitz Matrix | [Go]({{< relref "/ChapterFour/0766.Toeplitz-Matrix.md" >}})| Easy | O(n)| O(1)|| +|867. Transpose Matrix | [Go]({{< relref "/ChapterFour/0867.Transpose-Matrix.md" >}})| Easy | O(n)| O(1)|| +|891. Sum of Subsequence Widths | [Go]({{< relref "/ChapterFour/0891.Sum-of-Subsequence-Widths.md" >}})| Hard | O(n log n)| O(1)|| +|907. Sum of Subarray Minimums | [Go]({{< relref "/ChapterFour/0907.Sum-of-Subarray-Minimums.md" >}})| Medium | O(n)| O(n)|❤️| +|922. Sort Array By Parity II | [Go]({{< relref "/ChapterFour/0922.Sort-Array-By-Parity-II.md" >}})| Medium | O(n)| O(1)|| +|969. Pancake Sorting | [Go]({{< relref "/ChapterFour/0969.Pancake-Sorting.md" >}})| Medium | O(n)| O(1)|❤️| +|977. Squares of a Sorted Array | [Go]({{< relref "/ChapterFour/0977.Squares-of-a-Sorted-Array.md" >}})| Easy | O(n)| O(1)|| \ No newline at end of file diff --git a/ctl/meta/Backtracking b/ctl/meta/Backtracking new file mode 100644 index 00000000..b3c611fc --- /dev/null +++ b/ctl/meta/Backtracking @@ -0,0 +1,30 @@ +|17. Letter Combinations of a Phone Number | [Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})| Medium | O(log n)| O(1)|| +|22. Generate Parentheses| [Go]({{< relref "/ChapterFour/0022.Generate-Parentheses.md" >}})| Medium | O(log n)| O(1)|| +|37. Sudoku Solver | [Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})| Hard | O(n^2)| O(n^2)|❤️| +|39. Combination Sum | [Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})| Medium | O(n log n)| O(n)|| +|40. Combination Sum II | [Go]({{< relref "/ChapterFour/0040.Combination-Sum-II.md" >}})| Medium | O(n log n)| O(n)|| +|46. Permutations | [Go]({{< relref "/ChapterFour/0046.Permutations.md" >}})| Medium | O(n)| O(n)|❤️| +|47. Permutations II | [Go]({{< relref "/ChapterFour/0047.Permutations-II.md" >}})| Medium | O(n^2)| O(n)|❤️| +|51. N-Queens | [Go]({{< relref "/ChapterFour/0051.N-Queens.md" >}})| Hard | O(n^2)| O(n)|❤️| +|52. N-Queens II | [Go]({{< relref "/ChapterFour/0052.N-Queens-II.md" >}})| Hard | O(n^2)| O(n)|❤️| +|60. Permutation Sequence | [Go]({{< relref "/ChapterFour/0060.Permutation-Sequence.md" >}})| Medium | O(n log n)| O(1)|| +|77. Combinations | [Go]({{< relref "/ChapterFour/0077.Combinations.md" >}})| Medium | O(n)| O(n)|❤️| +|78. Subsets | [Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})| Medium | O(n^2)| O(n)|❤️| +|79. Word Search | [Go]({{< relref "/ChapterFour/0079.Word-Search.md" >}})| Medium | O(n^2)| O(n^2)|❤️| +|89. Gray Codes | [Go]({{< relref "/ChapterFour/0089.Gray-Code.md" >}})| Medium | O(n)| O(1)|| +|90. Subsets II | [Go]({{< relref "/ChapterFour/0090.Subsets-II.md" >}})| Medium | O(n^2)| O(n)|❤️| +|93. Restore IP Addresses | [Go]({{< relref "/ChapterFour/0093.Restore-IP-Addresses.md" >}})| Medium | O(n)| O(n)|❤️| +|126. Word Ladder II | [Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})| Hard | O(n)| O(n^2)|❤️| +|131. Palindrome Partitioning | [Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})| Medium | O(n)| O(n^2)|❤️| +|211. Add and Search Word - Data structure design | [Go]({{< relref "/ChapterFour/0211.Add-and-Search-Word---Data-structure-design.md" >}})| Medium | O(n)| O(n)|❤️| +|212. Word Search II | [Go]({{< relref "/ChapterFour/0212.Word-Search-II.md" >}})| Hard | O(n^2)| O(n^2)|❤️| +|216. Combination Sum III | [Go]({{< relref "/ChapterFour/0216.Combination-Sum-III.md" >}})| Medium | O(n)| O(1)|❤️| +|306. Additive Number | [Go]({{< relref "/ChapterFour/0306.Additive-Number.md" >}})| Medium | O(n^2)| O(1)|❤️| +|357. Count Numbers with Unique Digits | [Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})| Medium | O(1)| O(1)|| +|401. Binary Watch | [Go]({{< relref "/ChapterFour/0401.Binary-Watch.md" >}})| Easy | O(1)| O(1)|| +|526. Beautiful Arrangement | [Go]({{< relref "/ChapterFour/0526.Beautiful-Arrangement.md" >}})| Medium | O(n^2)| O(1)|❤️| +|784. Letter Case Permutation | [Go]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}})| Easy | O(n)| O(n)|| +|842. Split Array into Fibonacci Sequence | [Go]({{< relref "/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md" >}})| Medium | O(n^2)| O(1)|❤️| +|980. Unique Paths III | [Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})| Hard | O(n log n)| O(n)|| +|996. Number of Squareful Arrays | [Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})| Hard | O(n log n)| O(n) || +|1079. Letter Tile Possibilities | [Go]({{< relref "/ChapterFour/1079.Letter-Tile-Possibilities.md" >}})| Medium | O(n^2)| O(1)|❤️| \ No newline at end of file diff --git a/ctl/meta/Binary_Indexed_Tree b/ctl/meta/Binary_Indexed_Tree new file mode 100644 index 00000000..e69de29b diff --git a/ctl/meta/Binary_Search b/ctl/meta/Binary_Search new file mode 100644 index 00000000..42792418 --- /dev/null +++ b/ctl/meta/Binary_Search @@ -0,0 +1,13 @@ +|50. Pow(x, n) | [Go]({{< relref "/ChapterFour/0050.Powx-n.md" >}})| Medium | O(log n)| O(1)|| +|69. Sqrt(x) | [Go]({{< relref "/ChapterFour/0069.Sqrtx.md" >}})| Easy | O(log n)| O(1)|| +|167. Two Sum II - Input array is sorted | [Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})| Easy | O(n)| O(1)|| +|209. Minimum Size Subarray Sum | [Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})| Medium | O(n)| O(1)|| +|222. Count Complete Tree Nodes | [Go]({{< relref "/ChapterFour/0222.Count-Complete-Tree-Nodes.md" >}})| Medium | O(n)| O(1)|| +|230. Kth Smallest Element in a BST | [Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})| Medium | O(n)| O(1)|| +|287. Find the Duplicate Number | [Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})| Easy | O(n)| O(1)|❤️| +|300. Longest Increasing Subsequence | [Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})| Medium | O(n log n)| O(n)|| +|349. Intersection of Two Arrays | [Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})| Easy | O(n)| O(n) || +|350. Intersection of Two Arrays II | [Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})| Easy | O(n)| O(n) || +|392. Is Subsequence | [Go]({{< relref "/ChapterFour/0392.Is-Subsequence.md" >}})| Medium | O(n)| O(1)|| +|454. 4Sum II | [Go]({{< relref "/ChapterFour/0454.4Sum-II.md" >}})| Medium | O(n^2)| O(n) || +|710. Random Pick with Blacklist | [Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})| Hard | O(n)| O(n) || \ No newline at end of file diff --git a/ctl/meta/Bit_Manipulation b/ctl/meta/Bit_Manipulation new file mode 100644 index 00000000..5043dbf0 --- /dev/null +++ b/ctl/meta/Bit_Manipulation @@ -0,0 +1,29 @@ +|78. Subsets | [Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})| Medium | O(n^2)| O(n)|❤️| +|136. Single Number | [Go]({{< relref "/ChapterFour/0136.Single-Number.md" >}})| Easy | O(n)| O(1)|| +|137. Single Number II | [Go]({{< relref "/ChapterFour/0137.Single-Number-II.md" >}})| Medium | O(n)| O(1)|❤️| +|169. Majority Element | [Go]({{< relref "/ChapterFour/0169.Majority-Element.md" >}})| Easy | O(n)| O(1)|❤️| +|187. Repeated DNA Sequences | [Go]({{< relref "/ChapterFour/0187.Repeated-DNA-Sequences.md" >}})| Medium | O(n)| O(1)|| +|190. Reverse Bits | [Go]({{< relref "/ChapterFour/0190.Reverse-Bits.md" >}})| Easy | O(n)| O(1)|❤️| +|191. Number of 1 Bits | [Go]({{< relref "/ChapterFour/0191.Number-of-1-Bits.md" >}})| Easy | O(n)| O(1)|| +|201. Bitwise AND of Numbers Range | [Go]({{< relref "/ChapterFour/0201.Bitwise-AND-of-Numbers-Range.md" >}})| Medium | O(n)| O(1)|❤️| +|231. Power of Two | [Go]({{< relref "/ChapterFour/0231.Power-of-Two.md" >}})| Easy | O(1)| O(1)|| +|260. Single Number III | [Go]({{< relref "/ChapterFour/0260.Single-Number-III.md" >}})| Medium | O(n)| O(1)|❤️| +|268. Missing Number | [Go]({{< relref "/ChapterFour/0268.Missing-Number.md" >}})| Easy | O(n)| O(1)|| +|318. Maximum Product of Word Lengths | [Go]({{< relref "/ChapterFour/0318.Maximum-Product-of-Word-Lengths.md" >}})| Medium | O(n)| O(1)|| +|338. Counting Bits | [Go]({{< relref "/ChapterFour/0338.Counting-Bits.md" >}})| Medium | O(n)| O(n)|| +|342. Power of Four | [Go]({{< relref "/ChapterFour/0342.Power-of-Four.md" >}})| Easy | O(n)| O(1)|| +|371. Sum of Two Integers | [Go]({{< relref "/ChapterFour/0371.Sum-of-Two-Integers.md" >}})| Easy | O(n)| O(1)|| +|389. Find the Difference | [Go]({{< relref "/ChapterFour/0389.Find-the-Difference.md" >}})| Easy | O(n)| O(1)|| +|393. UTF-8 Validation | [Go]({{< relref "/ChapterFour/0393.UTF-8-Validation.md" >}})| Medium | O(n)| O(1)|| +|397. Integer Replacement | [Go]({{< relref "/ChapterFour/0397.Integer-Replacement.md" >}})| Medium | O(n)| O(1)|| +|401. Binary Watch | [Go]({{< relref "/ChapterFour/0401.Binary-Watch.md" >}})| Easy | O(1)| O(1)|| +|405. Convert a Number to Hexadecimal | [Go]({{< relref "/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md" >}})| Easy | O(n)| O(1)|| +|421. Maximum XOR of Two Numbers in an Array | [Go]({{< relref "/ChapterFour/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md" >}})| Medium | O(n)| O(1)|❤️| +|461. Hamming Distance | [Go]({{< relref "/ChapterFour/0461.Hamming-Distance.md" >}})| Easy | O(n)| O(1)|| +|476. Number Complement | [Go]({{< relref "/ChapterFour/0476.Number-Complement.md" >}})| Easy | O(n)| O(1)|| +|477. Total Hamming Distance | [Go]({{< relref "/ChapterFour/0477.Total-Hamming-Distance.md" >}})| Medium | O(n)| O(1)|| +|693. Binary Number with Alternating Bits | [Go]({{< relref "/ChapterFour/0693.Binary-Number-with-Alternating-Bits.md" >}})| Easy | O(n)| O(1)|❤️| +|756. Pyramid Transition Matrix | [Go]({{< relref "/ChapterFour/0756.Pyramid-Transition-Matrix.md" >}})| Medium | O(n log n)| O(n)|| +|762. Prime Number of Set Bits in Binary Representation | [Go]({{< relref "/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md" >}})| Easy | O(n)| O(1)|| +|784. Letter Case Permutation | [Go]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}})| Easy | O(n)| O(1)|| +|898. Bitwise ORs of Subarrays | [Go]({{< relref "/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md" >}})| Medium | O(n)| O(1)|| \ No newline at end of file diff --git a/ctl/meta/Breadth_First_Search b/ctl/meta/Breadth_First_Search new file mode 100644 index 00000000..4eb99cfe --- /dev/null +++ b/ctl/meta/Breadth_First_Search @@ -0,0 +1,14 @@ +|101. Symmetric Tree | [Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})| Easy | O(n)| O(1)|| +|102. Binary Tree Level Order Traversal | [Go]({{< relref "/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md" >}})| Medium | O(n)| O(1)|| +|103. Binary Tree Zigzag Level Order Traversal | [Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})| Medium | O(n)| O(n)|| +|107. Binary Tree Level Order Traversal II | [Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})| Easy | O(n)| O(1)|| +|111. Minimum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| +|126. Word Ladder II | [Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})| Hard | O(n)| O(n^2)|❤️| +|127. Word Ladder | [Go]({{< relref "/ChapterFour/0127.Word-Ladder.md" >}})| Medium | O(n)| O(n)|| +|199. Binary Tree Right Side View | [Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})| Medium | O(n)| O(1)|| +|200. Number of Islands | [Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})| Medium | O(n^2)| O(n^2)|| +|207. Course Schedule | [Go]({{< relref "/ChapterFour/0207.Course-Schedule.md" >}})| Medium | O(n^2)| O(n^2)|| +|210. Course Schedule II | [Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})| Medium | O(n^2)| O(n^2)|| +|515. Find Largest Value in Each Tree Row | [Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})| Medium | O(n)| O(n)|| +|542. 01 Matrix | [Go]({{< relref "/ChapterFour/0542.01-Matrix.md" >}})| Medium | O(n)| O(1)|| +|993. Cousins in Binary Tree | [Go]({{< relref "/ChapterFour/0993.Cousins-in-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| \ No newline at end of file diff --git a/ctl/meta/Depth_First_Search b/ctl/meta/Depth_First_Search new file mode 100644 index 00000000..9bf247b1 --- /dev/null +++ b/ctl/meta/Depth_First_Search @@ -0,0 +1,23 @@ +|98. Validate Binary Search Tree | [Go]({{< relref "/ChapterFour/0098.Validate-Binary-Search-Tree.md" >}})| Medium | O(n)| O(1)|| +|99. Recover Binary Search Tree | [Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}})| Hard | O(n)| O(1)|| +|100. Same Tree | [Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}})| Easy | O(n)| O(1)|| +|101. Symmetric Tree | [Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})| Easy | O(n)| O(1)|| +|104. Maximum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| +|108. Convert Sorted Array to Binary Search Tree | [Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})| Easy | O(n)| O(1)|| +|109. Convert Sorted List to Binary Search Tree | [Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})| Medium | O(log n)| O(n)|| +|110. Balanced Binary Tree | [Go]({{< relref "/ChapterFour/0110.Balanced-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| +|111. Minimum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| +|112. Path Sum | [Go]({{< relref "/ChapterFour/0112.Path-Sum.md" >}})| Easy | O(n)| O(1)|| +|113. Path Sum II | [Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}})| Medium | O(n)| O(1)|| +|114. Flatten Binary Tree to Linked List | [Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})| Medium | O(n)| O(1)|| +|124. Binary Tree Maximum Path Sum | [Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}})| Hard | O(n)| O(1)|| +|129. Sum Root to Leaf Numbers | [Go]({{< relref "/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md" >}})| Medium | O(n)| O(1)|| +|199. Binary Tree Right Side View | [Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})| Medium | O(n)| O(1)|| +|200. Number of Islands | [Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})| Medium | O(n^2)| O(n^2)|| +|207. Course Schedule | [Go]({{< relref "/ChapterFour/0207.Course-Schedule.md" >}})| Medium | O(n^2)| O(n^2)|| +|210. Course Schedule II | [Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})| Medium | O(n^2)| O(n^2)|| +|257. Binary Tree Paths | [Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})| Easy | O(n)| O(1)|| +|394. Decode String | [Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})| Medium | O(n)| O(n)|| +|515. Find Largest Value in Each Tree Row | [Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})| Medium | O(n)| O(n)|| +|542. 01 Matrix | [Go]({{< relref "/ChapterFour/0542.01-Matrix.md" >}})| Medium | O(n)| O(1)|| +|980. Unique Paths III | [Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})| Hard | O(n log n)| O(n)|| \ No newline at end of file diff --git a/ctl/meta/Dynamic_Programming b/ctl/meta/Dynamic_Programming new file mode 100644 index 00000000..0f937f91 --- /dev/null +++ b/ctl/meta/Dynamic_Programming @@ -0,0 +1,26 @@ +|53. Maximum Subarray| [Go]({{< relref "/ChapterFour/0053.Maximum-Subarray.md" >}})| Easy | O(n)| O(n)|| +|62. Unique Paths | [Go]({{< relref "/ChapterFour/0062.Unique-Paths.md" >}})| Medium | O(n^2)| O(n^2)|| +|63. Unique Paths II | [Go]({{< relref "/ChapterFour/0063.Unique-Paths-II.md" >}})| Medium | O(n^2)| O(n^2)|| +|64. Minimum Path Sum | [Go]({{< relref "/ChapterFour/0064.Minimum-Path-Sum.md" >}})| Medium | O(n^2)| O(n^2)|| +|70. Climbing Stairs | [Go]({{< relref "/ChapterFour/0070.Climbing-Stairs.md" >}})| Easy | O(n)| O(n)|| +|91. Decode Ways | [Go]({{< relref "/ChapterFour/0091.Decode-Ways.md" >}})| Medium | O(n)| O(n)|| +|96. Unique Binary Search Trees | [Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}})| Medium | O(n)| O(n)|| +|120. Triangle | [Go]({{< relref "/ChapterFour/0120.Triangle.md" >}})| Medium | O(n^2)| O(n)|| +|121. Best Time to Buy and Sell Stock | [Go]({{< relref "/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})| Easy | O(n)| O(1)|| +|152. Maximum Product Subarray | [Go]({{< relref "/ChapterFour/0152.Maximum-Product-Subarray.md" >}})| Medium | O(n)| O(1)|| +|198. House Robber | [Go]({{< relref "/ChapterFour/0198.House-Robber.md" >}})| Easy | O(n)| O(n)|| +|213. House Robber II | [Go]({{< relref "/ChapterFour/0213.House-Robber-II.md" >}})| Medium | O(n)| O(n)|| +|300. Longest Increasing Subsequence | [Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})| Medium | O(n log n)| O(n)|| +|309. Best Time to Buy and Sell Stock with Cooldown | [Go]({{< relref "/ChapterFour/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md" >}})| Medium | O(n)| O(n)|| +|322. Coin Change | [Go]({{< relref "/ChapterFour/0322.Coin-Change.md" >}})| Medium | O(n)| O(n)|| +|338. Counting Bits | [Go]({{< relref "/ChapterFour/0338.Counting-Bits.md" >}})| Medium | O(n)| O(n)|| +|343. Integer Break | [Go]({{< relref "/ChapterFour/0343.Integer-Break.md" >}})| Medium | O(n^2)| O(n)|| +|357. Count Numbers with Unique Digits | [Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})| Medium | O(1)| O(1)|| +|392. Is Subsequence | [Go]({{< relref "/ChapterFour/0392.Is-Subsequence.md" >}})| Medium | O(n)| O(1)|| +|416. Partition Equal Subset Sum | [Go]({{< relref "/ChapterFour/0416.Partition-Equal-Subset-Sum.md" >}})| Medium | O(n^2)| O(n)|| +|714. Best Time to Buy and Sell Stock with Transaction Fee | [Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})| Medium | O(n)| O(1)|| +|746. Min Cost Climbing Stairs | [Go]({{< relref "/ChapterFour/0746.Min-Cost-Climbing-Stairs.md" >}})| Easy | O(n)| O(1)|| +|838. Push Dominoes | [Go]({{< relref "/ChapterFour/0838.Push-Dominoes.md" >}})| Medium | O(n)| O(n)|| +|1025. Divisor Game | [Go]({{< relref "/ChapterFour/1025.Divisor-Game.md" >}})| Easy | O(1)| O(1)|| +|891. Sum of Subsequence Widths | [Go]({{< relref "/ChapterFour/0891.Sum-of-Subsequence-Widths.md" >}})| Hard | O(n log n)| O(1)|| +|942. DI String Match | [Go]({{< relref "/ChapterFour/0942.DI-String-Match.md" >}})| Easy | O(n)| O(1)|| \ No newline at end of file diff --git a/ctl/meta/Hash_Table b/ctl/meta/Hash_Table new file mode 100644 index 00000000..56a6bde0 --- /dev/null +++ b/ctl/meta/Hash_Table @@ -0,0 +1,33 @@ +|1. Two Sum | [Go]({{< relref "/ChapterFour/0001.Two-Sum.md" >}})| Easy | O(n)| O(n)|| +|3. Longest Substring Without Repeating Characters | [Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})| Medium | O(n)| O(1)|❤️| +|18. 4Sum | [Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})| Medium | O(n^3)| O(n^2)|❤️| +|30. Substring with Concatenation of All Words | [Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})| Hard | O(n)| O(n)|❤️| +|36. Valid Sudoku | [Go]({{< relref "/ChapterFour/0036.Valid-Sudoku.md" >}})| Medium | O(n^2)| O(n^2)|| +|37. Sudoku Solver | [Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})| Hard | O(n^2)| O(n^2)|❤️| +|49. Group Anagrams | [Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})| Medium | O(n log n)| O(n)|| +|76. Minimum Window Substring | [Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})| Hard | O(n)| O(n)|❤️| +|94. Binary Tree Inorder Traversal | [Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})| Medium | O(n)| O(1)|| +|138. Copy List with Random Pointer | [Go]()| Medium | O(n)| O(1)|| +|202. Happy Number | [Go]({{< relref "/ChapterFour/0202.Happy-Number.md" >}})| Easy | O(log n)| O(1)|| +|205. Isomorphic Strings | [Go]({{< relref "/ChapterFour/0205.Isomorphic-Strings.md" >}})| Easy | O(log n)| O(n)|| +|217. Contains Duplicate | [Go]({{< relref "/ChapterFour/0217.Contains-Duplicate.md" >}})| Easy | O(n)| O(n)|| +|219. Contains Duplicate II | [Go]({{< relref "/ChapterFour/0219.Contains-Duplicate-II.md" >}})| Easy | O(n)| O(n)|| +|242. Valid Anagram | [Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})| Easy | O(n)| O(n) || +|274. H-Index | [Go]({{< relref "/ChapterFour/0274.H-Index.md" >}})| Medium | O(n)| O(n) || +|290. Word Pattern | [Go]({{< relref "/ChapterFour/0290.Word-Pattern.md" >}})| Easy | O(n)| O(n) || +|347. Top K Frequent Elements | [Go]({{< relref "/ChapterFour/0347.Top-K-Frequent-Elements.md" >}})| Medium | O(n)| O(n) || +|349. Intersection of Two Arrays | [Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})| Easy | O(n)| O(n) || +|350. Intersection of Two Arrays II | [Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})| Easy | O(n)| O(n) || +|438. Find All Anagrams in a String | [Go]({{< relref "/ChapterFour/0438.Find-All-Anagrams-in-a-String.md" >}})| Easy | O(n)| O(1) || +|447. Number of Boomerangs | [Go]({{< relref "/ChapterFour/0447.Number-of-Boomerangs.md" >}})| Easy | O(n)| O(1) || +|451. Sort Characters By Frequency | [Go]({{< relref "/ChapterFour/0451.Sort-Characters-By-Frequency.md" >}})| Medium | O(n log n)| O(1) || +|454. 4Sum II | [Go]({{< relref "/ChapterFour/0454.4Sum-II.md" >}})| Medium | O(n^2)| O(n) || +|648. Replace Words | [Go]({{< relref "/ChapterFour/0648.Replace-Words.md" >}})| Medium | O(n)| O(n) || +|676. Implement Magic Dictionary | [Go]({{< relref "/ChapterFour/0676.Implement-Magic-Dictionary.md" >}})| Medium | O(n)| O(n) || +|720. Longest Word in Dictionary | [Go]({{< relref "/ChapterFour/0720.Longest-Word-in-Dictionary.md" >}})| Easy | O(n)| O(n) || +|726. Number of Atoms | [Go]({{< relref "/ChapterFour/0726.Number-of-Atoms.md" >}})| Hard | O(n)| O(n) |❤️| +|739. Daily Temperatures | [Go]({{< relref "/ChapterFour/0739.Daily-Temperatures.md" >}})| Medium | O(n)| O(n) || +|710. Random Pick with Blacklist | [Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})| Hard | O(n)| O(n) || +|895. Maximum Frequency Stack | [Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})| Hard | O(n)| O(n) || +|930. Binary Subarrays With Sum | [Go]({{< relref "/ChapterFour/0930.Binary-Subarrays-With-Sum.md" >}})| Medium | O(n)| O(n) |❤️| +|992. Subarrays with K Different Integers | [Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})| Hard | O(n)| O(n) |❤️| \ No newline at end of file diff --git a/ctl/meta/Linked_List b/ctl/meta/Linked_List new file mode 100644 index 00000000..326edc57 --- /dev/null +++ b/ctl/meta/Linked_List @@ -0,0 +1,29 @@ +|2. Add Two Numbers | [Go]({{< relref "/ChapterFour/0002.Add-Two-Numbers.md" >}})| Medium | O(n)| O(1)|| +|19. Remove Nth Node From End of List | [Go]({{< relref "/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md" >}})| Medium | O(n)| O(1)|| +|21. Merge Two Sorted Lists | [Go]({{< relref "/ChapterFour/0021.Merge-Two-Sorted-Lists.md" >}})| Easy | O(log n)| O(1)|| +|23. Merge k Sorted Lists| [Go]({{< relref "/ChapterFour/0023.Merge-k-Sorted-Lists.md" >}})| Hard | O(log n)| O(1)|❤️| +|24. Swap Nodes in Pairs | [Go]({{< relref "/ChapterFour/0024.Swap-Nodes-in-Pairs.md" >}})| Medium | O(n)| O(1)|| +|25. Reverse Nodes in k-Group | [Go]({{< relref "/ChapterFour/0025.Reverse-Nodes-in-k-Group.md" >}})| Hard | O(log n)| O(1)|❤️| +|61. Rotate List | [Go]({{< relref "/ChapterFour/0061.Rotate-List.md" >}})| Medium | O(n)| O(1)|| +|82. Remove Duplicates from Sorted List II | [Go]({{< relref "/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md" >}})| Medium | O(n)| O(1)|| +|83. Remove Duplicates from Sorted List | [Go]({{< relref "/ChapterFour/0083.Remove-Duplicates-from-Sorted-List.md" >}})| Easy | O(n)| O(1)|| +|86. Partition List | [Go]({{< relref "/ChapterFour/0086.Partition-List.md" >}})| Medium | O(n)| O(1)|❤️| +|92. Reverse Linked List II | [Go]({{< relref "/ChapterFour/0092.Reverse-Linked-List-II.md" >}})| Medium | O(n)| O(1)|❤️| +|109. Convert Sorted List to Binary Search Tree | [Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})| Medium | O(log n)| O(n)|| +|141. Linked List Cycle | [Go]({{< relref "/ChapterFour/0141.Linked-List-Cycle.md" >}})| Easy | O(n)| O(1)|❤️| +|142. Linked List Cycle II | [Go]({{< relref "/ChapterFour/0142.Linked-List-Cycle-II.md" >}})| Medium | O(n)| O(1)|❤️| +|143. Reorder List | [Go]({{< relref "/ChapterFour/0143.Reorder-List.md" >}})| Medium | O(n)| O(1)|❤️| +|147. Insertion Sort List | [Go]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}})| Medium | O(n)| O(1)|❤️| +|148. Sort List | [Go]({{< relref "/ChapterFour/0148.Sort-List.md" >}})| Medium | O(n log n)| O(n)|❤️| +|160. Intersection of Two Linked Lists | [Go]({{< relref "/ChapterFour/0160.Intersection-of-Two-Linked-Lists.md" >}})| Easy | O(n)| O(1)|❤️| +|203. Remove Linked List Elements | [Go]({{< relref "/ChapterFour/0203.Remove-Linked-List-Elements.md" >}})| Easy | O(n)| O(1)|| +|206. Reverse Linked List | [Go]({{< relref "/ChapterFour/0206.Reverse-Linked-List.md" >}})| Easy | O(n)| O(1)|| +|234. Palindrome Linked List | [Go]({{< relref "/ChapterFour/0234.Palindrome-Linked-List.md" >}})| Easy | O(n)| O(1)|| +|237. Delete Node in a Linked List | [Go]({{< relref "/ChapterFour/0237.Delete-Node-in-a-Linked-List.md" >}})| Easy | O(n)| O(1)|| +|328. Odd Even Linked List | [Go]({{< relref "/ChapterFour/0328.Odd-Even-Linked-List.md" >}})| Medium | O(n)| O(1)|| +|445. Add Two Numbers II | [Go]({{< relref "/ChapterFour/0445.Add-Two-Numbers-II.md" >}})| Medium | O(n)| O(n)|| +|725. Split Linked List in Parts | [Go]({{< relref "/ChapterFour/0725.Split-Linked-List-in-Parts.md" >}})| Medium | O(n)| O(1)|| +|817. Linked List Components | [Go]({{< relref "/ChapterFour/0817.Linked-List-Components.md" >}})| Medium | O(n)| O(1)|| +|707. Design Linked List | [Go]({{< relref "/ChapterFour/0707.Design-Linked-List.md" >}})| Easy | O(n)| O(1)|| +|876. Middle of the Linked List | [Go]({{< relref "/ChapterFour/0876.Middle-of-the-Linked-List.md" >}})| Easy | O(n)| O(1)|❤️| +|1019. Next Greater Node In Linked List | [Go]({{< relref "/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md" >}})| Medium | O(n)| O(1)|| \ No newline at end of file diff --git a/ctl/meta/Math b/ctl/meta/Math new file mode 100644 index 00000000..e7850955 --- /dev/null +++ b/ctl/meta/Math @@ -0,0 +1,18 @@ +|2. Add Two Numbers | [Go]({{< relref "/ChapterFour/0002.Add-Two-Numbers.md" >}})| Medium | O(n)| O(1)|| +|50. Pow(x, n) | [Go]({{< relref "/ChapterFour/0050.Powx-n.md" >}})| Medium | O(log n)| O(1)|| +|60. Permutation Sequence | [Go]({{< relref "/ChapterFour/0060.Permutation-Sequence.md" >}})| Medium | O(n log n)| O(1)|| +|69. Sqrt(x) | [Go]({{< relref "/ChapterFour/0069.Sqrtx.md" >}})| Easy | O(log n)| O(1)|| +|202. Happy Number | [Go]({{< relref "/ChapterFour/0202.Happy-Number.md" >}})| Easy | O(log n)| O(1)|| +|224. Basic Calculator | [Go]({{< relref "/ChapterFour/0224.Basic-Calculator.md" >}})| Hard | O(n)| O(n)|| +|231. Power of Two | [Go]({{< relref "/ChapterFour/0231.Power-of-Two.md" >}})| Easy | O(1)| O(1)|| +|263. Ugly Number | [Go]({{< relref "/ChapterFour/0263.Ugly-Number.md" >}})| Easy | O(log n)| O(1)|| +|326. Power of Three | [Go]({{< relref "/ChapterFour/0326.Power-of-Three.md" >}})| Easy | O(1)| O(1)|| +|343. Integer Break | [Go]({{< relref "/ChapterFour/0343.Integer-Break.md" >}})| Medium | O(n^2)| O(n)|| +|357. Count Numbers with Unique Digits | [Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})| Medium | O(1)| O(1)|| +|628. Maximum Product of Three Numbers | [Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})| Easy | O(n)| O(1)|| +|885. Spiral Matrix III | [Go]({{< relref "/ChapterFour/0885.Spiral-Matrix-III.md" >}})| Medium | O(n^2)| O(1)|| +|891. Sum of Subsequence Widths | [Go]({{< relref "/ChapterFour/0891.Sum-of-Subsequence-Widths.md" >}})| Hard | O(n log n)| O(1)|| +|942. DI String Match | [Go]({{< relref "/ChapterFour/0942.DI-String-Match.md" >}})| Easy | O(n)| O(1)|| +|976. Largest Perimeter Triangle | [Go]({{< relref "/ChapterFour/0976.Largest-Perimeter-Triangle.md" >}})| Easy | O(n log n)| O(log n) || +|996. Number of Squareful Arrays | [Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})| Hard | O(n log n)| O(n) || +|1025. Divisor Game | [Go]({{< relref "/ChapterFour/1025.Divisor-Game.md" >}})| Easy | O(1)| O(1)|| \ No newline at end of file diff --git a/ctl/meta/Segment_Tree b/ctl/meta/Segment_Tree new file mode 100644 index 00000000..0e7f9c74 --- /dev/null +++ b/ctl/meta/Segment_Tree @@ -0,0 +1,10 @@ +|218. The Skyline Problem | [Go]({{< relref "/ChapterFour/0218.The-Skyline-Problem.md" >}})| Hard | O(n log n)| O(n)|❤️| +|307. Range Sum Query - Mutable | [Go]({{< relref "/ChapterFour/0307.Range-Sum-Query---Mutable.md" >}})| Hard | O(1)| O(n)|| +|315. Count of Smaller Numbers After Self | [Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})| Hard | O(n log n)| O(n)|| +|327. Count of Range Sum | [Go]({{< relref "/ChapterFour/0327.Count-of-Range-Sum.md" >}})| Hard | O(n log n)| O(n)|❤️| +|493. Reverse Pairs | [Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})| Hard | O(n log n)| O(n)|| +|699. Falling Squares | [Go]({{< relref "/ChapterFour/0699.Falling-Squares.md" >}})| Hard | O(n log n)| O(n)|❤️| +|715. Range Module | [Go]({{< relref "/ChapterFour/0715.Range-Module.md" >}})| Hard | O(log n)| O(n)|❤️| +|732. My Calendar III | [Go]({{< relref "/ChapterFour/0732.My-Calendar-III.md" >}})| Hard | O(log n)| O(n)|❤️| +|850. Rectangle Area II | [Go]({{< relref "/ChapterFour/0850.Rectangle-Area-II.md" >}})| Hard | O(n log n)| O(n)|❤️| +|1157. Online Majority Element In Subarray | [Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})| Hard | O(log n)| O(n)|❤️| \ No newline at end of file diff --git a/ctl/meta/Sliding_Window b/ctl/meta/Sliding_Window new file mode 100644 index 00000000..e3ec8c4a --- /dev/null +++ b/ctl/meta/Sliding_Window @@ -0,0 +1,13 @@ +|3. Longest Substring Without Repeating Characters | [Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})| Medium | O(n)| O(1)|❤️| +|76. Minimum Window Substring | [Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})| Hard | O(n)| O(n)|❤️| +|239. Sliding Window Maximum | [Go]({{< relref "/ChapterFour/0239.Sliding-Window-Maximum.md" >}})| Hard | O(n * k)| O(n)|❤️| +|424. Longest Repeating Character Replacement | [Go]({{< relref "/ChapterFour/0424.Longest-Repeating-Character-Replacement.md" >}})| Medium | O(n)| O(1) || +|480. Sliding Window Median | [Go]({{< relref "/ChapterFour/0480.Sliding-Window-Median.md" >}})| Hard | O(n * log k)| O(k)|❤️| +|567. Permutation in String | [Go]({{< relref "/ChapterFour/0567.Permutation-in-String.md" >}})| Medium | O(n)| O(1)|❤️| +|978. Longest Turbulent Subarray | [Go]({{< relref "/ChapterFour/0978.Longest-Turbulent-Subarray.md" >}})| Medium | O(n)| O(1)|❤️| +|992. Subarrays with K Different Integers | [Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})| Hard | O(n)| O(n)|❤️| +|995. Minimum Number of K Consecutive Bit Flips | [Go]({{< relref "/ChapterFour/0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md" >}})| Hard | O(n)| O(1)|❤️| +|1004. Max Consecutive Ones III | [Go]({{< relref "/ChapterFour/1004.Max-Consecutive-Ones-III.md" >}})| Medium | O(n)| O(1) || +|1040. Moving Stones Until Consecutive II | [Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})| Medium | O(n log n)| O(1) |❤️| +|1052. Grumpy Bookstore Owner | [Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})| Medium | O(n log n)| O(1) || +|1074. Number of Submatrices That Sum to Target | [Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})| Hard | O(n^3)| O(n) |❤️| \ No newline at end of file diff --git a/ctl/meta/Sort b/ctl/meta/Sort new file mode 100644 index 00000000..cf944272 --- /dev/null +++ b/ctl/meta/Sort @@ -0,0 +1,23 @@ +|56. Merge Intervals | [Go]({{< relref "/ChapterFour/0056.Merge-Intervals.md" >}})| Medium | O(n log n)| O(log n)|| +|57. Insert Interval | [Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})| Hard | O(n)| O(1)|| +|75. Sort Colors | [Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})| Medium| O(n)| O(1)|❤️| +|147. Insertion Sort List | [Go]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}})| Medium | O(n)| O(1) |❤️| +|148. Sort List | [Go]({{< relref "/ChapterFour/0148.Sort-List.md" >}})| Medium |O(n log n)| O(log n)|❤️| +|164. Maximum Gap | [Go]({{< relref "/ChapterFour/0164.Maximum-Gap.md" >}})| Hard | O(n log n)| O(log n) |❤️| +|179. Largest Number | [Go]({{< relref "/ChapterFour/0179.Largest-Number.md" >}})| Medium | O(n log n)| O(log n) |❤️| +|220. Contains Duplicate III | [Go]({{< relref "/ChapterFour/0220.Contains-Duplicate-III.md" >}})| Medium | O(n log n)| O(1) |❤️| +|242. Valid Anagram | [Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})| Easy | O(n)| O(n) || +|274. H-Index | [Go]({{< relref "/ChapterFour/0274.H-Index.md" >}})| Medium | O(n)| O(n) || +|324. Wiggle Sort II | [Go]({{< relref "/ChapterFour/0324.Wiggle-Sort-II.md" >}})| Medium| O(n)| O(n)|❤️| +|349. Intersection of Two Arrays | [Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})| Easy | O(n)| O(n) || +|350. Intersection of Two Arrays II | [Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})| Easy | O(n)| O(n) || +|524. Longest Word in Dictionary through Deleting | [Go]({{< relref "/ChapterFour/0524.Longest-Word-in-Dictionary-through-Deleting.md" >}})| Medium | O(n)| O(1) || +|767. Reorganize String | [Go]({{< relref "/ChapterFour/0767.Reorganize-String.md" >}})| Medium | O(n log n)| O(log n) |❤️| +|853. Car Fleet | [Go]({{< relref "/ChapterFour/0853.Car-Fleet.md" >}})| Medium | O(n log n)| O(log n) || +|710. Random Pick with Blacklist | [Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})| Hard | O(n)| O(n) || +|922. Sort Array By Parity II | [Go]({{< relref "/ChapterFour/0922.Sort-Array-By-Parity-II.md" >}})| Easy | O(n)| O(1) || +|969. Pancake Sorting | [Go]({{< relref "/ChapterFour/0969.Pancake-Sorting.md" >}})| Medium | O(n log n)| O(log n) |❤️| +|973. K Closest Points to Origin | [Go]({{< relref "/ChapterFour/0973.K-Closest-Points-to-Origin.md" >}})| Medium | O(n log n)| O(log n) || +|976. Largest Perimeter Triangle | [Go]({{< relref "/ChapterFour/0976.Largest-Perimeter-Triangle.md" >}})| Easy | O(n log n)| O(log n) || +|1030. Matrix Cells in Distance Order | [Go]({{< relref "/ChapterFour/1030.Matrix-Cells-in-Distance-Order.md" >}})| Easy | O(n^2)| O(1) || +|1054. Distant Barcodes | [Go]({{< relref "/ChapterFour/1054.Distant-Barcodes.md" >}})| Medium | O(n log n)| O(log n) |❤️| \ No newline at end of file diff --git a/ctl/meta/Stack b/ctl/meta/Stack new file mode 100644 index 00000000..a145368c --- /dev/null +++ b/ctl/meta/Stack @@ -0,0 +1,37 @@ +|20. Valid Parentheses | [Go]({{< relref "/ChapterFour/0020.Valid-Parentheses.md" >}})| Easy | O(log n)| O(1)|| +|42. Trapping Rain Water | [Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})| Hard | O(n)| O(1)|❤️| +|71. Simplify Path | [Go]({{< relref "/ChapterFour/0071.Simplify-Path.md" >}})| Medium | O(n)| O(n)|❤️| +|84. Largest Rectangle in Histogram | [Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}})| Medium | O(n)| O(n)|❤️| +|94. Binary Tree Inorder Traversal | [Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})| Medium | O(n)| O(1)|| +|103. Binary Tree Zigzag Level Order Traversal | [Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})| Medium | O(n)| O(n)|| +|144. Binary Tree Preorder Traversal | [Go]({{< relref "/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md" >}})| Medium | O(n)| O(1)|| +|145. Binary Tree Postorder Traversal | [Go]({{< relref "/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md" >}})| Hard | O(n)| O(1)|| +|150. Evaluate Reverse Polish Notation | [Go]({{< relref "/ChapterFour/0150.Evaluate-Reverse-Polish-Notation.md" >}})| Medium | O(n)| O(1)|| +|155. Min Stack | [Go]({{< relref "/ChapterFour/0155.Min-Stack.md" >}})| Easy | O(n)| O(n)|| +|173. Binary Search Tree Iterator | [Go]({{< relref "/ChapterFour/0173.Binary-Search-Tree-Iterator.md" >}})| Medium | O(n)| O(1)|| +|224. Basic Calculator | [Go]({{< relref "/ChapterFour/0224.Basic-Calculator.md" >}})| Hard | O(n)| O(n)|| +|225. Implement Stack using Queues | [Go]({{< relref "/ChapterFour/0225.Implement-Stack-using-Queues.md" >}})| Easy | O(n)| O(n)|| +|232. Implement Queue using Stacks | [Go]({{< relref "/ChapterFour/0232.Implement-Queue-using-Stacks.md" >}})| Easy | O(n)| O(n)|| +|331. Verify Preorder Serialization of a Binary Tree | [Go]({{< relref "/ChapterFour/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md" >}})| Medium | O(n)| O(1)|| +|394. Decode String | [Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})| Medium | O(n)| O(n)|| +|402. Remove K Digits | [Go]({{< relref "/ChapterFour/0402.Remove-K-Digits.md" >}})| Medium | O(n)| O(1)|| +|456. 132 Pattern | [Go]({{< relref "/ChapterFour/0456.132-Pattern.md" >}})| Medium | O(n)| O(n)|| +|496. Next Greater Element I | [Go]({{< relref "/ChapterFour/0496.Next-Greater-Element-I.md" >}})| Easy | O(n)| O(n)|| +|503. Next Greater Element II | [Go]({{< relref "/ChapterFour/0503.Next-Greater-Element-II.md" >}})| Medium | O(n)| O(n)|| +|636. Exclusive Time of Functions | [Go]({{< relref "/ChapterFour/0636.Exclusive-Time-of-Functions.md" >}})| Medium | O(n)| O(n)|| +|682. Baseball Game | [Go]({{< relref "/ChapterFour/0682.Baseball-Game.md" >}})| Easy | O(n)| O(n)|| +|726. Number of Atoms | [Go]({{< relref "/ChapterFour/0726.Number-of-Atoms.md" >}})| Hard | O(n)| O(n) |❤️| +|735. Asteroid Collision | [Go]({{< relref "/ChapterFour/0735.Asteroid-Collision.md" >}})| Medium | O(n)| O(n) || +|739. Daily Temperatures | [Go]({{< relref "/ChapterFour/0739.Daily-Temperatures.md" >}})| Medium | O(n)| O(n) || +|844. Backspace String Compare | [Go]({{< relref "/ChapterFour/0844.Backspace-String-Compare.md" >}})| Easy | O(n)| O(n) || +|856. Score of Parentheses | [Go]({{< relref "/ChapterFour/0856.Score-of-Parentheses.md" >}})| Medium | O(n)| O(n)|| +|880. Decoded String at Index | [Go]({{< relref "/ChapterFour/0880.Decoded-String-at-Index.md" >}})| Medium | O(n)| O(n)|| +|895. Maximum Frequency Stack | [Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})| Hard | O(n)| O(n) || +|901. Online Stock Span | [Go]({{< relref "/ChapterFour/0901.Online-Stock-Span.md" >}})| Medium | O(n)| O(n) || +|907. Sum of Subarray Minimums | [Go]({{< relref "/ChapterFour/0907.Sum-of-Subarray-Minimums.md" >}})| Medium | O(n)| O(n)|❤️| +|921. Minimum Add to Make Parentheses Valid | [Go]({{< relref "/ChapterFour/0921.Minimum-Add-to-Make-Parentheses-Valid.md" >}})| Medium | O(n)| O(n)|| +|946. Validate Stack Sequences | [Go]({{< relref "/ChapterFour/0946.Validate-Stack-Sequences.md" >}})| Medium | O(n)| O(n)|| +|1003. Check If Word Is Valid After Substitutions | [Go]({{< relref "/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md" >}})| Medium | O(n)| O(1)|| +|1019. Next Greater Node In Linked List | [Go]({{< relref "/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md" >}})| Medium | O(n)| O(1)|| +|1021. Remove Outermost Parentheses | [Go]({{< relref "/ChapterFour/1021.Remove-Outermost-Parentheses.md" >}})| Medium | O(n)| O(1)|| +|1047. Remove All Adjacent Duplicates In String | [Go]({{< relref "/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md" >}})| Medium | O(n)| O(1)|| \ No newline at end of file diff --git a/ctl/meta/String b/ctl/meta/String new file mode 100644 index 00000000..e2d905f7 --- /dev/null +++ b/ctl/meta/String @@ -0,0 +1,20 @@ +|3. Longest Substring Without Repeating Characters | [Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})| Medium | O(n)| O(1)|❤️| +|17. Letter Combinations of a Phone Number | [Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})| Medium | O(log n)| O(1)|| +|20. Valid Parentheses | [Go]({{< relref "/ChapterFour/0020.Valid-Parentheses.md" >}})| Easy | O(log n)| O(1)|| +|22. Generate Parentheses | [Go]({{< relref "/ChapterFour/0022.Generate-Parentheses.md" >}})| Medium | O(log n)| O(1)|| +|28. Implement strStr() | [Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})| Easy | O(n)| O(1)|| +|30. Substring with Concatenation of All Words | [Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})| Hard | O(n)| O(n)|❤️| +|49. Group Anagrams | [Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})| Medium | O(n log n)| O(n)|| +|71. Simplify Path | [Go]({{< relref "/ChapterFour/0071.Simplify-Path.md" >}})| Medium | O(n)| O(n)|| +|76. Minimum Window Substring | [Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})| Hard | O(n)| O(n)|❤️| +|91. Decode Ways | [Go]({{< relref "/ChapterFour/0091.Decode-Ways.md" >}})| Medium | O(n)| O(n)|| +|93. Restore IP Addresses | [Go]({{< relref "/ChapterFour/0093.Restore-IP-Addresses.md" >}})| Medium | O(n)| O(n)|❤️| +|125. Valid Palindrome | [Go]({{< relref "/ChapterFour/0125.Valid-Palindrome.md" >}})| Easy | O(n)| O(1)|| +|126. Word Ladder II | [Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})| Hard | O(n)| O(n^2)|❤️| +|344. Reverse String | [Go]({{< relref "/ChapterFour/0344.Reverse-String.md" >}})| Easy | O(n)| O(1)|| +|345. Reverse Vowels of a String | [Go]({{< relref "/ChapterFour/0345.Reverse-Vowels-of-a-String.md" >}})| Easy | O(n)| O(1)|| +|767. Reorganize String | [Go]({{< relref "/ChapterFour/0767.Reorganize-String.md" >}})| Medium | O(n log n)| O(log n) |❤️| +|842. Split Array into Fibonacci Sequence | [Go]({{< relref "/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md" >}})| Medium | O(n^2)| O(1)|❤️| +|856. Score of Parentheses | [Go]({{< relref "/ChapterFour/0856.Score-of-Parentheses.md" >}})| Medium | O(n)| O(n)|| +|925. Long Pressed Name | [Go]({{< relref "/ChapterFour/0925.Long-Pressed-Name.md" >}})| Easy | O(n)| O(1)|| +|1003. Check If Word Is Valid After Substitutions | [Go]({{< relref "/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md" >}})| Medium | O(n)| O(1)|| \ No newline at end of file diff --git a/ctl/meta/Tree b/ctl/meta/Tree new file mode 100644 index 00000000..ce2a837b --- /dev/null +++ b/ctl/meta/Tree @@ -0,0 +1,33 @@ +|94. Binary Tree Inorder Traversal | [Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})| Medium | O(n)| O(1)|| +|96. Unique Binary Search Trees | [Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}})| Medium | O(n^2)| O(n)|| +|98. Validate Binary Search Tree | [Go]({{< relref "/ChapterFour/0098.Validate-Binary-Search-Tree.md" >}})| Medium | O(n)| O(1)|| +|99. Recover Binary Search Tree | [Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}})| Hard | O(n)| O(1)|| +|100. Same Tree | [Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}})| Easy | O(n)| O(1)|| +|101. Symmetric Tree | [Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})| Easy | O(n)| O(1)|| +|102. Binary Tree Level Order Traversal | [Go]({{< relref "/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md" >}})| Medium | O(n)| O(1)|| +|103. Binary Tree Zigzag Level Order Traversal | [Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})| Medium | O(n)| O(n)|| +|104. Maximum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| +|107. Binary Tree Level Order Traversal II | [Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})| Easy | O(n)| O(1)|| +|108. Convert Sorted Array to Binary Search Tree | [Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})| Easy | O(n)| O(1)|| +|110. Balanced Binary Tree | [Go]({{< relref "/ChapterFour/0110.Balanced-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| +|111. Minimum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| +|112. Path Sum | [Go]({{< relref "/ChapterFour/0112.Path-Sum.md" >}})| Easy | O(n)| O(1)|| +|113. Path Sum II | [Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}})| Medium | O(n)| O(1)|| +|114. Flatten Binary Tree to Linked List | [Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})| Medium | O(n)| O(1)|| +|124. Binary Tree Maximum Path Sum | [Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}})| Hard | O(n)| O(1)|| +|129. Sum Root to Leaf Numbers | [Go]({{< relref "/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md" >}})| Medium | O(n)| O(1)|| +|144. Binary Tree Preorder Traversal | [Go]({{< relref "/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md" >}})| Medium | O(n)| O(1)|| +|145. Binary Tree Postorder Traversal | [Go]({{< relref "/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md" >}})| Hard | O(n)| O(1)|| +|173. Binary Search Tree Iterator | [Go]({{< relref "/ChapterFour/0173.Binary-Search-Tree-Iterator.md" >}})| Medium | O(n)| O(1)|| +|199. Binary Tree Right Side View | [Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})| Medium | O(n)| O(1)|| +|222. Count Complete Tree Nodes | [Go]({{< relref "/ChapterFour/0222.Count-Complete-Tree-Nodes.md" >}})| Medium | O(n)| O(1)|| +|226. Invert Binary Tree | [Go]({{< relref "/ChapterFour/0226.Invert-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| +|230. Kth Smallest Element in a BST | [Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})| Medium | O(n)| O(1)|| +|235. Lowest Common Ancestor of a Binary Search Tree | [Go]({{< relref "/ChapterFour/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md" >}})| Easy | O(n)| O(1)|| +|236. Lowest Common Ancestor of a Binary Tree | [Go]({{< relref "/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md" >}})| Medium | O(n)| O(1)|| +|257. Binary Tree Paths | [Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})| Easy | O(n)| O(1)|| +|404. Sum of Left Leaves | [Go]({{< relref "/ChapterFour/0404.Sum-of-Left-Leaves.md" >}})| Easy | O(n)| O(1)|| +|437. Path Sum III | [Go]({{< relref "/ChapterFour/0437.Path-Sum-III.md" >}})| Easy | O(n)| O(1)|| +|515. Find Largest Value in Each Tree Row | [Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})| Medium | O(n)| O(n)|| +|637. Average of Levels in Binary Tree | [Go]({{< relref "/ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md" >}})| Easy | O(n)| O(n)|| +|993. Cousins in Binary Tree | [Go]({{< relref "/ChapterFour/0993.Cousins-in-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| \ No newline at end of file diff --git a/ctl/meta/Two_Pointers b/ctl/meta/Two_Pointers new file mode 100644 index 00000000..b69b9859 --- /dev/null +++ b/ctl/meta/Two_Pointers @@ -0,0 +1,50 @@ +|3. Longest Substring Without Repeating Characters | [Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})| Medium | O(n)| O(1)|❤️| +|11. Container With Most Water | [Go]({{< relref "/ChapterFour/0011.Container-With-Most-Water.md" >}})| Medium | O(n)| O(1)|| +|15. 3Sum | [Go]({{< relref "/ChapterFour/0015.3Sum.md" >}})| Medium | O(n^2)| O(n)|❤️| +|16. 3Sum Closest | [Go]({{< relref "/ChapterFour/0016.3Sum-Closest.md" >}})| Medium | O(n^2)| O(1)|❤️| +|18. 4Sum | [Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})| Medium | O(n^3)| O(n^2)|❤️| +|19. Remove Nth Node From End of List | [Go]({{< relref "/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md" >}})| Medium | O(n)| O(1)|| +|26. Remove Duplicates from Sorted Array | [Go]({{< relref "/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md" >}})| Easy | O(n)| O(1)|| +|27. Remove Element | [Go]({{< relref "/ChapterFour/0027.Remove-Element.md" >}})| Easy | O(n)| O(1)|| +|28. Implement strStr() | [Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})| Easy | O(n)| O(1)|| +|30. Substring with Concatenation of All Words | [Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})| Hard | O(n)| O(n)|❤️| +|42. Trapping Rain Water | [Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})| Hard | O(n)| O(1)|❤️| +|61. Rotate List | [Go]({{< relref "/ChapterFour/0061.Rotate-List.md" >}})| Medium | O(n)| O(1)|| +|75. Sort Colors | [Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})| Medium| O(n)| O(1)|❤️| +|76. Minimum Window Substring | [Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})| Hard | O(n)| O(n)|❤️| +|80. Remove Duplicates from Sorted Array II | [Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})| Medium | O(n)| O(1|| +|86. Partition List | [Go]({{< relref "/ChapterFour/0086.Partition-List.md" >}})| Medium | O(n)| O(1)|❤️| +|88. Merge Sorted Array | [Go]({{< relref "/ChapterFour/0088.Merge-Sorted-Array.md" >}})| Easy | O(n)| O(1)|❤️| +|125. Valid Palindrome | [Go]({{< relref "/ChapterFour/0125.Valid-Palindrome.md" >}})| Easy | O(n)| O(1)|| +|141. Linked List Cycle | [Go]({{< relref "/ChapterFour/0141.Linked-List-Cycle.md" >}})| Easy | O(n)| O(1)|❤️| +|142. Linked List Cycle II | [Go]({{< relref "/ChapterFour/0142.Linked-List-Cycle-II.md" >}})| Medium | O(n)| O(1)|❤️| +|167. Two Sum II - Input array is sorted | [Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})| Easy | O(n)| O(1)|| +|209. Minimum Size Subarray Sum | [Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})| Medium | O(n)| O(1)|| +|234. Palindrome Linked List | [Go]({{< relref "/ChapterFour/0234.Palindrome-Linked-List.md" >}})| Easy | O(n)| O(1)|| +|283. Move Zeroes | [Go]({{< relref "/ChapterFour/0283.Move-Zeroes.md" >}})| Easy | O(n)| O(1)|| +|287. Find the Duplicate Number | [Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})| Easy | O(n)| O(1)|❤️| +|344. Reverse String | [Go]({{< relref "/ChapterFour/0344.Reverse-String.md" >}})| Easy | O(n)| O(1)|| +|345. Reverse Vowels of a String | [Go]({{< relref "/ChapterFour/0345.Reverse-Vowels-of-a-String.md" >}})| Easy | O(n)| O(1)|| +|349. Intersection of Two Arrays | [Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})| Easy | O(n)| O(n) || +|350. Intersection of Two Arrays II | [Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})| Easy | O(n)| O(n) || +|424. Longest Repeating Character Replacement | [Go]({{< relref "/ChapterFour/0424.Longest-Repeating-Character-Replacement.md" >}})| Medium | O(n)| O(1) || +|524. Longest Word in Dictionary through Deleting | [Go]({{< relref "/ChapterFour/0524.Longest-Word-in-Dictionary-through-Deleting.md" >}})| Medium | O(n)| O(1) || +|532. K-diff Pairs in an Array | [Go]({{< relref "/ChapterFour/0532.K-diff-Pairs-in-an-Array.md" >}})| Easy | O(n)| O(n)|| +|567. Permutation in String | [Go]({{< relref "/ChapterFour/0567.Permutation-in-String.md" >}})| Medium | O(n)| O(1)|❤️| +|713. Subarray Product Less Than K | [Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})| Medium | O(n)| O(1)|| +|763. Partition Labels | [Go]({{< relref "/ChapterFour/0763.Partition-Labels.md" >}})| Medium | O(n)| O(1)|❤️| +|826. Most Profit Assigning Work | [Go]({{< relref "/ChapterFour/0826.Most-Profit-Assigning-Work.md" >}})| Medium | O(n log n)| O(n)|| +|828. Unique Letter String | [Go]({{< relref "/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md" >}})| Hard | O(n)| O(1)|❤️| +|838. Push Dominoes | [Go]({{< relref "/ChapterFour/0838.Push-Dominoes.md" >}})| Medium | O(n)| O(n)|| +|844. Backspace String Compare | [Go]({{< relref "/ChapterFour/0844.Backspace-String-Compare.md" >}})| Easy | O(n)| O(n) || +|845. Longest Mountain in Array | [Go]({{< relref "/ChapterFour/0845.Longest-Mountain-in-Array.md" >}})| Medium | O(n)| O(1) || +|881. Boats to Save People | [Go]({{< relref "/ChapterFour/0881.Boats-to-Save-People.md" >}})| Medium | O(n log n)| O(1) || +|904. Fruit Into Baskets | [Go]({{< relref "/ChapterFour/0904.Fruit-Into-Baskets.md" >}})| Medium | O(n log n)| O(1) || +|923. 3Sum With Multiplicity | [Go]({{< relref "/ChapterFour/0923.3Sum-With-Multiplicity.md" >}})| Medium | O(n^2)| O(n) || +|925. Long Pressed Name | [Go]({{< relref "/ChapterFour/0925.Long-Pressed-Name.md" >}})| Easy | O(n)| O(1)|| +|930. Binary Subarrays With Sum | [Go]({{< relref "/ChapterFour/0930.Binary-Subarrays-With-Sum.md" >}})| Medium | O(n)| O(n) |❤️| +|977. Squares of a Sorted Array | [Go]({{< relref "/ChapterFour/0977.Squares-of-a-Sorted-Array.md" >}})| Easy | O(n)| O(1)|| +|986. Interval List Intersections | [Go]({{< relref "/ChapterFour/0986.Interval-List-Intersections.md" >}})| Medium | O(n)| O(1)|| +|992. Subarrays with K Different Integers | [Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})| Hard | O(n)| O(n)|❤️| +|1004. Max Consecutive Ones III | [Go]({{< relref "/ChapterFour/1004.Max-Consecutive-Ones-III.md" >}})| Medium | O(n)| O(1) || +|1093. Statistics from a Large Sample | [Go]({{< relref "/ChapterFour/1093.Statistics-from-a-Large-Sample.md" >}})| Medium | O(n)| O(1) || \ No newline at end of file diff --git a/ctl/meta/Union_Find b/ctl/meta/Union_Find new file mode 100644 index 00000000..b0bab407 --- /dev/null +++ b/ctl/meta/Union_Find @@ -0,0 +1,18 @@ +|128. Longest Consecutive Sequence | [Go]({{< relref "/ChapterFour/0128.Longest-Consecutive-Sequence.md" >}})| Hard | O(n)| O(n)|❤️| +|130. Surrounded Regions | [Go]({{< relref "/ChapterFour/0130.Surrounded-Regions.md" >}})| Medium | O(m\*n)| O(m\*n)|| +|200. Number of Islands | [Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})| Medium | O(m\*n)| O(m\*n)|| +|399. Evaluate Division | [Go]({{< relref "/ChapterFour/0399.Evaluate-Division.md" >}})| Medium | O(n)| O(n)|| +|547. Friend Circles | [Go]({{< relref "/ChapterFour/0547.Friend-Circles.md" >}})| Medium | O(n^2)| O(n)|| +|684. Redundant Connection | [Go]({{< relref "/ChapterFour/0684.Redundant-Connection.md" >}})| Medium | O(n)| O(n)|| +|685. Redundant Connection II | [Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})| Hard | O(n)| O(n)|| +|721. Accounts Merge | [Go]({{< relref "/ChapterFour/0721.Accounts-Merge.md" >}})| Medium | O(n)| O(n)|❤️| +|765. Couples Holding Hands | [Go]({{< relref "/ChapterFour/0765.Couples-Holding-Hands.md" >}})| Hard | O(n)| O(n)|❤️| +|778. Swim in Rising Water | [Go]({{< relref "/ChapterFour/0778.Swim-in-Rising-Water.md" >}})| Hard | O(n^2)| O(n)|❤️| +|803. Bricks Falling When Hit | [Go]({{< relref "/ChapterFour/0803.Bricks-Falling-When-Hit.md" >}})| Hard | O(n^2)| O(n)|❤️| +|839. Similar String Groups | [Go]({{< relref "/ChapterFour/0839.Similar-String-Groups.md" >}})| Hard | O(n^2)| O(n)|| +|924. Minimize Malware Spread | [Go]({{< relref "/ChapterFour/0924.Minimize-Malware-Spread.md" >}})| Hard | O(m\*n)| O(n)|| +|928. Minimize Malware Spread II | [Go]({{< relref "/ChapterFour/0928.Minimize-Malware-Spread-II.md" >}})| Hard | O(m\*n)| O(n)|❤️| +|947. Most Stones Removed with Same Row or Column | [Go]({{< relref "/ChapterFour/0947.Most-Stones-Removed-with-Same-Row-or-Column.md" >}})| Medium | O(n)| O(n)|| +|952. Largest Component Size by Common Factor | [Go]({{< relref "/ChapterFour/0952.Largest-Component-Size-by-Common-Factor.md" >}})| Hard | O(n)| O(n)|❤️| +|959. Regions Cut By Slashes | [Go]({{< relref "/ChapterFour/0959.Regions-Cut-By-Slashes.md" >}})| Medium | O(n^2)| O(n^2)|❤️| +|990. Satisfiability of Equality Equations | [Go]({{< relref "/ChapterFour/0990.Satisfiability-of-Equality-Equations.md" >}})| Medium | O(n)| O(n)|| \ No newline at end of file diff --git a/ctl/meta/meta b/ctl/meta/meta new file mode 100644 index 00000000..a28e1a67 --- /dev/null +++ b/ctl/meta/meta @@ -0,0 +1,2 @@ +| Title | Solution | Difficulty | Time | Space |收藏| +| ----- | :--------: | :----------: | :----: | :-----: | :-----: | \ No newline at end of file diff --git a/ctl/models/lcproblems.go b/ctl/models/lcproblems.go index aad80cd1..3851eea3 100644 --- a/ctl/models/lcproblems.go +++ b/ctl/models/lcproblems.go @@ -47,8 +47,8 @@ type StatStatusPairs struct { Progress float64 `json:"progress"` } -// ConvertMdModel define -func ConvertMdModel(problems []StatStatusPairs) []Mdrow { +// ConvertMdModelFromSsp define +func ConvertMdModelFromSsp(problems []StatStatusPairs) []Mdrow { mdrows := []Mdrow{} for _, problem := range problems { res := Mdrow{} diff --git a/ctl/models/mdrow.go b/ctl/models/mdrow.go index 8b6b6bbc..ba200889 100644 --- a/ctl/models/mdrow.go +++ b/ctl/models/mdrow.go @@ -2,6 +2,7 @@ package models import ( "fmt" + "strings" ) // Mdrow define @@ -15,6 +16,19 @@ type Mdrow struct { Frequency string `json:"frequency"` } +// GenerateMdRows define +func GenerateMdRows(solutionIds []int, mdrows []Mdrow) { + for i := 0; i < len(solutionIds); i++ { + id := mdrows[solutionIds[i]-1].FrontendQuestionID + if solutionIds[i] == int(id) { + //fmt.Printf("id = %v i = %v solutionIds = %v\n", id, i, solutionIds[i]) + mdrows[id-1].SolutionPath = fmt.Sprintf("[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/%v)", fmt.Sprintf("%04d.%v", id, strings.Replace(mdrows[id-1].QuestionTitle, " ", "-", -1))) + } else { + fmt.Printf("序号出错了 solutionIds = %v id = %v\n", solutionIds[i], id) + } + } +} + // | 0001 | Two Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum)| 45.6% | Easy | | func (m Mdrow) tableLine() string { return fmt.Sprintf("|%04d|%v|%v|%v|%v||\n", m.FrontendQuestionID, m.QuestionTitle, m.SolutionPath, m.Acceptance, m.Difficulty) diff --git a/ctl/models/tagproblem.go b/ctl/models/tagproblem.go new file mode 100644 index 00000000..0514fbfe --- /dev/null +++ b/ctl/models/tagproblem.go @@ -0,0 +1,243 @@ +package models + +import ( + "encoding/json" + "fmt" + "github.com/halfrost/LeetCode-Go/ctl/util" + "strconv" + "strings" +) + +// Graphql define +type Graphql struct { + OperationName string `json:"operationName"` + Variables struct { + TitleSlug string `json:"titleSlug"` + } `json:"variables"` + Query string `json:"query"` +} + +// GraphQLResp define +type GraphQLResp struct { + Data struct { + TopicTag TopicTag `json:"topicTag"` + FavoritesLists FavoritesLists `json:"favoritesLists"` + } `json:"data"` +} + +// TopicTag define +type TopicTag struct { + Name string `json:"name"` + TranslatedName string `json:"translatedName"` + Slug string `json:"slug"` + Questions []Question `json:"questions"` + Frequencies float64 `json:"frequencies"` + Typename string `json:"__typename"` +} + +// Question define +type Question struct { + Status string `json:"status"` + QuestionID string `json:"questionId"` + QuestionFrontendID string `json:"questionFrontendId"` + Title string `json:"title"` + TitleSlug string `json:"titleSlug"` + TranslatedTitle string `json:"translatedTitle"` + Stats string `json:"stats"` + Difficulty string `json:"difficulty"` + TopicTags []TopicTags `json:"topicTags"` + CompanyTags interface{} `json:"companyTags"` + Typename string `json:"__typename"` +} + +// TopicTags define +type TopicTags struct { + Name string `json:"name"` + TranslatedName string `json:"translatedName"` + Slug string `json:"slug"` + Typename string `json:"__typename"` +} + +func (q Question) generateTagStatus() (TagStatus, error) { + var ts TagStatus + err := json.Unmarshal([]byte(q.Stats), &ts) + if err != nil { + fmt.Println(err) + return ts, err + } + return ts, nil +} + +// TagStatus define +type TagStatus struct { + TotalAccepted string `json:"totalAccepted"` + TotalSubmission string `json:"totalSubmission"` + TotalAcceptedRaw int32 `json:"totalAcceptedRaw"` + TotalSubmissionRaw int32 `json:"totalSubmissionRaw"` + AcRate string `json:"acRate"` +} + +// ConvertMdModelFromQuestions define +func ConvertMdModelFromQuestions(questions []Question) []Mdrow { + mdrows := []Mdrow{} + for _, question := range questions { + res := Mdrow{} + v, _ := strconv.Atoi(question.QuestionFrontendID) + res.FrontendQuestionID = int32(v) + res.QuestionTitle = question.Title + res.QuestionTitleSlug = question.TitleSlug + q, err := question.generateTagStatus() + if err != nil { + fmt.Println(err) + } + res.Acceptance = q.AcRate + res.Difficulty = question.Difficulty + mdrows = append(mdrows, res) + } + return mdrows +} + +// TagList define +type TagList struct { + FrontendQuestionID int32 `json:"question_id"` + QuestionTitle string `json:"question__title"` + SolutionPath string `json:"solution_path"` + Acceptance string `json:"acceptance"` + Difficulty string `json:"difficulty"` + TimeComplexity string `json:"time_complexity"` + SpaceComplexity string `json:"space_complexity"` + Favorite string `json:"favorite"` +} + +// | 0001 | Two Sum | [Go]({{< relref "/ChapterFour/0001.Two-Sum.md" >}})| Easy | O(n)| O(n)|❤️|50%| +func (t TagList) tableLine() string { + return fmt.Sprintf("|%04d|%v|%v|%v|%v|%v|%v|%v|\n", t.FrontendQuestionID, t.QuestionTitle, t.SolutionPath, t.Difficulty, t.TimeComplexity, t.SpaceComplexity, t.Favorite, t.Acceptance) +} + +// GenerateTagMdRows define +func GenerateTagMdRows(solutionIds []int, metaMap map[int]TagList, mdrows []Mdrow) []TagList { + tl := []TagList{} + for _, row := range mdrows { + if util.BinarySearch(solutionIds, int(row.FrontendQuestionID)) != -1 { + tmp := TagList{} + tmp.FrontendQuestionID = row.FrontendQuestionID + tmp.QuestionTitle = row.QuestionTitle + tmp.SolutionPath = fmt.Sprintf("[Go]({{< relref \"/ChapterFour/%v.md\" >}})", fmt.Sprintf("%04d.%v", int(row.FrontendQuestionID), strings.Replace(row.QuestionTitle, " ", "-", -1))) + tmp.Acceptance = row.Acceptance + tmp.Difficulty = row.Difficulty + tmp.TimeComplexity = metaMap[int(row.FrontendQuestionID)].TimeComplexity + tmp.SpaceComplexity = metaMap[int(row.FrontendQuestionID)].SpaceComplexity + tmp.Favorite = metaMap[int(row.FrontendQuestionID)].Favorite + tl = append(tl, tmp) + } + } + return tl +} + +// TagLists define +type TagLists struct { + TagLists []TagList +} + +//| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +//|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +func (tls TagLists) table() string { + res := "| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance |\n" + res += "|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: |\n" + for _, p := range tls.TagLists { + res += p.tableLine() + } + // 加这一行是为了撑开整个表格 + res += "|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|" + return res +} + +// AvailableTagTable define +func (tls TagLists) AvailableTagTable() string { + return tls.table() +} + +// FavoritesLists define +type FavoritesLists struct { + PublicFavorites []int `json:"publicFavorites"` + PrivateFavorites []struct { + IDHash string `json:"idHash"` + ID string `json:"id"` + Name string `json:"name"` + IsPublicFavorite bool `json:"isPublicFavorite"` + ViewCount int `json:"viewCount"` + Creator string `json:"creator"` + IsWatched bool `json:"isWatched"` + Questions []struct { + QuestionID string `json:"questionId"` + Title string `json:"title"` + TitleSlug string `json:"titleSlug"` + Typename string `json:"__typename"` + } `json:"questions"` + Typename string `json:"__typename"` + } `json:"privateFavorites"` + Typename string `json:"__typename"` +} + +// Gproblem define +type Gproblem struct { + QuestionID string `json:"questionId"` + QuestionFrontendID string `json:"questionFrontendId"` + BoundTopicID int `json:"boundTopicId"` + Title string `json:"title"` + TitleSlug string `json:"titleSlug"` + Content string `json:"content"` + TranslatedTitle string `json:"translatedTitle"` + TranslatedContent string `json:"translatedContent"` + IsPaidOnly bool `json:"isPaidOnly"` + Difficulty string `json:"difficulty"` + Likes int `json:"likes"` + Dislikes int `json:"dislikes"` + IsLiked interface{} `json:"isLiked"` + SimilarQuestions string `json:"similarQuestions"` + Contributors []interface{} `json:"contributors"` + LangToValidPlayground string `json:"langToValidPlayground"` + TopicTags []struct { + Name string `json:"name"` + Slug string `json:"slug"` + TranslatedName string `json:"translatedName"` + Typename string `json:"__typename"` + } `json:"topicTags"` + CompanyTagStats interface{} `json:"companyTagStats"` + CodeSnippets []GcodeSnippet `json:"codeSnippets"` + Stats string `json:"stats"` + Hints []interface{} `json:"hints"` + Solution interface{} `json:"solution"` + Status interface{} `json:"status"` + SampleTestCase string `json:"sampleTestCase"` + MetaData string `json:"metaData"` + JudgerAvailable bool `json:"judgerAvailable"` + JudgeType string `json:"judgeType"` + MysqlSchemas []interface{} `json:"mysqlSchemas"` + EnableRunCode bool `json:"enableRunCode"` + EnableTestMode bool `json:"enableTestMode"` + EnvInfo string `json:"envInfo"` + Typename string `json:"__typename"` +} + +// Gstat define +type Gstat struct { + TotalAcs int `json:"total_acs"` + QuestionTitle string `json:"question__title"` + IsNewQuestion bool `json:"is_new_question"` + QuestionArticleSlug string `json:"question__article__slug"` + TotalSubmitted int `json:"total_submitted"` + FrontendQuestionID int `json:"frontend_question_id"` + QuestionTitleSlug string `json:"question__title_slug"` + QuestionArticleLive bool `json:"question__article__live"` + QuestionHide bool `json:"question__hide"` + QuestionID int `json:"question_id"` +} + +// GcodeSnippet define +type GcodeSnippet struct { + Lang string `json:"lang"` + LangSlug string `json:"langSlug"` + Code string `json:"code"` + Typename string `json:"__typename"` +} diff --git a/ctl/pdf.go b/ctl/pdf.go new file mode 100644 index 00000000..03e18ee1 --- /dev/null +++ b/ctl/pdf.go @@ -0,0 +1,17 @@ +package main + +import ( + "github.com/spf13/cobra" +) + +func newPDFCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "pdf ", + Short: "PDF related commands", + Run: func(cmd *cobra.Command, args []string) { + + }, + } + //mc.PersistentFlags().StringVar(&logicEndpoint, "endpoint", "localhost:5880", "endpoint of logic service") + return cmd +} diff --git a/ctl/render.go b/ctl/render.go index 55fbfe73..549d1c38 100644 --- a/ctl/render.go +++ b/ctl/render.go @@ -5,21 +5,73 @@ import ( "encoding/json" "fmt" m "github.com/halfrost/LeetCode-Go/ctl/models" + "github.com/halfrost/LeetCode-Go/ctl/util" + "github.com/spf13/cobra" "io" "os" "regexp" "sort" + "strconv" "strings" ) -func main() { +var ( + chapterTwoList = []string{"Array", "String", "Two Pointers", "Linked List", "Stack", "Tree", "Dynamic Programming", "Backtracking", "Depth First Search", "Breadth First Search", + "Binary Search", "Math", "Hash Table", "Sort", "Bit Manipulation", "Union Find", "Sliding Window", "Segment Tree", "Binary Indexed Tree"} + chapterTwoFileName = []string{"Array", "String", "Two_Pointers", "Linked_List", "Stack", "Tree", "Dynamic_Programming", "Backtracking", "Depth_First_Search", "Breadth_First_Search", + "Binary_Search", "Math", "Hash_Table", "Sort", "Bit_Manipulation", "Union_Find", "Sliding_Window", "Segment_Tree", "Binary_Indexed_Tree"} + chapterTwoSlug = []string{"array", "string", "two-pointers", "linked-list", "stack", "tree", "dynamic-programming", "backtracking", "depth-first-search", "breadth-first-search", + "binary-search", "math", "hash-table", "sort", "bit-manipulation", "union-find", "sliding-window", "segment-tree", "binary-indexed-tree"} +) + +func newBuildCommand() *cobra.Command { + mc := &cobra.Command{ + Use: "build ", + Short: "Build doc related commands", + } + //mc.PersistentFlags().StringVar(&logicEndpoint, "endpoint", "localhost:5880", "endpoint of logic service") + mc.AddCommand( + newBuildREADME(), + newBuildChapterTwo(), + ) + + return mc +} + +func newBuildREADME() *cobra.Command { + cmd := &cobra.Command{ + Use: "readme", + Short: "Build readme.md commands", + Run: func(cmd *cobra.Command, args []string) { + buildREADME() + }, + } + // cmd.Flags().StringVar(&alias, "alias", "", "alias") + // cmd.Flags().StringVar(&appId, "appid", "", "appid") + return cmd +} + +func newBuildChapterTwo() *cobra.Command { + cmd := &cobra.Command{ + Use: "chapter-two", + Short: "Build Chapter Two commands", + Run: func(cmd *cobra.Command, args []string) { + buildChapterTwo() + }, + } + // cmd.Flags().StringVar(&alias, "alias", "", "alias") + // cmd.Flags().StringVar(&appId, "appid", "", "appid") + return cmd +} + +func buildREADME() { var ( problems []m.StatStatusPairs lpa m.LeetCodeProblemAll info m.UserInfo ) // 请求所有题目信息 - body := getProblemAllList(AllProblemURL) + body := getProblemAllList() problemsMap, optimizingIds := map[int]m.StatStatusPairs{}, []int{} err := json.Unmarshal(body, &lpa) if err != nil { @@ -34,36 +86,24 @@ func main() { for _, v := range problems { problemsMap[int(v.Stat.FrontendQuestionID)] = v } - mdrows := m.ConvertMdModel(problems) + mdrows := m.ConvertMdModelFromSsp(problems) sort.Sort(m.SortByQuestionID(mdrows)) - solutionIds, try := loadSolutionsDir() - generateMdRows(solutionIds, mdrows) + solutionIds, try := util.LoadSolutionsDir() + m.GenerateMdRows(solutionIds, mdrows) info.EasyTotal, info.MediumTotal, info.HardTotal, info.OptimizingEasy, info.OptimizingMedium, info.OptimizingHard, optimizingIds = statisticalData(problemsMap, solutionIds) omdrows := m.ConvertMdModelFromIds(problemsMap, optimizingIds) sort.Sort(m.SortByQuestionID(omdrows)) // 按照模板渲染 README - res, err := renderReadme("./template.markdown", len(solutionIds), try, m.Mdrows{Mdrows: mdrows}, m.Mdrows{Mdrows: omdrows}, info) + res, err := renderReadme("./template/template.markdown", len(solutionIds), try, m.Mdrows{Mdrows: mdrows}, m.Mdrows{Mdrows: omdrows}, info) if err != nil { fmt.Println(err) return } - writeFile("../README.md", res) + util.WriteFile("../README.md", res) //makeReadmeFile(mds) } -func generateMdRows(solutionIds []int, mdrows []m.Mdrow) { - for i := 0; i < len(solutionIds); i++ { - id := mdrows[solutionIds[i]-1].FrontendQuestionID - if solutionIds[i] == int(id) { - //fmt.Printf("id = %v i = %v solutionIds = %v\n", id, i, solutionIds[i]) - mdrows[id-1].SolutionPath = fmt.Sprintf("[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/%v)", fmt.Sprintf("%04d.%v", id, strings.Replace(mdrows[id-1].QuestionTitle, " ", "-", -1))) - } else { - fmt.Printf("序号出错了 solutionIds = %v id = %v\n", solutionIds[i], id) - } - } -} - func renderReadme(filePath string, total, try int, mdrows, omdrows m.Mdrows, user m.UserInfo) ([]byte, error) { f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) if err != nil { @@ -106,3 +146,97 @@ func renderReadme(filePath string, total, try int, mdrows, omdrows m.Mdrows, use } } } + +func buildChapterTwo() { + var ( + gr m.GraphQLResp + questions []m.Question + ) + + for index, tag := range chapterTwoSlug { + body := getTagProblemList(tag) + // fmt.Printf("%v\n", string(body)) + err := json.Unmarshal(body, &gr) + if err != nil { + fmt.Println(err) + return + } + questions = gr.Data.TopicTag.Questions + mdrows := m.ConvertMdModelFromQuestions(questions) + sort.Sort(m.SortByQuestionID(mdrows)) + solutionIds, _ := util.LoadSolutionsDir() + // generateMdRows(solutionIds, mdrows) + + tl, err := loadMetaData(fmt.Sprintf("./meta/%v", chapterTwoFileName[index])) + if err != nil { + fmt.Printf("err = %v\n", err) + } + tls := m.GenerateTagMdRows(solutionIds, tl, mdrows) + //fmt.Printf("tls = %v\n", tls) + // // 按照模板渲染 README + res, err := renderChapterTwo(fmt.Sprintf("./template/%v.md", chapterTwoFileName[index]), m.TagLists{TagLists: tls}) + if err != nil { + fmt.Println(err) + return + } + util.WriteFile(fmt.Sprintf("./%v.md", chapterTwoFileName[index]), res) + } +} + +func loadMetaData(filePath string) (map[int]m.TagList, error) { + f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) + if err != nil { + return nil, err + } + defer f.Close() + reader, metaMap := bufio.NewReader(f), map[int]m.TagList{} + + for { + line, _, err := reader.ReadLine() + if err != nil { + if err == io.EOF { + return metaMap, nil + } + return nil, err + } + s := strings.Split(string(line), "|") + v, _ := strconv.Atoi(strings.Split(s[1], ".")[0]) + // v[0] 是题号,s[4] time, s[5] space, s[6] favorite + metaMap[v] = m.TagList{ + FrontendQuestionID: int32(v), + Acceptance: "", + Difficulty: "", + TimeComplexity: s[4], + SpaceComplexity: s[5], + Favorite: s[6], + } + } +} + +func renderChapterTwo(filePath string, tls m.TagLists) ([]byte, error) { + f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) + if err != nil { + return nil, err + } + defer f.Close() + reader, output := bufio.NewReader(f), []byte{} + + for { + line, _, err := reader.ReadLine() + if err != nil { + if err == io.EOF { + return output, nil + } + return nil, err + } + if ok, _ := regexp.Match("{{.AvailableTagTable}}", line); ok { + reg := regexp.MustCompile("{{.AvailableTagTable}}") + newByte := reg.ReplaceAll(line, []byte(tls.AvailableTagTable())) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else { + output = append(output, line...) + output = append(output, []byte("\n")...) + } + } +} diff --git a/ctl/request.go b/ctl/request.go index 3b876595..056d5e14 100644 --- a/ctl/request.go +++ b/ctl/request.go @@ -1,6 +1,7 @@ package main import ( + "bytes" "fmt" "github.com/mozillazg/request" "io/ioutil" @@ -10,10 +11,15 @@ import ( const ( // AllProblemURL define AllProblemURL = "https://leetcode.com/api/problems/all/" + // QraphqlURL define + QraphqlURL = "https://leetcode.com/graphql" // LoginPageURL define LoginPageURL = "https://leetcode.com/accounts/login/" // AlgorithmsURL define AlgorithmsURL = "https://leetcode.com/api/problems/Algorithms/" + + // ArrayProblemURL define + ArrayProblemURL = "https://leetcode.com/tag/array/" ) var req *request.Request @@ -32,6 +38,7 @@ func signin() *request.Request { "Content-Type": "application/json", "Accept-Encoding": "", "cookie": cfg.Cookie, + "x-csrftoken": cfg.CSRFtoken, "Referer": "https://leetcode.com/accounts/login/", "origin": "https://leetcode.com", } @@ -43,30 +50,60 @@ func getRaw(URL string) []byte { resp, err := req.Get(URL) if err != nil { fmt.Printf("getRaw: Get Error: " + err.Error()) - } - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - fmt.Printf("getRaw: Read Error: " + err.Error()) - } - return body -} - -func getProblemAllList(URL string) []byte { - req := newReq() - resp, err := req.Get(URL) - if err != nil { - fmt.Println(err) return []byte{} } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { - fmt.Println(err) + fmt.Printf("getRaw: Read Error: " + err.Error()) return []byte{} } if resp.StatusCode == 200 { - fmt.Println("ok") + fmt.Println("Get problem Success!") } return body } + +func getProblemAllList() []byte { + return getRaw(AllProblemURL) +} + +// Variables define +type Variables struct { + slug string +} + +func getQraphql(payload string) []byte { + req := newReq() + resp, err := req.PostForm(QraphqlURL, bytes.NewBuffer([]byte(payload))) + if err != nil { + fmt.Printf("getRaw: Get Error: " + err.Error()) + return []byte{} + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + fmt.Printf("getRaw: Read Error: " + err.Error()) + return []byte{} + } + if resp.StatusCode == 200 { + fmt.Println("Get problem Success!") + } + return body +} + +func getTopicTag(variable string) string { + return fmt.Sprintf(`{ + "operationName": "getTopicTag", + "variables": { + "slug": "%s" + }, + "query": "query getTopicTag($slug: String!) { topicTag(slug: $slug) { name translatedName slug questions { status questionId questionFrontendId title titleSlug translatedTitle stats difficulty isPaidOnly topicTags { name translatedName slug __typename } companyTags { name translatedName slug __typename } __typename } frequencies __typename } favoritesLists { publicFavorites { ...favoriteFields __typename } privateFavorites { ...favoriteFields __typename } __typename }}fragment favoriteFields on FavoriteNode { idHash id name isPublicFavorite viewCount creator isWatched questions { questionId title titleSlug __typename } __typename}" + }`, variable) +} + +func getTagProblemList(tag string) []byte { + return getQraphql(getTopicTag(tag)) +} diff --git a/ctl/statistic.go b/ctl/statistic.go index 036204a2..c796dc44 100644 --- a/ctl/statistic.go +++ b/ctl/statistic.go @@ -2,6 +2,7 @@ package main import ( m "github.com/halfrost/LeetCode-Go/ctl/models" + "github.com/halfrost/LeetCode-Go/ctl/util" "sort" ) @@ -12,7 +13,7 @@ func statisticalData(problemsMap map[int]m.StatStatusPairs, solutionIds []int) ( case "Easy": { easyTotal++ - if v.Status == "ac" && binarySearch(solutionIds, int(v.Stat.FrontendQuestionID)) == -1 { + if v.Status == "ac" && util.BinarySearch(solutionIds, int(v.Stat.FrontendQuestionID)) == -1 { optimizingEasy++ optimizingIds = append(optimizingIds, int(v.Stat.FrontendQuestionID)) } @@ -20,7 +21,7 @@ func statisticalData(problemsMap map[int]m.StatStatusPairs, solutionIds []int) ( case "Medium": { mediumTotal++ - if v.Status == "ac" && binarySearch(solutionIds, int(v.Stat.FrontendQuestionID)) == -1 { + if v.Status == "ac" && util.BinarySearch(solutionIds, int(v.Stat.FrontendQuestionID)) == -1 { optimizingMedium++ optimizingIds = append(optimizingIds, int(v.Stat.FrontendQuestionID)) } @@ -28,7 +29,7 @@ func statisticalData(problemsMap map[int]m.StatStatusPairs, solutionIds []int) ( case "Hard": { hardTotal++ - if v.Status == "ac" && binarySearch(solutionIds, int(v.Stat.FrontendQuestionID)) == -1 { + if v.Status == "ac" && util.BinarySearch(solutionIds, int(v.Stat.FrontendQuestionID)) == -1 { optimizingHard++ optimizingIds = append(optimizingIds, int(v.Stat.FrontendQuestionID)) } diff --git a/ctl/template/Array.md b/ctl/template/Array.md new file mode 100644 index 00000000..87164757 --- /dev/null +++ b/ctl/template/Array.md @@ -0,0 +1,8 @@ +--- +title: Array +type: docs +--- + +# Array + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Backtracking.md b/ctl/template/Backtracking.md new file mode 100644 index 00000000..abbd8a52 --- /dev/null +++ b/ctl/template/Backtracking.md @@ -0,0 +1,100 @@ +--- +title: Backtracking +type: docs +--- + +# Backtracking + +![](https://img.halfrost.com/Leetcode/Backtracking.png) + +- 排列问题 Permutations。第 46 题,第 47 题。第 60 题,第 526 题,第 996 题。 +- 组合问题 Combination。第 39 题,第 40 题,第 77 题,第 216 题。 +- 排列和组合杂交问题。第 1079 题。 +- N 皇后终极解法(二进制解法)。第 51 题,第 52 题。 +- 数独问题。第 37 题。 +- 四个方向搜索。第 79 题,第 212 题,第 980 题。 +- 子集合问题。第 78 题,第 90 题。 +- Trie。第 208 题,第 211 题。 +- BFS 优化。第 126 题,第 127 题。 +- DFS 模板。(只是一个例子,不对应任何题) + +```go +func combinationSum2(candidates []int, target int) [][]int { + if len(candidates) == 0 { + return [][]int{} + } + c, res := []int{}, [][]int{} + sort.Ints(candidates) + findcombinationSum2(candidates, target, 0, c, &res) + return res +} + +func findcombinationSum2(nums []int, target, index int, c []int, res *[][]int) { + if target == 0 { + b := make([]int, len(c)) + copy(b, c) + *res = append(*res, b) + return + } + for i := index; i < len(nums); i++ { + if i > index && nums[i] == nums[i-1] { // 这里是去重的关键逻辑 + continue + } + if target >= nums[i] { + c = append(c, nums[i]) + findcombinationSum2(nums, target-nums[i], i+1, c, res) + c = c[:len(c)-1] + } + } +} +``` +- BFS 模板。(只是一个例子,不对应任何题) + +```go +func updateMatrix_BFS(matrix [][]int) [][]int { + res := make([][]int, len(matrix)) + if len(matrix) == 0 || len(matrix[0]) == 0 { + return res + } + queue := make([][]int, 0) + for i, _ := range matrix { + res[i] = make([]int, len(matrix[0])) + for j, _ := range res[i] { + if matrix[i][j] == 0 { + res[i][j] = -1 + queue = append(queue, []int{i, j}) + } + } + } + level := 1 + for len(queue) > 0 { + size := len(queue) + for size > 0 { + size -= 1 + node := queue[0] + queue = queue[1:] + i, j := node[0], node[1] + for _, direction := range [][]int{{-1, 0}, {1, 0}, {0, 1}, {0, -1}} { + x := i + direction[0] + y := j + direction[1] + if x < 0 || x >= len(matrix) || y < 0 || y >= len(matrix[0]) || res[x][y] < 0 || res[x][y] > 0 { + continue + } + res[x][y] = level + queue = append(queue, []int{x, y}) + } + } + level++ + } + for i, row := range res { + for j, cell := range row { + if cell == -1 { + res[i][j] = 0 + } + } + } + return res +} +``` + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Binary_Indexed_Tree.md b/ctl/template/Binary_Indexed_Tree.md new file mode 100644 index 00000000..0632403a --- /dev/null +++ b/ctl/template/Binary_Indexed_Tree.md @@ -0,0 +1,10 @@ +--- +title: Binary Indexed Tree +type: docs +--- + +# Binary Indexed Tree + +![](https://img.halfrost.com/Leetcode/Binary_Indexed_Tree.png) + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Binary_Search.md b/ctl/template/Binary_Search.md new file mode 100644 index 00000000..033ca9da --- /dev/null +++ b/ctl/template/Binary_Search.md @@ -0,0 +1,131 @@ +--- +title: Binary Search +type: docs +--- + +# Binary Search + +- 二分搜索的经典写法。需要注意的三点: + 1. 循环退出条件,注意是 low <= high,而不是 low < high。 + 2. mid 的取值,mid := low + (high-low)>>1 + 3. low 和 high 的更新。low = mid + 1,high = mid - 1。 + +```go +func binarySearchMatrix(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + (high-low)>>1 + if nums[mid] == target { + return mid + } else if nums[mid] > target { + high = mid - 1 + } else { + low = mid + 1 + } + } + return -1 +} +``` + +- 二分搜索的变种写法。有 4 个基本变种: + 1. 查找第一个与 target 相等的元素,时间复杂度 O(logn) + 2. 查找最后一个与 target 相等的元素,时间复杂度 O(logn) + 3. 查找第一个大于等于 target 的元素,时间复杂度 O(logn) + 4. 查找最后一个小于等于 target 的元素,时间复杂度 O(logn) + +```go +// 二分查找第一个与 target 相等的元素,时间复杂度 O(logn) +func searchFirstEqualElement(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + ((high - low) >> 1) + if nums[mid] > target { + high = mid - 1 + } else if nums[mid] < target { + low = mid + 1 + } else { + if (mid == 0) || (nums[mid-1] != target) { // 找到第一个与 target 相等的元素 + return mid + } + high = mid - 1 + } + } + return -1 +} + +// 二分查找最后一个与 target 相等的元素,时间复杂度 O(logn) +func searchLastEqualElement(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + ((high - low) >> 1) + if nums[mid] > target { + high = mid - 1 + } else if nums[mid] < target { + low = mid + 1 + } else { + if (mid == len(nums)-1) || (nums[mid+1] != target) { // 找到最后一个与 target 相等的元素 + return mid + } + low = mid + 1 + } + } + return -1 +} + +// 二分查找第一个大于等于 target 的元素,时间复杂度 O(logn) +func searchFirstGreaterElement(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + ((high - low) >> 1) + if nums[mid] >= target { + if (mid == 0) || (nums[mid-1] < target) { // 找到第一个大于等于 target 的元素 + return mid + } + high = mid - 1 + } else { + low = mid + 1 + } + } + return -1 +} + +// 二分查找最后一个小于等于 target 的元素,时间复杂度 O(logn) +func searchLastLessElement(nums []int, target int) int { + low, high := 0, len(nums)-1 + for low <= high { + mid := low + ((high - low) >> 1) + if nums[mid] <= target { + if (mid == len(nums)-1) || (nums[mid+1] > target) { // 找到最后一个小于等于 target 的元素 + return mid + } + low = mid + 1 + } else { + high = mid - 1 + } + } + return -1 +} +``` + +- 在基本有序的数组中用二分搜索。经典解法可以解,变种写法也可以写,常见的题型,在山峰数组中找山峰,在旋转有序数组中找分界点。第 33 题,第 81 题,第 153 题,第 154 题,第 162 题,第 852 题 + +```go +func peakIndexInMountainArray(A []int) int { + low, high := 0, len(A)-1 + for low < high { + mid := low + (high-low)>>1 + // 如果 mid 较大,则左侧存在峰值,high = m,如果 mid + 1 较大,则右侧存在峰值,low = mid + 1 + if A[mid] > A[mid+1] { + high = mid + } else { + low = mid + 1 + } + } + return low +} +``` + +- max-min 最大值最小化问题。求在最小满足条件的情况下的最大值。第 410 题,第 875 题,第 1011 题,第 1283 题。 + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Bit_Manipulation.md b/ctl/template/Bit_Manipulation.md new file mode 100644 index 00000000..3d568f31 --- /dev/null +++ b/ctl/template/Bit_Manipulation.md @@ -0,0 +1,44 @@ +--- +title: Bit Manipulation +type: docs +--- + +# Bit Manipulation + +![](https://img.halfrost.com/Leetcode/Bit_Manipulation.png) + +- 异或的特性。第 136 题,第 268 题,第 389 题,第 421 题, + +```go +x ^ 0 = x +x ^ 11111……1111 = ~x +x ^ (~x) = 11111……1111 +x ^ x = 0 +a ^ b = c => a ^ c = b => b ^ c = a (交换律) +a ^ b ^ c = a ^ (b ^ c) = (a ^ b)^ c (结合律) +``` + +- 构造特殊 Mask,将特殊位置放 0 或 1。 + +```go +将 x 最右边的 n 位清零, x & ( ~0 << n ) +获取 x 的第 n 位值(0 或者 1),(x >> n) & 1 +获取 x 的第 n 位的幂值,x & (1 << (n - 1)) +仅将第 n 位置为 1,x | (1 << n) +仅将第 n 位置为 0,x & (~(1 << n)) +将 x 最高位至第 n 位(含)清零,x & ((1 << n) - 1) +将第 n 位至第 0 位(含)清零,x & (~((1 << (n + 1)) - 1)) +``` + +- 有特殊意义的 & 位操作运算。第 260 题,第 201 题,第 318 题,第 371 题,第 397 题,第 461 题,第 693 题, + +```go +X & 1 == 1 判断是否是奇数(偶数) +X & = (X - 1) 将最低位(LSB)的 1 清零 +X & -X 得到最低位(LSB)的 1 +X & ~X = 0 +``` + + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Breadth_First_Search.md b/ctl/template/Breadth_First_Search.md new file mode 100644 index 00000000..230a3ea7 --- /dev/null +++ b/ctl/template/Breadth_First_Search.md @@ -0,0 +1,9 @@ +--- +title: Breadth First Search +type: docs +--- + +# Breadth First Search + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Depth_First_Search.md b/ctl/template/Depth_First_Search.md new file mode 100644 index 00000000..016d6798 --- /dev/null +++ b/ctl/template/Depth_First_Search.md @@ -0,0 +1,9 @@ +--- +title: Depth First Search +type: docs +--- + +# Depth First Search + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Dynamic_Programming.md b/ctl/template/Dynamic_Programming.md new file mode 100644 index 00000000..d3384ecb --- /dev/null +++ b/ctl/template/Dynamic_Programming.md @@ -0,0 +1,9 @@ +--- +title: Dynamic Programming +type: docs +--- + +# Dynamic Programming + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Hash_Table.md b/ctl/template/Hash_Table.md new file mode 100644 index 00000000..7677f9bd --- /dev/null +++ b/ctl/template/Hash_Table.md @@ -0,0 +1,9 @@ +--- +title: Hash Table +type: docs +--- + +# Hash Table + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Linked_List.md b/ctl/template/Linked_List.md new file mode 100644 index 00000000..fd332903 --- /dev/null +++ b/ctl/template/Linked_List.md @@ -0,0 +1,23 @@ +--- +title: Linked List +type: docs +--- + +# Linked List + +![](https://img.halfrost.com/Leetcode/Linked_List.png) + + +- 巧妙的构造虚拟头结点。可以使遍历处理逻辑更加统一。 +- 灵活使用递归。构造递归条件,使用递归可以巧妙的解题。不过需要注意有些题目不能使用递归,因为递归深度太深会导致超时和栈溢出。 +- 链表区间逆序。第 92 题。 +- 链表寻找中间节点。第 876 题。链表寻找倒数第 n 个节点。第 19 题。只需要一次遍历就可以得到答案。 +- 合并 K 个有序链表。第 21 题,第 23 题。 +- 链表归类。第 86 题,第 328 题。 +- 链表排序,时间复杂度要求 O(n * log n),空间复杂度 O(1)。只有一种做法,归并排序,至顶向下归并。第 148 题。 +- 判断链表是否存在环,如果有环,输出环的交叉点的下标;判断 2 个链表是否有交叉点,如果有交叉点,输出交叉点。第 141 题,第 142 题,第 160 题。 + + + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Math.md b/ctl/template/Math.md new file mode 100644 index 00000000..8ecedf58 --- /dev/null +++ b/ctl/template/Math.md @@ -0,0 +1,9 @@ +--- +title: Math +type: docs +--- + +# Math + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Segment_Tree.md b/ctl/template/Segment_Tree.md new file mode 100644 index 00000000..37f04d32 --- /dev/null +++ b/ctl/template/Segment_Tree.md @@ -0,0 +1,37 @@ +--- +title: Segment Tree +type: docs +--- + +# Segment Tree + +![](https://img.halfrost.com/Leetcode/Segment_Tree.png) + +- 线段树的经典数组实现写法。将合并两个节点 pushUp 逻辑抽象出来了,可以实现任意操作(常见的操作有:加法,取 max,min 等等)。第 218 题,第 303 题,第 307 题,第 699 题。 +- 计数线段树的经典写法。第 315 题,第 327 题,第 493 题。 +- 线段树的树的实现写法。第 715 题,第 732 题。 +- 区间懒惰更新。第 218 题,第 699 题。 +- 离散化。离散化需要注意一个特殊情况:假如三个区间为 [1,10] [1,4] [6,10],离散化后 x[1]=1,x[2]=4,x[3]=6,x[4]=10。第一个区间为 [1,4],第二个区间为 [1,2],第三个区间为 [3,4],这样一来,区间一 = 区间二 + 区间三,这和离散前的模型不符,离散前,很明显,区间一 > 区间二 + 区间三。正确的做法是:在相差大于 1 的数间加一个数,例如在上面 1 4 6 10 中间加 5,即可 x[1]=1,x[2]=4,x[3]=5,x[4]=6,x[5]=10。这样处理之后,区间一是 1-5 ,区间二是 1-2 ,区间三是 4-5 。 +- 灵活构建线段树。线段树节点可以存储多条信息,合并两个节点的 pushUp 操作也可以是多样的。第 850 题,第 1157 题。 + + +线段树[题型](https://blog.csdn.net/xuechelingxiao/article/details/38313105)从简单到困难: + +1. 单点更新: + [HDU 1166 敌兵布阵](http://acm.hdu.edu.cn/showproblem.php?pid=1166) update:单点增减 query:区间求和 + [HDU 1754 I Hate It](http://acm.hdu.edu.cn/showproblem.php?pid=1754) update:单点替换 query:区间最值 + [HDU 1394 Minimum Inversion Number](http://acm.hdu.edu.cn/showproblem.php?pid=1394) update:单点增减 query:区间求和 + [HDU 2795 Billboard](http://acm.hdu.edu.cn/showproblem.php?pid=2795) query:区间求最大值的位子(直接把update的操作在query里做了) +2. 区间更新: + [HDU 1698 Just a Hook](http://acm.hdu.edu.cn/showproblem.php?pid=1698) update:成段替换 (由于只query一次总区间,所以可以直接输出 1 结点的信息) + [POJ 3468 A Simple Problem with Integers](http://poj.org/problem?id=3468) update:成段增减 query:区间求和 + [POJ 2528 Mayor’s posters](http://poj.org/problem?id=2528) 离散化 + update:成段替换 query:简单hash + [POJ 3225 Help with Intervals](http://poj.org/problem?id=3225) update:成段替换,区间异或 query:简单hash +3. 区间合并(这类题目会询问区间中满足条件的连续最长区间,所以PushUp的时候需要对左右儿子的区间进行合并): + [POJ 3667 Hotel](http://poj.org/problem?id=3667) update:区间替换 query:询问满足条件的最左端点 +4. 扫描线(这类题目需要将一些操作排序,然后从左到右用一根扫描线扫过去最典型的就是矩形面积并,周长并等题): + [HDU 1542 Atlantis](http://acm.hdu.edu.cn/showproblem.php?pid=1542) update:区间增减 query:直接取根节点的值 + [HDU 1828 Picture](http://acm.hdu.edu.cn/showproblem.php?pid=1828) update:区间增减 query:直接取根节点的值 + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Sliding_Window.md b/ctl/template/Sliding_Window.md new file mode 100644 index 00000000..a4fdca5c --- /dev/null +++ b/ctl/template/Sliding_Window.md @@ -0,0 +1,29 @@ +--- +title: Sliding Window +type: docs +--- + +# Sliding Window + +![](https://img.halfrost.com/Leetcode/Sliding_Window.png) + +- 双指针滑动窗口的经典写法。右指针不断往右移,移动到不能往右移动为止(具体条件根据题目而定)。当右指针到最右边以后,开始挪动左指针,释放窗口左边界。第 3 题,第 76 题,第 209 题,第 424 题,第 438 题,第 567 题,第 713 题,第 763 题,第 845 题,第 881 题,第 904 题,第 978 题,第 992 题,第 1004 题,第 1040 题,第 1052 题。 + +```c + left, right := 0, -1 + + for left < len(s) { + if right+1 < len(s) && freq[s[right+1]-'a'] == 0 { + freq[s[right+1]-'a']++ + right++ + } else { + freq[s[left]-'a']-- + left++ + } + result = max(result, right-left+1) + } +``` +- 滑动窗口经典题。第 239 题,第 480 题。 + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Sort.md b/ctl/template/Sort.md new file mode 100644 index 00000000..9e68d7dd --- /dev/null +++ b/ctl/template/Sort.md @@ -0,0 +1,18 @@ +--- +title: Sort +type: docs +--- + +# Sort + +![](https://img.halfrost.com/Leetcode/Sort.png) + +- 深刻的理解多路快排。第 75 题。 +- 链表的排序,插入排序(第 147 题)和归并排序(第 148 题) +- 桶排序和基数排序。第 164 题。 +- "摆动排序"。第 324 题。 +- 两两不相邻的排序。第 767 题,第 1054 题。 +- "饼子排序"。第 969 题。 + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Stack.md b/ctl/template/Stack.md new file mode 100644 index 00000000..3f1658e4 --- /dev/null +++ b/ctl/template/Stack.md @@ -0,0 +1,17 @@ +--- +title: Stack +type: docs +--- + +# Stack + +![](https://img.halfrost.com/Leetcode/Stack.png) + +- 括号匹配问题及类似问题。第 20 题,第 921 题,第 1021 题。 +- 栈的基本 pop 和 push 操作。第 71 题,第 150 题,第 155 题,第 224 题,第 225 题,第 232 题,第 946 题,第 1047 题。 +- 利用栈进行编码问题。第 394 题,第 682 题,第 856 题,第 880 题。 +- **单调栈**。**利用栈维护一个单调递增或者递减的下标数组**。第 84 题,第 456 题,第 496 题,第 503 题,第 739 题,第 901 题,第 907 题,第 1019 题。 + + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/String.md b/ctl/template/String.md new file mode 100644 index 00000000..87afd108 --- /dev/null +++ b/ctl/template/String.md @@ -0,0 +1,9 @@ +--- +title: String +type: docs +--- + +# String + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Tree.md b/ctl/template/Tree.md new file mode 100644 index 00000000..c62c5398 --- /dev/null +++ b/ctl/template/Tree.md @@ -0,0 +1,9 @@ +--- +title: Tree +type: docs +--- + +# Tree + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Two_Pointers.md b/ctl/template/Two_Pointers.md new file mode 100644 index 00000000..80af5330 --- /dev/null +++ b/ctl/template/Two_Pointers.md @@ -0,0 +1,32 @@ +--- +title: Two Pointers +type: docs +--- + +# Two Pointers + +![](https://img.halfrost.com/Leetcode/Two_pointers.png) + +- 双指针滑动窗口的经典写法。右指针不断往右移,移动到不能往右移动为止(具体条件根据题目而定)。当右指针到最右边以后,开始挪动左指针,释放窗口左边界。第 3 题,第 76 题,第 209 题,第 424 题,第 438 题,第 567 题,第 713 题,第 763 题,第 845 题,第 881 题,第 904 题,第 978 题,第 992 题,第 1004 题,第 1040 题,第 1052 题。 + +```c + left, right := 0, -1 + + for left < len(s) { + if right+1 < len(s) && freq[s[right+1]-'a'] == 0 { + freq[s[right+1]-'a']++ + right++ + } else { + freq[s[left]-'a']-- + left++ + } + result = max(result, right-left+1) + } +``` + +- 快慢指针可以查找重复数字,时间复杂度 O(n),第 287 题。 +- 替换字母以后,相同字母能出现连续最长的长度。第 424 题。 +- SUM 问题集。第 1 题,第 15 题,第 16 题,第 18 题,第 167 题,第 923 题,第 1074 题。 + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template/Union_Find.md b/ctl/template/Union_Find.md new file mode 100644 index 00000000..752a5727 --- /dev/null +++ b/ctl/template/Union_Find.md @@ -0,0 +1,19 @@ +--- +title: Union Find +type: docs +--- + +# Union Find + +![](https://img.halfrost.com/Leetcode/Union_Find.png) + +- 灵活使用并查集的思想,熟练掌握并查集的[模板]({{< relref "/ChapterThree/UnionFind.md" >}}),模板中有两种并查集的实现方式,一种是路径压缩 + 秩优化的版本,另外一种是计算每个集合中元素的个数 + 最大集合元素个数的版本,这两种版本都有各自使用的地方。能使用第一类并查集模板的题目有:第 128 题,第 130 题,第 547 题,第 684 题,第 721 题,第 765 题,第 778 题,第 839 题,第 924 题,第 928 题,第 947 题,第 952 题,第 959 题,第 990 题。能使用第二类并查集模板的题目有:第 803 题,第 952 题。第 803 题秩优化和统计集合个数这些地方会卡时间,如果不优化,会 TLE。 +- 并查集是一种思想,有些题需要灵活使用这种思想,而不是死套模板,如第 399 题,这一题是 stringUnionFind,利用并查集思想实现的。这里每个节点是基于字符串和 map 的,而不是单纯的用 int 节点编号实现的。 +- 有些题死套模板反而做不出来,比如第 685 题,这一题不能路径压缩和秩优化,因为题目中涉及到有向图,需要知道节点的前驱节点,如果路径压缩了,这一题就没法做了。这一题不需要路径压缩和秩优化。 +- 灵活的抽象题目给的信息,将给定的信息合理的编号,使用并查集解题,并用 map 降低时间复杂度,如第 721 题,第 959 题。 +- 关于地图,砖块,网格的题目,可以新建一个特殊节点,将四周边缘的砖块或者网格都 union() 到这个特殊节点上。第 130 题,第 803 题。 +- 能用并查集的题目,一般也可以用 DFS 和 BFS 解答,只不过时间复杂度会高一点。 + + + +{{.AvailableTagTable}} \ No newline at end of file diff --git a/ctl/template.markdown b/ctl/template/template.markdown similarity index 100% rename from ctl/template.markdown rename to ctl/template/template.markdown diff --git a/ctl/template_render.go b/ctl/template_render.go index ed3d123f..374b36f8 100644 --- a/ctl/template_render.go +++ b/ctl/template_render.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" m "github.com/halfrost/LeetCode-Go/ctl/models" + "github.com/halfrost/LeetCode-Go/ctl/util" "html/template" "io/ioutil" "os" @@ -19,7 +20,7 @@ func makeReadmeFile(mdrows m.Mdrows) { fmt.Println(err) } // 保存 README.md 文件 - writeFile(file, b.Bytes()) + util.WriteFile(file, b.Bytes()) } func readTMPL(path string) string { diff --git a/ctl/util.go b/ctl/util/util.go similarity index 83% rename from ctl/util.go rename to ctl/util/util.go index d33ea074..a3b6ab0e 100644 --- a/ctl/util.go +++ b/ctl/util/util.go @@ -1,4 +1,4 @@ -package main +package util import ( "fmt" @@ -8,7 +8,8 @@ import ( "strconv" ) -func loadSolutionsDir() ([]int, int) { +// LoadSolutionsDir define +func LoadSolutionsDir() ([]int, int) { files, err := ioutil.ReadDir("../leetcode/") if err != nil { fmt.Println(err) @@ -28,7 +29,8 @@ func loadSolutionsDir() ([]int, int) { return solutionIds, len(files) - len(solutionIds) } -func writeFile(fileName string, content []byte) { +// WriteFile define +func WriteFile(fileName string, content []byte) { file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0777) if err != nil { fmt.Println(err) @@ -42,7 +44,8 @@ func writeFile(fileName string, content []byte) { fmt.Println("write file successful") } -func binarySearch(nums []int, target int) int { +// BinarySearch define +func BinarySearch(nums []int, target int) int { low, high := 0, len(nums)-1 for low <= high { mid := low + (high-low)>>1 diff --git a/ctl/version.go b/ctl/version.go new file mode 100644 index 00000000..c996a651 --- /dev/null +++ b/ctl/version.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var ( + version = "v1.0" + versionCmd = &cobra.Command{ + Use: "version", + Short: "Prints the version of tacoctl", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("tacoctl version:", version) + }, + } +) From a2ceb138bb206670e4c37e2c293a96609f1471e9 Mon Sep 17 00:00:00 2001 From: YDZ Date: Fri, 15 Jan 2021 22:48:01 +0800 Subject: [PATCH 73/82] render chapter two --- ...ost to Move Chips to The Same Position.go} | 0 ...o Move Chips to The Same Position_test.go} | 0 .../README.md | 2 +- ...ost-to-Move-Chips-to-The-Same-Position.md} | 2 +- website/content/ChapterTwo/Array.md | 198 +++++++++++++----- website/content/menu/index.md | 2 +- 6 files changed, 146 insertions(+), 58 deletions(-) rename leetcode/{1217.Play-with-Chips/1217. Play with Chips.go => 1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position/1217. Minimum Cost to Move Chips to The Same Position.go} (100%) rename leetcode/{1217.Play-with-Chips/1217. Play with Chips_test.go => 1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position/1217. Minimum Cost to Move Chips to The Same Position_test.go} (100%) rename leetcode/{1217.Play-with-Chips => 1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position}/README.md (95%) rename website/content/ChapterFour/{1217.Play-with-Chips.md => 1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md} (95%) diff --git a/leetcode/1217.Play-with-Chips/1217. Play with Chips.go b/leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position/1217. Minimum Cost to Move Chips to The Same Position.go similarity index 100% rename from leetcode/1217.Play-with-Chips/1217. Play with Chips.go rename to leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position/1217. Minimum Cost to Move Chips to The Same Position.go diff --git a/leetcode/1217.Play-with-Chips/1217. Play with Chips_test.go b/leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position/1217. Minimum Cost to Move Chips to The Same Position_test.go similarity index 100% rename from leetcode/1217.Play-with-Chips/1217. Play with Chips_test.go rename to leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position/1217. Minimum Cost to Move Chips to The Same Position_test.go diff --git a/leetcode/1217.Play-with-Chips/README.md b/leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position/README.md similarity index 95% rename from leetcode/1217.Play-with-Chips/README.md rename to leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position/README.md index 7eb9669f..e7ac7fe5 100755 --- a/leetcode/1217.Play-with-Chips/README.md +++ b/leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position/README.md @@ -1,4 +1,4 @@ -# [1217. Play with Chips](https://leetcode.com/problems/play-with-chips/) +# [1217. Minimum Cost to Move Chips to The Same Position](https://leetcode.com/problems/minimum-cost-to-move-chips-to-the-same-position/) ## 题目 diff --git a/website/content/ChapterFour/1217.Play-with-Chips.md b/website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md similarity index 95% rename from website/content/ChapterFour/1217.Play-with-Chips.md rename to website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md index 29eec710..bdb64fa0 100755 --- a/website/content/ChapterFour/1217.Play-with-Chips.md +++ b/website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md @@ -1,4 +1,4 @@ -# [1217. Play with Chips](https://leetcode.com/problems/play-with-chips/) +# [1217. Minimum Cost to Move Chips to The Same Position](https://leetcode.com/problems/minimum-cost-to-move-chips-to-the-same-position/) ## 题目 diff --git a/website/content/ChapterTwo/Array.md b/website/content/ChapterTwo/Array.md index 59dfa8f1..dde8b937 100644 --- a/website/content/ChapterTwo/Array.md +++ b/website/content/ChapterTwo/Array.md @@ -5,58 +5,146 @@ type: docs # Array -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|1. Two Sum| [Go]({{< relref "/ChapterFour/0001.Two-Sum.md" >}})| Easy | O(n)| O(n)|| -|11. Container With Most Water| [Go]({{< relref "/ChapterFour/0011.Container-With-Most-Water.md" >}})| Medium | O(n)| O(1)|| -|15. 3Sum | [Go]({{< relref "/ChapterFour/0015.3Sum.md" >}})| Medium | O(n^2)| O(n)|❤️| -|16. 3Sum Closest | [Go]({{< relref "/ChapterFour/0016.3Sum-Closest.md" >}})| Medium | O(n^2)| O(1)|❤️| -|18. 4Sum | [Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})| Medium | O(n^3)| O(n^2)|❤️| -|26. Remove Duplicates from Sorted Array | [Go]({{< relref "/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md" >}})| Easy | O(n)| O(1)|| -|27. Remove Element | [Go]({{< relref "/ChapterFour/0027.Remove-Element.md" >}})| Easy | O(n)| O(1)|| -|39. Combination Sum | [Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})| Medium | O(n log n)| O(n)|| -|40. Combination Sum II | [Go]({{< relref "/ChapterFour/0040.Combination-Sum-II.md" >}})| Medium | O(n log n)| O(n)|| -|41. First Missing Positive | [Go]({{< relref "/ChapterFour/0041.First-Missing-Positive.md" >}})| Hard | O(n)| O(n)|| -|42. Trapping Rain Water | [Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})| Hard | O(n)| O(1)|❤️| -|48. Rotate Image | [Go]({{< relref "/ChapterFour/0048.Rotate-Image.md" >}})| Medium | O(n)| O(1)|| -|53. Maximum Subarray| [Go]({{< relref "/ChapterFour/0053.Maximum-Subarray.md" >}})| Easy | O(n)| O(n)|| -|54. Spiral Matrix| [Go]({{< relref "/ChapterFour/0054.Spiral-Matrix.md" >}})| Medium | O(n)| O(n^2)|| -|56. Merge Intervals | [Go]({{< relref "/ChapterFour/0056.Merge-Intervals.md" >}})| Medium | O(n log n)| O(1)|| -|57. Insert Interval | [Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})| Hard | O(n)| O(1)|| -|59. Spiral Matrix II | [Go]({{< relref "/ChapterFour/0059.Spiral-Matrix-II.md" >}})| Medium | O(n)| O(n^2)|| -|62. Unique Paths | [Go]({{< relref "/ChapterFour/0062.Unique-Paths.md" >}})| Medium | O(n^2)| O(n^2)|| -|63. Unique Paths II | [Go]({{< relref "/ChapterFour/0063.Unique-Paths-II.md" >}})| Medium | O(n^2)| O(n^2)|| -|64. Minimum Path Sum | [Go]({{< relref "/ChapterFour/0064.Minimum-Path-Sum.md" >}})| Medium | O(n^2)| O(n^2)|| -|75. Sort Colors | [Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})| Medium| O(n)| O(1)|❤️| -|78. Subsets| [Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})| Medium | O(n^2)| O(n)|❤️| -|79. Word Search | [Go]({{< relref "/ChapterFour/0079.Word-Search.md" >}})| Medium | O(n^2)| O(n^2)|❤️| -|80. Remove Duplicates from Sorted Array II| [Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})| Medium | O(n)| O(1|| -|84. Largest Rectangle in Histogram | [Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}})| Medium | O(n)| O(n)|❤️| -|88. Merge Sorted Array | [Go]({{< relref "/ChapterFour/0088.Merge-Sorted-Array.md" >}})| Easy | O(n)| O(1)|❤️| -|90. Subsets II | [Go]({{< relref "/ChapterFour/0090.Subsets-II.md" >}})| Medium | O(n^2)| O(n)|❤️| -|120. Triangle | [Go]({{< relref "/ChapterFour/0120.Triangle.md" >}})| Medium | O(n^2)| O(n)|| -|121. Best Time to Buy and Sell Stock | [Go]({{< relref "/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})| Easy | O(n)| O(1)|| -|122. Best Time to Buy and Sell Stock II | [Go]({{< relref "/ChapterFour/0122.Best-Time-to-Buy-and-Sell-Stock-II.md" >}})| Easy | O(n)| O(1)|| -|126. Word Ladder II | [Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})| Hard | O(n)| O(n^2)|❤️| -|152. Maximum Product Subarray | [Go]({{< relref "/ChapterFour/0152.Maximum-Product-Subarray.md" >}})| Medium | O(n)| O(1)|| -|167. Two Sum II - Input array is sorted | [Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})| Easy | O(n)| O(1)|| -|209. Minimum Size Subarray Sum | [Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})| Medium | O(n)| O(1)|| -|216. Combination Sum III | [Go]({{< relref "/ChapterFour/0216.Combination-Sum-III.md" >}})| Medium | O(n)| O(1)|❤️| -|217. Contains Duplicate | [Go]({{< relref "/ChapterFour/0217.Contains-Duplicate.md" >}})| Easy | O(n)| O(n)|| -|219. Contains Duplicate II | [Go]({{< relref "/ChapterFour/0219.Contains-Duplicate-II.md" >}})| Easy | O(n)| O(n)|| -|283. Move Zeroes | [Go]({{< relref "/ChapterFour/0283.Move-Zeroes.md" >}})| Easy | O(n)| O(1)|| -|287. Find the Duplicate Number | [Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})| Easy | O(n)| O(1)|❤️| -|532. K-diff Pairs in an Array | [Go]({{< relref "/ChapterFour/0532.K-diff-Pairs-in-an-Array.md" >}})| Easy | O(n)| O(n)|| -|566. Reshape the Matrix | [Go]({{< relref "/ChapterFour/0566.Reshape-the-Matrix.md" >}})| Easy | O(n^2)| O(n^2)|| -|628. Maximum Product of Three Numbers | [Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})| Easy | O(n)| O(1)|| -|713. Subarray Product Less Than K | [Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})| Medium | O(n)| O(1)|| -|714. Best Time to Buy and Sell Stock with Transaction Fee| [Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})| Medium | O(n)| O(1)|| -|746. Min Cost Climbing Stairs | [Go]({{< relref "/ChapterFour/0746.Min-Cost-Climbing-Stairs.md" >}})| Easy | O(n)| O(1)|| -|766. Toeplitz Matrix | [Go]({{< relref "/ChapterFour/0766.Toeplitz-Matrix.md" >}})| Easy | O(n)| O(1)|| -|867. Transpose Matrix | [Go]({{< relref "/ChapterFour/0867.Transpose-Matrix.md" >}})| Easy | O(n)| O(1)|| -|891. Sum of Subsequence Widths | [Go]({{< relref "/ChapterFour/0891.Sum-of-Subsequence-Widths.md" >}})| Hard | O(n log n)| O(1)|| -|907. Sum of Subarray Minimums | [Go]({{< relref "/ChapterFour/0907.Sum-of-Subarray-Minimums.md" >}})| Medium | O(n)| O(n)|❤️| -|922. Sort Array By Parity II | [Go]({{< relref "/ChapterFour/0922.Sort-Array-By-Parity-II.md" >}})| Medium | O(n)| O(1)|| -|969. Pancake Sorting | [Go]({{< relref "/ChapterFour/0969.Pancake-Sorting.md" >}})| Medium | O(n)| O(1)|❤️| -|977. Squares of a Sorted Array | [Go]({{< relref "/ChapterFour/0977.Squares-of-a-Sorted-Array.md" >}})| Easy | O(n)| O(1)|| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0001|Two Sum|[Go]({{< relref "/ChapterFour/0001.Two-Sum.md" >}})|Easy| O(n)| O(n)||46.2%| +|0004|Median of Two Sorted Arrays|[Go]({{< relref "/ChapterFour/0004.Median-of-Two-Sorted-Arrays.md" >}})|Hard||||30.8%| +|0011|Container With Most Water|[Go]({{< relref "/ChapterFour/0011.Container-With-Most-Water.md" >}})|Medium| O(n)| O(1)||52.2%| +|0015|3Sum|[Go]({{< relref "/ChapterFour/0015.3Sum.md" >}})|Medium| O(n^2)| O(n)|❤️|27.8%| +|0016|3Sum Closest|[Go]({{< relref "/ChapterFour/0016.3Sum-Closest.md" >}})|Medium| O(n^2)| O(1)|❤️|46.2%| +|0018|4Sum|[Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})|Medium| O(n^3)| O(n^2)|❤️|34.6%| +|0026|Remove Duplicates from Sorted Array|[Go]({{< relref "/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md" >}})|Easy| O(n)| O(1)||46.3%| +|0027|Remove Element|[Go]({{< relref "/ChapterFour/0027.Remove-Element.md" >}})|Easy| O(n)| O(1)||49.0%| +|0033|Search in Rotated Sorted Array|[Go]({{< relref "/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md" >}})|Medium||||35.6%| +|0034|Find First and Last Position of Element in Sorted Array|[Go]({{< relref "/ChapterFour/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array.md" >}})|Medium||||37.1%| +|0035|Search Insert Position|[Go]({{< relref "/ChapterFour/0035.Search-Insert-Position.md" >}})|Easy||||42.8%| +|0039|Combination Sum|[Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})|Medium| O(n log n)| O(n)||58.7%| +|0040|Combination Sum II|[Go]({{< relref "/ChapterFour/0040.Combination-Sum-II.md" >}})|Medium| O(n log n)| O(n)||49.8%| +|0041|First Missing Positive|[Go]({{< relref "/ChapterFour/0041.First-Missing-Positive.md" >}})|Hard| O(n)| O(n)||33.4%| +|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|50.7%| +|0048|Rotate Image|[Go]({{< relref "/ChapterFour/0048.Rotate-Image.md" >}})|Medium| O(n)| O(1)||59.3%| +|0053|Maximum Subarray|[Go]({{< relref "/ChapterFour/0053.Maximum-Subarray.md" >}})|Easy| O(n)| O(n)||47.5%| +|0054|Spiral Matrix|[Go]({{< relref "/ChapterFour/0054.Spiral-Matrix.md" >}})|Medium| O(n)| O(n^2)||35.5%| +|0055|Jump Game|[Go]({{< relref "/ChapterFour/0055.Jump-Game.md" >}})|Medium||||35.1%| +|0056|Merge Intervals|[Go]({{< relref "/ChapterFour/0056.Merge-Intervals.md" >}})|Medium| O(n log n)| O(1)||40.7%| +|0057|Insert Interval|[Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})|Medium| O(n)| O(1)||34.8%| +|0059|Spiral Matrix II|[Go]({{< relref "/ChapterFour/0059.Spiral-Matrix-II.md" >}})|Medium| O(n)| O(n^2)||57.4%| +|0062|Unique Paths|[Go]({{< relref "/ChapterFour/0062.Unique-Paths.md" >}})|Medium| O(n^2)| O(n^2)||55.6%| +|0063|Unique Paths II|[Go]({{< relref "/ChapterFour/0063.Unique-Paths-II.md" >}})|Medium| O(n^2)| O(n^2)||35.1%| +|0064|Minimum Path Sum|[Go]({{< relref "/ChapterFour/0064.Minimum-Path-Sum.md" >}})|Medium| O(n^2)| O(n^2)||55.9%| +|0066|Plus One|[Go]({{< relref "/ChapterFour/0066.Plus-One.md" >}})|Easy||||42.5%| +|0074|Search a 2D Matrix|[Go]({{< relref "/ChapterFour/0074.Search-a-2D-Matrix.md" >}})|Medium||||37.4%| +|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|48.9%| +|0078|Subsets|[Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|64.5%| +|0079|Word Search|[Go]({{< relref "/ChapterFour/0079.Word-Search.md" >}})|Medium| O(n^2)| O(n^2)|❤️|36.6%| +|0080|Remove Duplicates from Sorted Array II|[Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})|Medium| O(n)| O(1||45.8%| +|0081|Search in Rotated Sorted Array II|[Go]({{< relref "/ChapterFour/0081.Search-in-Rotated-Sorted-Array-II.md" >}})|Medium||||33.5%| +|0084|Largest Rectangle in Histogram|[Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}})|Hard| O(n)| O(n)|❤️|36.8%| +|0088|Merge Sorted Array|[Go]({{< relref "/ChapterFour/0088.Merge-Sorted-Array.md" >}})|Easy| O(n)| O(1)|❤️|40.6%| +|0090|Subsets II|[Go]({{< relref "/ChapterFour/0090.Subsets-II.md" >}})|Medium| O(n^2)| O(n)|❤️|48.5%| +|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| +|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.1%| +|0118|Pascal's Triangle|[Go]({{< relref "/ChapterFour/0118.Pascals-Triangle.md" >}})|Easy||||54.4%| +|0120|Triangle|[Go]({{< relref "/ChapterFour/0120.Triangle.md" >}})|Medium| O(n^2)| O(n)||45.5%| +|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||51.2%| +|0122|Best Time to Buy and Sell Stock II|[Go]({{< relref "/ChapterFour/0122.Best-Time-to-Buy-and-Sell-Stock-II.md" >}})|Easy| O(n)| O(1)||58.2%| +|0126|Word Ladder II|[Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})|Hard| O(n)| O(n^2)|❤️|23.4%| +|0128|Longest Consecutive Sequence|[Go]({{< relref "/ChapterFour/0128.Longest-Consecutive-Sequence.md" >}})|Hard||||46.0%| +|0152|Maximum Product Subarray|[Go]({{< relref "/ChapterFour/0152.Maximum-Product-Subarray.md" >}})|Medium| O(n)| O(1)||32.6%| +|0153|Find Minimum in Rotated Sorted Array|[Go]({{< relref "/ChapterFour/0153.Find-Minimum-in-Rotated-Sorted-Array.md" >}})|Medium||||45.9%| +|0154|Find Minimum in Rotated Sorted Array II|[Go]({{< relref "/ChapterFour/0154.Find-Minimum-in-Rotated-Sorted-Array-II.md" >}})|Hard||||41.9%| +|0162|Find Peak Element|[Go]({{< relref "/ChapterFour/0162.Find-Peak-Element.md" >}})|Medium||||43.8%| +|0167|Two Sum II - Input array is sorted|[Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})|Easy| O(n)| O(1)||55.4%| +|0169|Majority Element|[Go]({{< relref "/ChapterFour/0169.Majority-Element.md" >}})|Easy||||59.8%| +|0189|Rotate Array|[Go]({{< relref "/ChapterFour/0189.Rotate-Array.md" >}})|Medium||||36.4%| +|0209|Minimum Size Subarray Sum|[Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})|Medium| O(n)| O(1)||39.2%| +|0216|Combination Sum III|[Go]({{< relref "/ChapterFour/0216.Combination-Sum-III.md" >}})|Medium| O(n)| O(1)|❤️|59.9%| +|0217|Contains Duplicate|[Go]({{< relref "/ChapterFour/0217.Contains-Duplicate.md" >}})|Easy| O(n)| O(n)||56.5%| +|0219|Contains Duplicate II|[Go]({{< relref "/ChapterFour/0219.Contains-Duplicate-II.md" >}})|Easy| O(n)| O(n)||38.5%| +|0228|Summary Ranges|[Go]({{< relref "/ChapterFour/0228.Summary-Ranges.md" >}})|Easy||||42.1%| +|0229|Majority Element II|[Go]({{< relref "/ChapterFour/0229.Majority-Element-II.md" >}})|Medium||||38.5%| +|0268|Missing Number|[Go]({{< relref "/ChapterFour/0268.Missing-Number.md" >}})|Easy||||53.4%| +|0283|Move Zeroes|[Go]({{< relref "/ChapterFour/0283.Move-Zeroes.md" >}})|Easy| O(n)| O(1)||58.4%| +|0287|Find the Duplicate Number|[Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})|Medium| O(n)| O(1)|❤️|57.1%| +|0414|Third Maximum Number|[Go]({{< relref "/ChapterFour/0414.Third-Maximum-Number.md" >}})|Easy||||30.6%| +|0448|Find All Numbers Disappeared in an Array|[Go]({{< relref "/ChapterFour/0448.Find-All-Numbers-Disappeared-in-an-Array.md" >}})|Easy||||56.1%| +|0457|Circular Array Loop|[Go]({{< relref "/ChapterFour/0457.Circular-Array-Loop.md" >}})|Medium||||30.0%| +|0485|Max Consecutive Ones|[Go]({{< relref "/ChapterFour/0485.Max-Consecutive-Ones.md" >}})|Easy||||53.2%| +|0509|Fibonacci Number|[Go]({{< relref "/ChapterFour/0509.Fibonacci-Number.md" >}})|Easy||||67.3%| +|0532|K-diff Pairs in an Array|[Go]({{< relref "/ChapterFour/0532.K-diff-Pairs-in-an-Array.md" >}})|Medium| O(n)| O(n)||34.9%| +|0561|Array Partition I|[Go]({{< relref "/ChapterFour/0561.Array-Partition-I.md" >}})|Easy||||72.8%| +|0566|Reshape the Matrix|[Go]({{< relref "/ChapterFour/0566.Reshape-the-Matrix.md" >}})|Easy| O(n^2)| O(n^2)||61.0%| +|0605|Can Place Flowers|[Go]({{< relref "/ChapterFour/0605.Can-Place-Flowers.md" >}})|Easy||||31.9%| +|0628|Maximum Product of Three Numbers|[Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})|Easy| O(n)| O(1)||47.0%| +|0661|Image Smoother|[Go]({{< relref "/ChapterFour/0661.Image-Smoother.md" >}})|Easy||||52.1%| +|0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| +|0697|Degree of an Array|[Go]({{< relref "/ChapterFour/0697.Degree-of-an-Array.md" >}})|Easy||||54.3%| +|0713|Subarray Product Less Than K|[Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})|Medium| O(n)| O(1)||40.4%| +|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.8%| +|0717|1-bit and 2-bit Characters|[Go]({{< relref "/ChapterFour/0717.1-bit-and-2-bit-Characters.md" >}})|Easy||||47.6%| +|0718|Maximum Length of Repeated Subarray|[Go]({{< relref "/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md" >}})|Medium||||50.1%| +|0719|Find K-th Smallest Pair Distance|[Go]({{< relref "/ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md" >}})|Hard||||32.5%| +|0724|Find Pivot Index|[Go]({{< relref "/ChapterFour/0724.Find-Pivot-Index.md" >}})|Easy||||45.0%| +|0729|My Calendar I|[Go]({{< relref "/ChapterFour/0729.My-Calendar-I.md" >}})|Medium||||53.1%| +|0746|Min Cost Climbing Stairs|[Go]({{< relref "/ChapterFour/0746.Min-Cost-Climbing-Stairs.md" >}})|Easy| O(n)| O(1)||50.9%| +|0766|Toeplitz Matrix|[Go]({{< relref "/ChapterFour/0766.Toeplitz-Matrix.md" >}})|Easy| O(n)| O(1)||65.8%| +|0830|Positions of Large Groups|[Go]({{< relref "/ChapterFour/0830.Positions-of-Large-Groups.md" >}})|Easy||||50.2%| +|0832|Flipping an Image|[Go]({{< relref "/ChapterFour/0832.Flipping-an-Image.md" >}})|Easy||||77.9%| +|0867|Transpose Matrix|[Go]({{< relref "/ChapterFour/0867.Transpose-Matrix.md" >}})|Easy| O(n)| O(1)||62.2%| +|0888|Fair Candy Swap|[Go]({{< relref "/ChapterFour/0888.Fair-Candy-Swap.md" >}})|Easy||||58.7%| +|0891|Sum of Subsequence Widths|[Go]({{< relref "/ChapterFour/0891.Sum-of-Subsequence-Widths.md" >}})|Hard| O(n log n)| O(1)||32.8%| +|0896|Monotonic Array|[Go]({{< relref "/ChapterFour/0896.Monotonic-Array.md" >}})|Easy||||58.0%| +|0907|Sum of Subarray Minimums|[Go]({{< relref "/ChapterFour/0907.Sum-of-Subarray-Minimums.md" >}})|Medium| O(n)| O(n)|❤️|33.2%| +|0914|X of a Kind in a Deck of Cards|[Go]({{< relref "/ChapterFour/0914.X-of-a-Kind-in-a-Deck-of-Cards.md" >}})|Easy||||34.4%| +|0918|Maximum Sum Circular Subarray|[Go]({{< relref "/ChapterFour/0918.Maximum-Sum-Circular-Subarray.md" >}})|Medium||||34.1%| +|0922|Sort Array By Parity II|[Go]({{< relref "/ChapterFour/0922.Sort-Array-By-Parity-II.md" >}})|Easy| O(n)| O(1)||70.2%| +|0969|Pancake Sorting|[Go]({{< relref "/ChapterFour/0969.Pancake-Sorting.md" >}})|Medium| O(n)| O(1)|❤️|68.5%| +|0977|Squares of a Sorted Array|[Go]({{< relref "/ChapterFour/0977.Squares-of-a-Sorted-Array.md" >}})|Easy| O(n)| O(1)||72.3%| +|0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0978.Longest-Turbulent-Subarray.md" >}})|Medium||||46.6%| +|0985|Sum of Even Numbers After Queries|[Go]({{< relref "/ChapterFour/0985.Sum-of-Even-Numbers-After-Queries.md" >}})|Easy||||60.7%| +|0999|Available Captures for Rook|[Go]({{< relref "/ChapterFour/0999.Available-Captures-for-Rook.md" >}})|Easy||||66.8%| +|1002|Find Common Characters|[Go]({{< relref "/ChapterFour/1002.Find-Common-Characters.md" >}})|Easy||||68.1%| +|1011|Capacity To Ship Packages Within D Days|[Go]({{< relref "/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md" >}})|Medium||||59.5%| +|1018|Binary Prefix Divisible By 5|[Go]({{< relref "/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md" >}})|Easy||||47.8%| +|1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium||||54.0%| +|1051|Height Checker|[Go]({{< relref "/ChapterFour/1051.Height-Checker.md" >}})|Easy||||71.8%| +|1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})|Medium||||55.7%| +|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.4%| +|1089|Duplicate Zeros|[Go]({{< relref "/ChapterFour/1089.Duplicate-Zeros.md" >}})|Easy||||52.0%| +|1122|Relative Sort Array|[Go]({{< relref "/ChapterFour/1122.Relative-Sort-Array.md" >}})|Easy||||67.7%| +|1128|Number of Equivalent Domino Pairs|[Go]({{< relref "/ChapterFour/1128.Number-of-Equivalent-Domino-Pairs.md" >}})|Easy||||46.6%| +|1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard||||39.5%| +|1160|Find Words That Can Be Formed by Characters|[Go]({{< relref "/ChapterFour/1160.Find-Words-That-Can-Be-Formed-by-Characters.md" >}})|Easy||||67.5%| +|1170|Compare Strings by Frequency of the Smallest Character|[Go]({{< relref "/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md" >}})|Easy||||59.5%| +|1184|Distance Between Bus Stops|[Go]({{< relref "/ChapterFour/1184.Distance-Between-Bus-Stops.md" >}})|Easy||||54.2%| +|1185|Day of the Week|[Go]({{< relref "/ChapterFour/1185.Day-of-the-Week.md" >}})|Easy||||62.0%| +|1200|Minimum Absolute Difference|[Go]({{< relref "/ChapterFour/1200.Minimum-Absolute-Difference.md" >}})|Easy||||66.8%| +|1202|Smallest String With Swaps|[Go]({{< relref "/ChapterFour/1202.Smallest-String-With-Swaps.md" >}})|Medium||||48.3%| +|1208|Get Equal Substrings Within Budget|[Go]({{< relref "/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md" >}})|Medium||||43.7%| +|1217|Minimum Cost to Move Chips to The Same Position|[Go]({{< relref "/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md" >}})|Easy||||71.2%| +|1232|Check If It Is a Straight Line|[Go]({{< relref "/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md" >}})|Easy||||43.9%| +|1252|Cells with Odd Values in a Matrix|[Go]({{< relref "/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md" >}})|Easy||||78.5%| +|1260|Shift 2D Grid|[Go]({{< relref "/ChapterFour/1260.Shift-2D-Grid.md" >}})|Easy||||61.8%| +|1266|Minimum Time Visiting All Points|[Go]({{< relref "/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md" >}})|Easy||||79.3%| +|1275|Find Winner on a Tic Tac Toe Game|[Go]({{< relref "/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md" >}})|Easy||||52.9%| +|1287|Element Appearing More Than 25% In Sorted Array|[Go]({{< relref "/ChapterFour/1287.Element-Appearing-More-Than-25%-In-Sorted-Array.md" >}})|Easy||||60.2%| +|1295|Find Numbers with Even Number of Digits|[Go]({{< relref "/ChapterFour/1295.Find-Numbers-with-Even-Number-of-Digits.md" >}})|Easy||||79.4%| +|1299|Replace Elements with Greatest Element on Right Side|[Go]({{< relref "/ChapterFour/1299.Replace-Elements-with-Greatest-Element-on-Right-Side.md" >}})|Easy||||74.1%| +|1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.3%| +|1304|Find N Unique Integers Sum up to Zero|[Go]({{< relref "/ChapterFour/1304.Find-N-Unique-Integers-Sum-up-to-Zero.md" >}})|Easy||||76.5%| +|1313|Decompress Run-Length Encoded List|[Go]({{< relref "/ChapterFour/1313.Decompress-Run-Length-Encoded-List.md" >}})|Easy||||85.3%| +|1380|Lucky Numbers in a Matrix|[Go]({{< relref "/ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md" >}})|Easy||||70.9%| +|1385|Find the Distance Value Between Two Arrays|[Go]({{< relref "/ChapterFour/1385.Find-the-Distance-Value-Between-Two-Arrays.md" >}})|Easy||||66.4%| +|1389|Create Target Array in the Given Order|[Go]({{< relref "/ChapterFour/1389.Create-Target-Array-in-the-Given-Order.md" >}})|Easy||||84.7%| +|1464|Maximum Product of Two Elements in an Array|[Go]({{< relref "/ChapterFour/1464.Maximum-Product-of-Two-Elements-in-an-Array.md" >}})|Easy||||76.9%| +|1470|Shuffle the Array|[Go]({{< relref "/ChapterFour/1470.Shuffle-the-Array.md" >}})|Easy||||88.5%| +|1480|Running Sum of 1d Array|[Go]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}})|Easy||||89.6%| +|1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| +|1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.3%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.4%| +|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||51.6%| +|1652|Defuse the Bomb|[Go]({{< relref "/ChapterFour/1652.Defuse-the-Bomb.md" >}})|Easy||||64.2%| +|1656|Design an Ordered Stream|[Go]({{< relref "/ChapterFour/1656.Design-an-Ordered-Stream.md" >}})|Easy||||82.4%| +|1672|Richest Customer Wealth|[Go]({{< relref "/ChapterFour/1672.Richest-Customer-Wealth.md" >}})|Easy||||88.6%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 78729367..6c636d23 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -527,7 +527,7 @@ headless: true - [1202.Smallest-String-With-Swaps]({{< relref "/ChapterFour/1202.Smallest-String-With-Swaps.md" >}}) - [1207.Unique-Number-of-Occurrences]({{< relref "/ChapterFour/1207.Unique-Number-of-Occurrences.md" >}}) - [1208.Get-Equal-Substrings-Within-Budget]({{< relref "/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md" >}}) - - [1217.Play-with-Chips]({{< relref "/ChapterFour/1217.Play-with-Chips.md" >}}) + - [1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position]({{< relref "/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md" >}}) - [1221.Split-a-String-in-Balanced-Strings]({{< relref "/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md" >}}) - [1232.Check-If-It-Is-a-Straight-Line]({{< relref "/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md" >}}) - [1234.Replace-the-Substring-for-Balanced-String]({{< relref "/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md" >}}) From 4614f589ec7fb3c80b3a90ca970c146d6e03e4d5 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sat, 16 Jan 2021 00:18:39 +0800 Subject: [PATCH 74/82] Micro fix --- .../547. Number of Provinces.go} | 0 .../547. Number of Provinces_test.go} | 0 .../README.md | 2 +- ...rs of All Substrings of a Given String.go} | 0 ... All Substrings of a Given String_test.go} | 0 .../README.md | 81 ++++++++++++++++++- .../0098.Validate-Binary-Search-Tree.md | 2 +- .../ChapterFour/0130.Surrounded-Regions.md | 2 +- website/content/ChapterFour/0146.LRU-Cache.md | 6 +- .../content/ChapterFour/0189.Rotate-Array.md | 8 +- .../ChapterFour/0228.Summary-Ranges.md | 12 +-- website/content/ChapterFour/0460.LFU-Cache.md | 6 +- .../content/ChapterFour/0493.Reverse-Pairs.md | 4 +- ...dom-Point-in-Non-overlapping-Rectangles.md | 2 +- .../0528.Random-Pick-with-Weight.md | 2 +- .../ChapterFour/0541.Reverse-String-II.md | 2 +- ...Circles.md => 0547.Number-of-Provinces.md} | 2 +- .../ChapterFour/0605.Can-Place-Flowers.md | 6 +- .../ChapterFour/0785.Is-Graph-Bipartite.md | 2 +- ...rs-of-All-Substrings-of-a-Given-String.md} | 41 +++++++--- .../0830.Positions-of-Large-Groups.md | 10 +-- .../ChapterFour/0910.Smallest-Range-II.md | 8 +- .../1018.Binary-Prefix-Divisible-By-5.md | 10 +-- .../1093.Statistics-from-a-Large-Sample.md | 2 +- .../1105.Filling-Bookcase-Shelves.md | 2 +- .../1108.Defanging-an-IP-Address.md | 2 +- ...-Depth-of-Two-Valid-Parentheses-Strings.md | 2 +- .../ChapterFour/1122.Relative-Sort-Array.md | 2 +- ...owest-Common-Ancestor-of-Deepest-Leaves.md | 2 +- .../1128.Number-of-Equivalent-Domino-Pairs.md | 2 +- .../1137.N-th-Tribonacci-Number.md | 2 +- .../ChapterFour/1154.Day-of-the-Year.md | 2 +- ...157.Online-Majority-Element-In-Subarray.md | 2 +- ...-by-Frequency-of-the-Smallest-Character.md | 2 +- ...-Sum-Consecutive-Nodes-from-Linked-List.md | 2 +- .../ChapterFour/1175.Prime-Arrangements.md | 2 +- .../1184.Distance-Between-Bus-Stops.md | 2 +- .../ChapterFour/1185.Day-of-the-Week.md | 2 +- .../1189.Maximum-Number-of-Balloons.md | 2 +- .../1200.Minimum-Absolute-Difference.md | 2 +- .../ChapterFour/1201.Ugly-Number-III.md | 2 +- .../1202.Smallest-String-With-Swaps.md | 2 +- .../1207.Unique-Number-of-Occurrences.md | 2 +- ...1208.Get-Equal-Substrings-Within-Budget.md | 2 +- ...Cost-to-Move-Chips-to-The-Same-Position.md | 2 +- ...1221.Split-a-String-in-Balanced-Strings.md | 2 +- .../1232.Check-If-It-Is-a-Straight-Line.md | 2 +- ...place-the-Substring-for-Balanced-String.md | 2 +- .../1235.Maximum-Profit-in-Job-Scheduling.md | 2 +- .../1252.Cells-with-Odd-Values-in-a-Matrix.md | 2 +- .../1266.Minimum-Time-Visiting-All-Points.md | 2 +- .../1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md | 2 +- .../1539.Kth-Missing-Positive-Number.md | 6 +- .../1573.Number-of-Ways-to-Split-a-String.md | 10 +-- ...k-Array-Formation-Through-Concatenation.md | 12 +-- .../1646.Get-Maximum-in-Generated-Array.md | 8 +- ...ns-to-Make-Character-Frequencies-Unique.md | 8 +- ...8.Sell-Diminishing-Valued-Colored-Balls.md | 10 +-- ...reate-Sorted-Array-through-Instructions.md | 8 +- .../ChapterFour/1652.Defuse-the-Bomb.md | 8 +- ...nimum-Deletions-to-Make-String-Balanced.md | 6 +- .../1654.Minimum-Jumps-to-Reach-Home.md | 8 +- .../1655.Distribute-Repeating-Integers.md | 12 +-- .../1656.Design-an-Ordered-Stream.md | 4 +- ...1657.Determine-if-Two-Strings-Are-Close.md | 10 +-- ....Minimum-Operations-to-Reduce-X-to-Zero.md | 8 +- .../1659.Maximize-Grid-Happiness.md | 8 +- ...eck-If-Two-String-Arrays-are-Equivalent.md | 8 +- ...llest-String-With-A-Given-Numeric-Value.md | 6 +- .../1664.Ways-to-Make-a-Fair-Array.md | 8 +- ....Minimum-Initial-Energy-to-Finish-Tasks.md | 8 +- .../1668.Maximum-Repeating-Substring.md | 8 +- .../1669.Merge-In-Between-Linked-Lists.md | 6 +- .../1670.Design-Front-Middle-Back-Queue.md | 4 +- .../1672.Richest-Customer-Wealth.md | 8 +- ...3.Find-the-Most-Competitive-Subsequence.md | 6 +- ...nimum-Moves-to-Make-Array-Complementary.md | 8 +- .../1678.Goal-Parser-Interpretation.md | 8 +- .../1679.Max-Number-of-K-Sum-Pairs.md | 6 +- ...atenation-of-Consecutive-Binary-Numbers.md | 8 +- .../1681.Minimum-Incompatibility.md | 8 +- ....Count-the-Number-of-Consistent-Strings.md | 8 +- ...-Absolute-Differences-in-a-Sorted-Array.md | 6 +- .../1688.Count-of-Matches-in-Tournament.md | 6 +- ...o-Minimum-Number-Of-Deci-Binary-Numbers.md | 8 +- .../ChapterFour/1690.Stone-Game-VII.md | 6 +- .../ChapterFour/1694.Reformat-Phone-Number.md | 12 +-- .../ChapterFour/1695.Maximum-Erasure-Value.md | 6 +- website/content/menu/index.md | 4 +- 89 files changed, 321 insertions(+), 227 deletions(-) rename leetcode/{0547.Friend-Circles/547. Friend Circles.go => 0547.Number-of-Provinces/547. Number of Provinces.go} (100%) rename leetcode/{0547.Friend-Circles/547. Friend Circles_test.go => 0547.Number-of-Provinces/547. Number of Provinces_test.go} (100%) rename leetcode/{0547.Friend-Circles => 0547.Number-of-Provinces}/README.md (97%) rename leetcode/{0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String.go => 0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String/828. Count Unique Characters of All Substrings of a Given String.go} (100%) rename leetcode/{0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String_test.go => 0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String/828. Count Unique Characters of All Substrings of a Given String_test.go} (100%) rename leetcode/{0828.COPYRIGHT-PROBLEM-XXX => 0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String}/README.md (52%) rename website/content/ChapterFour/{0547.Friend-Circles.md => 0547.Number-of-Provinces.md} (97%) rename website/content/ChapterFour/{0828.COPYRIGHT-PROBLEM-XXX.md => 0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md} (66%) diff --git a/leetcode/0547.Friend-Circles/547. Friend Circles.go b/leetcode/0547.Number-of-Provinces/547. Number of Provinces.go similarity index 100% rename from leetcode/0547.Friend-Circles/547. Friend Circles.go rename to leetcode/0547.Number-of-Provinces/547. Number of Provinces.go diff --git a/leetcode/0547.Friend-Circles/547. Friend Circles_test.go b/leetcode/0547.Number-of-Provinces/547. Number of Provinces_test.go similarity index 100% rename from leetcode/0547.Friend-Circles/547. Friend Circles_test.go rename to leetcode/0547.Number-of-Provinces/547. Number of Provinces_test.go diff --git a/leetcode/0547.Friend-Circles/README.md b/leetcode/0547.Number-of-Provinces/README.md similarity index 97% rename from leetcode/0547.Friend-Circles/README.md rename to leetcode/0547.Number-of-Provinces/README.md index 6cfe79b1..0dafa9ba 100755 --- a/leetcode/0547.Friend-Circles/README.md +++ b/leetcode/0547.Number-of-Provinces/README.md @@ -1,4 +1,4 @@ -# [547. Friend Circles](https://leetcode.com/problems/friend-circles/) +# [547. Number of Provinces](https://leetcode.com/problems/number-of-provinces/) ## 题目 diff --git a/leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String.go b/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String/828. Count Unique Characters of All Substrings of a Given String.go similarity index 100% rename from leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String.go rename to leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String/828. Count Unique Characters of All Substrings of a Given String.go diff --git a/leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String_test.go b/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String/828. Count Unique Characters of All Substrings of a Given String_test.go similarity index 100% rename from leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String_test.go rename to leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String/828. Count Unique Characters of All Substrings of a Given String_test.go diff --git a/leetcode/0828.COPYRIGHT-PROBLEM-XXX/README.md b/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String/README.md similarity index 52% rename from leetcode/0828.COPYRIGHT-PROBLEM-XXX/README.md rename to leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String/README.md index b26bae01..fd29a4af 100644 --- a/leetcode/0828.COPYRIGHT-PROBLEM-XXX/README.md +++ b/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String/README.md @@ -1,16 +1,44 @@ -# [828. Unique Letter String](https://leetcode.com/problems/unique-letter-string/) +# [828. Count Unique Characters of All Substrings of a Given String](https://leetcode.com/problems/count-unique-characters-of-all-substrings-of-a-given-string/) + ## 题目 -THIS PROBLEM COPYRIGHT BELONGS TO CODILITY.COM +Let's define a function `countUniqueChars(s)` that returns the number of unique characters on `s`, for example if `s = "LEETCODE"` then `"L"`, `"T"`,`"C"`,`"O"`,`"D"` are the unique characters since they appear only once in `s`, therefore `countUniqueChars(s) = 5`.On this problem given a string `s` we need to return the sum of `countUniqueChars(t)` where `t` is a substring of `s`. Notice that some substrings can be repeated so on this case you have to count the repeated ones too. + +Since the answer can be very large, return the answer modulo `10 ^ 9 + 7`. **Example 1:** +``` +Input: s = "ABC" +Output: 10 +Explanation: All possible substrings are: "A","B","C","AB","BC" and "ABC". +Evey substring is composed with only unique letters. +Sum of lengths of all substring is 1 + 1 + 1 + 2 + 2 + 3 = 10 +``` **Example 2:** +``` +Input: s = "ABA" +Output: 8 +Explanation: The same as example 1, except countUniqueChars("ABA") = 1. +``` + +**Example 3:** + +``` +Input: s = "LEETCODE" +Output: 92 + +``` + +**Constraints:** + +- `0 <= s.length <= 10^4` +- `s` contain upper-case English letters only. ## 题目大意 @@ -18,11 +46,56 @@ THIS PROBLEM COPYRIGHT BELONGS TO CODILITY.COM 对于给定字符串 S,计算其所有非空子串的独特字符的个数(即 UNIQ(substring))之和。如果在 S 的不同位置上出现两个甚至多个相同的子串,那么我们认为这些子串是不同的。考虑到答案可能会非常大,规定返回格式为:结果 mod 10 ^ 9 + 7。 - ## 解题思路 - 这一题可以先用暴力解法尝试解题,不过提交以后会发现判题结果是超时。出错的一组数据是一个有 10000 个字符的字符串。暴力解法中间由于遍历了太多的子区间,导致了超时。 - 这道题换一个角度思考问题。当子字符串中字符 X 出现了 2 次以上,那么它就对最终结果没有任何影响,所以只有当某个字符只出现一次的时候才会影响最终结果。再者,一个子字符串中不重复的字符的总个数,也就是这个子字符串 UNIQ 值。例如,“ABC”,这个子字符串的 UNIQ 值是 3,可以这样计算,它属于 A 的独特的字符串,也属于 B 的独特的字符串,也属于 C 的独特的字符串,那么计算这个子字符串的问题可以分解成计算 A 有多少个独特的子字符串,B 有多少个独特的子字符串,C 有多少个独特的子字符串的问题。在计算 A 有多少个子字符串的问题的时候,里面肯定会包含 "ABC" 这个子字符串的。所以原问题就转换成了分别计算给出的字符串中每个字符出现在独特字符串中的总数之和。 -- 假设原字符串是 BAABBABBBAAABA,这个字符串中出现了很多 A 和很多 B,假设我们当前计算到了第 3 个 A 的位置了(index = 5),即标红色的那个 A。如何计算这个 A 在哪些子字符串中是独特的呢?由于子字符串题目中要求必须是连续的区间,所以这个问题很简单。找到这个 A 前一个 A 的下标位置(index = 2),再找到这个 A 后一个 A 的下标位置(index = 9),即 BAABBABBBAAABA,第一个 A 和当前计算的 A 中间区间有 2 个字符,第三个 A 和当前计算的 A 中间有 3 个字符。那么当前计算的 A 出现在 `(2 + 1) * (3 + 1) = 12` 个子字符串中是独特的,这 12 个字符串是:`A`,`BA`,`BBA`,`AB`,`ABB`,`ABBB`,`BAB`,`BABB`,`BABBB`,`BBAB`,`BBABB`,`BBABBB`。计算方法,假设当前待计算的字符的下标是 i ,找到当前字符前一次出现的下标位置 left,再找到当前字符后一次出现的下标位置 right,那么左边区间 (left,i) 的**开区间**内包含的字符数是 i - left - 1,右边区间 (i,right) 的**开区间**内包含的字符数是 right - i - 1。左右两边都还需要考虑空字符串的情况,即左右两边都可以不取任何字符,那么对应的就是只有中间这个待计算的字符 `A`。所以左右两边都还需要再加上空串的情况,左边 i - left - 1 + 1 = i - left,右边 right - i - 1 + 1 = right - i。左右两边的情况进行排列组合,即 (i - left) * (right - i)。针对字符串的每个字符都计算这样的值,最后累积的总和就是题目中要求的总 UNIQ 值。 +- 假设原字符串是 BAABBABBBAAABA,这个字符串中出现了很多 A 和很多 B,假设我们当前计算到了第 3 个 A 的位置了(index = 5),即标红色的那个 A。如何计算这个 A 在哪些子字符串中是独特的呢?由于子字符串题目中要求必须是连续的区间,所以这个问题很简单。找到这个 A 前一个 A 的下标位置(index = 2),再找到这个 A 后一个 A 的下标位置(index = 9),即 BAABBABBBAAABA,第一个 A 和当前计算的 A 中间区间有 2 个字符,第三个 A 和当前计算的 A 中间有 3 个字符。那么当前计算的 A 出现在 `(2 + 1) * (3 + 1) = 12` 个子字符串中是独特的,这 12 个字符串是:`A`,`BA`,`BBA`,`AB`,`ABB`,`ABBB`,`BAB`,`BABB`,`BABBB`,`BBAB`,`BBABB`,`BBABBB`。计算方法,假设当前待计算的字符的下标是 i ,找到当前字符前一次出现的下标位置 left,再找到当前字符后一次出现的下标位置 right,那么左边区间 (left,i) 的***开区间****内包含的字符数是 i - left - 1,右边区间 (i,right) 的***开区间****内包含的字符数是 right - i - 1。左右两边都还需要考虑空字符串的情况,即左右两边都可以不取任何字符,那么对应的就是只有中间这个待计算的字符 `A`。所以左右两边都还需要再加上空串的情况,左边 i - left - 1 + 1 = i - left,右边 right - i - 1 + 1 = right - i。左右两边的情况进行排列组合,即 (i - left) * (right - i)。针对字符串的每个字符都计算这样的值,最后累积的总和就是题目中要求的总 UNIQ 值。 +## 代码 +```go +package leetcode + +func uniqueLetterString(S string) int { + res, left, right := 0, 0, 0 + for i := 0; i < len(S); i++ { + left = i - 1 + for left >= 0 && S[left] != S[i] { + left-- + } + right = i + 1 + for right < len(S) && S[right] != S[i] { + right++ + } + res += (i - left) * (right - i) + } + return res % 1000000007 +} + +// 暴力解法,超时!时间复杂度 O(n^2) +func uniqueLetterString1(S string) int { + if len(S) == 0 { + return 0 + } + res, mod := 0, 1000000007 + for i := 0; i < len(S); i++ { + letterMap := map[byte]int{} + for j := i; j < len(S); j++ { + letterMap[S[j]]++ + tmp := 0 + for _, v := range letterMap { + if v > 1 { + tmp++ + } + } + if tmp == len(letterMap) { + continue + } else { + res += len(letterMap) - tmp + } + } + } + return res % mod +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/0098.Validate-Binary-Search-Tree.md b/website/content/ChapterFour/0098.Validate-Binary-Search-Tree.md index 870f3598..0787fd0d 100755 --- a/website/content/ChapterFour/0098.Validate-Binary-Search-Tree.md +++ b/website/content/ChapterFour/0098.Validate-Binary-Search-Tree.md @@ -11,7 +11,7 @@ Assume a BST is defined as follows: - The right subtree of a node contains only nodes with keys **greater than** the node's key. - Both the left and right subtrees must also be binary search trees. -**xample 1:** +**Example 1**: 2 / \ diff --git a/website/content/ChapterFour/0130.Surrounded-Regions.md b/website/content/ChapterFour/0130.Surrounded-Regions.md index 4ba38197..a5709860 100755 --- a/website/content/ChapterFour/0130.Surrounded-Regions.md +++ b/website/content/ChapterFour/0130.Surrounded-Regions.md @@ -22,7 +22,7 @@ After running your function, the board should be: X X X X X O X X -**Explanation:** +**Explanation**: Surrounded regions shouldn’t be on the border, which means that any `'O'` on the border of the board are not flipped to `'X'`. Any `'O'` that is not on the border and it is not connected to an `'O'` on the border will be flipped to `'X'`. Two cells are connected if they are adjacent cells connected horizontally or vertically. diff --git a/website/content/ChapterFour/0146.LRU-Cache.md b/website/content/ChapterFour/0146.LRU-Cache.md index 4f252945..917b2684 100644 --- a/website/content/ChapterFour/0146.LRU-Cache.md +++ b/website/content/ChapterFour/0146.LRU-Cache.md @@ -10,9 +10,9 @@ Implement the `LRUCache` class: - `int get(int key)` Return the value of the `key` if the key exists, otherwise return `1`. - `void put(int key, int value)` Update the value of the `key` if the `key` exists. Otherwise, add the `key-value` pair to the cache. If the number of keys exceeds the `capacity` from this operation, **evict** the least recently used key. -**Follow up:**Could you do `get` and `put` in `O(1)` time complexity? +**Follow up**:Could you do `get` and `put` in `O(1)` time complexity? -**Example 1:** +**Example 1**: ``` Input @@ -35,7 +35,7 @@ lRUCache.get(4); // return 4 ``` -**Constraints:** +**Constraints**: - `1 <= capacity <= 3000` - `0 <= key <= 3000` diff --git a/website/content/ChapterFour/0189.Rotate-Array.md b/website/content/ChapterFour/0189.Rotate-Array.md index a83b4ab6..e5560337 100644 --- a/website/content/ChapterFour/0189.Rotate-Array.md +++ b/website/content/ChapterFour/0189.Rotate-Array.md @@ -4,12 +4,12 @@ Given an array, rotate the array to the right by *k* steps, where *k* is non-negative. -**Follow up:** +**Follow up**: - Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem. - Could you do it in-place with O(1) extra space? -**Example 1:** +**Example 1**: ``` Input: nums = [1,2,3,4,5,6,7], k = 3 @@ -20,7 +20,7 @@ rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,3,4] ``` -**Example 2:** +**Example 2**: ``` Input: nums = [-1,-100,3,99], k = 2 @@ -30,7 +30,7 @@ rotate 1 steps to the right: [99,-1,-100,3] rotate 2 steps to the right: [3,99,-1,-100] ``` -**Constraints:** +**Constraints**: - `1 <= nums.length <= 2 * 10^4` - `-2^31 <= nums[i] <= 2^31 - 1` diff --git a/website/content/ChapterFour/0228.Summary-Ranges.md b/website/content/ChapterFour/0228.Summary-Ranges.md index e8a2b2e1..7512736a 100644 --- a/website/content/ChapterFour/0228.Summary-Ranges.md +++ b/website/content/ChapterFour/0228.Summary-Ranges.md @@ -12,7 +12,7 @@ Each range `[a,b]` in the list should be output as: - `"a->b"` if `a != b` - `"a"` if `a == b` -**Example 1:** +**Example 1**: ``` Input: nums = [0,1,2,4,5,7] @@ -24,7 +24,7 @@ Explanation: The ranges are: ``` -**Example 2:** +**Example 2**: ``` Input: nums = [0,2,3,4,6,8,9] @@ -37,7 +37,7 @@ Explanation: The ranges are: ``` -**Example 3:** +**Example 3**: ``` Input: nums = [] @@ -45,7 +45,7 @@ Output: [] ``` -**Example 4:** +**Example 4**: ``` Input: nums = [-1] @@ -53,7 +53,7 @@ Output: ["-1"] ``` -**Example 5:** +**Example 5**: ``` Input: nums = [0] @@ -61,7 +61,7 @@ Output: ["0"] ``` -**Constraints:** +**Constraints**: - `0 <= nums.length <= 20` - `231 <= nums[i] <= 231 - 1` diff --git a/website/content/ChapterFour/0460.LFU-Cache.md b/website/content/ChapterFour/0460.LFU-Cache.md index d47b03e9..4bc0f1be 100644 --- a/website/content/ChapterFour/0460.LFU-Cache.md +++ b/website/content/ChapterFour/0460.LFU-Cache.md @@ -13,7 +13,7 @@ Implement the `LFUCache` class: **Notice that** the number of times an item is used is the number of calls to the `get` and `put` functions for that item since it was inserted. This number is set to zero when the item is removed. -**Example 1:** +**Example 1**: ``` Input @@ -37,12 +37,12 @@ lfu.get(4); // return 4 ``` -**Constraints:** +**Constraints**: - `0 <= capacity, key, value <= 104` - At most `10^5` calls will be made to `get` and `put`. -**Follow up:** Could you do both operations in `O(1)` time complexity? +**Follow up**: Could you do both operations in `O(1)` time complexity? ## 题目大意 diff --git a/website/content/ChapterFour/0493.Reverse-Pairs.md b/website/content/ChapterFour/0493.Reverse-Pairs.md index 6335db07..b6e2e840 100755 --- a/website/content/ChapterFour/0493.Reverse-Pairs.md +++ b/website/content/ChapterFour/0493.Reverse-Pairs.md @@ -7,12 +7,12 @@ Given an array `nums`, we call `(i, j)` an **important reverse pair** if ` You need to return the number of important reverse pairs in the given array. -**Example1:** +**Example1**: Input: [1,3,2,3,1] Output: 2 -**Example2:** +**Example2**: Input: [2,4,3,5,1] Output: 3 diff --git a/website/content/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md b/website/content/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md index 3c68e053..97029b4b 100755 --- a/website/content/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md +++ b/website/content/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md @@ -31,7 +31,7 @@ Given a list of **non-overlapping** axis-aligned rectangles `rects`, write a Output: [null,[-1,-2],[2,0],[-2,-1],[3,0],[-2,-2]] -**Explanation of Input Syntax:** +**Explanation of Input Syntax**: The input is two lists: the subroutines called and their arguments. `Solution`'s constructor has one argument, the array of rectangles `rects`. `pick` has no arguments. Arguments are always wrapped with a list, even if there aren't any. diff --git a/website/content/ChapterFour/0528.Random-Pick-with-Weight.md b/website/content/ChapterFour/0528.Random-Pick-with-Weight.md index 9e5d6397..53733f3b 100755 --- a/website/content/ChapterFour/0528.Random-Pick-with-Weight.md +++ b/website/content/ChapterFour/0528.Random-Pick-with-Weight.md @@ -25,7 +25,7 @@ Given an array `w` of positive integers, where `w[i]` describes the weight o [[[1,3]],[],[],[],[],[]] Output: [null,0,1,1,1,0] -**Explanation of Input Syntax:** +**Explanation of Input Syntax**: The input is two lists: the subroutines called and their arguments. `Solution`'s constructor has one argument, the array `w`. `pickIndex` has no arguments. Arguments are always wrapped with a list, even if there aren't any. diff --git a/website/content/ChapterFour/0541.Reverse-String-II.md b/website/content/ChapterFour/0541.Reverse-String-II.md index 8d9ebdaf..e95c1d9c 100755 --- a/website/content/ChapterFour/0541.Reverse-String-II.md +++ b/website/content/ChapterFour/0541.Reverse-String-II.md @@ -10,7 +10,7 @@ Given a string and an integer k, you need to reverse the first k characters for Input: s = "abcdefg", k = 2 Output: "bacdfeg" -**Restrictions:** +**Restrictions**: 1. The string consists of lower English letters only. 2. Length of the given string and k will in the range [1, 10000] diff --git a/website/content/ChapterFour/0547.Friend-Circles.md b/website/content/ChapterFour/0547.Number-of-Provinces.md similarity index 97% rename from website/content/ChapterFour/0547.Friend-Circles.md rename to website/content/ChapterFour/0547.Number-of-Provinces.md index a5597297..2cc6c178 100755 --- a/website/content/ChapterFour/0547.Friend-Circles.md +++ b/website/content/ChapterFour/0547.Number-of-Provinces.md @@ -1,4 +1,4 @@ -# [547. Friend Circles](https://leetcode.com/problems/friend-circles/) +# [547. Number of Provinces](https://leetcode.com/problems/number-of-provinces/) ## 题目 diff --git a/website/content/ChapterFour/0605.Can-Place-Flowers.md b/website/content/ChapterFour/0605.Can-Place-Flowers.md index 746817ad..1c8b09ba 100644 --- a/website/content/ChapterFour/0605.Can-Place-Flowers.md +++ b/website/content/ChapterFour/0605.Can-Place-Flowers.md @@ -6,21 +6,21 @@ You have a long flowerbed in which some of the plots are planted, and some are n Given an integer array `flowerbed` containing `0`'s and `1`'s, where `0` means empty and `1` means not empty, and an integer `n`, return *if* `n` new flowers can be planted in the `flowerbed` without violating the no-adjacent-flowers rule. -**Example 1:** +**Example 1**: ``` Input: flowerbed = [1,0,0,0,1], n = 1 Output: true ``` -**Example 2:** +**Example 2**: ``` Input: flowerbed = [1,0,0,0,1], n = 2 Output: false ``` -**Constraints:** +**Constraints**: - `1 <= flowerbed.length <= 2 * 104` - `flowerbed[i]` is `0` or `1`. diff --git a/website/content/ChapterFour/0785.Is-Graph-Bipartite.md b/website/content/ChapterFour/0785.Is-Graph-Bipartite.md index a5eb6679..2eb2e5d1 100644 --- a/website/content/ChapterFour/0785.Is-Graph-Bipartite.md +++ b/website/content/ChapterFour/0785.Is-Graph-Bipartite.md @@ -32,7 +32,7 @@ The graph is given in the following form: `graph[i]` is a list of indexes `j` We cannot find a way to divide the set of nodes into two independent subsets. -**Note:** +**Note**: - `graph` will have length in range `[1, 100]`. - `graph[i]` will contain integers in range `[0, graph.length - 1]`. diff --git a/website/content/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md b/website/content/ChapterFour/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md similarity index 66% rename from website/content/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md rename to website/content/ChapterFour/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md index 49ebc4c0..23224a84 100644 --- a/website/content/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md +++ b/website/content/ChapterFour/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md @@ -1,16 +1,44 @@ -# [828. Unique Letter String](https://leetcode.com/problems/unique-letter-string/) +# [828. Count Unique Characters of All Substrings of a Given String](https://leetcode.com/problems/count-unique-characters-of-all-substrings-of-a-given-string/) + ## 题目 -THIS PROBLEM COPYRIGHT BELONGS TO CODILITY.COM +Let's define a function `countUniqueChars(s)` that returns the number of unique characters on `s`, for example if `s = "LEETCODE"` then `"L"`, `"T"`,`"C"`,`"O"`,`"D"` are the unique characters since they appear only once in `s`, therefore `countUniqueChars(s) = 5`.On this problem given a string `s` we need to return the sum of `countUniqueChars(t)` where `t` is a substring of `s`. Notice that some substrings can be repeated so on this case you have to count the repeated ones too. + +Since the answer can be very large, return the answer modulo `10 ^ 9 + 7`. **Example 1**: +``` +Input: s = "ABC" +Output: 10 +Explanation: All possible substrings are: "A","B","C","AB","BC" and "ABC". +Evey substring is composed with only unique letters. +Sum of lengths of all substring is 1 + 1 + 1 + 2 + 2 + 3 = 10 +``` **Example 2**: +``` +Input: s = "ABA" +Output: 8 +Explanation: The same as example 1, except countUniqueChars("ABA") = 1. +``` + +**Example 3**: + +``` +Input: s = "LEETCODE" +Output: 92 + +``` + +**Constraints**: + +- `0 <= s.length <= 10^4` +- `s` contain upper-case English letters only. ## 题目大意 @@ -18,20 +46,15 @@ THIS PROBLEM COPYRIGHT BELONGS TO CODILITY.COM 对于给定字符串 S,计算其所有非空子串的独特字符的个数(即 UNIQ(substring))之和。如果在 S 的不同位置上出现两个甚至多个相同的子串,那么我们认为这些子串是不同的。考虑到答案可能会非常大,规定返回格式为:结果 mod 10 ^ 9 + 7。 - ## 解题思路 - 这一题可以先用暴力解法尝试解题,不过提交以后会发现判题结果是超时。出错的一组数据是一个有 10000 个字符的字符串。暴力解法中间由于遍历了太多的子区间,导致了超时。 - 这道题换一个角度思考问题。当子字符串中字符 X 出现了 2 次以上,那么它就对最终结果没有任何影响,所以只有当某个字符只出现一次的时候才会影响最终结果。再者,一个子字符串中不重复的字符的总个数,也就是这个子字符串 UNIQ 值。例如,“ABC”,这个子字符串的 UNIQ 值是 3,可以这样计算,它属于 A 的独特的字符串,也属于 B 的独特的字符串,也属于 C 的独特的字符串,那么计算这个子字符串的问题可以分解成计算 A 有多少个独特的子字符串,B 有多少个独特的子字符串,C 有多少个独特的子字符串的问题。在计算 A 有多少个子字符串的问题的时候,里面肯定会包含 "ABC" 这个子字符串的。所以原问题就转换成了分别计算给出的字符串中每个字符出现在独特字符串中的总数之和。 -- 假设原字符串是 BAABBABBBAAABA,这个字符串中出现了很多 A 和很多 B,假设我们当前计算到了第 3 个 A 的位置了(index = 5),即标红色的那个 A。如何计算这个 A 在哪些子字符串中是独特的呢?由于子字符串题目中要求必须是连续的区间,所以这个问题很简单。找到这个 A 前一个 A 的下标位置(index = 2),再找到这个 A 后一个 A 的下标位置(index = 9),即 BAABBABBBAAABA,第一个 A 和当前计算的 A 中间区间有 2 个字符,第三个 A 和当前计算的 A 中间有 3 个字符。那么当前计算的 A 出现在 `(2 + 1) * (3 + 1) = 12` 个子字符串中是独特的,这 12 个字符串是:`A`,`BA`,`BBA`,`AB`,`ABB`,`ABBB`,`BAB`,`BABB`,`BABBB`,`BBAB`,`BBABB`,`BBABBB`。计算方法,假设当前待计算的字符的下标是 i ,找到当前字符前一次出现的下标位置 left,再找到当前字符后一次出现的下标位置 right,那么左边区间 (left,i) 的**开区间**内包含的字符数是 i - left - 1,右边区间 (i,right) 的**开区间**内包含的字符数是 right - i - 1。左右两边都还需要考虑空字符串的情况,即左右两边都可以不取任何字符,那么对应的就是只有中间这个待计算的字符 `A`。所以左右两边都还需要再加上空串的情况,左边 i - left - 1 + 1 = i - left,右边 right - i - 1 + 1 = right - i。左右两边的情况进行排列组合,即 (i - left) * (right - i)。针对字符串的每个字符都计算这样的值,最后累积的总和就是题目中要求的总 UNIQ 值。 - - - +- 假设原字符串是 BAABBABBBAAABA,这个字符串中出现了很多 A 和很多 B,假设我们当前计算到了第 3 个 A 的位置了(index = 5),即标红色的那个 A。如何计算这个 A 在哪些子字符串中是独特的呢?由于子字符串题目中要求必须是连续的区间,所以这个问题很简单。找到这个 A 前一个 A 的下标位置(index = 2),再找到这个 A 后一个 A 的下标位置(index = 9),即 BAABBABBBAAABA,第一个 A 和当前计算的 A 中间区间有 2 个字符,第三个 A 和当前计算的 A 中间有 3 个字符。那么当前计算的 A 出现在 `(2 + 1) * (3 + 1) = 12` 个子字符串中是独特的,这 12 个字符串是:`A`,`BA`,`BBA`,`AB`,`ABB`,`ABBB`,`BAB`,`BABB`,`BABBB`,`BBAB`,`BBABB`,`BBABBB`。计算方法,假设当前待计算的字符的下标是 i ,找到当前字符前一次出现的下标位置 left,再找到当前字符后一次出现的下标位置 right,那么左边区间 (left,i) 的***开区间****内包含的字符数是 i - left - 1,右边区间 (i,right) 的***开区间****内包含的字符数是 right - i - 1。左右两边都还需要考虑空字符串的情况,即左右两边都可以不取任何字符,那么对应的就是只有中间这个待计算的字符 `A`。所以左右两边都还需要再加上空串的情况,左边 i - left - 1 + 1 = i - left,右边 right - i - 1 + 1 = right - i。左右两边的情况进行排列组合,即 (i - left) * (right - i)。针对字符串的每个字符都计算这样的值,最后累积的总和就是题目中要求的总 UNIQ 值。 ## 代码 ```go - package leetcode func uniqueLetterString(S string) int { @@ -75,6 +98,4 @@ func uniqueLetterString1(S string) int { } return res % mod } - - ``` \ No newline at end of file diff --git a/website/content/ChapterFour/0830.Positions-of-Large-Groups.md b/website/content/ChapterFour/0830.Positions-of-Large-Groups.md index 5323f2e0..02736a18 100644 --- a/website/content/ChapterFour/0830.Positions-of-Large-Groups.md +++ b/website/content/ChapterFour/0830.Positions-of-Large-Groups.md @@ -13,7 +13,7 @@ A group is considered **large** if it has 3 or more characters. Return *the intervals of every **large** group sorted in **increasing order by start index***. -**Example 1:** +**Example 1**: ``` Input: s = "abbxxxxzzy" @@ -21,7 +21,7 @@ Output: [[3,6]] Explanation: "xxxx" is the only large group with start index 3 and end index 6. ``` -**Example 2:** +**Example 2**: ``` Input: s = "abc" @@ -29,7 +29,7 @@ Output: [] Explanation: We have groups "a", "b", and "c", none of which are large groups. ``` -**Example 3:** +**Example 3**: ``` Input: s = "abcdddeeeeaabbbcd" @@ -37,14 +37,14 @@ Output: [[3,5],[6,9],[12,14]] Explanation: The large groups are "ddd", "eeee", and "bbb". ``` -**Example 4:** +**Example 4**: ``` Input: s = "aba" Output: [] ``` -**Constraints:** +**Constraints**: - `1 <= s.length <= 1000` - `s` contains lower-case English letters only. diff --git a/website/content/ChapterFour/0910.Smallest-Range-II.md b/website/content/ChapterFour/0910.Smallest-Range-II.md index 5aea9e54..f7183454 100644 --- a/website/content/ChapterFour/0910.Smallest-Range-II.md +++ b/website/content/ChapterFour/0910.Smallest-Range-II.md @@ -8,7 +8,7 @@ After this process, we have some array `B`. Return the smallest possible difference between the maximum value of `B` and the minimum value of `B`. -**Example 1:** +**Example 1**: ``` Input: A = [1], K = 0 @@ -16,7 +16,7 @@ Output: 0 Explanation: B = [1] ``` -**Example 2:** +**Example 2**: ``` Input: A = [0,10], K = 2 @@ -24,7 +24,7 @@ Output: 6 Explanation: B = [2,8] ``` -**Example 3:** +**Example 3**: ``` Input: A = [1,3,6], K = 3 @@ -32,7 +32,7 @@ Output: 3 Explanation: B = [4,6,3] ``` -**Note:** +**Note**: 1. `1 <= A.length <= 10000` 2. `0 <= A[i] <= 10000` diff --git a/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md b/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md index 5559c7e9..76d165f6 100644 --- a/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md +++ b/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md @@ -7,7 +7,7 @@ Given an array `A` of `0`s and `1`s, consider `N_i`: the i-th subarray from Return a list of booleans `answer`, where `answer[i]` is `true` if and only if `N_i` is divisible by 5. -**Example 1:** +**Example 1**: ``` Input: [0,1,1] @@ -17,7 +17,7 @@ The input numbers in binary are 0, 01, 011; which are 0, 1, and 3 in base-10. O ``` -**Example 2:** +**Example 2**: ``` Input: [1,1,1] @@ -25,7 +25,7 @@ Output: [false,false,false] ``` -**Example 3:** +**Example 3**: ``` Input: [0,1,1,1,1,1] @@ -33,7 +33,7 @@ Output: [true,false,false,false,true,false] ``` -**Example 4:** +**Example 4**: ``` Input: [1,1,1,0,1] @@ -41,7 +41,7 @@ Output: [false,false,false,false,false] ``` -**Note:** +**Note**: 1. `1 <= A.length <= 30000` 2. `A[i]` is `0` or `1` diff --git a/website/content/ChapterFour/1093.Statistics-from-a-Large-Sample.md b/website/content/ChapterFour/1093.Statistics-from-a-Large-Sample.md index 7ebf2a32..ab5f59be 100755 --- a/website/content/ChapterFour/1093.Statistics-from-a-Large-Sample.md +++ b/website/content/ChapterFour/1093.Statistics-from-a-Large-Sample.md @@ -22,7 +22,7 @@ Return the minimum, maximum, mean, median, and mode of the sample respectively, Input: count = [0,4,3,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] Output: [1.00000,4.00000,2.18182,2.00000,1.00000] -**Constraints:** +**Constraints**: 1. `count.length == 256` 2. `1 <= sum(count) <= 10^9` diff --git a/website/content/ChapterFour/1105.Filling-Bookcase-Shelves.md b/website/content/ChapterFour/1105.Filling-Bookcase-Shelves.md index 5c248f89..a09fe67b 100755 --- a/website/content/ChapterFour/1105.Filling-Bookcase-Shelves.md +++ b/website/content/ChapterFour/1105.Filling-Bookcase-Shelves.md @@ -23,7 +23,7 @@ Return the minimum possible height that the total bookshelf can be after placing The sum of the heights of the 3 shelves are 1 + 3 + 2 = 6. Notice that book number 2 does not have to be on the first shelf. -**Constraints:** +**Constraints**: - `1 <= books.length <= 1000` - `1 <= books[i][0] <= shelf_width <= 1000` diff --git a/website/content/ChapterFour/1108.Defanging-an-IP-Address.md b/website/content/ChapterFour/1108.Defanging-an-IP-Address.md index 0eb4a7f9..870f909d 100755 --- a/website/content/ChapterFour/1108.Defanging-an-IP-Address.md +++ b/website/content/ChapterFour/1108.Defanging-an-IP-Address.md @@ -17,7 +17,7 @@ A *defanged IP address* replaces every period `"."` with `"[.]"`. Input: address = "255.100.50.0" Output: "255[.]100[.]50[.]0" -**Constraints:** +**Constraints**: - The given `address` is a valid IPv4 address. diff --git a/website/content/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md b/website/content/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md index 8f4d8f59..aebabe96 100755 --- a/website/content/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md +++ b/website/content/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md @@ -33,7 +33,7 @@ Return an `answer` array (of length `seq.length`) that encodes such a choice Input: seq = "()(())()" Output: [0,0,0,1,1,0,1,1] -**Constraints:** +**Constraints**: - `1 <= seq.size <= 10000` diff --git a/website/content/ChapterFour/1122.Relative-Sort-Array.md b/website/content/ChapterFour/1122.Relative-Sort-Array.md index 7a536881..1a560cee 100755 --- a/website/content/ChapterFour/1122.Relative-Sort-Array.md +++ b/website/content/ChapterFour/1122.Relative-Sort-Array.md @@ -12,7 +12,7 @@ Sort the elements of `arr1` such that the relative ordering of items in `arr1 Input: arr1 = [2,3,1,3,2,4,6,7,9,2,19], arr2 = [2,1,4,3,9,6] Output: [2,2,2,1,4,3,3,9,6,7,19] -**Constraints:** +**Constraints**: - `arr1.length, arr2.length <= 1000` - `0 <= arr1[i], arr2[i] <= 1000` diff --git a/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md b/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md index f2838c9d..4d9e958d 100755 --- a/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md +++ b/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md @@ -30,7 +30,7 @@ Recall that: Input: root = [1,2,3,4,5] Output: [2,4,5] -**Constraints:** +**Constraints**: - The given tree will have between 1 and 1000 nodes. - Each node of the tree will have a distinct value between 1 and 1000. diff --git a/website/content/ChapterFour/1128.Number-of-Equivalent-Domino-Pairs.md b/website/content/ChapterFour/1128.Number-of-Equivalent-Domino-Pairs.md index cc946659..f30cc814 100755 --- a/website/content/ChapterFour/1128.Number-of-Equivalent-Domino-Pairs.md +++ b/website/content/ChapterFour/1128.Number-of-Equivalent-Domino-Pairs.md @@ -12,7 +12,7 @@ Return the number of pairs `(i, j)` for which `0 <= i < j < dominoes.length`, Input: dominoes = [[1,2],[2,1],[3,4],[5,6]] Output: 1 -**Constraints:** +**Constraints**: - `1 <= dominoes.length <= 40000` - `1 <= dominoes[i][j] <= 9` diff --git a/website/content/ChapterFour/1137.N-th-Tribonacci-Number.md b/website/content/ChapterFour/1137.N-th-Tribonacci-Number.md index f897528d..0e6e6d17 100755 --- a/website/content/ChapterFour/1137.N-th-Tribonacci-Number.md +++ b/website/content/ChapterFour/1137.N-th-Tribonacci-Number.md @@ -22,7 +22,7 @@ Given `n`, return the value of Tn. Input: n = 25 Output: 1389537 -**Constraints:** +**Constraints**: - `0 <= n <= 37` - The answer is guaranteed to fit within a 32-bit integer, ie. `answer <= 2^31 - 1`. diff --git a/website/content/ChapterFour/1154.Day-of-the-Year.md b/website/content/ChapterFour/1154.Day-of-the-Year.md index 6b1bc846..8fcd6833 100755 --- a/website/content/ChapterFour/1154.Day-of-the-Year.md +++ b/website/content/ChapterFour/1154.Day-of-the-Year.md @@ -26,7 +26,7 @@ Given a string `date` representing a [Gregorian calendar](https://en.wikiped Input: date = "2004-03-01" Output: 61 -**Constraints:** +**Constraints**: - `date.length == 10` - `date[4] == date[7] == '-'`, and all other `date[i]`'s are digits diff --git a/website/content/ChapterFour/1157.Online-Majority-Element-In-Subarray.md b/website/content/ChapterFour/1157.Online-Majority-Element-In-Subarray.md index ac7d539b..10f4d06a 100755 --- a/website/content/ChapterFour/1157.Online-Majority-Element-In-Subarray.md +++ b/website/content/ChapterFour/1157.Online-Majority-Element-In-Subarray.md @@ -19,7 +19,7 @@ Each `query(...)` returns the element in `arr[left], arr[left+1], ..., arr[ri majorityChecker.query(0,3,3); // returns -1 majorityChecker.query(2,3,2); // returns 2 -**Constraints:** +**Constraints**: - `1 <= arr.length <= 20000` - `1 <= arr[i] <= 20000` diff --git a/website/content/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md b/website/content/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md index be6dfc0d..f9605d63 100755 --- a/website/content/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md +++ b/website/content/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md @@ -18,7 +18,7 @@ Now, given string arrays `queries` and `words`, return an integer array `ans Output: [1,2] Explanation: On the first query only f("bbb") < f("aaaa"). On the second query both f("aaa") and f("aaaa") are both > f("cc"). -**Constraints:** +**Constraints**: - `1 <= queries.length <= 2000` - `1 <= words.length <= 2000` diff --git a/website/content/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md b/website/content/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md index b71ad63b..6b55a1a8 100755 --- a/website/content/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md +++ b/website/content/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md @@ -25,7 +25,7 @@ After doing so, return the head of the final linked list. You may return any suc Input: head = [1,2,3,-3,-2] Output: [1] -**Constraints:** +**Constraints**: - The given linked list will contain between `1` and `1000` nodes. - Each node in the linked list has `-1000 <= node.val <= 1000`. diff --git a/website/content/ChapterFour/1175.Prime-Arrangements.md b/website/content/ChapterFour/1175.Prime-Arrangements.md index e5550e67..ceae2ed5 100755 --- a/website/content/ChapterFour/1175.Prime-Arrangements.md +++ b/website/content/ChapterFour/1175.Prime-Arrangements.md @@ -20,7 +20,7 @@ Since the answer may be large, return the answer **modulo `10^9 + 7`**. Input: n = 100 Output: 682289015 -**Constraints:** +**Constraints**: - `1 <= n <= 100` diff --git a/website/content/ChapterFour/1184.Distance-Between-Bus-Stops.md b/website/content/ChapterFour/1184.Distance-Between-Bus-Stops.md index 4f5f6c64..7455432d 100755 --- a/website/content/ChapterFour/1184.Distance-Between-Bus-Stops.md +++ b/website/content/ChapterFour/1184.Distance-Between-Bus-Stops.md @@ -32,7 +32,7 @@ Return the shortest distance between the given `start` and `destination` sto Output: 4 Explanation: Distance between 0 and 3 is 6 or 4, minimum is 4. -**Constraints:** +**Constraints**: - `1 <= n <= 10^4` - `distance.length == n` diff --git a/website/content/ChapterFour/1185.Day-of-the-Week.md b/website/content/ChapterFour/1185.Day-of-the-Week.md index 0eef0bcf..1d970543 100755 --- a/website/content/ChapterFour/1185.Day-of-the-Week.md +++ b/website/content/ChapterFour/1185.Day-of-the-Week.md @@ -24,7 +24,7 @@ Return the answer as one of the following values `{"Sunday", "Monday", "Tuesday Input: day = 15, month = 8, year = 1993 Output: "Sunday" -**Constraints:** +**Constraints**: - The given dates are valid dates between the years `1971` and `2100`. diff --git a/website/content/ChapterFour/1189.Maximum-Number-of-Balloons.md b/website/content/ChapterFour/1189.Maximum-Number-of-Balloons.md index 9fdae875..9bfd7219 100755 --- a/website/content/ChapterFour/1189.Maximum-Number-of-Balloons.md +++ b/website/content/ChapterFour/1189.Maximum-Number-of-Balloons.md @@ -26,7 +26,7 @@ You can use each character in `text` **at most once**. Return the maximum numb Input: text = "leetcode" Output: 0 -**Constraints:** +**Constraints**: - `1 <= text.length <= 10^4` - `text` consists of lower case English letters only. diff --git a/website/content/ChapterFour/1200.Minimum-Absolute-Difference.md b/website/content/ChapterFour/1200.Minimum-Absolute-Difference.md index c52b7799..ad1b5e88 100755 --- a/website/content/ChapterFour/1200.Minimum-Absolute-Difference.md +++ b/website/content/ChapterFour/1200.Minimum-Absolute-Difference.md @@ -27,7 +27,7 @@ Return a list of pairs in ascending order(with respect to pairs), each pair `[a Input: arr = [3,8,-10,23,19,-4,-14,27] Output: [[-14,-10],[19,23],[23,27]] -**Constraints:** +**Constraints**: - `2 <= arr.length <= 10^5` - `-10^6 <= arr[i] <= 10^6` diff --git a/website/content/ChapterFour/1201.Ugly-Number-III.md b/website/content/ChapterFour/1201.Ugly-Number-III.md index 171ebe8b..74d25b81 100755 --- a/website/content/ChapterFour/1201.Ugly-Number-III.md +++ b/website/content/ChapterFour/1201.Ugly-Number-III.md @@ -30,7 +30,7 @@ Ugly numbers are **positive integers** which are divisible by `a` **or** `b Input: n = 1000000000, a = 2, b = 217983653, c = 336916467 Output: 1999999984 -**Constraints:** +**Constraints**: - `1 <= n, a, b, c <= 10^9` - `1 <= a * b * c <= 10^18` diff --git a/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md b/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md index 18527ba9..9a46cee4 100755 --- a/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md +++ b/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md @@ -35,7 +35,7 @@ Return the lexicographically smallest string that `s` can be changed to after Swap s[1] and s[2], s = "bac" Swap s[0] and s[1], s = "abc" -**Constraints:** +**Constraints**: - `1 <= s.length <= 10^5` - `0 <= pairs.length <= 10^5` diff --git a/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md b/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md index 43e3c6f8..bba34134 100755 --- a/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md +++ b/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md @@ -21,7 +21,7 @@ Given an array of integers `arr`, write a function that returns `true` if an Input: arr = [-3,0,1,-3,1,1,1,-3,10,0] Output: true -**Constraints:** +**Constraints**: - `1 <= arr.length <= 1000` - `-1000 <= arr[i] <= 1000` diff --git a/website/content/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md b/website/content/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md index 5d0474f5..3569ea9e 100755 --- a/website/content/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md +++ b/website/content/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md @@ -29,7 +29,7 @@ If there is no substring from `s` that can be changed to its corresponding sub Output: 1 Explanation: You can't make any change, so the maximum length is 1. -**Constraints:** +**Constraints**: - `1 <= s.length, t.length <= 10^5` - `0 <= maxCost <= 10^6` diff --git a/website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md b/website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md index bdb64fa0..7740a7ac 100755 --- a/website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md +++ b/website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md @@ -26,7 +26,7 @@ Return the minimum cost needed to move all the chips to the same position (any Output: 2 Explanation: Both fourth and fifth chip will be moved to position two with cost 1. Total minimum cost will be 2. -**Constraints:** +**Constraints**: - `1 <= chips.length <= 100` - `1 <= chips[i] <= 10^9` diff --git a/website/content/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md b/website/content/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md index 5a50681b..9cfeaedf 100755 --- a/website/content/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md +++ b/website/content/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md @@ -27,7 +27,7 @@ Return the maximum amount of splitted balanced strings. Output: 1 Explanation: s can be split into "LLLLRRRR". -**Constraints:** +**Constraints**: - `1 <= s.length <= 1000` - `s[i] = 'L' or 'R'` diff --git a/website/content/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md b/website/content/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md index a6bdd744..831b229f 100755 --- a/website/content/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md +++ b/website/content/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md @@ -20,7 +20,7 @@ You are given an array `coordinates`, `coordinates[i] = [x, y]`, where `[x, y Input: coordinates = [[1,1],[2,2],[3,4],[4,5],[5,6],[7,7]] Output: false -**Constraints:** +**Constraints**: - `2 <= coordinates.length <= 1000` - `coordinates[i].length == 2` diff --git a/website/content/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md b/website/content/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md index f5584b74..a9d35b14 100755 --- a/website/content/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md +++ b/website/content/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md @@ -35,7 +35,7 @@ Return 0 if the string is already **balanced**. Output: 3 Explanation: We can replace the last 3 'Q' to make s = "QWER". -**Constraints:** +**Constraints**: - `1 <= s.length <= 10^5` - `s.length` is a multiple of `4` diff --git a/website/content/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md b/website/content/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md index 915b5433..9f08f7a4 100755 --- a/website/content/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md +++ b/website/content/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md @@ -34,7 +34,7 @@ If you choose a job that ends at time `X` you will be able to start another j Input: startTime = [1,1,1], endTime = [2,3,4], profit = [5,6,4] Output: 6 -**Constraints:** +**Constraints**: - `1 <= startTime.length == endTime.length == profit.length <= 5 * 10^4` - `1 <= startTime[i] < endTime[i] <= 10^9` diff --git a/website/content/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md b/website/content/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md index 14db287a..9d46af45 100755 --- a/website/content/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md +++ b/website/content/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md @@ -25,7 +25,7 @@ Return *the number of cells with odd values* in the matrix after applying the Output: 0 Explanation: Final matrix = [[2,2],[2,2]]. There is no odd number in the final matrix. -**Constraints:** +**Constraints**: - `1 <= n <= 50` - `1 <= m <= 50` diff --git a/website/content/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md b/website/content/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md index 5fe48f07..5e5268af 100755 --- a/website/content/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md +++ b/website/content/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md @@ -26,7 +26,7 @@ You can move according to the next rules: Input: points = [[3,2],[-2,2]] Output: 5 -**Constraints:** +**Constraints**: - `points.length == n` - `1 <= n <= 100` diff --git a/website/content/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md b/website/content/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md index d019be1c..750d3c7b 100644 --- a/website/content/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md +++ b/website/content/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md @@ -68,7 +68,7 @@ Explanation: The game has not finished yet. ``` -**Constraints:** +**Constraints**: - `1 <= moves.length <= 9` - `moves[i].length == 2` diff --git a/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md b/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md index ba13a085..9350e713 100644 --- a/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md +++ b/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md @@ -6,7 +6,7 @@ Given an array `arr` of positive integers sorted in a **strictly increasing *Find the* `kth` *positive integer that is missing from this array.* -**Example 1:** +**Example 1**: ``` Input: arr = [2,3,4,7,11], k = 5 @@ -14,7 +14,7 @@ Output: 9 Explanation: The missing positive integers are [1,5,6,8,9,10,12,13,...]. The 5th missing positive integer is 9. ``` -**Example 2:** +**Example 2**: ``` Input: arr = [1,2,3,4], k = 2 @@ -22,7 +22,7 @@ Output: 6 Explanation: The missing positive integers are [5,6,7,...]. The 2nd missing positive integer is 6. ``` -**Constraints:** +**Constraints**: - `1 <= arr.length <= 1000` - `1 <= arr[i] <= 1000` diff --git a/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md b/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md index 6b8ac226..8954680f 100644 --- a/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md +++ b/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md @@ -9,7 +9,7 @@ Return the number of ways `s` can be split such that the number of characters Since the answer may be too large, return it modulo 10^9 + 7. -**Example 1:** +**Example 1**: ``` Input: s = "10101" @@ -22,7 +22,7 @@ Explanation: There are four ways to split s in 3 parts where each part contain t ``` -**Example 2:** +**Example 2**: ``` Input: s = "1001" @@ -30,7 +30,7 @@ Output: 0 ``` -**Example 3:** +**Example 3**: ``` Input: s = "0000" @@ -42,7 +42,7 @@ Explanation: There are three ways to split s in 3 parts. ``` -**Example 4:** +**Example 4**: ``` Input: s = "100100010100110" @@ -50,7 +50,7 @@ Output: 12 ``` -**Constraints:** +**Constraints**: - `3 <= s.length <= 10^5` - `s[i]` is `'0'` or `'1'`. diff --git a/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md b/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md index 86498177..dbbce406 100644 --- a/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md +++ b/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md @@ -7,14 +7,14 @@ You are given an array of **distinct** integers `arr` and an array of intege Return `true` *if it is possible to form the array* `arr` *from* `pieces`. Otherwise, return `false`. -**Example 1:** +**Example 1**: ``` Input: arr = [85], pieces = [[85]] Output: true ``` -**Example 2:** +**Example 2**: ``` Input: arr = [15,88], pieces = [[88],[15]] @@ -22,7 +22,7 @@ Output: true Explanation: Concatenate [15] then [88] ``` -**Example 3:** +**Example 3**: ``` Input: arr = [49,18,16], pieces = [[16,18,49]] @@ -30,7 +30,7 @@ Output: false Explanation: Even though the numbers match, we cannot reorder pieces[0]. ``` -**Example 4:** +**Example 4**: ``` Input: arr = [91,4,64,78], pieces = [[78],[4,64],[91]] @@ -38,7 +38,7 @@ Output: true Explanation: Concatenate [91] then [4,64] then [78] ``` -**Example 5:** +**Example 5**: ``` Input: arr = [1,3,5,7], pieces = [[2,4,6,8]] @@ -46,7 +46,7 @@ Output: false ``` -**Constraints:** +**Constraints**: - `1 <= pieces.length <= arr.length <= 100` - `sum(pieces[i].length) == arr.length` diff --git a/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md b/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md index a703bba7..ce833f68 100644 --- a/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md +++ b/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md @@ -12,7 +12,7 @@ You are given an integer `n`. An array `nums` of length `n + 1` is generate Return *****the **maximum** integer in the array* `nums`. -**Example 1:** +**Example 1**: ``` Input: n = 7 @@ -30,7 +30,7 @@ Hence, nums = [0,1,1,2,1,3,2,3], and the maximum is 3. ``` -**Example 2:** +**Example 2**: ``` Input: n = 2 @@ -39,7 +39,7 @@ Explanation: According to the given rules, the maximum between nums[0], nums[1], ``` -**Example 3:** +**Example 3**: ``` Input: n = 3 @@ -48,7 +48,7 @@ Explanation: According to the given rules, the maximum between nums[0], nums[1], ``` -**Constraints:** +**Constraints**: - `0 <= n <= 100` diff --git a/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md b/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md index e6b2fff8..40aacead 100644 --- a/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md +++ b/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md @@ -9,7 +9,7 @@ Given a string `s`, return *the **minimum** number of characters you need to The **frequency** of a character in a string is the number of times it appears in the string. For example, in the string `"aab"`, the **frequency** of `'a'` is `2`, while the **frequency** of `'b'` is `1`. -**Example 1:** +**Example 1**: ``` Input: s = "aab" @@ -18,7 +18,7 @@ Explanation: s is already good. ``` -**Example 2:** +**Example 2**: ``` Input: s = "aaabbbcc" @@ -27,7 +27,7 @@ Explanation: You can delete two 'b's resulting in the good string "aaabcc". Another way it to delete one 'b' and one 'c' resulting in the good string "aaabbc". ``` -**Example 3:** +**Example 3**: ``` Input: s = "ceabaacb" @@ -37,7 +37,7 @@ Note that we only care about characters that are still in the string at the end ``` -**Constraints:** +**Constraints**: - `1 <= s.length <= 105` - `s` contains only lowercase English letters. diff --git a/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md b/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md index bddd91b3..e030a9f5 100644 --- a/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md +++ b/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md @@ -11,7 +11,7 @@ You are given an integer array, `inventory`, where `inventory[i]` represents Return *the **maximum** total value that you can attain after selling* `orders` *colored balls*. As the answer may be too large, return it **modulo** `109 + 7`. -**Example 1:** +**Example 1**: ![https://assets.leetcode.com/uploads/2020/11/05/jj.gif](https://assets.leetcode.com/uploads/2020/11/05/jj.gif) @@ -23,7 +23,7 @@ The maximum total value is 2 + 5 + 4 + 3 = 14. ``` -**Example 2:** +**Example 2**: ``` Input: inventory = [3,5], orders = 6 @@ -32,14 +32,14 @@ Explanation: Sell the 1st color 2 times (3 + 2) and the 2nd color 4 times (5 + 4 The maximum total value is 3 + 2 + 5 + 4 + 3 + 2 = 19. ``` -**Example 3:** +**Example 3**: ``` Input: inventory = [2,8,4,10,6], orders = 20 Output: 110 ``` -**Example 4:** +**Example 4**: ``` Input: inventory = [1000000000], orders = 1000000000 @@ -47,7 +47,7 @@ Output: 21 Explanation: Sell the 1st color 1000000000 times for a total value of 500000000500000000. 500000000500000000 modulo 109 + 7 = 21. ``` -**Constraints:** +**Constraints**: - `1 <= inventory.length <= 10^5` - `1 <= inventory[i] <= 10^9` diff --git a/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md b/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md index 2f99c307..08435245 100644 --- a/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md +++ b/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md @@ -11,7 +11,7 @@ For example, if inserting element `3` into `nums = [1,2,3,5]`, the **cost** Return *the **total cost** to insert all elements from* `instructions` *into* `nums`. Since the answer may be large, return it **modulo** `10^9 + 7` -**Example 1:** +**Example 1**: ``` Input: instructions = [1,5,6,2] @@ -24,7 +24,7 @@ Insert 2 with cost min(1, 2) = 1, now nums = [1,2,5,6]. The total cost is 0 + 0 + 0 + 1 = 1. ``` -**Example 2:** +**Example 2**: ``` Input: instructions = [1,2,3,6,5,4] @@ -39,7 +39,7 @@ Insert 4 with cost min(3, 2) = 2, now nums = [1,2,3,4,5,6]. The total cost is 0 + 0 + 0 + 0 + 1 + 2 = 3. ``` -**Example 3:** +**Example 3**: ``` Input: instructions = [1,3,3,3,2,4,2,1,2] @@ -57,7 +57,7 @@ Insert 2 with cost min(2, 4) = 2, now nums = [1,1,2,2,2,3,3,3,4]. The total cost is 0 + 0 + 0 + 0 + 1 + 0 + 1 + 0 + 2 = 4. ``` -**Constraints:** +**Constraints**: - `1 <= instructions.length <= 105` - `1 <= instructions[i] <= 105` diff --git a/website/content/ChapterFour/1652.Defuse-the-Bomb.md b/website/content/ChapterFour/1652.Defuse-the-Bomb.md index cc47f853..df2c48b3 100644 --- a/website/content/ChapterFour/1652.Defuse-the-Bomb.md +++ b/website/content/ChapterFour/1652.Defuse-the-Bomb.md @@ -15,7 +15,7 @@ As `code` is circular, the next element of `code[n-1]` is `code[0]`, and th Given the **circular** array `code` and an integer key `k`, return *the decrypted code to defuse the bomb*! -**Example 1:** +**Example 1**: ``` Input: code = [5,7,1,4], k = 3 @@ -23,7 +23,7 @@ Output: [12,10,16,13] Explanation: Each number is replaced by the sum of the next 3 numbers. The decrypted code is [7+1+4, 1+4+5, 4+5+7, 5+7+1]. Notice that the numbers wrap around. ``` -**Example 2:** +**Example 2**: ``` Input: code = [1,2,3,4], k = 0 @@ -31,7 +31,7 @@ Output: [0,0,0,0] Explanation: When k is zero, the numbers are replaced by 0. ``` -**Example 3:** +**Example 3**: ``` Input: code = [2,4,9,3], k = -2 @@ -39,7 +39,7 @@ Output: [12,5,6,13] Explanation: The decrypted code is [3+9, 2+3, 4+2, 9+4]. Notice that the numbers wrap around again. If k is negative, the sum is of the previous numbers. ``` -**Constraints:** +**Constraints**: - `n == code.length` - `1 <= n <= 100` diff --git a/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md b/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md index f162b23e..fe8836e1 100644 --- a/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md +++ b/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md @@ -9,7 +9,7 @@ You can delete any number of characters in `s` to make `s` **balanced**. `s Return *the **minimum** number of deletions needed to make* `s` ***balanced***. -**Example 1:** +**Example 1**: ``` Input: s = "aababbab" @@ -19,7 +19,7 @@ Delete the characters at 0-indexed positions 2 and 6 ("aababbab" -> "aaabbb"), o Delete the characters at 0-indexed positions 3 and 6 ("aababbab" -> "aabbbb"). ``` -**Example 2:** +**Example 2**: ``` Input: s = "bbaaaaabb" @@ -27,7 +27,7 @@ Output: 2 Explanation: The only solution is to delete the first two characters. ``` -**Constraints:** +**Constraints**: - `1 <= s.length <= 105` - `s[i]` is `'a'` or `'b'`. diff --git a/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md b/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md index 790c9cf3..fdb7ef53 100644 --- a/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md +++ b/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md @@ -16,7 +16,7 @@ The bug may jump forward **beyond** its home, but it **cannot jump** to posi Given an array of integers `forbidden`, where `forbidden[i]` means that the bug cannot jump to the position `forbidden[i]`, and integers `a`, `b`, and `x`, return *the minimum number of jumps needed for the bug to reach its home*. If there is no possible sequence of jumps that lands the bug on position `x`, return `1.` -**Example 1:** +**Example 1**: ``` Input: forbidden = [14,4,18,1,15], a = 3, b = 15, x = 9 @@ -24,14 +24,14 @@ Output: 3 Explanation: 3 jumps forward (0 -> 3 -> 6 -> 9) will get the bug home. ``` -**Example 2:** +**Example 2**: ``` Input: forbidden = [8,3,16,6,12,20], a = 15, b = 13, x = 11 Output: -1 ``` -**Example 3:** +**Example 3**: ``` Input: forbidden = [1,6,2,14,5,17,4], a = 16, b = 9, x = 7 @@ -40,7 +40,7 @@ Explanation: One jump forward (0 -> 16) then one jump backward (16 -> 7) will ge ``` -**Constraints:** +**Constraints**: - `1 <= forbidden.length <= 1000` - `1 <= a, b, forbidden[i] <= 2000` diff --git a/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md b/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md index 1c1faaed..7960563c 100644 --- a/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md +++ b/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md @@ -11,7 +11,7 @@ You are given an array of `n` integers, `nums`, where there are at most `50` Return `true` *if it is possible to distribute* `nums` *according to the above conditions*. -**Example 1:** +**Example 1**: ``` Input: nums = [1,2,3,4], quantity = [2] @@ -19,7 +19,7 @@ Output: false Explanation: The 0th customer cannot be given two different integers. ``` -**Example 2:** +**Example 2**: ``` Input: nums = [1,2,3,3], quantity = [2] @@ -27,7 +27,7 @@ Output: true Explanation: The 0th customer is given [3,3]. The integers [1,2] are not used. ``` -**Example 3:** +**Example 3**: ``` Input: nums = [1,1,2,2], quantity = [2,2] @@ -35,7 +35,7 @@ Output: true Explanation: The 0th customer is given [1,1], and the 1st customer is given [2,2]. ``` -**Example 4:** +**Example 4**: ``` Input: nums = [1,1,2,3], quantity = [2,2] @@ -43,7 +43,7 @@ Output: false Explanation: Although the 0th customer could be given [1,1], the 1st customer cannot be satisfied. ``` -**Example 5:** +**Example 5**: ``` Input: nums = [1,1,1,1,1], quantity = [2,3] @@ -51,7 +51,7 @@ Output: true Explanation: The 0th customer is given [1,1], and the 1st customer is given [1,1,1]. ``` -**Constraints:** +**Constraints**: - `n == nums.length` - `1 <= n <= 105` diff --git a/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md b/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md index 96d52e60..db625aea 100644 --- a/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md +++ b/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md @@ -11,7 +11,7 @@ Implement the `OrderedStream` class: - `OrderedStream(int n)` Constructs the stream to take `n` values. - `String[] insert(int id, String value)` Inserts the pair `(id, value)` into the stream, then returns the **largest possible chunk** of currently inserted values that appear next in the order. -**Example:** +**Example**: ![https://assets.leetcode.com/uploads/2020/11/10/q1.gif](https://assets.leetcode.com/uploads/2020/11/10/q1.gif) @@ -36,7 +36,7 @@ os.insert(4, "ddddd"); // Inserts (4, "ddddd"), returns ["ddddd", "eeeee"]. ``` -**Constraints:** +**Constraints**: - `1 <= n <= 1000` - `1 <= id <= n` diff --git a/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md b/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md index 711c758f..cd8b3455 100644 --- a/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md +++ b/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md @@ -14,7 +14,7 @@ You can use the operations on either string as many times as necessary. Given two strings, `word1` and `word2`, return `true` *if* `word1` *and* `word2` *are **close**, and* `false` *otherwise.* -**Example 1:** +**Example 1**: ``` Input: word1 = "abc", word2 = "bca" @@ -25,7 +25,7 @@ Apply Operation 1: "acb" -> "bca" ``` -**Example 2:** +**Example 2**: ``` Input: word1 = "a", word2 = "aa" @@ -34,7 +34,7 @@ Explanation: It is impossible to attain word2 from word1, or vice versa, in any ``` -**Example 3:** +**Example 3**: ``` Input: word1 = "cabbba", word2 = "abbccc" @@ -46,7 +46,7 @@ Apply Operation 2: "baaccc" -> "abbccc" ``` -**Example 4:** +**Example 4**: ``` Input: word1 = "cabbba", word2 = "aabbss" @@ -55,7 +55,7 @@ Explanation: It is impossible to attain word2 from word1, or vice versa, in any ``` -**Constraints:** +**Constraints**: - `1 <= word1.length, word2.length <= 105` - `word1` and `word2` contain only lowercase English letters. diff --git a/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md b/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md index 3fb34d44..5f40e213 100644 --- a/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md +++ b/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md @@ -7,7 +7,7 @@ You are given an integer array `nums` and an integer `x`. In one operation, y Return *the **minimum number** of operations to reduce* `x` *to **exactly*** `0` *if it's possible, otherwise, return* `1`. -**Example 1:** +**Example 1**: ``` Input: nums = [1,1,4,2,3], x = 5 @@ -16,7 +16,7 @@ Explanation: The optimal solution is to remove the last two elements to reduce x ``` -**Example 2:** +**Example 2**: ``` Input: nums = [5,6,7,8,9], x = 4 @@ -24,7 +24,7 @@ Output: -1 ``` -**Example 3:** +**Example 3**: ``` Input: nums = [3,2,20,1,1,3], x = 10 @@ -33,7 +33,7 @@ Explanation: The optimal solution is to remove the last three elements and the f ``` -**Constraints:** +**Constraints**: - `1 <= nums.length <= 105` - `1 <= nums[i] <= 104` diff --git a/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md b/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md index 6f880d26..fe9bab4d 100644 --- a/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md +++ b/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md @@ -15,7 +15,7 @@ Neighbors live in the directly adjacent cells north, east, south, and west of a The **grid happiness** is the **sum** of each person's happiness. Return *the **maximum possible grid happiness**.* -**Example 1:** +**Example 1**: ![https://assets.leetcode.com/uploads/2020/11/05/grid_happiness.png](https://assets.leetcode.com/uploads/2020/11/05/grid_happiness.png) @@ -31,7 +31,7 @@ The grid happiness is 120 + 60 + 60 = 240. The above figure shows the grid in this example with each person's happiness. The introvert stays in the light green cell while the extroverts live on the light purple cells. ``` -**Example 2:** +**Example 2**: ``` Input: m = 3, n = 1, introvertsCount = 2, extrovertsCount = 1 @@ -43,14 +43,14 @@ Explanation: Place the two introverts in (1,1) and (3,1) and the extrovert at (2 The grid happiness is 90 + 80 + 90 = 260. ``` -**Example 3:** +**Example 3**: ``` Input: m = 2, n = 2, introvertsCount = 4, extrovertsCount = 0 Output: 240 ``` -**Constraints:** +**Constraints**: - `1 <= m, n <= 5` - `0 <= introvertsCount, extrovertsCount <= min(m * n, 6)` diff --git a/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md b/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md index d1e47d01..fecd0ed0 100644 --- a/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md +++ b/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md @@ -7,7 +7,7 @@ Given two string arrays `word1` and `word2`, return **`true` *if the two ar A string is **represented** by an array if the array elements concatenated **in order** forms the string. -**Example 1:** +**Example 1**: ``` Input: word1 = ["ab", "c"], word2 = ["a", "bc"] @@ -18,21 +18,21 @@ word2 represents string "a" + "bc" -> "abc" The strings are the same, so return true. ``` -**Example 2:** +**Example 2**: ``` Input: word1 = ["a", "cb"], word2 = ["ab", "c"] Output: false ``` -**Example 3:** +**Example 3**: ``` Input: word1 = ["abc", "d", "defg"], word2 = ["abcddefg"] Output: true ``` -**Constraints:** +**Constraints**: - `1 <= word1.length, word2.length <= 103` - `1 <= word1[i].length, word2[i].length <= 103` diff --git a/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md b/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md index e0ab8917..5e932b8d 100644 --- a/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md +++ b/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md @@ -10,7 +10,7 @@ You are given two integers `n` and `k`. Return *the **lexicographically sma Note that a string `x` is lexicographically smaller than string `y` if `x` comes before `y` in dictionary order, that is, either `x` is a prefix of `y`, or if `i` is the first position such that `x[i] != y[i]`, then `x[i]` comes before `y[i]` in alphabetic order. -**Example 1:** +**Example 1**: ``` Input: n = 3, k = 27 @@ -18,14 +18,14 @@ Output: "aay" Explanation: The numeric value of the string is 1 + 1 + 25 = 27, and it is the smallest string with such a value and length equal to 3. ``` -**Example 2:** +**Example 2**: ``` Input: n = 5, k = 73 Output: "aaszz" ``` -**Constraints:** +**Constraints**: - `1 <= n <= 105` - `n <= k <= 26 * n` diff --git a/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md b/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md index 9c40f823..77af00a1 100644 --- a/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md +++ b/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md @@ -15,7 +15,7 @@ An array is **fair** if the sum of the odd-indexed values equals the sum of th Return the ***number** of indices that you could choose such that after the removal,* `nums` *is **fair**.* -**Example 1:** +**Example 1**: ``` Input: nums = [2,1,6,4] @@ -28,7 +28,7 @@ Remove index 3: [2,1,6] -> Even sum: 2 + 6 = 8. Odd sum: 1. Not fair. There is 1 index that you can remove to make nums fair. ``` -**Example 2:** +**Example 2**: ``` Input: nums = [1,1,1] @@ -36,7 +36,7 @@ Output: 3 Explanation: You can remove any index and the remaining array is fair. ``` -**Example 3:** +**Example 3**: ``` Input: nums = [1,2,3] @@ -44,7 +44,7 @@ Output: 0 Explanation: You cannot make a fair array after removing any index. ``` -**Constraints:** +**Constraints**: - `1 <= nums.length <= 105` - `1 <= nums[i] <= 104` diff --git a/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md b/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md index c2bd57e6..b8226454 100644 --- a/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md +++ b/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md @@ -13,7 +13,7 @@ You can finish the tasks in **any order** you like. Return *the **minimum** initial amount of energy you will need* *to finish all the tasks*. -**Example 1:** +**Example 1**: ``` Input: tasks = [[1,2],[2,4],[4,8]] @@ -26,7 +26,7 @@ Starting with 8 energy, we finish the tasks in the following order: Notice that even though we have leftover energy, starting with 7 energy does not work because we cannot do the 3rd task. ``` -**Example 2:** +**Example 2**: ``` Input: tasks = [[1,3],[2,4],[10,11],[10,12],[8,9]] @@ -40,7 +40,7 @@ Starting with 32 energy, we finish the tasks in the following order: - 5th task. Now energy = 9 - 8 = 1. ``` -**Example 3:** +**Example 3**: ``` Input: tasks = [[1,7],[2,8],[3,9],[4,10],[5,11],[6,12]] @@ -56,7 +56,7 @@ Starting with 27 energy, we finish the tasks in the following order: ``` -**Constraints:** +**Constraints**: - `1 <= tasks.length <= 105` - `1 <= actuali <= minimumi <= 104` diff --git a/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md b/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md index b25e75de..61ea3c70 100644 --- a/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md +++ b/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md @@ -7,7 +7,7 @@ For a string `sequence`, a string `word` is **`k`-repeating** if `word` c Given strings `sequence` and `word`, return *the **maximum `k`-repeating value** of `word` in `sequence`*. -**Example 1:** +**Example 1**: ``` Input: sequence = "ababc", word = "ab" @@ -15,7 +15,7 @@ Output: 2 Explanation: "abab" is a substring in "ababc". ``` -**Example 2:** +**Example 2**: ``` Input: sequence = "ababc", word = "ba" @@ -23,7 +23,7 @@ Output: 1 Explanation: "ba" is a substring in "ababc". "baba" is not a substring in "ababc". ``` -**Example 3:** +**Example 3**: ``` Input: sequence = "ababc", word = "ac" @@ -31,7 +31,7 @@ Output: 0 Explanation: "ac" is not a substring in "ababc". ``` -**Constraints:** +**Constraints**: - `1 <= sequence.length <= 100` - `1 <= word.length <= 100` diff --git a/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md b/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md index 3b221b0f..919ff5ce 100644 --- a/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md +++ b/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md @@ -13,7 +13,7 @@ The blue edges and nodes in the following figure incidate the result: *Build the result list and return its head.* -**Example 1:** +**Example 1**: ![https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex1.png](https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex1.png) @@ -24,7 +24,7 @@ Explanation: We remove the nodes 3 and 4 and put the entire list2 in their place ``` -**Example 2:** +**Example 2**: ![https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex2.png](https://assets.leetcode.com/uploads/2020/11/05/merge_linked_list_ex2.png) @@ -35,7 +35,7 @@ Explanation: The blue edges and nodes in the above figure indicate the result. ``` -**Constraints:** +**Constraints**: - `3 <= list1.length <= 104` - `1 <= a <= b < list1.length - 1` diff --git a/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md b/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md index 2046abf8..30067232 100644 --- a/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md +++ b/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md @@ -20,7 +20,7 @@ Implement the `FrontMiddleBack` class: - Pushing `6` into the middle of `[1, 2, 3, 4, 5]` results in `[1, 2, 6, 3, 4, 5]`. - Popping the middle from `[1, 2, 3, 4, 5, 6]` returns `3` and results in `[1, 2, 4, 5, 6]`. -**Example 1:** +**Example 1**: ``` Input: @@ -43,7 +43,7 @@ q.popFront(); // return -1 -> [] (The queue is empty) ``` -**Constraints:** +**Constraints**: - `1 <= val <= 109` - At most `1000` calls will be made to `pushFront`, `pushMiddle`, `pushBack`, `popFront`, `popMiddle`, and `popBack`. diff --git a/website/content/ChapterFour/1672.Richest-Customer-Wealth.md b/website/content/ChapterFour/1672.Richest-Customer-Wealth.md index 250cf480..0f95c881 100644 --- a/website/content/ChapterFour/1672.Richest-Customer-Wealth.md +++ b/website/content/ChapterFour/1672.Richest-Customer-Wealth.md @@ -7,7 +7,7 @@ You are given an `m x n` integer grid `accounts` where `accounts[i][j]` is A customer's **wealth** is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum **wealth**. -**Example 1:** +**Example 1**: ``` Input: accounts = [[1,2,3],[3,2,1]] @@ -17,7 +17,7 @@ Explanation:1st customer has wealth = 1 + 2 + 3 = 6 Both customers are considered the richest with a wealth of 6 each, so return 6. ``` -**Example 2:** +**Example 2**: ``` Input: accounts = [[1,5],[7,3],[3,5]] @@ -29,14 +29,14 @@ Explanation: The 2nd customer is the richest with a wealth of 10. ``` -**Example 3:** +**Example 3**: ``` Input: accounts = [[2,8,7],[7,1,3],[1,9,5]] Output: 17 ``` -**Constraints:** +**Constraints**: - `m == accounts.length` - `n == accounts[i].length` diff --git a/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md b/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md index 74ced398..0fb52b6f 100644 --- a/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md +++ b/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md @@ -9,7 +9,7 @@ An array's subsequence is a resulting sequence obtained by erasing some (possibl We define that a subsequence `a` is more **competitive** than a subsequence `b` (of the same length) if in the first position where `a` and `b` differ, subsequence `a` has a number **less** than the corresponding number in `b`. For example, `[1,3,4]` is more competitive than `[1,3,5]` because the first position they differ is at the final number, and `4` is less than `5`. -**Example 1:** +**Example 1**: ``` Input: nums = [3,5,2,6], k = 2 @@ -18,7 +18,7 @@ Explanation: Among the set of every possible subsequence: {[3,5], [3,2], [3,6], ``` -**Example 2:** +**Example 2**: ``` Input: nums = [2,4,3,3,5,4,9,6], k = 4 @@ -26,7 +26,7 @@ Output: [2,3,3,4] ``` -**Constraints:** +**Constraints**: - `1 <= nums.length <= 105` - `0 <= nums[i] <= 109` diff --git a/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md b/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md index 8e565e10..54fb1254 100644 --- a/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md +++ b/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md @@ -8,7 +8,7 @@ The array `nums` is **complementary** if for all indices `i` (**0-indexed* Return the ***minimum** number of moves required to make* `nums` ***complementary***. -**Example 1:** +**Example 1**: ``` Input: nums = [1,2,4,3], limit = 4 @@ -21,7 +21,7 @@ nums[3] + nums[0] = 3 + 1 = 4. Therefore, nums[i] + nums[n-1-i] = 4 for every i, so nums is complementary. ``` -**Example 2:** +**Example 2**: ``` Input: nums = [1,2,2,1], limit = 2 @@ -29,7 +29,7 @@ Output: 2 Explanation: In 2 moves, you can change nums to [2,2,2,2]. You cannot change any number to 3 since 3 > limit. ``` -**Example 3:** +**Example 3**: ``` Input: nums = [1,2,1,2], limit = 2 @@ -37,7 +37,7 @@ Output: 0 Explanation: nums is already complementary. ``` -**Constraints:** +**Constraints**: - `n == nums.length` - `2 <= n <= 105` diff --git a/website/content/ChapterFour/1678.Goal-Parser-Interpretation.md b/website/content/ChapterFour/1678.Goal-Parser-Interpretation.md index 4f8145f4..0accbbe7 100644 --- a/website/content/ChapterFour/1678.Goal-Parser-Interpretation.md +++ b/website/content/ChapterFour/1678.Goal-Parser-Interpretation.md @@ -6,7 +6,7 @@ You own a **Goal Parser** that can interpret a string `command`. The `comman Given the string `command`, return *the **Goal Parser**'s interpretation of* `command`. -**Example 1:** +**Example 1**: ``` Input: command = "G()(al)" @@ -18,21 +18,21 @@ G -> G The final concatenated result is "Goal". ``` -**Example 2:** +**Example 2**: ``` Input: command = "G()()()()(al)" Output: "Gooooal" ``` -**Example 3:** +**Example 3**: ``` Input: command = "(al)G(al)()()G" Output: "alGalooG" ``` -**Constraints:** +**Constraints**: - `1 <= command.length <= 100` - `command` consists of `"G"`, `"()"`, and/or `"(al)"` in some order. diff --git a/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md b/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md index 83ed4b31..19b30fd4 100644 --- a/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md +++ b/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md @@ -9,7 +9,7 @@ In one operation, you can pick two numbers from the array whose sum equals `k` Return *the maximum number of operations you can perform on the array*. -**Example 1:** +**Example 1**: ``` Input: nums = [1,2,3,4], k = 5 @@ -20,7 +20,7 @@ Explanation: Starting with nums = [1,2,3,4]: There are no more pairs that sum up to 5, hence a total of 2 operations. ``` -**Example 2:** +**Example 2**: ``` Input: nums = [3,1,3,4,3], k = 6 @@ -30,7 +30,7 @@ Explanation: Starting with nums = [3,1,3,4,3]: There are no more pairs that sum up to 6, hence a total of 1 operation. ``` -**Constraints:** +**Constraints**: - `1 <= nums.length <= 105` - `1 <= nums[i] <= 109` diff --git a/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md b/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md index b43a3e66..5be2e74d 100644 --- a/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md +++ b/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md @@ -5,7 +5,7 @@ Given an integer `n`, return *the **decimal value** of the binary string formed by concatenating the binary representations of* `1` *to* `n` *in order, **modulo*** `109 + 7`. -**Example 1:** +**Example 1**: ``` Input: n = 1 @@ -13,7 +13,7 @@ Output: 1 Explanation: "1" in binary corresponds to the decimal value 1. ``` -**Example 2:** +**Example 2**: ``` Input: n = 3 @@ -22,7 +22,7 @@ Explanation: In binary, 1, 2, and 3 corresponds to "1", "10", and "11". After concatenating them, we have "11011", which corresponds to the decimal value 27. ``` -**Example 3:** +**Example 3**: ``` Input: n = 12 @@ -32,7 +32,7 @@ The decimal value of that is 118505380540. After modulo 109 + 7, the result is 505379714. ``` -**Constraints:** +**Constraints**: - `1 <= n <= 10^5` diff --git a/website/content/ChapterFour/1681.Minimum-Incompatibility.md b/website/content/ChapterFour/1681.Minimum-Incompatibility.md index e2f5dc1d..03773a04 100644 --- a/website/content/ChapterFour/1681.Minimum-Incompatibility.md +++ b/website/content/ChapterFour/1681.Minimum-Incompatibility.md @@ -11,7 +11,7 @@ Return *the **minimum possible sum of incompatibilities** of the* `k` *subs A subset is a group integers that appear in the array with no particular order. -**Example 1:** +**Example 1**: ``` Input: nums = [1,2,1,4], k = 2 @@ -21,7 +21,7 @@ The incompatibility is (2-1) + (4-1) = 4. Note that [1,1] and [2,4] would result in a smaller sum, but the first subset contains 2 equal elements. ``` -**Example 2:** +**Example 2**: ``` Input: nums = [6,3,8,1,3,1,2,2], k = 4 @@ -31,7 +31,7 @@ The incompatibility is (2-1) + (3-2) + (8-6) + (3-1) = 6. ``` -**Example 3:** +**Example 3**: ``` Input: nums = [5,3,3,6,3,3], k = 3 @@ -40,7 +40,7 @@ Explanation: It is impossible to distribute nums into 3 subsets where no two ele ``` -**Constraints:** +**Constraints**: - `1 <= k <= nums.length <= 16` - `nums.length` is divisible by `k` diff --git a/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md b/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md index 85a779c8..fdfe2ab1 100644 --- a/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md +++ b/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md @@ -7,7 +7,7 @@ You are given a string `allowed` consisting of **distinct** characters and a Return *the number of **consistent** strings in the array* `words`. -**Example 1:** +**Example 1**: ``` Input: allowed = "ab", words = ["ad","bd","aaab","baa","badab"] @@ -16,7 +16,7 @@ Explanation: Strings "aaab" and "baa" are consistent since they only contain cha ``` -**Example 2:** +**Example 2**: ``` Input: allowed = "abc", words = ["a","b","c","ab","ac","bc","abc"] @@ -25,7 +25,7 @@ Explanation: All strings are consistent. ``` -**Example 3:** +**Example 3**: ``` Input: allowed = "cad", words = ["cc","acd","b","ba","bac","bad","ac","d"] @@ -34,7 +34,7 @@ Explanation: Strings "cc", "acd", "ac", and "d" are consistent. ``` -**Constraints:** +**Constraints**: - `1 <= words.length <= 104` - `1 <= allowed.length <= 26` diff --git a/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md b/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md index 2de2fe4c..d7c2465c 100644 --- a/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md +++ b/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md @@ -9,7 +9,7 @@ Build and return *an integer array* `result` *with the same length as* `nums In other words, `result[i]` is equal to `sum(|nums[i]-nums[j]|)` where `0 <= j < nums.length` and `j != i` (**0-indexed**). -**Example 1:** +**Example 1**: ``` Input: nums = [2,3,5] @@ -20,14 +20,14 @@ result[1] = |3-2| + |3-3| + |3-5| = 1 + 0 + 2 = 3, result[2] = |5-2| + |5-3| + |5-5| = 3 + 2 + 0 = 5. ``` -**Example 2:** +**Example 2**: ``` Input: nums = [1,4,6,8,10] Output: [24,15,13,15,21] ``` -**Constraints:** +**Constraints**: - `2 <= nums.length <= 105` - `1 <= nums[i] <= nums[i + 1] <= 104` diff --git a/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md b/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md index b9b5f0a9..61c9f7ab 100644 --- a/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md +++ b/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md @@ -10,7 +10,7 @@ You are given an integer `n`, the number of teams in a tournament that has stra Return *the number of matches played in the tournament until a winner is decided.* -**Example 1:** +**Example 1**: ``` Input: n = 7 @@ -22,7 +22,7 @@ Explanation: Details of the tournament: Total number of matches = 3 + 2 + 1 = 6. ``` -**Example 2:** +**Example 2**: ``` Input: n = 14 @@ -35,7 +35,7 @@ Explanation: Details of the tournament: Total number of matches = 7 + 3 + 2 + 1 = 13. ``` -**Constraints:** +**Constraints**: - `1 <= n <= 200` diff --git a/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md b/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md index 2ac4daa2..a6d53116 100644 --- a/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md +++ b/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md @@ -6,7 +6,7 @@ A decimal number is called **deci-binary** if each of its digits is either `0 Given a string `n` that represents a positive decimal integer, return *the **minimum** number of positive **deci-binary** numbers needed so that they sum up to* `n`*.* -**Example 1:** +**Example 1**: ``` Input: n = "32" @@ -14,21 +14,21 @@ Output: 3 Explanation: 10 + 11 + 11 = 32 ``` -**Example 2:** +**Example 2**: ``` Input: n = "82734" Output: 8 ``` -**Example 3:** +**Example 3**: ``` Input: n = "27346209830709182346" Output: 9 ``` -**Constraints:** +**Constraints**: - `1 <= n.length <= 105` - `n` consists of only digits. diff --git a/website/content/ChapterFour/1690.Stone-Game-VII.md b/website/content/ChapterFour/1690.Stone-Game-VII.md index c7b618ac..0a33e2dc 100644 --- a/website/content/ChapterFour/1690.Stone-Game-VII.md +++ b/website/content/ChapterFour/1690.Stone-Game-VII.md @@ -10,7 +10,7 @@ Bob found that he will always lose this game (poor Bob, he always loses), so he Given an array of integers `stones` where `stones[i]` represents the value of the `ith` stone **from the left**, return *the **difference** in Alice and Bob's score if they both play **optimally**.* -**Example 1:** +**Example 1**: ``` Input: stones = [5,3,1,4,2] @@ -24,14 +24,14 @@ Explanation: The score difference is 18 - 12 = 6. ``` -**Example 2:** +**Example 2**: ``` Input: stones = [7,90,5,1,100,10,10,2] Output: 122 ``` -**Constraints:** +**Constraints**: - `n == stones.length` - `2 <= n <= 1000` diff --git a/website/content/ChapterFour/1694.Reformat-Phone-Number.md b/website/content/ChapterFour/1694.Reformat-Phone-Number.md index 670aae71..474c1209 100644 --- a/website/content/ChapterFour/1694.Reformat-Phone-Number.md +++ b/website/content/ChapterFour/1694.Reformat-Phone-Number.md @@ -15,7 +15,7 @@ The blocks are then joined by dashes. Notice that the reformatting process shoul Return *the phone number after formatting.* -**Example 1:** +**Example 1**: ``` Input: number = "1-23-45 6" @@ -27,7 +27,7 @@ Joining the blocks gives "123-456". ``` -**Example 2:** +**Example 2**: ``` Input: number = "123 4-567" @@ -39,7 +39,7 @@ Joining the blocks gives "123-45-67". ``` -**Example 3:** +**Example 3**: ``` Input: number = "123 4-5678" @@ -52,7 +52,7 @@ Joining the blocks gives "123-456-78". ``` -**Example 4:** +**Example 4**: ``` Input: number = "12" @@ -60,7 +60,7 @@ Output: "12" ``` -**Example 5:** +**Example 5**: ``` Input: number = "--17-5 229 35-39475 " @@ -68,7 +68,7 @@ Output: "175-229-353-94-75" ``` -**Constraints:** +**Constraints**: - `2 <= number.length <= 100` - `number` consists of digits and the characters `'-'` and `' '`. diff --git a/website/content/ChapterFour/1695.Maximum-Erasure-Value.md b/website/content/ChapterFour/1695.Maximum-Erasure-Value.md index a2dec532..948220c1 100644 --- a/website/content/ChapterFour/1695.Maximum-Erasure-Value.md +++ b/website/content/ChapterFour/1695.Maximum-Erasure-Value.md @@ -9,7 +9,7 @@ Return *the **maximum score** you can get by erasing **exactly one** subarr An array `b` is called to be a subarray of `a` if it forms a contiguous subsequence of `a`, that is, if it is equal to `a[l],a[l+1],...,a[r]` for some `(l,r)`. -**Example 1:** +**Example 1**: ``` Input: nums = [4,2,4,5,6] @@ -17,7 +17,7 @@ Output: 17 Explanation: The optimal subarray here is [2,4,5,6]. ``` -**Example 2:** +**Example 2**: ``` Input: nums = [5,2,1,2,5,2,1,2,5] @@ -25,7 +25,7 @@ Output: 8 Explanation: The optimal subarray here is [5,2,1] or [1,2,5]. ``` -**Constraints:** +**Constraints**: - `1 <= nums.length <= 105` - `1 <= nums[i] <= 104` diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 6c636d23..de7f9a68 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -317,7 +317,7 @@ headless: true - [0537.Complex-Number-Multiplication]({{< relref "/ChapterFour/0537.Complex-Number-Multiplication.md" >}}) - [0541.Reverse-String-II]({{< relref "/ChapterFour/0541.Reverse-String-II.md" >}}) - [0542.01-Matrix]({{< relref "/ChapterFour/0542.01-Matrix.md" >}}) - - [0547.Friend-Circles]({{< relref "/ChapterFour/0547.Friend-Circles.md" >}}) + - [0547.Number-of-Provinces]({{< relref "/ChapterFour/0547.Number-of-Provinces.md" >}}) - [0557.Reverse-Words-in-a-String-III]({{< relref "/ChapterFour/0557.Reverse-Words-in-a-String-III.md" >}}) - [0561.Array-Partition-I]({{< relref "/ChapterFour/0561.Array-Partition-I.md" >}}) - [0563.Binary-Tree-Tilt]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}}) @@ -397,7 +397,7 @@ headless: true - [0817.Linked-List-Components]({{< relref "/ChapterFour/0817.Linked-List-Components.md" >}}) - [0819.Most-Common-Word]({{< relref "/ChapterFour/0819.Most-Common-Word.md" >}}) - [0826.Most-Profit-Assigning-Work]({{< relref "/ChapterFour/0826.Most-Profit-Assigning-Work.md" >}}) - - [0828.COPYRIGHT-PROBLEM-XXX]({{< relref "/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md" >}}) + - [0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String]({{< relref "/ChapterFour/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md" >}}) - [0830.Positions-of-Large-Groups]({{< relref "/ChapterFour/0830.Positions-of-Large-Groups.md" >}}) - [0832.Flipping-an-Image]({{< relref "/ChapterFour/0832.Flipping-an-Image.md" >}}) - [0834.Sum-of-Distances-in-Tree]({{< relref "/ChapterFour/0834.Sum-of-Distances-in-Tree.md" >}}) From 1a51946f5d91f3419159c70f66f07de046158bed Mon Sep 17 00:00:00 2001 From: YDZ Date: Sat, 16 Jan 2021 00:27:26 +0800 Subject: [PATCH 75/82] render chapter two --- ctl/meta/Two_Pointers | 2 +- ctl/meta/Union_Find | 2 +- ctl/models/tagproblem.go | 9 +- ctl/render.go | 7 +- ...gn Add and Search Words Data Structure.go} | 0 ...d and Search Words Data Structure_test.go} | 0 .../README.md | 2 +- ...gn-Add-and-Search-Words-Data-Structure.md} | 2 +- website/content/ChapterTwo/Array.md | 19 +-- website/content/ChapterTwo/Backtracking.md | 70 ++++++----- .../content/ChapterTwo/Binary_Indexed_Tree.md | 10 ++ website/content/ChapterTwo/Binary_Search.md | 87 +++++++++++--- .../content/ChapterTwo/Bit_Manipulation.md | 66 +++++----- .../ChapterTwo/Breadth_First_Search.md | 45 ++++--- .../content/ChapterTwo/Depth_First_Search.md | 101 ++++++++++++---- .../content/ChapterTwo/Dynamic_Programming.md | 83 ++++++++----- website/content/ChapterTwo/Hash_Table.md | 107 +++++++++++------ website/content/ChapterTwo/Linked_List.md | 69 ++++++----- website/content/ChapterTwo/Math.md | 95 +++++++++++---- website/content/ChapterTwo/Segment_Tree.md | 28 +++-- website/content/ChapterTwo/Sliding_Window.md | 35 +++--- website/content/ChapterTwo/Sort.md | 62 ++++++---- website/content/ChapterTwo/Stack.md | 84 ++++++------- website/content/ChapterTwo/String.md | 70 +++++++---- website/content/ChapterTwo/Tree.md | 98 +++++++++------ website/content/ChapterTwo/Two_Pointers.md | 113 ++++++++++-------- website/content/ChapterTwo/Union_Find.md | 44 +++---- website/content/menu/index.md | 2 +- 28 files changed, 822 insertions(+), 490 deletions(-) rename leetcode/{0211.Add-and-Search-Word---Data-structure-design/211. Add and Search Word - Data structure design.go => 0211.Design-Add-and-Search-Words-Data-Structure/211. Design Add and Search Words Data Structure.go} (100%) rename leetcode/{0211.Add-and-Search-Word---Data-structure-design/211. Add and Search Word - Data structure design_test.go => 0211.Design-Add-and-Search-Words-Data-Structure/211. Design Add and Search Words Data Structure_test.go} (100%) rename leetcode/{0211.Add-and-Search-Word---Data-structure-design => 0211.Design-Add-and-Search-Words-Data-Structure}/README.md (89%) rename website/content/ChapterFour/{0211.Add-and-Search-Word---Data-structure-design.md => 0211.Design-Add-and-Search-Words-Data-Structure.md} (94%) diff --git a/ctl/meta/Two_Pointers b/ctl/meta/Two_Pointers index b69b9859..2c238556 100644 --- a/ctl/meta/Two_Pointers +++ b/ctl/meta/Two_Pointers @@ -34,7 +34,7 @@ |713. Subarray Product Less Than K | [Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})| Medium | O(n)| O(1)|| |763. Partition Labels | [Go]({{< relref "/ChapterFour/0763.Partition-Labels.md" >}})| Medium | O(n)| O(1)|❤️| |826. Most Profit Assigning Work | [Go]({{< relref "/ChapterFour/0826.Most-Profit-Assigning-Work.md" >}})| Medium | O(n log n)| O(n)|| -|828. Unique Letter String | [Go]({{< relref "/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md" >}})| Hard | O(n)| O(1)|❤️| +|828. Count Unique Characters of All Substrings of a Given String | [Go]({{< relref "/ChapterFour/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md" >}})| Hard | O(n)| O(1)|❤️| |838. Push Dominoes | [Go]({{< relref "/ChapterFour/0838.Push-Dominoes.md" >}})| Medium | O(n)| O(n)|| |844. Backspace String Compare | [Go]({{< relref "/ChapterFour/0844.Backspace-String-Compare.md" >}})| Easy | O(n)| O(n) || |845. Longest Mountain in Array | [Go]({{< relref "/ChapterFour/0845.Longest-Mountain-in-Array.md" >}})| Medium | O(n)| O(1) || diff --git a/ctl/meta/Union_Find b/ctl/meta/Union_Find index b0bab407..66424cf4 100644 --- a/ctl/meta/Union_Find +++ b/ctl/meta/Union_Find @@ -2,7 +2,7 @@ |130. Surrounded Regions | [Go]({{< relref "/ChapterFour/0130.Surrounded-Regions.md" >}})| Medium | O(m\*n)| O(m\*n)|| |200. Number of Islands | [Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})| Medium | O(m\*n)| O(m\*n)|| |399. Evaluate Division | [Go]({{< relref "/ChapterFour/0399.Evaluate-Division.md" >}})| Medium | O(n)| O(n)|| -|547. Friend Circles | [Go]({{< relref "/ChapterFour/0547.Friend-Circles.md" >}})| Medium | O(n^2)| O(n)|| +|547. Number of Provinces | [Go]({{< relref "/ChapterFour/0547.Number-of-Provinces.md" >}})| Medium | O(n^2)| O(n)|| |684. Redundant Connection | [Go]({{< relref "/ChapterFour/0684.Redundant-Connection.md" >}})| Medium | O(n)| O(n)|| |685. Redundant Connection II | [Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})| Hard | O(n)| O(n)|| |721. Accounts Merge | [Go]({{< relref "/ChapterFour/0721.Accounts-Merge.md" >}})| Medium | O(n)| O(n)|❤️| diff --git a/ctl/models/tagproblem.go b/ctl/models/tagproblem.go index 0514fbfe..838bbd23 100644 --- a/ctl/models/tagproblem.go +++ b/ctl/models/tagproblem.go @@ -122,7 +122,14 @@ func GenerateTagMdRows(solutionIds []int, metaMap map[int]TagList, mdrows []Mdro tmp := TagList{} tmp.FrontendQuestionID = row.FrontendQuestionID tmp.QuestionTitle = row.QuestionTitle - tmp.SolutionPath = fmt.Sprintf("[Go]({{< relref \"/ChapterFour/%v.md\" >}})", fmt.Sprintf("%04d.%v", int(row.FrontendQuestionID), strings.Replace(row.QuestionTitle, " ", "-", -1))) + s1 := strings.Replace(row.QuestionTitle, " ", "-", -1) + s2 := strings.Replace(s1, "'", "", -1) + s3 := strings.Replace(s2, "%", "", -1) + s4 := strings.Replace(s3, "(", "", -1) + s5 := strings.Replace(s4, ")", "", -1) + s6 := strings.Replace(s5, ",", "", -1) + s7 := strings.Replace(s6, "?", "", -1) + tmp.SolutionPath = fmt.Sprintf("[Go]({{< relref \"/ChapterFour/%v.md\" >}})", fmt.Sprintf("%04d.%v", int(row.FrontendQuestionID), s7)) tmp.Acceptance = row.Acceptance tmp.Difficulty = row.Difficulty tmp.TimeComplexity = metaMap[int(row.FrontendQuestionID)].TimeComplexity diff --git a/ctl/render.go b/ctl/render.go index 549d1c38..1e474d79 100644 --- a/ctl/render.go +++ b/ctl/render.go @@ -152,7 +152,6 @@ func buildChapterTwo() { gr m.GraphQLResp questions []m.Question ) - for index, tag := range chapterTwoSlug { body := getTagProblemList(tag) // fmt.Printf("%v\n", string(body)) @@ -165,21 +164,19 @@ func buildChapterTwo() { mdrows := m.ConvertMdModelFromQuestions(questions) sort.Sort(m.SortByQuestionID(mdrows)) solutionIds, _ := util.LoadSolutionsDir() - // generateMdRows(solutionIds, mdrows) - tl, err := loadMetaData(fmt.Sprintf("./meta/%v", chapterTwoFileName[index])) if err != nil { fmt.Printf("err = %v\n", err) } tls := m.GenerateTagMdRows(solutionIds, tl, mdrows) //fmt.Printf("tls = %v\n", tls) - // // 按照模板渲染 README + // 按照模板渲染 README res, err := renderChapterTwo(fmt.Sprintf("./template/%v.md", chapterTwoFileName[index]), m.TagLists{TagLists: tls}) if err != nil { fmt.Println(err) return } - util.WriteFile(fmt.Sprintf("./%v.md", chapterTwoFileName[index]), res) + util.WriteFile(fmt.Sprintf("../website/content/ChapterTwo/%v.md", chapterTwoFileName[index]), res) } } diff --git a/leetcode/0211.Add-and-Search-Word---Data-structure-design/211. Add and Search Word - Data structure design.go b/leetcode/0211.Design-Add-and-Search-Words-Data-Structure/211. Design Add and Search Words Data Structure.go similarity index 100% rename from leetcode/0211.Add-and-Search-Word---Data-structure-design/211. Add and Search Word - Data structure design.go rename to leetcode/0211.Design-Add-and-Search-Words-Data-Structure/211. Design Add and Search Words Data Structure.go diff --git a/leetcode/0211.Add-and-Search-Word---Data-structure-design/211. Add and Search Word - Data structure design_test.go b/leetcode/0211.Design-Add-and-Search-Words-Data-Structure/211. Design Add and Search Words Data Structure_test.go similarity index 100% rename from leetcode/0211.Add-and-Search-Word---Data-structure-design/211. Add and Search Word - Data structure design_test.go rename to leetcode/0211.Design-Add-and-Search-Words-Data-Structure/211. Design Add and Search Words Data Structure_test.go diff --git a/leetcode/0211.Add-and-Search-Word---Data-structure-design/README.md b/leetcode/0211.Design-Add-and-Search-Words-Data-Structure/README.md similarity index 89% rename from leetcode/0211.Add-and-Search-Word---Data-structure-design/README.md rename to leetcode/0211.Design-Add-and-Search-Words-Data-Structure/README.md index 57f8c335..cc646b06 100755 --- a/leetcode/0211.Add-and-Search-Word---Data-structure-design/README.md +++ b/leetcode/0211.Design-Add-and-Search-Words-Data-Structure/README.md @@ -1,4 +1,4 @@ -# [211. Add and Search Word - Data structure design](https://leetcode.com/problems/add-and-search-word-data-structure-design/) +# [211. Design Add and Search Words Data Structure](https://leetcode.com/problems/design-add-and-search-words-data-structure/) ## 题目 diff --git a/website/content/ChapterFour/0211.Add-and-Search-Word---Data-structure-design.md b/website/content/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md similarity index 94% rename from website/content/ChapterFour/0211.Add-and-Search-Word---Data-structure-design.md rename to website/content/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md index ba8502f7..208903d5 100755 --- a/website/content/ChapterFour/0211.Add-and-Search-Word---Data-structure-design.md +++ b/website/content/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md @@ -1,4 +1,4 @@ -# [211. Add and Search Word - Data structure design](https://leetcode.com/problems/add-and-search-word-data-structure-design/) +# [211. Design Add and Search Words Data Structure](https://leetcode.com/problems/design-add-and-search-words-data-structure/) ## 题目 diff --git a/website/content/ChapterTwo/Array.md b/website/content/ChapterTwo/Array.md index dde8b937..fae2d630 100644 --- a/website/content/ChapterTwo/Array.md +++ b/website/content/ChapterTwo/Array.md @@ -76,7 +76,7 @@ type: docs |0566|Reshape the Matrix|[Go]({{< relref "/ChapterFour/0566.Reshape-the-Matrix.md" >}})|Easy| O(n^2)| O(n^2)||61.0%| |0605|Can Place Flowers|[Go]({{< relref "/ChapterFour/0605.Can-Place-Flowers.md" >}})|Easy||||31.9%| |0628|Maximum Product of Three Numbers|[Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})|Easy| O(n)| O(1)||47.0%| -|0661|Image Smoother|[Go]({{< relref "/ChapterFour/0661.Image-Smoother.md" >}})|Easy||||52.1%| +|0661|Image Smoother|[Go]({{< relref "/ChapterFour/0661.Image-Smoother.md" >}})|Easy||||52.2%| |0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| |0697|Degree of an Array|[Go]({{< relref "/ChapterFour/0697.Degree-of-an-Array.md" >}})|Easy||||54.3%| |0713|Subarray Product Less Than K|[Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})|Medium| O(n)| O(1)||40.4%| @@ -87,7 +87,7 @@ type: docs |0724|Find Pivot Index|[Go]({{< relref "/ChapterFour/0724.Find-Pivot-Index.md" >}})|Easy||||45.0%| |0729|My Calendar I|[Go]({{< relref "/ChapterFour/0729.My-Calendar-I.md" >}})|Medium||||53.1%| |0746|Min Cost Climbing Stairs|[Go]({{< relref "/ChapterFour/0746.Min-Cost-Climbing-Stairs.md" >}})|Easy| O(n)| O(1)||50.9%| -|0766|Toeplitz Matrix|[Go]({{< relref "/ChapterFour/0766.Toeplitz-Matrix.md" >}})|Easy| O(n)| O(1)||65.8%| +|0766|Toeplitz Matrix|[Go]({{< relref "/ChapterFour/0766.Toeplitz-Matrix.md" >}})|Easy| O(n)| O(1)||65.7%| |0830|Positions of Large Groups|[Go]({{< relref "/ChapterFour/0830.Positions-of-Large-Groups.md" >}})|Easy||||50.2%| |0832|Flipping an Image|[Go]({{< relref "/ChapterFour/0832.Flipping-an-Image.md" >}})|Easy||||77.9%| |0867|Transpose Matrix|[Go]({{< relref "/ChapterFour/0867.Transpose-Matrix.md" >}})|Easy| O(n)| O(1)||62.2%| @@ -107,8 +107,8 @@ type: docs |1011|Capacity To Ship Packages Within D Days|[Go]({{< relref "/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md" >}})|Medium||||59.5%| |1018|Binary Prefix Divisible By 5|[Go]({{< relref "/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md" >}})|Easy||||47.8%| |1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium||||54.0%| -|1051|Height Checker|[Go]({{< relref "/ChapterFour/1051.Height-Checker.md" >}})|Easy||||71.8%| -|1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})|Medium||||55.7%| +|1051|Height Checker|[Go]({{< relref "/ChapterFour/1051.Height-Checker.md" >}})|Easy||||71.9%| +|1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})|Medium||||55.6%| |1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.4%| |1089|Duplicate Zeros|[Go]({{< relref "/ChapterFour/1089.Duplicate-Zeros.md" >}})|Easy||||52.0%| |1122|Relative Sort Array|[Go]({{< relref "/ChapterFour/1122.Relative-Sort-Array.md" >}})|Easy||||67.7%| @@ -127,11 +127,11 @@ type: docs |1260|Shift 2D Grid|[Go]({{< relref "/ChapterFour/1260.Shift-2D-Grid.md" >}})|Easy||||61.8%| |1266|Minimum Time Visiting All Points|[Go]({{< relref "/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md" >}})|Easy||||79.3%| |1275|Find Winner on a Tic Tac Toe Game|[Go]({{< relref "/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md" >}})|Easy||||52.9%| -|1287|Element Appearing More Than 25% In Sorted Array|[Go]({{< relref "/ChapterFour/1287.Element-Appearing-More-Than-25%-In-Sorted-Array.md" >}})|Easy||||60.2%| +|1287|Element Appearing More Than 25% In Sorted Array|[Go]({{< relref "/ChapterFour/1287.Element-Appearing-More-Than-25-In-Sorted-Array.md" >}})|Easy||||60.2%| |1295|Find Numbers with Even Number of Digits|[Go]({{< relref "/ChapterFour/1295.Find-Numbers-with-Even-Number-of-Digits.md" >}})|Easy||||79.4%| |1299|Replace Elements with Greatest Element on Right Side|[Go]({{< relref "/ChapterFour/1299.Replace-Elements-with-Greatest-Element-on-Right-Side.md" >}})|Easy||||74.1%| |1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.3%| -|1304|Find N Unique Integers Sum up to Zero|[Go]({{< relref "/ChapterFour/1304.Find-N-Unique-Integers-Sum-up-to-Zero.md" >}})|Easy||||76.5%| +|1304|Find N Unique Integers Sum up to Zero|[Go]({{< relref "/ChapterFour/1304.Find-N-Unique-Integers-Sum-up-to-Zero.md" >}})|Easy||||76.6%| |1313|Decompress Run-Length Encoded List|[Go]({{< relref "/ChapterFour/1313.Decompress-Run-Length-Encoded-List.md" >}})|Easy||||85.3%| |1380|Lucky Numbers in a Matrix|[Go]({{< relref "/ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md" >}})|Easy||||70.9%| |1385|Find the Distance Value Between Two Arrays|[Go]({{< relref "/ChapterFour/1385.Find-the-Distance-Value-Between-Two-Arrays.md" >}})|Easy||||66.4%| @@ -141,10 +141,11 @@ type: docs |1480|Running Sum of 1d Array|[Go]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}})|Easy||||89.6%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| |1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.3%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.4%| -|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||51.6%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.3%| +|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||52.3%| |1652|Defuse the Bomb|[Go]({{< relref "/ChapterFour/1652.Defuse-the-Bomb.md" >}})|Easy||||64.2%| -|1656|Design an Ordered Stream|[Go]({{< relref "/ChapterFour/1656.Design-an-Ordered-Stream.md" >}})|Easy||||82.4%| +|1656|Design an Ordered Stream|[Go]({{< relref "/ChapterFour/1656.Design-an-Ordered-Stream.md" >}})|Easy||||82.5%| |1672|Richest Customer Wealth|[Go]({{< relref "/ChapterFour/1672.Richest-Customer-Wealth.md" >}})|Easy||||88.6%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + diff --git a/website/content/ChapterTwo/Backtracking.md b/website/content/ChapterTwo/Backtracking.md index 74f112a0..dd2cd9dc 100644 --- a/website/content/ChapterTwo/Backtracking.md +++ b/website/content/ChapterTwo/Backtracking.md @@ -97,36 +97,40 @@ func updateMatrix_BFS(matrix [][]int) [][]int { } ``` -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|17. Letter Combinations of a Phone Number | [Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})| Medium | O(log n)| O(1)|| -|22. Generate Parentheses| [Go]({{< relref "/ChapterFour/0022.Generate-Parentheses.md" >}})| Medium | O(log n)| O(1)|| -|37. Sudoku Solver | [Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})| Hard | O(n^2)| O(n^2)|❤️| -|39. Combination Sum | [Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})| Medium | O(n log n)| O(n)|| -|40. Combination Sum II | [Go]({{< relref "/ChapterFour/0040.Combination-Sum-II.md" >}})| Medium | O(n log n)| O(n)|| -|46. Permutations | [Go]({{< relref "/ChapterFour/0046.Permutations.md" >}})| Medium | O(n)| O(n)|❤️| -|47. Permutations II | [Go]({{< relref "/ChapterFour/0047.Permutations-II.md" >}})| Medium | O(n^2)| O(n)|❤️| -|51. N-Queens | [Go]({{< relref "/ChapterFour/0051.N-Queens.md" >}})| Hard | O(n^2)| O(n)|❤️| -|52. N-Queens II | [Go]({{< relref "/ChapterFour/0052.N-Queens-II.md" >}})| Hard | O(n^2)| O(n)|❤️| -|60. Permutation Sequence | [Go]({{< relref "/ChapterFour/0060.Permutation-Sequence.md" >}})| Medium | O(n log n)| O(1)|| -|77. Combinations | [Go]({{< relref "/ChapterFour/0077.Combinations.md" >}})| Medium | O(n)| O(n)|❤️| -|78. Subsets | [Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})| Medium | O(n^2)| O(n)|❤️| -|79. Word Search | [Go]({{< relref "/ChapterFour/0079.Word-Search.md" >}})| Medium | O(n^2)| O(n^2)|❤️| -|89. Gray Codes | [Go]({{< relref "/ChapterFour/0089.Gray-Code.md" >}})| Medium | O(n)| O(1)|| -|90. Subsets II | [Go]({{< relref "/ChapterFour/0090.Subsets-II.md" >}})| Medium | O(n^2)| O(n)|❤️| -|93. Restore IP Addresses | [Go]({{< relref "/ChapterFour/0093.Restore-IP-Addresses.md" >}})| Medium | O(n)| O(n)|❤️| -|126. Word Ladder II | [Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})| Hard | O(n)| O(n^2)|❤️| -|131. Palindrome Partitioning | [Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})| Medium | O(n)| O(n^2)|❤️| -|211. Add and Search Word - Data structure design | [Go]({{< relref "/ChapterFour/0211.Add-and-Search-Word---Data-structure-design.md" >}})| Medium | O(n)| O(n)|❤️| -|212. Word Search II | [Go]({{< relref "/ChapterFour/0212.Word-Search-II.md" >}})| Hard | O(n^2)| O(n^2)|❤️| -|216. Combination Sum III | [Go]({{< relref "/ChapterFour/0216.Combination-Sum-III.md" >}})| Medium | O(n)| O(1)|❤️| -|306. Additive Number | [Go]({{< relref "/ChapterFour/0306.Additive-Number.md" >}})| Medium | O(n^2)| O(1)|❤️| -|357. Count Numbers with Unique Digits | [Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})| Medium | O(1)| O(1)|| -|401. Binary Watch | [Go]({{< relref "/ChapterFour/0401.Binary-Watch.md" >}})| Easy | O(1)| O(1)|| -|526. Beautiful Arrangement | [Go]({{< relref "/ChapterFour/0526.Beautiful-Arrangement.md" >}})| Medium | O(n^2)| O(1)|❤️| -|784. Letter Case Permutation | [Go]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}})| Easy | O(n)| O(n)|| -|842. Split Array into Fibonacci Sequence | [Go]({{< relref "/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md" >}})| Medium | O(n^2)| O(1)|❤️| -|980. Unique Paths III | [Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})| Hard | O(n log n)| O(n)|| -|996. Number of Squareful Arrays | [Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})| Hard | O(n log n)| O(n) || -|1079. Letter Tile Possibilities | [Go]({{< relref "/ChapterFour/1079.Letter-Tile-Possibilities.md" >}})| Medium | O(n^2)| O(1)|❤️| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium| O(log n)| O(1)||48.6%| +|0022|Generate Parentheses|[Go]({{< relref "/ChapterFour/0022.Generate-Parentheses.md" >}})|Medium| O(log n)| O(1)||64.8%| +|0037|Sudoku Solver|[Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})|Hard| O(n^2)| O(n^2)|❤️|45.9%| +|0039|Combination Sum|[Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})|Medium| O(n log n)| O(n)||58.7%| +|0040|Combination Sum II|[Go]({{< relref "/ChapterFour/0040.Combination-Sum-II.md" >}})|Medium| O(n log n)| O(n)||49.8%| +|0046|Permutations|[Go]({{< relref "/ChapterFour/0046.Permutations.md" >}})|Medium| O(n)| O(n)|❤️|66.0%| +|0047|Permutations II|[Go]({{< relref "/ChapterFour/0047.Permutations-II.md" >}})|Medium| O(n^2)| O(n)|❤️|49.0%| +|0051|N-Queens|[Go]({{< relref "/ChapterFour/0051.N-Queens.md" >}})|Hard| O(n^2)| O(n)|❤️|49.0%| +|0052|N-Queens II|[Go]({{< relref "/ChapterFour/0052.N-Queens-II.md" >}})|Hard| O(n^2)| O(n)|❤️|59.7%| +|0060|Permutation Sequence|[Go]({{< relref "/ChapterFour/0060.Permutation-Sequence.md" >}})|Hard| O(n log n)| O(1)||39.2%| +|0077|Combinations|[Go]({{< relref "/ChapterFour/0077.Combinations.md" >}})|Medium| O(n)| O(n)|❤️|56.9%| +|0078|Subsets|[Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|64.5%| +|0079|Word Search|[Go]({{< relref "/ChapterFour/0079.Word-Search.md" >}})|Medium| O(n^2)| O(n^2)|❤️|36.6%| +|0089|Gray Code|[Go]({{< relref "/ChapterFour/0089.Gray-Code.md" >}})|Medium| O(n)| O(1)||50.1%| +|0090|Subsets II|[Go]({{< relref "/ChapterFour/0090.Subsets-II.md" >}})|Medium| O(n^2)| O(n)|❤️|48.5%| +|0093|Restore IP Addresses|[Go]({{< relref "/ChapterFour/0093.Restore-IP-Addresses.md" >}})|Medium| O(n)| O(n)|❤️|37.2%| +|0126|Word Ladder II|[Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})|Hard| O(n)| O(n^2)|❤️|23.4%| +|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})|Medium| O(n)| O(n^2)|❤️|51.3%| +|0211|Design Add and Search Words Data Structure|[Go]({{< relref "/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md" >}})|Medium| O(n)| O(n)|❤️|39.8%| +|0212|Word Search II|[Go]({{< relref "/ChapterFour/0212.Word-Search-II.md" >}})|Hard| O(n^2)| O(n^2)|❤️|36.5%| +|0216|Combination Sum III|[Go]({{< relref "/ChapterFour/0216.Combination-Sum-III.md" >}})|Medium| O(n)| O(1)|❤️|59.9%| +|0306|Additive Number|[Go]({{< relref "/ChapterFour/0306.Additive-Number.md" >}})|Medium| O(n^2)| O(1)|❤️|29.6%| +|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.7%| +|0401|Binary Watch|[Go]({{< relref "/ChapterFour/0401.Binary-Watch.md" >}})|Easy| O(1)| O(1)||48.3%| +|0526|Beautiful Arrangement|[Go]({{< relref "/ChapterFour/0526.Beautiful-Arrangement.md" >}})|Medium| O(n^2)| O(1)|❤️|61.7%| +|0784|Letter Case Permutation|[Go]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}})|Medium| O(n)| O(n)||66.2%| +|0842|Split Array into Fibonacci Sequence|[Go]({{< relref "/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md" >}})|Medium| O(n^2)| O(1)|❤️|36.7%| +|0980|Unique Paths III|[Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})|Hard| O(n log n)| O(n)||77.1%| +|0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.0%| +|1079|Letter Tile Possibilities|[Go]({{< relref "/ChapterFour/1079.Letter-Tile-Possibilities.md" >}})|Medium| O(n^2)| O(1)|❤️|75.8%| +|1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.7%| +|1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.2%| +|1681|Minimum Incompatibility|[Go]({{< relref "/ChapterFour/1681.Minimum-Incompatibility.md" >}})|Hard||||35.0%| +|1688|Count of Matches in Tournament|[Go]({{< relref "/ChapterFour/1688.Count-of-Matches-in-Tournament.md" >}})|Easy||||83.2%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Binary_Indexed_Tree.md b/website/content/ChapterTwo/Binary_Indexed_Tree.md index 7fbc2dfc..9c722c1a 100644 --- a/website/content/ChapterTwo/Binary_Indexed_Tree.md +++ b/website/content/ChapterTwo/Binary_Indexed_Tree.md @@ -6,3 +6,13 @@ type: docs # Binary Indexed Tree ![](https://img.halfrost.com/Leetcode/Binary_Indexed_Tree.png) + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0218|The Skyline Problem|[Go]({{< relref "/ChapterFour/0218.The-Skyline-Problem.md" >}})|Hard||||36.1%| +|0307|Range Sum Query - Mutable|[Go]({{< relref "/ChapterFour/0307.Range-Sum-Query---Mutable.md" >}})|Medium||||36.5%| +|0315|Count of Smaller Numbers After Self|[Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})|Hard||||42.6%| +|0327|Count of Range Sum|[Go]({{< relref "/ChapterFour/0327.Count-of-Range-Sum.md" >}})|Hard||||35.9%| +|0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})|Hard||||26.6%| +|1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Binary_Search.md b/website/content/ChapterTwo/Binary_Search.md index 2c71c30d..7339fdc6 100644 --- a/website/content/ChapterTwo/Binary_Search.md +++ b/website/content/ChapterTwo/Binary_Search.md @@ -127,19 +127,74 @@ func peakIndexInMountainArray(A []int) int { - max-min 最大值最小化问题。求在最小满足条件的情况下的最大值。第 410 题,第 875 题,第 1011 题,第 1283 题。 -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|50. Pow(x, n) | [Go]({{< relref "/ChapterFour/0050.Powx-n.md" >}})| Medium | O(log n)| O(1)|| -|69. Sqrt(x) | [Go]({{< relref "/ChapterFour/0069.Sqrtx.md" >}})| Easy | O(log n)| O(1)|| -|167. Two Sum II - Input array is sorted | [Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})| Easy | O(n)| O(1)|| -|209. Minimum Size Subarray Sum | [Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})| Medium | O(n)| O(1)|| -|222. Count Complete Tree Nodes | [Go]({{< relref "/ChapterFour/0222.Count-Complete-Tree-Nodes.md" >}})| Medium | O(n)| O(1)|| -|230. Kth Smallest Element in a BST | [Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})| Medium | O(n)| O(1)|| -|287. Find the Duplicate Number | [Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})| Easy | O(n)| O(1)|❤️| -|300. Longest Increasing Subsequence | [Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})| Medium | O(n log n)| O(n)|| -|349. Intersection of Two Arrays | [Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})| Easy | O(n)| O(n) || -|350. Intersection of Two Arrays II | [Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})| Easy | O(n)| O(n) || -|392. Is Subsequence | [Go]({{< relref "/ChapterFour/0392.Is-Subsequence.md" >}})| Medium | O(n)| O(1)|| -|454. 4Sum II | [Go]({{< relref "/ChapterFour/0454.4Sum-II.md" >}})| Medium | O(n^2)| O(n) || -|710. Random Pick with Blacklist | [Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})| Hard | O(n)| O(n) || -|-----------------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0004|Median of Two Sorted Arrays|[Go]({{< relref "/ChapterFour/0004.Median-of-Two-Sorted-Arrays.md" >}})|Hard||||30.8%| +|0029|Divide Two Integers|[Go]({{< relref "/ChapterFour/0029.Divide-Two-Integers.md" >}})|Medium||||16.6%| +|0033|Search in Rotated Sorted Array|[Go]({{< relref "/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md" >}})|Medium||||35.6%| +|0034|Find First and Last Position of Element in Sorted Array|[Go]({{< relref "/ChapterFour/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array.md" >}})|Medium||||37.1%| +|0035|Search Insert Position|[Go]({{< relref "/ChapterFour/0035.Search-Insert-Position.md" >}})|Easy||||42.8%| +|0050|Pow(x, n)|[Go]({{< relref "/ChapterFour/0050.Powx-n.md" >}})|Medium| O(log n)| O(1)||30.8%| +|0069|Sqrt(x)|[Go]({{< relref "/ChapterFour/0069.Sqrtx.md" >}})|Easy| O(log n)| O(1)||34.8%| +|0074|Search a 2D Matrix|[Go]({{< relref "/ChapterFour/0074.Search-a-2D-Matrix.md" >}})|Medium||||37.4%| +|0081|Search in Rotated Sorted Array II|[Go]({{< relref "/ChapterFour/0081.Search-in-Rotated-Sorted-Array-II.md" >}})|Medium||||33.5%| +|0153|Find Minimum in Rotated Sorted Array|[Go]({{< relref "/ChapterFour/0153.Find-Minimum-in-Rotated-Sorted-Array.md" >}})|Medium||||45.9%| +|0154|Find Minimum in Rotated Sorted Array II|[Go]({{< relref "/ChapterFour/0154.Find-Minimum-in-Rotated-Sorted-Array-II.md" >}})|Hard||||41.9%| +|0162|Find Peak Element|[Go]({{< relref "/ChapterFour/0162.Find-Peak-Element.md" >}})|Medium||||43.8%| +|0167|Two Sum II - Input array is sorted|[Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})|Easy| O(n)| O(1)||55.4%| +|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0174.Dungeon-Game.md" >}})|Hard||||33.1%| +|0209|Minimum Size Subarray Sum|[Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})|Medium| O(n)| O(1)||39.2%| +|0222|Count Complete Tree Nodes|[Go]({{< relref "/ChapterFour/0222.Count-Complete-Tree-Nodes.md" >}})|Medium| O(n)| O(1)||48.8%| +|0230|Kth Smallest Element in a BST|[Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})|Medium| O(n)| O(1)||62.1%| +|0240|Search a 2D Matrix II|[Go]({{< relref "/ChapterFour/0240.Search-a-2D-Matrix-II.md" >}})|Medium||||44.1%| +|0275|H-Index II|[Go]({{< relref "/ChapterFour/0275.H-Index-II.md" >}})|Medium||||36.2%| +|0287|Find the Duplicate Number|[Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})|Medium| O(n)| O(1)|❤️|57.1%| +|0300|Longest Increasing Subsequence|[Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})|Medium| O(n log n)| O(n)||43.6%| +|0315|Count of Smaller Numbers After Self|[Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})|Hard||||42.6%| +|0327|Count of Range Sum|[Go]({{< relref "/ChapterFour/0327.Count-of-Range-Sum.md" >}})|Hard||||35.9%| +|0349|Intersection of Two Arrays|[Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})|Easy| O(n)| O(n) ||64.4%| +|0350|Intersection of Two Arrays II|[Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})|Easy| O(n)| O(n) ||51.9%| +|0354|Russian Doll Envelopes|[Go]({{< relref "/ChapterFour/0354.Russian-Doll-Envelopes.md" >}})|Hard||||36.1%| +|0367|Valid Perfect Square|[Go]({{< relref "/ChapterFour/0367.Valid-Perfect-Square.md" >}})|Easy||||42.0%| +|0378|Kth Smallest Element in a Sorted Matrix|[Go]({{< relref "/ChapterFour/0378.Kth-Smallest-Element-in-a-Sorted-Matrix.md" >}})|Medium||||55.8%| +|0392|Is Subsequence|[Go]({{< relref "/ChapterFour/0392.Is-Subsequence.md" >}})|Easy| O(n)| O(1)||49.5%| +|0410|Split Array Largest Sum|[Go]({{< relref "/ChapterFour/0410.Split-Array-Largest-Sum.md" >}})|Hard||||46.1%| +|0436|Find Right Interval|[Go]({{< relref "/ChapterFour/0436.Find-Right-Interval.md" >}})|Medium||||48.4%| +|0441|Arranging Coins|[Go]({{< relref "/ChapterFour/0441.Arranging-Coins.md" >}})|Easy||||42.3%| +|0454|4Sum II|[Go]({{< relref "/ChapterFour/0454.4Sum-II.md" >}})|Medium| O(n^2)| O(n) ||54.5%| +|0475|Heaters|[Go]({{< relref "/ChapterFour/0475.Heaters.md" >}})|Medium||||33.5%| +|0483|Smallest Good Base|[Go]({{< relref "/ChapterFour/0483.Smallest-Good-Base.md" >}})|Hard||||36.2%| +|0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})|Hard||||26.6%| +|0497|Random Point in Non-overlapping Rectangles|[Go]({{< relref "/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md" >}})|Medium||||39.1%| +|0528|Random Pick with Weight|[Go]({{< relref "/ChapterFour/0528.Random-Pick-with-Weight.md" >}})|Medium||||44.5%| +|0658|Find K Closest Elements|[Go]({{< relref "/ChapterFour/0658.Find-K-Closest-Elements.md" >}})|Medium||||41.7%| +|0668|Kth Smallest Number in Multiplication Table|[Go]({{< relref "/ChapterFour/0668.Kth-Smallest-Number-in-Multiplication-Table.md" >}})|Hard||||47.6%| +|0704|Binary Search|[Go]({{< relref "/ChapterFour/0704.Binary-Search.md" >}})|Easy||||54.0%| +|0710|Random Pick with Blacklist|[Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})|Hard| O(n)| O(n) ||32.7%| +|0718|Maximum Length of Repeated Subarray|[Go]({{< relref "/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md" >}})|Medium||||50.1%| +|0719|Find K-th Smallest Pair Distance|[Go]({{< relref "/ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md" >}})|Hard||||32.5%| +|0744|Find Smallest Letter Greater Than Target|[Go]({{< relref "/ChapterFour/0744.Find-Smallest-Letter-Greater-Than-Target.md" >}})|Easy||||45.6%| +|0778|Swim in Rising Water|[Go]({{< relref "/ChapterFour/0778.Swim-in-Rising-Water.md" >}})|Hard||||54.4%| +|0786|K-th Smallest Prime Fraction|[Go]({{< relref "/ChapterFour/0786.K-th-Smallest-Prime-Fraction.md" >}})|Hard||||41.7%| +|0793|Preimage Size of Factorial Zeroes Function|[Go]({{< relref "/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md" >}})|Hard||||40.6%| +|0852|Peak Index in a Mountain Array|[Go]({{< relref "/ChapterFour/0852.Peak-Index-in-a-Mountain-Array.md" >}})|Easy||||71.8%| +|0862|Shortest Subarray with Sum at Least K|[Go]({{< relref "/ChapterFour/0862.Shortest-Subarray-with-Sum-at-Least-K.md" >}})|Hard||||25.1%| +|0875|Koko Eating Bananas|[Go]({{< relref "/ChapterFour/0875.Koko-Eating-Bananas.md" >}})|Medium||||53.4%| +|0878|Nth Magical Number|[Go]({{< relref "/ChapterFour/0878.Nth-Magical-Number.md" >}})|Hard||||28.9%| +|0887|Super Egg Drop|[Go]({{< relref "/ChapterFour/0887.Super-Egg-Drop.md" >}})|Hard||||27.0%| +|0911|Online Election|[Go]({{< relref "/ChapterFour/0911.Online-Election.md" >}})|Medium||||51.2%| +|0927|Three Equal Parts|[Go]({{< relref "/ChapterFour/0927.Three-Equal-Parts.md" >}})|Hard||||34.5%| +|0981|Time Based Key-Value Store|[Go]({{< relref "/ChapterFour/0981.Time-Based-Key-Value-Store.md" >}})|Medium||||53.9%| +|1011|Capacity To Ship Packages Within D Days|[Go]({{< relref "/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md" >}})|Medium||||59.5%| +|1111|Maximum Nesting Depth of Two Valid Parentheses Strings|[Go]({{< relref "/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md" >}})|Medium||||72.4%| +|1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard||||39.5%| +|1201|Ugly Number III|[Go]({{< relref "/ChapterFour/1201.Ugly-Number-III.md" >}})|Medium||||26.3%| +|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| +|1283|Find the Smallest Divisor Given a Threshold|[Go]({{< relref "/ChapterFour/1283.Find-the-Smallest-Divisor-Given-a-Threshold.md" >}})|Medium||||49.2%| +|1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.3%| +|1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| +|1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.6%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + +--| diff --git a/website/content/ChapterTwo/Bit_Manipulation.md b/website/content/ChapterTwo/Bit_Manipulation.md index 4dbc8705..c86d5963 100644 --- a/website/content/ChapterTwo/Bit_Manipulation.md +++ b/website/content/ChapterTwo/Bit_Manipulation.md @@ -40,35 +40,37 @@ X & ~X = 0 ``` -| Title | Solution | Difficulty | Time | Space | 收藏 | -| ----- | :--------: | :----------: | :----: | :-----: |:-----: | -|78. Subsets | [Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})| Medium | O(n^2)| O(n)|❤️| -|136. Single Number | [Go]({{< relref "/ChapterFour/0136.Single-Number.md" >}})| Easy | O(n)| O(1)|| -|137. Single Number II | [Go]({{< relref "/ChapterFour/0137.Single-Number-II.md" >}})| Medium | O(n)| O(1)|❤️| -|169. Majority Element | [Go]({{< relref "/ChapterFour/0169.Majority-Element.md" >}})| Easy | O(n)| O(1)|❤️| -|187. Repeated DNA Sequences | [Go]({{< relref "/ChapterFour/0187.Repeated-DNA-Sequences.md" >}})| Medium | O(n)| O(1)|| -|190. Reverse Bits | [Go]({{< relref "/ChapterFour/0190.Reverse-Bits.md" >}})| Easy | O(n)| O(1)|❤️| -|191. Number of 1 Bits | [Go]({{< relref "/ChapterFour/0191.Number-of-1-Bits.md" >}})| Easy | O(n)| O(1)|| -|201. Bitwise AND of Numbers Range | [Go]({{< relref "/ChapterFour/0201.Bitwise-AND-of-Numbers-Range.md" >}})| Medium | O(n)| O(1)|❤️| -|231. Power of Two | [Go]({{< relref "/ChapterFour/0231.Power-of-Two.md" >}})| Easy | O(1)| O(1)|| -|260. Single Number III | [Go]({{< relref "/ChapterFour/0260.Single-Number-III.md" >}})| Medium | O(n)| O(1)|❤️| -|268. Missing Number | [Go]({{< relref "/ChapterFour/0268.Missing-Number.md" >}})| Easy | O(n)| O(1)|| -|318. Maximum Product of Word Lengths | [Go]({{< relref "/ChapterFour/0318.Maximum-Product-of-Word-Lengths.md" >}})| Medium | O(n)| O(1)|| -|338. Counting Bits | [Go]({{< relref "/ChapterFour/0338.Counting-Bits.md" >}})| Medium | O(n)| O(n)|| -|342. Power of Four | [Go]({{< relref "/ChapterFour/0342.Power-of-Four.md" >}})| Easy | O(n)| O(1)|| -|371. Sum of Two Integers | [Go]({{< relref "/ChapterFour/0371.Sum-of-Two-Integers.md" >}})| Easy | O(n)| O(1)|| -|389. Find the Difference | [Go]({{< relref "/ChapterFour/0389.Find-the-Difference.md" >}})| Easy | O(n)| O(1)|| -|393. UTF-8 Validation | [Go]({{< relref "/ChapterFour/0393.UTF-8-Validation.md" >}})| Medium | O(n)| O(1)|| -|397. Integer Replacement | [Go]({{< relref "/ChapterFour/0397.Integer-Replacement.md" >}})| Medium | O(n)| O(1)|| -|401. Binary Watch | [Go]({{< relref "/ChapterFour/0401.Binary-Watch.md" >}})| Easy | O(1)| O(1)|| -|405. Convert a Number to Hexadecimal | [Go]({{< relref "/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md" >}})| Easy | O(n)| O(1)|| -|421. Maximum XOR of Two Numbers in an Array | [Go]({{< relref "/ChapterFour/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md" >}})| Medium | O(n)| O(1)|❤️| -|461. Hamming Distance | [Go]({{< relref "/ChapterFour/0461.Hamming-Distance.md" >}})| Easy | O(n)| O(1)|| -|476. Number Complement | [Go]({{< relref "/ChapterFour/0476.Number-Complement.md" >}})| Easy | O(n)| O(1)|| -|477. Total Hamming Distance | [Go]({{< relref "/ChapterFour/0477.Total-Hamming-Distance.md" >}})| Medium | O(n)| O(1)|| -|693. Binary Number with Alternating Bits | [Go]({{< relref "/ChapterFour/0693.Binary-Number-with-Alternating-Bits.md" >}})| Easy | O(n)| O(1)|❤️| -|756. Pyramid Transition Matrix | [Go]({{< relref "/ChapterFour/0756.Pyramid-Transition-Matrix.md" >}})| Medium | O(n log n)| O(n)|| -|762. Prime Number of Set Bits in Binary Representation | [Go]({{< relref "/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md" >}})| Easy | O(n)| O(1)|| -|784. Letter Case Permutation | [Go]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}})| Easy | O(n)| O(1)|| -|898. Bitwise ORs of Subarrays | [Go]({{< relref "/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md" >}})| Medium | O(n)| O(1)|| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0078|Subsets|[Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|64.5%| +|0136|Single Number|[Go]({{< relref "/ChapterFour/0136.Single-Number.md" >}})|Easy| O(n)| O(1)||66.4%| +|0137|Single Number II|[Go]({{< relref "/ChapterFour/0137.Single-Number-II.md" >}})|Medium| O(n)| O(1)|❤️|53.5%| +|0169|Majority Element|[Go]({{< relref "/ChapterFour/0169.Majority-Element.md" >}})|Easy| O(n)| O(1)|❤️|59.8%| +|0187|Repeated DNA Sequences|[Go]({{< relref "/ChapterFour/0187.Repeated-DNA-Sequences.md" >}})|Medium| O(n)| O(1)||41.2%| +|0190|Reverse Bits|[Go]({{< relref "/ChapterFour/0190.Reverse-Bits.md" >}})|Easy| O(n)| O(1)|❤️|41.6%| +|0191|Number of 1 Bits|[Go]({{< relref "/ChapterFour/0191.Number-of-1-Bits.md" >}})|Easy| O(n)| O(1)||51.9%| +|0201|Bitwise AND of Numbers Range|[Go]({{< relref "/ChapterFour/0201.Bitwise-AND-of-Numbers-Range.md" >}})|Medium| O(n)| O(1)|❤️|39.6%| +|0231|Power of Two|[Go]({{< relref "/ChapterFour/0231.Power-of-Two.md" >}})|Easy| O(1)| O(1)||43.8%| +|0260|Single Number III|[Go]({{< relref "/ChapterFour/0260.Single-Number-III.md" >}})|Medium| O(n)| O(1)|❤️|65.2%| +|0268|Missing Number|[Go]({{< relref "/ChapterFour/0268.Missing-Number.md" >}})|Easy| O(n)| O(1)||53.4%| +|0318|Maximum Product of Word Lengths|[Go]({{< relref "/ChapterFour/0318.Maximum-Product-of-Word-Lengths.md" >}})|Medium| O(n)| O(1)||52.0%| +|0338|Counting Bits|[Go]({{< relref "/ChapterFour/0338.Counting-Bits.md" >}})|Medium| O(n)| O(n)||70.2%| +|0342|Power of Four|[Go]({{< relref "/ChapterFour/0342.Power-of-Four.md" >}})|Easy| O(n)| O(1)||41.6%| +|0371|Sum of Two Integers|[Go]({{< relref "/ChapterFour/0371.Sum-of-Two-Integers.md" >}})|Medium| O(n)| O(1)||50.6%| +|0389|Find the Difference|[Go]({{< relref "/ChapterFour/0389.Find-the-Difference.md" >}})|Easy| O(n)| O(1)||57.7%| +|0393|UTF-8 Validation|[Go]({{< relref "/ChapterFour/0393.UTF-8-Validation.md" >}})|Medium| O(n)| O(1)||37.9%| +|0397|Integer Replacement|[Go]({{< relref "/ChapterFour/0397.Integer-Replacement.md" >}})|Medium| O(n)| O(1)||33.4%| +|0401|Binary Watch|[Go]({{< relref "/ChapterFour/0401.Binary-Watch.md" >}})|Easy| O(1)| O(1)||48.3%| +|0405|Convert a Number to Hexadecimal|[Go]({{< relref "/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md" >}})|Easy| O(n)| O(1)||44.3%| +|0421|Maximum XOR of Two Numbers in an Array|[Go]({{< relref "/ChapterFour/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md" >}})|Medium| O(n)| O(1)|❤️|53.9%| +|0461|Hamming Distance|[Go]({{< relref "/ChapterFour/0461.Hamming-Distance.md" >}})|Easy| O(n)| O(1)||73.1%| +|0476|Number Complement|[Go]({{< relref "/ChapterFour/0476.Number-Complement.md" >}})|Easy| O(n)| O(1)||65.1%| +|0477|Total Hamming Distance|[Go]({{< relref "/ChapterFour/0477.Total-Hamming-Distance.md" >}})|Medium| O(n)| O(1)||50.6%| +|0693|Binary Number with Alternating Bits|[Go]({{< relref "/ChapterFour/0693.Binary-Number-with-Alternating-Bits.md" >}})|Easy| O(n)| O(1)|❤️|59.7%| +|0756|Pyramid Transition Matrix|[Go]({{< relref "/ChapterFour/0756.Pyramid-Transition-Matrix.md" >}})|Medium| O(n log n)| O(n)||55.5%| +|0762|Prime Number of Set Bits in Binary Representation|[Go]({{< relref "/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md" >}})|Easy| O(n)| O(1)||64.1%| +|0784|Letter Case Permutation|[Go]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}})|Medium| O(n)| O(1)||66.2%| +|0898|Bitwise ORs of Subarrays|[Go]({{< relref "/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md" >}})|Medium| O(n)| O(1)||34.0%| +|1290|Convert Binary Number in a Linked List to Integer|[Go]({{< relref "/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md" >}})|Easy||||81.6%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Breadth_First_Search.md b/website/content/ChapterTwo/Breadth_First_Search.md index f5ff7c73..eec61d7d 100644 --- a/website/content/ChapterTwo/Breadth_First_Search.md +++ b/website/content/ChapterTwo/Breadth_First_Search.md @@ -5,20 +5,31 @@ type: docs # Breadth First Search -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|101. Symmetric Tree | [Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})| Easy | O(n)| O(1)|| -|102. Binary Tree Level Order Traversal | [Go]({{< relref "/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md" >}})| Medium | O(n)| O(1)|| -|103. Binary Tree Zigzag Level Order Traversal | [Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})| Medium | O(n)| O(n)|| -|107. Binary Tree Level Order Traversal II | [Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})| Easy | O(n)| O(1)|| -|111. Minimum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| -|126. Word Ladder II | [Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})| Hard | O(n)| O(n^2)|❤️| -|127. Word Ladder | [Go]({{< relref "/ChapterFour/0127.Word-Ladder.md" >}})| Medium | O(n)| O(n)|| -|199. Binary Tree Right Side View | [Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})| Medium | O(n)| O(1)|| -|200. Number of Islands | [Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})| Medium | O(n^2)| O(n^2)|| -|207. Course Schedule | [Go]({{< relref "/ChapterFour/0207.Course-Schedule.md" >}})| Medium | O(n^2)| O(n^2)|| -|210. Course Schedule II | [Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})| Medium | O(n^2)| O(n^2)|| -|515. Find Largest Value in Each Tree Row | [Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})| Medium | O(n)| O(n)|| -|542. 01 Matrix | [Go]({{< relref "/ChapterFour/0542.01-Matrix.md" >}})| Medium | O(n)| O(1)|| -|993. Cousins in Binary Tree | [Go]({{< relref "/ChapterFour/0993.Cousins-in-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0101|Symmetric Tree|[Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})|Easy| O(n)| O(1)||47.9%| +|0102|Binary Tree Level Order Traversal|[Go]({{< relref "/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md" >}})|Medium| O(n)| O(1)||56.2%| +|0103|Binary Tree Zigzag Level Order Traversal|[Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})|Medium| O(n)| O(n)||49.8%| +|0107|Binary Tree Level Order Traversal II|[Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})|Easy| O(n)| O(1)||54.8%| +|0111|Minimum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||39.2%| +|0126|Word Ladder II|[Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})|Hard| O(n)| O(n^2)|❤️|23.4%| +|0127|Word Ladder|[Go]({{< relref "/ChapterFour/0127.Word-Ladder.md" >}})|Hard| O(n)| O(n)||31.5%| +|0130|Surrounded Regions|[Go]({{< relref "/ChapterFour/0130.Surrounded-Regions.md" >}})|Medium||||29.2%| +|0199|Binary Tree Right Side View|[Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})|Medium| O(n)| O(1)||55.7%| +|0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})|Medium| O(n^2)| O(n^2)||48.6%| +|0207|Course Schedule|[Go]({{< relref "/ChapterFour/0207.Course-Schedule.md" >}})|Medium| O(n^2)| O(n^2)||44.2%| +|0210|Course Schedule II|[Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})|Medium| O(n^2)| O(n^2)||42.2%| +|0513|Find Bottom Left Tree Value|[Go]({{< relref "/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md" >}})|Medium||||62.3%| +|0515|Find Largest Value in Each Tree Row|[Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})|Medium| O(n)| O(n)||62.0%| +|0529|Minesweeper|[Go]({{< relref "/ChapterFour/0529.Minesweeper.md" >}})|Medium||||60.7%| +|0542|01 Matrix|[Go]({{< relref "/ChapterFour/0542.01-Matrix.md" >}})|Medium| O(n)| O(1)||40.6%| +|0785|Is Graph Bipartite?|[Go]({{< relref "/ChapterFour/0785.Is-Graph-Bipartite.md" >}})|Medium||||48.2%| +|0815|Bus Routes|[Go]({{< relref "/ChapterFour/0815.Bus-Routes.md" >}})|Hard||||43.2%| +|0863|All Nodes Distance K in Binary Tree|[Go]({{< relref "/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}})|Medium||||57.5%| +|0864|Shortest Path to Get All Keys|[Go]({{< relref "/ChapterFour/0864.Shortest-Path-to-Get-All-Keys.md" >}})|Hard||||41.5%| +|0993|Cousins in Binary Tree|[Go]({{< relref "/ChapterFour/0993.Cousins-in-Binary-Tree.md" >}})|Easy| O(n)| O(1)||52.2%| +|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.6%| +|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.4%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + diff --git a/website/content/ChapterTwo/Depth_First_Search.md b/website/content/ChapterTwo/Depth_First_Search.md index 41d8ac37..78a8554c 100644 --- a/website/content/ChapterTwo/Depth_First_Search.md +++ b/website/content/ChapterTwo/Depth_First_Search.md @@ -5,29 +5,78 @@ type: docs # Depth First Search -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|98. Validate Binary Search Tree | [Go]({{< relref "/ChapterFour/0098.Validate-Binary-Search-Tree.md" >}})| Medium | O(n)| O(1)|| -|99. Recover Binary Search Tree | [Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}})| Hard | O(n)| O(1)|| -|100. Same Tree | [Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}})| Easy | O(n)| O(1)|| -|101. Symmetric Tree | [Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})| Easy | O(n)| O(1)|| -|104. Maximum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| -|108. Convert Sorted Array to Binary Search Tree | [Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})| Easy | O(n)| O(1)|| -|109. Convert Sorted List to Binary Search Tree | [Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})| Medium | O(log n)| O(n)|| -|110. Balanced Binary Tree | [Go]({{< relref "/ChapterFour/0110.Balanced-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| -|111. Minimum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| -|112. Path Sum | [Go]({{< relref "/ChapterFour/0112.Path-Sum.md" >}})| Easy | O(n)| O(1)|| -|113. Path Sum II | [Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}})| Medium | O(n)| O(1)|| -|114. Flatten Binary Tree to Linked List | [Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})| Medium | O(n)| O(1)|| -|124. Binary Tree Maximum Path Sum | [Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}})| Hard | O(n)| O(1)|| -|129. Sum Root to Leaf Numbers | [Go]({{< relref "/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md" >}})| Medium | O(n)| O(1)|| -|199. Binary Tree Right Side View | [Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})| Medium | O(n)| O(1)|| -|200. Number of Islands | [Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})| Medium | O(n^2)| O(n^2)|| -|207. Course Schedule | [Go]({{< relref "/ChapterFour/0207.Course-Schedule.md" >}})| Medium | O(n^2)| O(n^2)|| -|210. Course Schedule II | [Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})| Medium | O(n^2)| O(n^2)|| -|257. Binary Tree Paths | [Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})| Easy | O(n)| O(1)|| -|394. Decode String | [Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})| Medium | O(n)| O(n)|| -|515. Find Largest Value in Each Tree Row | [Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})| Medium | O(n)| O(n)|| -|542. 01 Matrix | [Go]({{< relref "/ChapterFour/0542.01-Matrix.md" >}})| Medium | O(n)| O(1)|| -|980. Unique Paths III | [Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})| Hard | O(n log n)| O(n)|| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium||||48.6%| +|0098|Validate Binary Search Tree|[Go]({{< relref "/ChapterFour/0098.Validate-Binary-Search-Tree.md" >}})|Medium| O(n)| O(1)||28.6%| +|0099|Recover Binary Search Tree|[Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}})|Hard| O(n)| O(1)||42.1%| +|0100|Same Tree|[Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}})|Easy| O(n)| O(1)||54.0%| +|0101|Symmetric Tree|[Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})|Easy| O(n)| O(1)||47.9%| +|0104|Maximum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||67.7%| +|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| +|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.1%| +|0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||59.9%| +|0109|Convert Sorted List to Binary Search Tree|[Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})|Medium| O(log n)| O(n)||49.8%| +|0110|Balanced Binary Tree|[Go]({{< relref "/ChapterFour/0110.Balanced-Binary-Tree.md" >}})|Easy| O(n)| O(1)||44.6%| +|0111|Minimum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||39.2%| +|0112|Path Sum|[Go]({{< relref "/ChapterFour/0112.Path-Sum.md" >}})|Easy| O(n)| O(1)||42.1%| +|0113|Path Sum II|[Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}})|Medium| O(n)| O(1)||48.6%| +|0114|Flatten Binary Tree to Linked List|[Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})|Medium| O(n)| O(1)||51.4%| +|0124|Binary Tree Maximum Path Sum|[Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}})|Hard| O(n)| O(1)||35.2%| +|0129|Sum Root to Leaf Numbers|[Go]({{< relref "/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md" >}})|Medium| O(n)| O(1)||50.6%| +|0130|Surrounded Regions|[Go]({{< relref "/ChapterFour/0130.Surrounded-Regions.md" >}})|Medium||||29.2%| +|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})|Medium||||51.3%| +|0199|Binary Tree Right Side View|[Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})|Medium| O(n)| O(1)||55.7%| +|0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})|Medium| O(n^2)| O(n^2)||48.6%| +|0207|Course Schedule|[Go]({{< relref "/ChapterFour/0207.Course-Schedule.md" >}})|Medium| O(n^2)| O(n^2)||44.2%| +|0210|Course Schedule II|[Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})|Medium| O(n^2)| O(n^2)||42.2%| +|0211|Design Add and Search Words Data Structure|[Go]({{< relref "/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md" >}})|Medium||||39.8%| +|0257|Binary Tree Paths|[Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})|Easy| O(n)| O(1)||53.2%| +|0329|Longest Increasing Path in a Matrix|[Go]({{< relref "/ChapterFour/0329.Longest-Increasing-Path-in-a-Matrix.md" >}})|Hard||||44.4%| +|0337|House Robber III|[Go]({{< relref "/ChapterFour/0337.House-Robber-III.md" >}})|Medium||||51.7%| +|0394|Decode String|[Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})|Medium| O(n)| O(n)||52.3%| +|0491|Increasing Subsequences|[Go]({{< relref "/ChapterFour/0491.Increasing-Subsequences.md" >}})|Medium||||47.3%| +|0494|Target Sum|[Go]({{< relref "/ChapterFour/0494.Target-Sum.md" >}})|Medium||||45.9%| +|0513|Find Bottom Left Tree Value|[Go]({{< relref "/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md" >}})|Medium||||62.3%| +|0515|Find Largest Value in Each Tree Row|[Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})|Medium| O(n)| O(n)||62.0%| +|0526|Beautiful Arrangement|[Go]({{< relref "/ChapterFour/0526.Beautiful-Arrangement.md" >}})|Medium||||61.7%| +|0529|Minesweeper|[Go]({{< relref "/ChapterFour/0529.Minesweeper.md" >}})|Medium||||60.7%| +|0542|01 Matrix|[Go]({{< relref "/ChapterFour/0542.01-Matrix.md" >}})|Medium| O(n)| O(1)||40.6%| +|0547|Number of Provinces|[Go]({{< relref "/ChapterFour/0547.Number-of-Provinces.md" >}})|Medium||||60.1%| +|0563|Binary Tree Tilt|[Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}})|Easy||||52.6%| +|0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.5%| +|0685|Redundant Connection II|[Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})|Hard||||32.9%| +|0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| +|0721|Accounts Merge|[Go]({{< relref "/ChapterFour/0721.Accounts-Merge.md" >}})|Medium||||51.2%| +|0733|Flood Fill|[Go]({{< relref "/ChapterFour/0733.Flood-Fill.md" >}})|Easy||||55.8%| +|0753|Cracking the Safe|[Go]({{< relref "/ChapterFour/0753.Cracking-the-Safe.md" >}})|Hard||||52.0%| +|0756|Pyramid Transition Matrix|[Go]({{< relref "/ChapterFour/0756.Pyramid-Transition-Matrix.md" >}})|Medium||||55.5%| +|0778|Swim in Rising Water|[Go]({{< relref "/ChapterFour/0778.Swim-in-Rising-Water.md" >}})|Hard||||54.4%| +|0785|Is Graph Bipartite?|[Go]({{< relref "/ChapterFour/0785.Is-Graph-Bipartite.md" >}})|Medium||||48.2%| +|0802|Find Eventual Safe States|[Go]({{< relref "/ChapterFour/0802.Find-Eventual-Safe-States.md" >}})|Medium||||49.7%| +|0834|Sum of Distances in Tree|[Go]({{< relref "/ChapterFour/0834.Sum-of-Distances-in-Tree.md" >}})|Hard||||45.5%| +|0839|Similar String Groups|[Go]({{< relref "/ChapterFour/0839.Similar-String-Groups.md" >}})|Hard||||40.0%| +|0841|Keys and Rooms|[Go]({{< relref "/ChapterFour/0841.Keys-and-Rooms.md" >}})|Medium||||65.2%| +|0851|Loud and Rich|[Go]({{< relref "/ChapterFour/0851.Loud-and-Rich.md" >}})|Medium||||52.4%| +|0863|All Nodes Distance K in Binary Tree|[Go]({{< relref "/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}})|Medium||||57.5%| +|0872|Leaf-Similar Trees|[Go]({{< relref "/ChapterFour/0872.Leaf-Similar-Trees.md" >}})|Easy||||64.5%| +|0897|Increasing Order Search Tree|[Go]({{< relref "/ChapterFour/0897.Increasing-Order-Search-Tree.md" >}})|Easy||||74.3%| +|0924|Minimize Malware Spread|[Go]({{< relref "/ChapterFour/0924.Minimize-Malware-Spread.md" >}})|Hard||||41.8%| +|0928|Minimize Malware Spread II|[Go]({{< relref "/ChapterFour/0928.Minimize-Malware-Spread-II.md" >}})|Hard||||41.2%| +|0947|Most Stones Removed with Same Row or Column|[Go]({{< relref "/ChapterFour/0947.Most-Stones-Removed-with-Same-Row-or-Column.md" >}})|Medium||||55.4%| +|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0959.Regions-Cut-By-Slashes.md" >}})|Medium||||66.8%| +|0968|Binary Tree Cameras|[Go]({{< relref "/ChapterFour/0968.Binary-Tree-Cameras.md" >}})|Hard||||38.5%| +|0979|Distribute Coins in Binary Tree|[Go]({{< relref "/ChapterFour/0979.Distribute-Coins-in-Binary-Tree.md" >}})|Medium||||69.5%| +|0980|Unique Paths III|[Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})|Hard| O(n log n)| O(n)||77.1%| +|1020|Number of Enclaves|[Go]({{< relref "/ChapterFour/1020.Number-of-Enclaves.md" >}})|Medium||||58.7%| +|1026|Maximum Difference Between Node and Ancestor|[Go]({{< relref "/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}})|Medium||||69.1%| +|1028|Recover a Tree From Preorder Traversal|[Go]({{< relref "/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md" >}})|Hard||||70.7%| +|1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||67.5%| +|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||67.8%| +|1145|Binary Tree Coloring Game|[Go]({{< relref "/ChapterFour/1145.Binary-Tree-Coloring-Game.md" >}})|Medium||||51.4%| +|1254|Number of Closed Islands|[Go]({{< relref "/ChapterFour/1254.Number-of-Closed-Islands.md" >}})|Medium||||61.5%| +|1302|Deepest Leaves Sum|[Go]({{< relref "/ChapterFour/1302.Deepest-Leaves-Sum.md" >}})|Medium||||84.1%| +|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.6%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Dynamic_Programming.md b/website/content/ChapterTwo/Dynamic_Programming.md index 2baddaa9..ccfc9c9e 100644 --- a/website/content/ChapterTwo/Dynamic_Programming.md +++ b/website/content/ChapterTwo/Dynamic_Programming.md @@ -5,32 +5,57 @@ type: docs # Dynamic Programming -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|53. Maximum Subarray| [Go]({{< relref "/ChapterFour/0053.Maximum-Subarray.md" >}})| Easy | O(n)| O(n)|| -|62. Unique Paths | [Go]({{< relref "/ChapterFour/0062.Unique-Paths.md" >}})| Medium | O(n^2)| O(n^2)|| -|63. Unique Paths II | [Go]({{< relref "/ChapterFour/0063.Unique-Paths-II.md" >}})| Medium | O(n^2)| O(n^2)|| -|64. Minimum Path Sum | [Go]({{< relref "/ChapterFour/0064.Minimum-Path-Sum.md" >}})| Medium | O(n^2)| O(n^2)|| -|70. Climbing Stairs | [Go]({{< relref "/ChapterFour/0070.Climbing-Stairs.md" >}})| Easy | O(n)| O(n)|| -|91. Decode Ways | [Go]({{< relref "/ChapterFour/0091.Decode-Ways.md" >}})| Medium | O(n)| O(n)|| -|96. Unique Binary Search Trees | [Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}})| Medium | O(n)| O(n)|| -|120. Triangle | [Go]({{< relref "/ChapterFour/0120.Triangle.md" >}})| Medium | O(n^2)| O(n)|| -|121. Best Time to Buy and Sell Stock | [Go]({{< relref "/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})| Easy | O(n)| O(1)|| -|152. Maximum Product Subarray | [Go]({{< relref "/ChapterFour/0152.Maximum-Product-Subarray.md" >}})| Medium | O(n)| O(1)|| -|198. House Robber | [Go]({{< relref "/ChapterFour/0198.House-Robber.md" >}})| Easy | O(n)| O(n)|| -|213. House Robber II | [Go]({{< relref "/ChapterFour/0213.House-Robber-II.md" >}})| Medium | O(n)| O(n)|| -|300. Longest Increasing Subsequence | [Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})| Medium | O(n log n)| O(n)|| -|309. Best Time to Buy and Sell Stock with Cooldown | [Go]({{< relref "/ChapterFour/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md" >}})| Medium | O(n)| O(n)|| -|322. Coin Change | [Go]({{< relref "/ChapterFour/0322.Coin-Change.md" >}})| Medium | O(n)| O(n)|| -|338. Counting Bits | [Go]({{< relref "/ChapterFour/0338.Counting-Bits.md" >}})| Medium | O(n)| O(n)|| -|343. Integer Break | [Go]({{< relref "/ChapterFour/0343.Integer-Break.md" >}})| Medium | O(n^2)| O(n)|| -|357. Count Numbers with Unique Digits | [Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})| Medium | O(1)| O(1)|| -|392. Is Subsequence | [Go]({{< relref "/ChapterFour/0392.Is-Subsequence.md" >}})| Medium | O(n)| O(1)|| -|416. Partition Equal Subset Sum | [Go]({{< relref "/ChapterFour/0416.Partition-Equal-Subset-Sum.md" >}})| Medium | O(n^2)| O(n)|| -|714. Best Time to Buy and Sell Stock with Transaction Fee | [Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})| Medium | O(n)| O(1)|| -|746. Min Cost Climbing Stairs | [Go]({{< relref "/ChapterFour/0746.Min-Cost-Climbing-Stairs.md" >}})| Easy | O(n)| O(1)|| -|838. Push Dominoes | [Go]({{< relref "/ChapterFour/0838.Push-Dominoes.md" >}})| Medium | O(n)| O(n)|| -|1025. Divisor Game | [Go]({{< relref "/ChapterFour/1025.Divisor-Game.md" >}})| Easy | O(1)| O(1)|| -|891. Sum of Subsequence Widths | [Go]({{< relref "/ChapterFour/0891.Sum-of-Subsequence-Widths.md" >}})| Hard | O(n log n)| O(1)|| -|942. DI String Match | [Go]({{< relref "/ChapterFour/0942.DI-String-Match.md" >}})| Easy | O(n)| O(1)|| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard||||50.7%| +|0053|Maximum Subarray|[Go]({{< relref "/ChapterFour/0053.Maximum-Subarray.md" >}})|Easy| O(n)| O(n)||47.5%| +|0062|Unique Paths|[Go]({{< relref "/ChapterFour/0062.Unique-Paths.md" >}})|Medium| O(n^2)| O(n^2)||55.6%| +|0063|Unique Paths II|[Go]({{< relref "/ChapterFour/0063.Unique-Paths-II.md" >}})|Medium| O(n^2)| O(n^2)||35.1%| +|0064|Minimum Path Sum|[Go]({{< relref "/ChapterFour/0064.Minimum-Path-Sum.md" >}})|Medium| O(n^2)| O(n^2)||55.9%| +|0070|Climbing Stairs|[Go]({{< relref "/ChapterFour/0070.Climbing-Stairs.md" >}})|Easy| O(n)| O(n)||48.5%| +|0091|Decode Ways|[Go]({{< relref "/ChapterFour/0091.Decode-Ways.md" >}})|Medium| O(n)| O(n)||26.2%| +|0095|Unique Binary Search Trees II|[Go]({{< relref "/ChapterFour/0095.Unique-Binary-Search-Trees-II.md" >}})|Medium||||42.1%| +|0096|Unique Binary Search Trees|[Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}})|Medium| O(n)| O(n)||54.1%| +|0120|Triangle|[Go]({{< relref "/ChapterFour/0120.Triangle.md" >}})|Medium| O(n^2)| O(n)||45.5%| +|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||51.2%| +|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})|Medium||||51.3%| +|0152|Maximum Product Subarray|[Go]({{< relref "/ChapterFour/0152.Maximum-Product-Subarray.md" >}})|Medium| O(n)| O(1)||32.6%| +|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0174.Dungeon-Game.md" >}})|Hard||||33.1%| +|0198|House Robber|[Go]({{< relref "/ChapterFour/0198.House-Robber.md" >}})|Medium| O(n)| O(n)||42.7%| +|0213|House Robber II|[Go]({{< relref "/ChapterFour/0213.House-Robber-II.md" >}})|Medium| O(n)| O(n)||37.4%| +|0300|Longest Increasing Subsequence|[Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})|Medium| O(n log n)| O(n)||43.6%| +|0303|Range Sum Query - Immutable|[Go]({{< relref "/ChapterFour/0303.Range-Sum-Query---Immutable.md" >}})|Easy||||47.0%| +|0309|Best Time to Buy and Sell Stock with Cooldown|[Go]({{< relref "/ChapterFour/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md" >}})|Medium| O(n)| O(n)||48.0%| +|0322|Coin Change|[Go]({{< relref "/ChapterFour/0322.Coin-Change.md" >}})|Medium| O(n)| O(n)||36.9%| +|0337|House Robber III|[Go]({{< relref "/ChapterFour/0337.House-Robber-III.md" >}})|Medium||||51.7%| +|0338|Counting Bits|[Go]({{< relref "/ChapterFour/0338.Counting-Bits.md" >}})|Medium| O(n)| O(n)||70.2%| +|0343|Integer Break|[Go]({{< relref "/ChapterFour/0343.Integer-Break.md" >}})|Medium| O(n^2)| O(n)||51.0%| +|0354|Russian Doll Envelopes|[Go]({{< relref "/ChapterFour/0354.Russian-Doll-Envelopes.md" >}})|Hard||||36.1%| +|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.7%| +|0392|Is Subsequence|[Go]({{< relref "/ChapterFour/0392.Is-Subsequence.md" >}})|Easy| O(n)| O(1)||49.5%| +|0410|Split Array Largest Sum|[Go]({{< relref "/ChapterFour/0410.Split-Array-Largest-Sum.md" >}})|Hard||||46.1%| +|0416|Partition Equal Subset Sum|[Go]({{< relref "/ChapterFour/0416.Partition-Equal-Subset-Sum.md" >}})|Medium| O(n^2)| O(n)||44.7%| +|0474|Ones and Zeroes|[Go]({{< relref "/ChapterFour/0474.Ones-and-Zeroes.md" >}})|Medium||||43.4%| +|0494|Target Sum|[Go]({{< relref "/ChapterFour/0494.Target-Sum.md" >}})|Medium||||45.9%| +|0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.5%| +|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.8%| +|0718|Maximum Length of Repeated Subarray|[Go]({{< relref "/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md" >}})|Medium||||50.1%| +|0746|Min Cost Climbing Stairs|[Go]({{< relref "/ChapterFour/0746.Min-Cost-Climbing-Stairs.md" >}})|Easy| O(n)| O(1)||50.9%| +|0838|Push Dominoes|[Go]({{< relref "/ChapterFour/0838.Push-Dominoes.md" >}})|Medium| O(n)| O(n)||49.7%| +|0887|Super Egg Drop|[Go]({{< relref "/ChapterFour/0887.Super-Egg-Drop.md" >}})|Hard||||27.0%| +|0898|Bitwise ORs of Subarrays|[Go]({{< relref "/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md" >}})|Medium||||34.0%| +|0920|Number of Music Playlists|[Go]({{< relref "/ChapterFour/0920.Number-of-Music-Playlists.md" >}})|Hard||||47.6%| +|0968|Binary Tree Cameras|[Go]({{< relref "/ChapterFour/0968.Binary-Tree-Cameras.md" >}})|Hard||||38.5%| +|0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0978.Longest-Turbulent-Subarray.md" >}})|Medium||||46.6%| +|1025|Divisor Game|[Go]({{< relref "/ChapterFour/1025.Divisor-Game.md" >}})|Easy| O(1)| O(1)||66.1%| +|1049|Last Stone Weight II|[Go]({{< relref "/ChapterFour/1049.Last-Stone-Weight-II.md" >}})|Medium||||45.0%| +|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.4%| +|1105|Filling Bookcase Shelves|[Go]({{< relref "/ChapterFour/1105.Filling-Bookcase-Shelves.md" >}})|Medium||||57.7%| +|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| +|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.4%| +|1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.7%| +|1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.2%| +|1664|Ways to Make a Fair Array|[Go]({{< relref "/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md" >}})|Medium||||60.6%| +|1690|Stone Game VII|[Go]({{< relref "/ChapterFour/1690.Stone-Game-VII.md" >}})|Medium||||46.5%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Hash_Table.md b/website/content/ChapterTwo/Hash_Table.md index ae4d2386..6424f1b3 100644 --- a/website/content/ChapterTwo/Hash_Table.md +++ b/website/content/ChapterTwo/Hash_Table.md @@ -5,39 +5,74 @@ type: docs # Hash Table -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|1. Two Sum | [Go]({{< relref "/ChapterFour/0001.Two-Sum.md" >}})| Easy | O(n)| O(n)|| -|3. Longest Substring Without Repeating Characters | [Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})| Medium | O(n)| O(1)|❤️| -|18. 4Sum | [Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})| Medium | O(n^3)| O(n^2)|❤️| -|30. Substring with Concatenation of All Words | [Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})| Hard | O(n)| O(n)|❤️| -|36. Valid Sudoku | [Go]({{< relref "/ChapterFour/0036.Valid-Sudoku.md" >}})| Medium | O(n^2)| O(n^2)|| -|37. Sudoku Solver | [Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})| Hard | O(n^2)| O(n^2)|❤️| -|49. Group Anagrams | [Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})| Medium | O(n log n)| O(n)|| -|76. Minimum Window Substring | [Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})| Hard | O(n)| O(n)|❤️| -|94. Binary Tree Inorder Traversal | [Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})| Medium | O(n)| O(1)|| -|138. Copy List with Random Pointer | [Go]()| Medium | O(n)| O(1)|| -|202. Happy Number | [Go]({{< relref "/ChapterFour/0202.Happy-Number.md" >}})| Easy | O(log n)| O(1)|| -|205. Isomorphic Strings | [Go]({{< relref "/ChapterFour/0205.Isomorphic-Strings.md" >}})| Easy | O(log n)| O(n)|| -|217. Contains Duplicate | [Go]({{< relref "/ChapterFour/0217.Contains-Duplicate.md" >}})| Easy | O(n)| O(n)|| -|219. Contains Duplicate II | [Go]({{< relref "/ChapterFour/0219.Contains-Duplicate-II.md" >}})| Easy | O(n)| O(n)|| -|242. Valid Anagram | [Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})| Easy | O(n)| O(n) || -|274. H-Index | [Go]({{< relref "/ChapterFour/0274.H-Index.md" >}})| Medium | O(n)| O(n) || -|290. Word Pattern | [Go]({{< relref "/ChapterFour/0290.Word-Pattern.md" >}})| Easy | O(n)| O(n) || -|347. Top K Frequent Elements | [Go]({{< relref "/ChapterFour/0347.Top-K-Frequent-Elements.md" >}})| Medium | O(n)| O(n) || -|349. Intersection of Two Arrays | [Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})| Easy | O(n)| O(n) || -|350. Intersection of Two Arrays II | [Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})| Easy | O(n)| O(n) || -|438. Find All Anagrams in a String | [Go]({{< relref "/ChapterFour/0438.Find-All-Anagrams-in-a-String.md" >}})| Easy | O(n)| O(1) || -|447. Number of Boomerangs | [Go]({{< relref "/ChapterFour/0447.Number-of-Boomerangs.md" >}})| Easy | O(n)| O(1) || -|451. Sort Characters By Frequency | [Go]({{< relref "/ChapterFour/0451.Sort-Characters-By-Frequency.md" >}})| Medium | O(n log n)| O(1) || -|454. 4Sum II | [Go]({{< relref "/ChapterFour/0454.4Sum-II.md" >}})| Medium | O(n^2)| O(n) || -|648. Replace Words | [Go]({{< relref "/ChapterFour/0648.Replace-Words.md" >}})| Medium | O(n)| O(n) || -|676. Implement Magic Dictionary | [Go]({{< relref "/ChapterFour/0676.Implement-Magic-Dictionary.md" >}})| Medium | O(n)| O(n) || -|720. Longest Word in Dictionary | [Go]({{< relref "/ChapterFour/0720.Longest-Word-in-Dictionary.md" >}})| Easy | O(n)| O(n) || -|726. Number of Atoms | [Go]({{< relref "/ChapterFour/0726.Number-of-Atoms.md" >}})| Hard | O(n)| O(n) |❤️| -|739. Daily Temperatures | [Go]({{< relref "/ChapterFour/0739.Daily-Temperatures.md" >}})| Medium | O(n)| O(n) || -|710. Random Pick with Blacklist | [Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})| Hard | O(n)| O(n) || -|895. Maximum Frequency Stack | [Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})| Hard | O(n)| O(n) || -|930. Binary Subarrays With Sum | [Go]({{< relref "/ChapterFour/0930.Binary-Subarrays-With-Sum.md" >}})| Medium | O(n)| O(n) |❤️| -|992. Subarrays with K Different Integers | [Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})| Hard | O(n)| O(n) |❤️| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0001|Two Sum|[Go]({{< relref "/ChapterFour/0001.Two-Sum.md" >}})|Easy| O(n)| O(n)||46.2%| +|0003|Longest Substring Without Repeating Characters|[Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})|Medium| O(n)| O(1)|❤️|31.3%| +|0018|4Sum|[Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})|Medium| O(n^3)| O(n^2)|❤️|34.6%| +|0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.0%| +|0036|Valid Sudoku|[Go]({{< relref "/ChapterFour/0036.Valid-Sudoku.md" >}})|Medium| O(n^2)| O(n^2)||50.2%| +|0037|Sudoku Solver|[Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})|Hard| O(n^2)| O(n^2)|❤️|45.9%| +|0049|Group Anagrams|[Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})|Medium| O(n log n)| O(n)||58.8%| +|0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|35.7%| +|0094|Binary Tree Inorder Traversal|[Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})|Medium| O(n)| O(1)||65.4%| +|0136|Single Number|[Go]({{< relref "/ChapterFour/0136.Single-Number.md" >}})|Easy||||66.4%| +|0187|Repeated DNA Sequences|[Go]({{< relref "/ChapterFour/0187.Repeated-DNA-Sequences.md" >}})|Medium||||41.2%| +|0202|Happy Number|[Go]({{< relref "/ChapterFour/0202.Happy-Number.md" >}})|Easy| O(log n)| O(1)||51.1%| +|0204|Count Primes|[Go]({{< relref "/ChapterFour/0204.Count-Primes.md" >}})|Easy||||32.1%| +|0205|Isomorphic Strings|[Go]({{< relref "/ChapterFour/0205.Isomorphic-Strings.md" >}})|Easy| O(log n)| O(n)||40.3%| +|0217|Contains Duplicate|[Go]({{< relref "/ChapterFour/0217.Contains-Duplicate.md" >}})|Easy| O(n)| O(n)||56.5%| +|0219|Contains Duplicate II|[Go]({{< relref "/ChapterFour/0219.Contains-Duplicate-II.md" >}})|Easy| O(n)| O(n)||38.5%| +|0242|Valid Anagram|[Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})|Easy| O(n)| O(n) ||57.9%| +|0274|H-Index|[Go]({{< relref "/ChapterFour/0274.H-Index.md" >}})|Medium| O(n)| O(n) ||36.3%| +|0290|Word Pattern|[Go]({{< relref "/ChapterFour/0290.Word-Pattern.md" >}})|Easy| O(n)| O(n) ||38.2%| +|0347|Top K Frequent Elements|[Go]({{< relref "/ChapterFour/0347.Top-K-Frequent-Elements.md" >}})|Medium| O(n)| O(n) ||62.2%| +|0349|Intersection of Two Arrays|[Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})|Easy| O(n)| O(n) ||64.4%| +|0350|Intersection of Two Arrays II|[Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})|Easy| O(n)| O(n) ||51.9%| +|0387|First Unique Character in a String|[Go]({{< relref "/ChapterFour/0387.First-Unique-Character-in-a-String.md" >}})|Easy||||53.7%| +|0389|Find the Difference|[Go]({{< relref "/ChapterFour/0389.Find-the-Difference.md" >}})|Easy||||57.7%| +|0409|Longest Palindrome|[Go]({{< relref "/ChapterFour/0409.Longest-Palindrome.md" >}})|Easy||||52.1%| +|0438|Find All Anagrams in a String|[Go]({{< relref "/ChapterFour/0438.Find-All-Anagrams-in-a-String.md" >}})|Medium| O(n)| O(1) ||44.7%| +|0447|Number of Boomerangs|[Go]({{< relref "/ChapterFour/0447.Number-of-Boomerangs.md" >}})|Medium| O(n)| O(1) ||52.3%| +|0451|Sort Characters By Frequency|[Go]({{< relref "/ChapterFour/0451.Sort-Characters-By-Frequency.md" >}})|Medium| O(n log n)| O(1) ||64.1%| +|0454|4Sum II|[Go]({{< relref "/ChapterFour/0454.4Sum-II.md" >}})|Medium| O(n^2)| O(n) ||54.5%| +|0463|Island Perimeter|[Go]({{< relref "/ChapterFour/0463.Island-Perimeter.md" >}})|Easy||||66.5%| +|0500|Keyboard Row|[Go]({{< relref "/ChapterFour/0500.Keyboard-Row.md" >}})|Easy||||65.5%| +|0508|Most Frequent Subtree Sum|[Go]({{< relref "/ChapterFour/0508.Most-Frequent-Subtree-Sum.md" >}})|Medium||||58.9%| +|0575|Distribute Candies|[Go]({{< relref "/ChapterFour/0575.Distribute-Candies.md" >}})|Easy||||61.9%| +|0594|Longest Harmonious Subsequence|[Go]({{< relref "/ChapterFour/0594.Longest-Harmonious-Subsequence.md" >}})|Easy||||47.7%| +|0599|Minimum Index Sum of Two Lists|[Go]({{< relref "/ChapterFour/0599.Minimum-Index-Sum-of-Two-Lists.md" >}})|Easy||||51.5%| +|0632|Smallest Range Covering Elements from K Lists|[Go]({{< relref "/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md" >}})|Hard||||53.9%| +|0645|Set Mismatch|[Go]({{< relref "/ChapterFour/0645.Set-Mismatch.md" >}})|Easy||||42.5%| +|0648|Replace Words|[Go]({{< relref "/ChapterFour/0648.Replace-Words.md" >}})|Medium| O(n)| O(n) ||58.2%| +|0676|Implement Magic Dictionary|[Go]({{< relref "/ChapterFour/0676.Implement-Magic-Dictionary.md" >}})|Medium| O(n)| O(n) ||55.1%| +|0705|Design HashSet|[Go]({{< relref "/ChapterFour/0705.Design-HashSet.md" >}})|Easy||||64.6%| +|0706|Design HashMap|[Go]({{< relref "/ChapterFour/0706.Design-HashMap.md" >}})|Easy||||62.5%| +|0710|Random Pick with Blacklist|[Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})|Hard| O(n)| O(n) ||32.7%| +|0718|Maximum Length of Repeated Subarray|[Go]({{< relref "/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md" >}})|Medium||||50.1%| +|0720|Longest Word in Dictionary|[Go]({{< relref "/ChapterFour/0720.Longest-Word-in-Dictionary.md" >}})|Easy| O(n)| O(n) ||49.0%| +|0726|Number of Atoms|[Go]({{< relref "/ChapterFour/0726.Number-of-Atoms.md" >}})|Hard| O(n)| O(n) |❤️|51.0%| +|0739|Daily Temperatures|[Go]({{< relref "/ChapterFour/0739.Daily-Temperatures.md" >}})|Medium| O(n)| O(n) ||64.3%| +|0748|Shortest Completing Word|[Go]({{< relref "/ChapterFour/0748.Shortest-Completing-Word.md" >}})|Easy||||57.4%| +|0771|Jewels and Stones|[Go]({{< relref "/ChapterFour/0771.Jewels-and-Stones.md" >}})|Easy||||86.8%| +|0781|Rabbits in Forest|[Go]({{< relref "/ChapterFour/0781.Rabbits-in-Forest.md" >}})|Medium||||55.4%| +|0811|Subdomain Visit Count|[Go]({{< relref "/ChapterFour/0811.Subdomain-Visit-Count.md" >}})|Easy||||71.2%| +|0884|Uncommon Words from Two Sentences|[Go]({{< relref "/ChapterFour/0884.Uncommon-Words-from-Two-Sentences.md" >}})|Easy||||63.9%| +|0895|Maximum Frequency Stack|[Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})|Hard| O(n)| O(n) ||62.1%| +|0930|Binary Subarrays With Sum|[Go]({{< relref "/ChapterFour/0930.Binary-Subarrays-With-Sum.md" >}})|Medium| O(n)| O(n) |❤️|44.3%| +|0953|Verifying an Alien Dictionary|[Go]({{< relref "/ChapterFour/0953.Verifying-an-Alien-Dictionary.md" >}})|Easy||||52.5%| +|0961|N-Repeated Element in Size 2N Array|[Go]({{< relref "/ChapterFour/0961.N-Repeated-Element-in-Size-2N-Array.md" >}})|Easy||||74.4%| +|0970|Powerful Integers|[Go]({{< relref "/ChapterFour/0970.Powerful-Integers.md" >}})|Easy||||39.9%| +|0981|Time Based Key-Value Store|[Go]({{< relref "/ChapterFour/0981.Time-Based-Key-Value-Store.md" >}})|Medium||||53.9%| +|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n) |❤️|50.4%| +|1002|Find Common Characters|[Go]({{< relref "/ChapterFour/1002.Find-Common-Characters.md" >}})|Easy||||68.1%| +|1078|Occurrences After Bigram|[Go]({{< relref "/ChapterFour/1078.Occurrences-After-Bigram.md" >}})|Easy||||64.9%| +|1160|Find Words That Can Be Formed by Characters|[Go]({{< relref "/ChapterFour/1160.Find-Words-That-Can-Be-Formed-by-Characters.md" >}})|Easy||||67.5%| +|1189|Maximum Number of Balloons|[Go]({{< relref "/ChapterFour/1189.Maximum-Number-of-Balloons.md" >}})|Easy||||61.8%| +|1207|Unique Number of Occurrences|[Go]({{< relref "/ChapterFour/1207.Unique-Number-of-Occurrences.md" >}})|Easy||||71.6%| +|1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| +|1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.3%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.3%| +|1679|Max Number of K-Sum Pairs|[Go]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}})|Medium||||52.0%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Linked_List.md b/website/content/ChapterTwo/Linked_List.md index d786f466..ef03c6e9 100644 --- a/website/content/ChapterTwo/Linked_List.md +++ b/website/content/ChapterTwo/Linked_List.md @@ -19,35 +19,40 @@ type: docs -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|2. Add Two Numbers | [Go]({{< relref "/ChapterFour/0002.Add-Two-Numbers.md" >}})| Medium | O(n)| O(1)|| -|19. Remove Nth Node From End of List | [Go]({{< relref "/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md" >}})| Medium | O(n)| O(1)|| -|21. Merge Two Sorted Lists | [Go]({{< relref "/ChapterFour/0021.Merge-Two-Sorted-Lists.md" >}})| Easy | O(log n)| O(1)|| -|23. Merge k Sorted Lists| [Go]({{< relref "/ChapterFour/0023.Merge-k-Sorted-Lists.md" >}})| Hard | O(log n)| O(1)|❤️| -|24. Swap Nodes in Pairs | [Go]({{< relref "/ChapterFour/0024.Swap-Nodes-in-Pairs.md" >}})| Medium | O(n)| O(1)|| -|25. Reverse Nodes in k-Group | [Go]({{< relref "/ChapterFour/0025.Reverse-Nodes-in-k-Group.md" >}})| Hard | O(log n)| O(1)|❤️| -|61. Rotate List | [Go]({{< relref "/ChapterFour/0061.Rotate-List.md" >}})| Medium | O(n)| O(1)|| -|82. Remove Duplicates from Sorted List II | [Go]({{< relref "/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md" >}})| Medium | O(n)| O(1)|| -|83. Remove Duplicates from Sorted List | [Go]({{< relref "/ChapterFour/0083.Remove-Duplicates-from-Sorted-List.md" >}})| Easy | O(n)| O(1)|| -|86. Partition List | [Go]({{< relref "/ChapterFour/0086.Partition-List.md" >}})| Medium | O(n)| O(1)|❤️| -|92. Reverse Linked List II | [Go]({{< relref "/ChapterFour/0092.Reverse-Linked-List-II.md" >}})| Medium | O(n)| O(1)|❤️| -|109. Convert Sorted List to Binary Search Tree | [Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})| Medium | O(log n)| O(n)|| -|141. Linked List Cycle | [Go]({{< relref "/ChapterFour/0141.Linked-List-Cycle.md" >}})| Easy | O(n)| O(1)|❤️| -|142. Linked List Cycle II | [Go]({{< relref "/ChapterFour/0142.Linked-List-Cycle-II.md" >}})| Medium | O(n)| O(1)|❤️| -|143. Reorder List | [Go]({{< relref "/ChapterFour/0143.Reorder-List.md" >}})| Medium | O(n)| O(1)|❤️| -|147. Insertion Sort List | [Go]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}})| Medium | O(n)| O(1)|❤️| -|148. Sort List | [Go]({{< relref "/ChapterFour/0148.Sort-List.md" >}})| Medium | O(n log n)| O(n)|❤️| -|160. Intersection of Two Linked Lists | [Go]({{< relref "/ChapterFour/0160.Intersection-of-Two-Linked-Lists.md" >}})| Easy | O(n)| O(1)|❤️| -|203. Remove Linked List Elements | [Go]({{< relref "/ChapterFour/0203.Remove-Linked-List-Elements.md" >}})| Easy | O(n)| O(1)|| -|206. Reverse Linked List | [Go]({{< relref "/ChapterFour/0206.Reverse-Linked-List.md" >}})| Easy | O(n)| O(1)|| -|234. Palindrome Linked List | [Go]({{< relref "/ChapterFour/0234.Palindrome-Linked-List.md" >}})| Easy | O(n)| O(1)|| -|237. Delete Node in a Linked List | [Go]({{< relref "/ChapterFour/0237.Delete-Node-in-a-Linked-List.md" >}})| Easy | O(n)| O(1)|| -|328. Odd Even Linked List | [Go]({{< relref "/ChapterFour/0328.Odd-Even-Linked-List.md" >}})| Medium | O(n)| O(1)|| -|445. Add Two Numbers II | [Go]({{< relref "/ChapterFour/0445.Add-Two-Numbers-II.md" >}})| Medium | O(n)| O(n)|| -|725. Split Linked List in Parts | [Go]({{< relref "/ChapterFour/0725.Split-Linked-List-in-Parts.md" >}})| Medium | O(n)| O(1)|| -|817. Linked List Components | [Go]({{< relref "/ChapterFour/0817.Linked-List-Components.md" >}})| Medium | O(n)| O(1)|| -|707. Design Linked List | [Go]({{< relref "/ChapterFour/0707.Design-Linked-List.md" >}})| Easy | O(n)| O(1)|| -|876. Middle of the Linked List | [Go]({{< relref "/ChapterFour/0876.Middle-of-the-Linked-List.md" >}})| Easy | O(n)| O(1)|❤️| -|1019. Next Greater Node In Linked List | [Go]({{< relref "/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md" >}})| Medium | O(n)| O(1)|| -|---------------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0002|Add Two Numbers|[Go]({{< relref "/ChapterFour/0002.Add-Two-Numbers.md" >}})|Medium| O(n)| O(1)||35.2%| +|0019|Remove Nth Node From End of List|[Go]({{< relref "/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md" >}})|Medium| O(n)| O(1)||35.6%| +|0021|Merge Two Sorted Lists|[Go]({{< relref "/ChapterFour/0021.Merge-Two-Sorted-Lists.md" >}})|Easy| O(log n)| O(1)||55.6%| +|0023|Merge k Sorted Lists|[Go]({{< relref "/ChapterFour/0023.Merge-k-Sorted-Lists.md" >}})|Hard| O(log n)| O(1)|❤️|42.0%| +|0024|Swap Nodes in Pairs|[Go]({{< relref "/ChapterFour/0024.Swap-Nodes-in-Pairs.md" >}})|Medium| O(n)| O(1)||52.6%| +|0025|Reverse Nodes in k-Group|[Go]({{< relref "/ChapterFour/0025.Reverse-Nodes-in-k-Group.md" >}})|Hard| O(log n)| O(1)|❤️|44.2%| +|0061|Rotate List|[Go]({{< relref "/ChapterFour/0061.Rotate-List.md" >}})|Medium| O(n)| O(1)||31.6%| +|0082|Remove Duplicates from Sorted List II|[Go]({{< relref "/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md" >}})|Medium| O(n)| O(1)||39.0%| +|0083|Remove Duplicates from Sorted List|[Go]({{< relref "/ChapterFour/0083.Remove-Duplicates-from-Sorted-List.md" >}})|Easy| O(n)| O(1)||46.3%| +|0086|Partition List|[Go]({{< relref "/ChapterFour/0086.Partition-List.md" >}})|Medium| O(n)| O(1)|❤️|43.0%| +|0092|Reverse Linked List II|[Go]({{< relref "/ChapterFour/0092.Reverse-Linked-List-II.md" >}})|Medium| O(n)| O(1)|❤️|40.2%| +|0109|Convert Sorted List to Binary Search Tree|[Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})|Medium| O(log n)| O(n)||49.8%| +|0141|Linked List Cycle|[Go]({{< relref "/ChapterFour/0141.Linked-List-Cycle.md" >}})|Easy| O(n)| O(1)|❤️|42.2%| +|0142|Linked List Cycle II|[Go]({{< relref "/ChapterFour/0142.Linked-List-Cycle-II.md" >}})|Medium| O(n)| O(1)|❤️|39.3%| +|0143|Reorder List|[Go]({{< relref "/ChapterFour/0143.Reorder-List.md" >}})|Medium| O(n)| O(1)|❤️|40.2%| +|0147|Insertion Sort List|[Go]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}})|Medium| O(n)| O(1)|❤️|44.1%| +|0148|Sort List|[Go]({{< relref "/ChapterFour/0148.Sort-List.md" >}})|Medium| O(n log n)| O(n)|❤️|45.8%| +|0160|Intersection of Two Linked Lists|[Go]({{< relref "/ChapterFour/0160.Intersection-of-Two-Linked-Lists.md" >}})|Easy| O(n)| O(1)|❤️|42.6%| +|0203|Remove Linked List Elements|[Go]({{< relref "/ChapterFour/0203.Remove-Linked-List-Elements.md" >}})|Easy| O(n)| O(1)||39.0%| +|0206|Reverse Linked List|[Go]({{< relref "/ChapterFour/0206.Reverse-Linked-List.md" >}})|Easy| O(n)| O(1)||64.8%| +|0234|Palindrome Linked List|[Go]({{< relref "/ChapterFour/0234.Palindrome-Linked-List.md" >}})|Easy| O(n)| O(1)||40.2%| +|0237|Delete Node in a Linked List|[Go]({{< relref "/ChapterFour/0237.Delete-Node-in-a-Linked-List.md" >}})|Easy| O(n)| O(1)||66.3%| +|0328|Odd Even Linked List|[Go]({{< relref "/ChapterFour/0328.Odd-Even-Linked-List.md" >}})|Medium| O(n)| O(1)||56.9%| +|0445|Add Two Numbers II|[Go]({{< relref "/ChapterFour/0445.Add-Two-Numbers-II.md" >}})|Medium| O(n)| O(n)||56.0%| +|0707|Design Linked List|[Go]({{< relref "/ChapterFour/0707.Design-Linked-List.md" >}})|Medium| O(n)| O(1)||25.7%| +|0725|Split Linked List in Parts|[Go]({{< relref "/ChapterFour/0725.Split-Linked-List-in-Parts.md" >}})|Medium| O(n)| O(1)||52.8%| +|0817|Linked List Components|[Go]({{< relref "/ChapterFour/0817.Linked-List-Components.md" >}})|Medium| O(n)| O(1)||57.6%| +|0876|Middle of the Linked List|[Go]({{< relref "/ChapterFour/0876.Middle-of-the-Linked-List.md" >}})|Easy| O(n)| O(1)|❤️|68.9%| +|1019|Next Greater Node In Linked List|[Go]({{< relref "/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md" >}})|Medium| O(n)| O(1)||58.2%| +|1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go]({{< relref "/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md" >}})|Medium||||41.4%| +|1290|Convert Binary Number in a Linked List to Integer|[Go]({{< relref "/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md" >}})|Easy||||81.6%| +|1669|Merge In Between Linked Lists|[Go]({{< relref "/ChapterFour/1669.Merge-In-Between-Linked-Lists.md" >}})|Medium||||78.2%| +|1670|Design Front Middle Back Queue|[Go]({{< relref "/ChapterFour/1670.Design-Front-Middle-Back-Queue.md" >}})|Medium||||54.6%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Math.md b/website/content/ChapterTwo/Math.md index b20da7a3..afecf1c9 100644 --- a/website/content/ChapterTwo/Math.md +++ b/website/content/ChapterTwo/Math.md @@ -5,24 +5,77 @@ type: docs # Math -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|2. Add Two Numbers | [Go]({{< relref "/ChapterFour/0002.Add-Two-Numbers.md" >}})| Medium | O(n)| O(1)|| -|50. Pow(x, n) | [Go]({{< relref "/ChapterFour/0050.Powx-n.md" >}})| Medium | O(log n)| O(1)|| -|60. Permutation Sequence | [Go]({{< relref "/ChapterFour/0060.Permutation-Sequence.md" >}})| Medium | O(n log n)| O(1)|| -|69. Sqrt(x) | [Go]({{< relref "/ChapterFour/0069.Sqrtx.md" >}})| Easy | O(log n)| O(1)|| -|202. Happy Number | [Go]({{< relref "/ChapterFour/0202.Happy-Number.md" >}})| Easy | O(log n)| O(1)|| -|224. Basic Calculator | [Go]({{< relref "/ChapterFour/0224.Basic-Calculator.md" >}})| Hard | O(n)| O(n)|| -|231. Power of Two | [Go]({{< relref "/ChapterFour/0231.Power-of-Two.md" >}})| Easy | O(1)| O(1)|| -|263. Ugly Number | [Go]({{< relref "/ChapterFour/0263.Ugly-Number.md" >}})| Easy | O(log n)| O(1)|| -|326. Power of Three | [Go]({{< relref "/ChapterFour/0326.Power-of-Three.md" >}})| Easy | O(1)| O(1)|| -|343. Integer Break | [Go]({{< relref "/ChapterFour/0343.Integer-Break.md" >}})| Medium | O(n^2)| O(n)|| -|357. Count Numbers with Unique Digits | [Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})| Medium | O(1)| O(1)|| -|628. Maximum Product of Three Numbers | [Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})| Easy | O(n)| O(1)|| -|885. Spiral Matrix III | [Go]({{< relref "/ChapterFour/0885.Spiral-Matrix-III.md" >}})| Medium | O(n^2)| O(1)|| -|891. Sum of Subsequence Widths | [Go]({{< relref "/ChapterFour/0891.Sum-of-Subsequence-Widths.md" >}})| Hard | O(n log n)| O(1)|| -|942. DI String Match | [Go]({{< relref "/ChapterFour/0942.DI-String-Match.md" >}})| Easy | O(n)| O(1)|| -|976. Largest Perimeter Triangle | [Go]({{< relref "/ChapterFour/0976.Largest-Perimeter-Triangle.md" >}})| Easy | O(n log n)| O(log n) || -|996. Number of Squareful Arrays | [Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})| Hard | O(n log n)| O(n) || -|1025. Divisor Game | [Go]({{< relref "/ChapterFour/1025.Divisor-Game.md" >}})| Easy | O(1)| O(1)|| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0002|Add Two Numbers|[Go]({{< relref "/ChapterFour/0002.Add-Two-Numbers.md" >}})|Medium| O(n)| O(1)||35.2%| +|0007|Reverse Integer|[Go]({{< relref "/ChapterFour/0007.Reverse-Integer.md" >}})|Easy||||25.8%| +|0009|Palindrome Number|[Go]({{< relref "/ChapterFour/0009.Palindrome-Number.md" >}})|Easy||||49.5%| +|0013|Roman to Integer|[Go]({{< relref "/ChapterFour/0013.Roman-to-Integer.md" >}})|Easy||||56.4%| +|0029|Divide Two Integers|[Go]({{< relref "/ChapterFour/0029.Divide-Two-Integers.md" >}})|Medium||||16.6%| +|0050|Pow(x, n)|[Go]({{< relref "/ChapterFour/0050.Powx-n.md" >}})|Medium| O(log n)| O(1)||30.8%| +|0060|Permutation Sequence|[Go]({{< relref "/ChapterFour/0060.Permutation-Sequence.md" >}})|Hard| O(n log n)| O(1)||39.2%| +|0067|Add Binary|[Go]({{< relref "/ChapterFour/0067.Add-Binary.md" >}})|Easy||||46.6%| +|0069|Sqrt(x)|[Go]({{< relref "/ChapterFour/0069.Sqrtx.md" >}})|Easy| O(log n)| O(1)||34.8%| +|0168|Excel Sheet Column Title|[Go]({{< relref "/ChapterFour/0168.Excel-Sheet-Column-Title.md" >}})|Easy||||31.6%| +|0171|Excel Sheet Column Number|[Go]({{< relref "/ChapterFour/0171.Excel-Sheet-Column-Number.md" >}})|Easy||||56.7%| +|0172|Factorial Trailing Zeroes|[Go]({{< relref "/ChapterFour/0172.Factorial-Trailing-Zeroes.md" >}})|Easy||||38.4%| +|0202|Happy Number|[Go]({{< relref "/ChapterFour/0202.Happy-Number.md" >}})|Easy| O(log n)| O(1)||51.1%| +|0204|Count Primes|[Go]({{< relref "/ChapterFour/0204.Count-Primes.md" >}})|Easy||||32.1%| +|0223|Rectangle Area|[Go]({{< relref "/ChapterFour/0223.Rectangle-Area.md" >}})|Medium||||38.1%| +|0224|Basic Calculator|[Go]({{< relref "/ChapterFour/0224.Basic-Calculator.md" >}})|Hard| O(n)| O(n)||38.0%| +|0231|Power of Two|[Go]({{< relref "/ChapterFour/0231.Power-of-Two.md" >}})|Easy| O(1)| O(1)||43.8%| +|0258|Add Digits|[Go]({{< relref "/ChapterFour/0258.Add-Digits.md" >}})|Easy||||58.3%| +|0263|Ugly Number|[Go]({{< relref "/ChapterFour/0263.Ugly-Number.md" >}})|Easy| O(log n)| O(1)||41.7%| +|0268|Missing Number|[Go]({{< relref "/ChapterFour/0268.Missing-Number.md" >}})|Easy||||53.4%| +|0326|Power of Three|[Go]({{< relref "/ChapterFour/0326.Power-of-Three.md" >}})|Easy| O(1)| O(1)||42.1%| +|0343|Integer Break|[Go]({{< relref "/ChapterFour/0343.Integer-Break.md" >}})|Medium| O(n^2)| O(n)||51.0%| +|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.7%| +|0367|Valid Perfect Square|[Go]({{< relref "/ChapterFour/0367.Valid-Perfect-Square.md" >}})|Easy||||42.0%| +|0372|Super Pow|[Go]({{< relref "/ChapterFour/0372.Super-Pow.md" >}})|Medium||||36.6%| +|0397|Integer Replacement|[Go]({{< relref "/ChapterFour/0397.Integer-Replacement.md" >}})|Medium||||33.4%| +|0441|Arranging Coins|[Go]({{< relref "/ChapterFour/0441.Arranging-Coins.md" >}})|Easy||||42.3%| +|0447|Number of Boomerangs|[Go]({{< relref "/ChapterFour/0447.Number-of-Boomerangs.md" >}})|Medium||||52.3%| +|0453|Minimum Moves to Equal Array Elements|[Go]({{< relref "/ChapterFour/0453.Minimum-Moves-to-Equal-Array-Elements.md" >}})|Easy||||50.7%| +|0483|Smallest Good Base|[Go]({{< relref "/ChapterFour/0483.Smallest-Good-Base.md" >}})|Hard||||36.2%| +|0507|Perfect Number|[Go]({{< relref "/ChapterFour/0507.Perfect-Number.md" >}})|Easy||||36.0%| +|0537|Complex Number Multiplication|[Go]({{< relref "/ChapterFour/0537.Complex-Number-Multiplication.md" >}})|Medium||||68.3%| +|0598|Range Addition II|[Go]({{< relref "/ChapterFour/0598.Range-Addition-II.md" >}})|Easy||||50.0%| +|0628|Maximum Product of Three Numbers|[Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})|Easy| O(n)| O(1)||47.0%| +|0633|Sum of Square Numbers|[Go]({{< relref "/ChapterFour/0633.Sum-of-Square-Numbers.md" >}})|Medium||||32.4%| +|0645|Set Mismatch|[Go]({{< relref "/ChapterFour/0645.Set-Mismatch.md" >}})|Easy||||42.5%| +|0753|Cracking the Safe|[Go]({{< relref "/ChapterFour/0753.Cracking-the-Safe.md" >}})|Hard||||52.0%| +|0781|Rabbits in Forest|[Go]({{< relref "/ChapterFour/0781.Rabbits-in-Forest.md" >}})|Medium||||55.4%| +|0812|Largest Triangle Area|[Go]({{< relref "/ChapterFour/0812.Largest-Triangle-Area.md" >}})|Easy||||58.8%| +|0836|Rectangle Overlap|[Go]({{< relref "/ChapterFour/0836.Rectangle-Overlap.md" >}})|Easy||||45.1%| +|0878|Nth Magical Number|[Go]({{< relref "/ChapterFour/0878.Nth-Magical-Number.md" >}})|Hard||||28.9%| +|0885|Spiral Matrix III|[Go]({{< relref "/ChapterFour/0885.Spiral-Matrix-III.md" >}})|Medium| O(n^2)| O(1)||70.5%| +|0887|Super Egg Drop|[Go]({{< relref "/ChapterFour/0887.Super-Egg-Drop.md" >}})|Hard||||27.0%| +|0891|Sum of Subsequence Widths|[Go]({{< relref "/ChapterFour/0891.Sum-of-Subsequence-Widths.md" >}})|Hard| O(n log n)| O(1)||32.8%| +|0892|Surface Area of 3D Shapes|[Go]({{< relref "/ChapterFour/0892.Surface-Area-of-3D-Shapes.md" >}})|Easy||||59.5%| +|0910|Smallest Range II|[Go]({{< relref "/ChapterFour/0910.Smallest-Range-II.md" >}})|Medium||||31.2%| +|0914|X of a Kind in a Deck of Cards|[Go]({{< relref "/ChapterFour/0914.X-of-a-Kind-in-a-Deck-of-Cards.md" >}})|Easy||||34.4%| +|0927|Three Equal Parts|[Go]({{< relref "/ChapterFour/0927.Three-Equal-Parts.md" >}})|Hard||||34.5%| +|0942|DI String Match|[Go]({{< relref "/ChapterFour/0942.DI-String-Match.md" >}})|Easy| O(n)| O(1)||73.4%| +|0949|Largest Time for Given Digits|[Go]({{< relref "/ChapterFour/0949.Largest-Time-for-Given-Digits.md" >}})|Medium||||36.2%| +|0952|Largest Component Size by Common Factor|[Go]({{< relref "/ChapterFour/0952.Largest-Component-Size-by-Common-Factor.md" >}})|Hard||||36.1%| +|0970|Powerful Integers|[Go]({{< relref "/ChapterFour/0970.Powerful-Integers.md" >}})|Easy||||39.9%| +|0976|Largest Perimeter Triangle|[Go]({{< relref "/ChapterFour/0976.Largest-Perimeter-Triangle.md" >}})|Easy| O(n log n)| O(log n) ||58.5%| +|0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.0%| +|1017|Convert to Base -2|[Go]({{< relref "/ChapterFour/1017.Convert-to-Base--2.md" >}})|Medium||||59.6%| +|1025|Divisor Game|[Go]({{< relref "/ChapterFour/1025.Divisor-Game.md" >}})|Easy| O(1)| O(1)||66.1%| +|1037|Valid Boomerang|[Go]({{< relref "/ChapterFour/1037.Valid-Boomerang.md" >}})|Easy||||37.9%| +|1073|Adding Two Negabinary Numbers|[Go]({{< relref "/ChapterFour/1073.Adding-Two-Negabinary-Numbers.md" >}})|Medium||||34.7%| +|1093|Statistics from a Large Sample|[Go]({{< relref "/ChapterFour/1093.Statistics-from-a-Large-Sample.md" >}})|Medium||||49.3%| +|1154|Day of the Year|[Go]({{< relref "/ChapterFour/1154.Day-of-the-Year.md" >}})|Easy||||49.3%| +|1175|Prime Arrangements|[Go]({{< relref "/ChapterFour/1175.Prime-Arrangements.md" >}})|Easy||||51.8%| +|1201|Ugly Number III|[Go]({{< relref "/ChapterFour/1201.Ugly-Number-III.md" >}})|Medium||||26.3%| +|1217|Minimum Cost to Move Chips to The Same Position|[Go]({{< relref "/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md" >}})|Easy||||71.2%| +|1232|Check If It Is a Straight Line|[Go]({{< relref "/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md" >}})|Easy||||43.9%| +|1281|Subtract the Product and Sum of Digits of an Integer|[Go]({{< relref "/ChapterFour/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer.md" >}})|Easy||||85.6%| +|1317|Convert Integer to the Sum of Two No-Zero Integers|[Go]({{< relref "/ChapterFour/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers.md" >}})|Easy||||56.8%| +|1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| +|1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%| +|1680|Concatenation of Consecutive Binary Numbers|[Go]({{< relref "/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md" >}})|Medium||||45.1%| +|1685|Sum of Absolute Differences in a Sorted Array|[Go]({{< relref "/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md" >}})|Medium||||61.7%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Segment_Tree.md b/website/content/ChapterTwo/Segment_Tree.md index fb0c06b9..0f053551 100644 --- a/website/content/ChapterTwo/Segment_Tree.md +++ b/website/content/ChapterTwo/Segment_Tree.md @@ -33,16 +33,18 @@ type: docs [HDU 1542 Atlantis](http://acm.hdu.edu.cn/showproblem.php?pid=1542) update:区间增减 query:直接取根节点的值 [HDU 1828 Picture](http://acm.hdu.edu.cn/showproblem.php?pid=1828) update:区间增减 query:直接取根节点的值 -| Title | Solution | Difficulty | Time | Space | 收藏 | -| ----- | :--------: | :----------: | :----: | :-----: |:-----: | -|218. The Skyline Problem | [Go]({{< relref "/ChapterFour/0218.The-Skyline-Problem.md" >}})| Hard | O(n log n)| O(n)|❤️| -|307. Range Sum Query - Mutable | [Go]({{< relref "/ChapterFour/0307.Range-Sum-Query---Mutable.md" >}})| Hard | O(1)| O(n)|| -|315. Count of Smaller Numbers After Self | [Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})| Hard | O(n log n)| O(n)|| -|327. Count of Range Sum | [Go]({{< relref "/ChapterFour/0327.Count-of-Range-Sum.md" >}})| Hard | O(n log n)| O(n)|❤️| -|493. Reverse Pairs | [Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})| Hard | O(n log n)| O(n)|| -|699. Falling Squares | [Go]({{< relref "/ChapterFour/0699.Falling-Squares.md" >}})| Hard | O(n log n)| O(n)|❤️| -|715. Range Module | [Go]({{< relref "/ChapterFour/0715.Range-Module.md" >}})| Hard | O(log n)| O(n)|❤️| -|732. My Calendar III | [Go]({{< relref "/ChapterFour/0732.My-Calendar-III.md" >}})| Hard | O(log n)| O(n)|❤️| -|850. Rectangle Area II | [Go]({{< relref "/ChapterFour/0850.Rectangle-Area-II.md" >}})| Hard | O(n log n)| O(n)|❤️| -|1157. Online Majority Element In Subarray | [Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})| Hard | O(log n)| O(n)|❤️| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0218|The Skyline Problem|[Go]({{< relref "/ChapterFour/0218.The-Skyline-Problem.md" >}})|Hard| O(n log n)| O(n)|❤️|36.1%| +|0307|Range Sum Query - Mutable|[Go]({{< relref "/ChapterFour/0307.Range-Sum-Query---Mutable.md" >}})|Medium| O(1)| O(n)||36.5%| +|0315|Count of Smaller Numbers After Self|[Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})|Hard| O(n log n)| O(n)||42.6%| +|0327|Count of Range Sum|[Go]({{< relref "/ChapterFour/0327.Count-of-Range-Sum.md" >}})|Hard| O(n log n)| O(n)|❤️|35.9%| +|0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})|Hard| O(n log n)| O(n)||26.6%| +|0699|Falling Squares|[Go]({{< relref "/ChapterFour/0699.Falling-Squares.md" >}})|Hard| O(n log n)| O(n)|❤️|42.4%| +|0715|Range Module|[Go]({{< relref "/ChapterFour/0715.Range-Module.md" >}})|Hard| O(log n)| O(n)|❤️|40.0%| +|0732|My Calendar III|[Go]({{< relref "/ChapterFour/0732.My-Calendar-III.md" >}})|Hard| O(log n)| O(n)|❤️|61.4%| +|0850|Rectangle Area II|[Go]({{< relref "/ChapterFour/0850.Rectangle-Area-II.md" >}})|Hard| O(n log n)| O(n)|❤️|48.4%| +|1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard| O(log n)| O(n)|❤️|39.5%| +|1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Sliding_Window.md b/website/content/ChapterTwo/Sliding_Window.md index 2ffd90d7..709a3015 100644 --- a/website/content/ChapterTwo/Sliding_Window.md +++ b/website/content/ChapterTwo/Sliding_Window.md @@ -25,19 +25,22 @@ type: docs ``` - 滑动窗口经典题。第 239 题,第 480 题。 -| Title | Solution | Difficulty | Time | Space | 收藏 | -| ----- | :--------: | :----------: | :----: | :-----: |:-----: | -|3. Longest Substring Without Repeating Characters | [Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})| Medium | O(n)| O(1)|❤️| -|76. Minimum Window Substring | [Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})| Hard | O(n)| O(n)|❤️| -|239. Sliding Window Maximum | [Go]({{< relref "/ChapterFour/0239.Sliding-Window-Maximum.md" >}})| Hard | O(n * k)| O(n)|❤️| -|424. Longest Repeating Character Replacement | [Go]({{< relref "/ChapterFour/0424.Longest-Repeating-Character-Replacement.md" >}})| Medium | O(n)| O(1) || -|480. Sliding Window Median | [Go]({{< relref "/ChapterFour/0480.Sliding-Window-Median.md" >}})| Hard | O(n * log k)| O(k)|❤️| -|567. Permutation in String | [Go]({{< relref "/ChapterFour/0567.Permutation-in-String.md" >}})| Medium | O(n)| O(1)|❤️| -|978. Longest Turbulent Subarray | [Go]({{< relref "/ChapterFour/0978.Longest-Turbulent-Subarray.md" >}})| Medium | O(n)| O(1)|❤️| -|992. Subarrays with K Different Integers | [Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})| Hard | O(n)| O(n)|❤️| -|995. Minimum Number of K Consecutive Bit Flips | [Go]({{< relref "/ChapterFour/0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md" >}})| Hard | O(n)| O(1)|❤️| -|1004. Max Consecutive Ones III | [Go]({{< relref "/ChapterFour/1004.Max-Consecutive-Ones-III.md" >}})| Medium | O(n)| O(1) || -|1040. Moving Stones Until Consecutive II | [Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})| Medium | O(n log n)| O(1) |❤️| -|1052. Grumpy Bookstore Owner | [Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})| Medium | O(n log n)| O(1) || -|1074. Number of Submatrices That Sum to Target | [Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})| Hard | O(n^3)| O(n) |❤️| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0003|Longest Substring Without Repeating Characters|[Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})|Medium| O(n)| O(1)|❤️|31.3%| +|0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|35.7%| +|0239|Sliding Window Maximum|[Go]({{< relref "/ChapterFour/0239.Sliding-Window-Maximum.md" >}})|Hard| O(n * k)| O(n)|❤️|44.5%| +|0424|Longest Repeating Character Replacement|[Go]({{< relref "/ChapterFour/0424.Longest-Repeating-Character-Replacement.md" >}})|Medium| O(n)| O(1) ||48.0%| +|0480|Sliding Window Median|[Go]({{< relref "/ChapterFour/0480.Sliding-Window-Median.md" >}})|Hard| O(n * log k)| O(k)|❤️|38.4%| +|0567|Permutation in String|[Go]({{< relref "/ChapterFour/0567.Permutation-in-String.md" >}})|Medium| O(n)| O(1)|❤️|44.6%| +|0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0978.Longest-Turbulent-Subarray.md" >}})|Medium| O(n)| O(1)|❤️|46.6%| +|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n)|❤️|50.4%| +|0995|Minimum Number of K Consecutive Bit Flips|[Go]({{< relref "/ChapterFour/0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md" >}})|Hard| O(n)| O(1)|❤️|49.6%| +|1004|Max Consecutive Ones III|[Go]({{< relref "/ChapterFour/1004.Max-Consecutive-Ones-III.md" >}})|Medium| O(n)| O(1) ||60.5%| +|1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium| O(n log n)| O(1) |❤️|54.0%| +|1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})|Medium| O(n log n)| O(1) ||55.6%| +|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard| O(n^3)| O(n) |❤️|61.4%| +|1208|Get Equal Substrings Within Budget|[Go]({{< relref "/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md" >}})|Medium||||43.7%| +|1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.6%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Sort.md b/website/content/ChapterTwo/Sort.md index f759edf8..f4dc0947 100644 --- a/website/content/ChapterTwo/Sort.md +++ b/website/content/ChapterTwo/Sort.md @@ -14,29 +14,39 @@ type: docs - 两两不相邻的排序。第 767 题,第 1054 题。 - "饼子排序"。第 969 题。 -| Title | Solution | Difficulty | Time | Space | 收藏 | -| ----- | :--------: | :----------: | :----: | :-----: |:-----: | -|56. Merge Intervals | [Go]({{< relref "/ChapterFour/0056.Merge-Intervals.md" >}})| Medium | O(n log n)| O(log n)|| -|57. Insert Interval | [Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})| Hard | O(n)| O(1)|| -|75. Sort Colors | [Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})| Medium| O(n)| O(1)|❤️| -|147. Insertion Sort List | [Go]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}})| Medium | O(n)| O(1) |❤️| -|148. Sort List | [Go]({{< relref "/ChapterFour/0148.Sort-List.md" >}})| Medium |O(n log n)| O(log n)|❤️| -|164. Maximum Gap | [Go]({{< relref "/ChapterFour/0164.Maximum-Gap.md" >}})| Hard | O(n log n)| O(log n) |❤️| -|179. Largest Number | [Go]({{< relref "/ChapterFour/0179.Largest-Number.md" >}})| Medium | O(n log n)| O(log n) |❤️| -|220. Contains Duplicate III | [Go]({{< relref "/ChapterFour/0220.Contains-Duplicate-III.md" >}})| Medium | O(n log n)| O(1) |❤️| -|242. Valid Anagram | [Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})| Easy | O(n)| O(n) || -|274. H-Index | [Go]({{< relref "/ChapterFour/0274.H-Index.md" >}})| Medium | O(n)| O(n) || -|324. Wiggle Sort II | [Go]({{< relref "/ChapterFour/0324.Wiggle-Sort-II.md" >}})| Medium| O(n)| O(n)|❤️| -|349. Intersection of Two Arrays | [Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})| Easy | O(n)| O(n) || -|350. Intersection of Two Arrays II | [Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})| Easy | O(n)| O(n) || -|524. Longest Word in Dictionary through Deleting | [Go]({{< relref "/ChapterFour/0524.Longest-Word-in-Dictionary-through-Deleting.md" >}})| Medium | O(n)| O(1) || -|767. Reorganize String | [Go]({{< relref "/ChapterFour/0767.Reorganize-String.md" >}})| Medium | O(n log n)| O(log n) |❤️| -|853. Car Fleet | [Go]({{< relref "/ChapterFour/0853.Car-Fleet.md" >}})| Medium | O(n log n)| O(log n) || -|710. Random Pick with Blacklist | [Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})| Hard | O(n)| O(n) || -|922. Sort Array By Parity II | [Go]({{< relref "/ChapterFour/0922.Sort-Array-By-Parity-II.md" >}})| Easy | O(n)| O(1) || -|969. Pancake Sorting | [Go]({{< relref "/ChapterFour/0969.Pancake-Sorting.md" >}})| Medium | O(n log n)| O(log n) |❤️| -|973. K Closest Points to Origin | [Go]({{< relref "/ChapterFour/0973.K-Closest-Points-to-Origin.md" >}})| Medium | O(n log n)| O(log n) || -|976. Largest Perimeter Triangle | [Go]({{< relref "/ChapterFour/0976.Largest-Perimeter-Triangle.md" >}})| Easy | O(n log n)| O(log n) || -|1030. Matrix Cells in Distance Order | [Go]({{< relref "/ChapterFour/1030.Matrix-Cells-in-Distance-Order.md" >}})| Easy | O(n^2)| O(1) || -|1054. Distant Barcodes | [Go]({{< relref "/ChapterFour/1054.Distant-Barcodes.md" >}})| Medium | O(n log n)| O(log n) |❤️| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0056|Merge Intervals|[Go]({{< relref "/ChapterFour/0056.Merge-Intervals.md" >}})|Medium| O(n log n)| O(log n)||40.7%| +|0057|Insert Interval|[Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})|Medium| O(n)| O(1)||34.8%| +|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|48.9%| +|0147|Insertion Sort List|[Go]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}})|Medium| O(n)| O(1) |❤️|44.1%| +|0148|Sort List|[Go]({{< relref "/ChapterFour/0148.Sort-List.md" >}})|Medium|O(n log n)| O(log n)|❤️|45.8%| +|0164|Maximum Gap|[Go]({{< relref "/ChapterFour/0164.Maximum-Gap.md" >}})|Hard| O(n log n)| O(log n) |❤️|36.6%| +|0179|Largest Number|[Go]({{< relref "/ChapterFour/0179.Largest-Number.md" >}})|Medium| O(n log n)| O(log n) |❤️|30.4%| +|0220|Contains Duplicate III|[Go]({{< relref "/ChapterFour/0220.Contains-Duplicate-III.md" >}})|Medium| O(n log n)| O(1) |❤️|21.3%| +|0242|Valid Anagram|[Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})|Easy| O(n)| O(n) ||57.9%| +|0274|H-Index|[Go]({{< relref "/ChapterFour/0274.H-Index.md" >}})|Medium| O(n)| O(n) ||36.3%| +|0315|Count of Smaller Numbers After Self|[Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})|Hard||||42.6%| +|0324|Wiggle Sort II|[Go]({{< relref "/ChapterFour/0324.Wiggle-Sort-II.md" >}})|Medium| O(n)| O(n)|❤️|30.5%| +|0327|Count of Range Sum|[Go]({{< relref "/ChapterFour/0327.Count-of-Range-Sum.md" >}})|Hard||||35.9%| +|0349|Intersection of Two Arrays|[Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})|Easy| O(n)| O(n) ||64.4%| +|0350|Intersection of Two Arrays II|[Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})|Easy| O(n)| O(n) ||51.9%| +|0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})|Hard||||26.6%| +|0524|Longest Word in Dictionary through Deleting|[Go]({{< relref "/ChapterFour/0524.Longest-Word-in-Dictionary-through-Deleting.md" >}})|Medium| O(n)| O(1) ||48.9%| +|0710|Random Pick with Blacklist|[Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})|Hard| O(n)| O(n) ||32.7%| +|0767|Reorganize String|[Go]({{< relref "/ChapterFour/0767.Reorganize-String.md" >}})|Medium| O(n log n)| O(log n) |❤️|49.9%| +|0853|Car Fleet|[Go]({{< relref "/ChapterFour/0853.Car-Fleet.md" >}})|Medium| O(n log n)| O(log n) ||43.6%| +|0922|Sort Array By Parity II|[Go]({{< relref "/ChapterFour/0922.Sort-Array-By-Parity-II.md" >}})|Easy| O(n)| O(1) ||70.2%| +|0969|Pancake Sorting|[Go]({{< relref "/ChapterFour/0969.Pancake-Sorting.md" >}})|Medium| O(n log n)| O(log n) |❤️|68.5%| +|0973|K Closest Points to Origin|[Go]({{< relref "/ChapterFour/0973.K-Closest-Points-to-Origin.md" >}})|Medium| O(n log n)| O(log n) ||64.5%| +|0976|Largest Perimeter Triangle|[Go]({{< relref "/ChapterFour/0976.Largest-Perimeter-Triangle.md" >}})|Easy| O(n log n)| O(log n) ||58.5%| +|1030|Matrix Cells in Distance Order|[Go]({{< relref "/ChapterFour/1030.Matrix-Cells-in-Distance-Order.md" >}})|Easy| O(n^2)| O(1) ||66.9%| +|1054|Distant Barcodes|[Go]({{< relref "/ChapterFour/1054.Distant-Barcodes.md" >}})|Medium| O(n log n)| O(log n) |❤️|44.2%| +|1122|Relative Sort Array|[Go]({{< relref "/ChapterFour/1122.Relative-Sort-Array.md" >}})|Easy||||67.7%| +|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| +|1305|All Elements in Two Binary Search Trees|[Go]({{< relref "/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}})|Medium||||77.8%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.3%| +|1647|Minimum Deletions to Make Character Frequencies Unique|[Go]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}})|Medium||||53.9%| +|1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Stack.md b/website/content/ChapterTwo/Stack.md index cae1b29c..192775aa 100644 --- a/website/content/ChapterTwo/Stack.md +++ b/website/content/ChapterTwo/Stack.md @@ -12,43 +12,47 @@ type: docs - 利用栈进行编码问题。第 394 题,第 682 题,第 856 题,第 880 题。 - **单调栈**。**利用栈维护一个单调递增或者递减的下标数组**。第 84 题,第 456 题,第 496 题,第 503 题,第 739 题,第 901 题,第 907 题,第 1019 题。 -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|20. Valid Parentheses | [Go]({{< relref "/ChapterFour/0020.Valid-Parentheses.md" >}})| Easy | O(log n)| O(1)|| -|42. Trapping Rain Water | [Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})| Hard | O(n)| O(1)|❤️| -|71. Simplify Path | [Go]({{< relref "/ChapterFour/0071.Simplify-Path.md" >}})| Medium | O(n)| O(n)|❤️| -|84. Largest Rectangle in Histogram | [Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}})| Medium | O(n)| O(n)|❤️| -|94. Binary Tree Inorder Traversal | [Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})| Medium | O(n)| O(1)|| -|103. Binary Tree Zigzag Level Order Traversal | [Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})| Medium | O(n)| O(n)|| -|144. Binary Tree Preorder Traversal | [Go]({{< relref "/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md" >}})| Medium | O(n)| O(1)|| -|145. Binary Tree Postorder Traversal | [Go]({{< relref "/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md" >}})| Hard | O(n)| O(1)|| -|150. Evaluate Reverse Polish Notation | [Go]({{< relref "/ChapterFour/0150.Evaluate-Reverse-Polish-Notation.md" >}})| Medium | O(n)| O(1)|| -|155. Min Stack | [Go]({{< relref "/ChapterFour/0155.Min-Stack.md" >}})| Easy | O(n)| O(n)|| -|173. Binary Search Tree Iterator | [Go]({{< relref "/ChapterFour/0173.Binary-Search-Tree-Iterator.md" >}})| Medium | O(n)| O(1)|| -|224. Basic Calculator | [Go]({{< relref "/ChapterFour/0224.Basic-Calculator.md" >}})| Hard | O(n)| O(n)|| -|225. Implement Stack using Queues | [Go]({{< relref "/ChapterFour/0225.Implement-Stack-using-Queues.md" >}})| Easy | O(n)| O(n)|| -|232. Implement Queue using Stacks | [Go]({{< relref "/ChapterFour/0232.Implement-Queue-using-Stacks.md" >}})| Easy | O(n)| O(n)|| -|331. Verify Preorder Serialization of a Binary Tree | [Go]({{< relref "/ChapterFour/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md" >}})| Medium | O(n)| O(1)|| -|394. Decode String | [Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})| Medium | O(n)| O(n)|| -|402. Remove K Digits | [Go]({{< relref "/ChapterFour/0402.Remove-K-Digits.md" >}})| Medium | O(n)| O(1)|| -|456. 132 Pattern | [Go]({{< relref "/ChapterFour/0456.132-Pattern.md" >}})| Medium | O(n)| O(n)|| -|496. Next Greater Element I | [Go]({{< relref "/ChapterFour/0496.Next-Greater-Element-I.md" >}})| Easy | O(n)| O(n)|| -|503. Next Greater Element II | [Go]({{< relref "/ChapterFour/0503.Next-Greater-Element-II.md" >}})| Medium | O(n)| O(n)|| -|636. Exclusive Time of Functions | [Go]({{< relref "/ChapterFour/0636.Exclusive-Time-of-Functions.md" >}})| Medium | O(n)| O(n)|| -|682. Baseball Game | [Go]({{< relref "/ChapterFour/0682.Baseball-Game.md" >}})| Easy | O(n)| O(n)|| -|726. Number of Atoms | [Go]({{< relref "/ChapterFour/0726.Number-of-Atoms.md" >}})| Hard | O(n)| O(n) |❤️| -|735. Asteroid Collision | [Go]({{< relref "/ChapterFour/0735.Asteroid-Collision.md" >}})| Medium | O(n)| O(n) || -|739. Daily Temperatures | [Go]({{< relref "/ChapterFour/0739.Daily-Temperatures.md" >}})| Medium | O(n)| O(n) || -|844. Backspace String Compare | [Go]({{< relref "/ChapterFour/0844.Backspace-String-Compare.md" >}})| Easy | O(n)| O(n) || -|856. Score of Parentheses | [Go]({{< relref "/ChapterFour/0856.Score-of-Parentheses.md" >}})| Medium | O(n)| O(n)|| -|880. Decoded String at Index | [Go]({{< relref "/ChapterFour/0880.Decoded-String-at-Index.md" >}})| Medium | O(n)| O(n)|| -|895. Maximum Frequency Stack | [Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})| Hard | O(n)| O(n) || -|901. Online Stock Span | [Go]({{< relref "/ChapterFour/0901.Online-Stock-Span.md" >}})| Medium | O(n)| O(n) || -|907. Sum of Subarray Minimums | [Go]({{< relref "/ChapterFour/0907.Sum-of-Subarray-Minimums.md" >}})| Medium | O(n)| O(n)|❤️| -|921. Minimum Add to Make Parentheses Valid | [Go]({{< relref "/ChapterFour/0921.Minimum-Add-to-Make-Parentheses-Valid.md" >}})| Medium | O(n)| O(n)|| -|946. Validate Stack Sequences | [Go]({{< relref "/ChapterFour/0946.Validate-Stack-Sequences.md" >}})| Medium | O(n)| O(n)|| -|1003. Check If Word Is Valid After Substitutions | [Go]({{< relref "/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md" >}})| Medium | O(n)| O(1)|| -|1019. Next Greater Node In Linked List | [Go]({{< relref "/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md" >}})| Medium | O(n)| O(1)|| -|1021. Remove Outermost Parentheses | [Go]({{< relref "/ChapterFour/1021.Remove-Outermost-Parentheses.md" >}})| Medium | O(n)| O(1)|| -|1047. Remove All Adjacent Duplicates In String | [Go]({{< relref "/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md" >}})| Medium | O(n)| O(1)|| -|---------------------------------------|-----------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0020|Valid Parentheses|[Go]({{< relref "/ChapterFour/0020.Valid-Parentheses.md" >}})|Easy| O(log n)| O(1)||39.5%| +|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|50.7%| +|0071|Simplify Path|[Go]({{< relref "/ChapterFour/0071.Simplify-Path.md" >}})|Medium| O(n)| O(n)|❤️|33.6%| +|0084|Largest Rectangle in Histogram|[Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}})|Hard| O(n)| O(n)|❤️|36.8%| +|0094|Binary Tree Inorder Traversal|[Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})|Medium| O(n)| O(1)||65.4%| +|0103|Binary Tree Zigzag Level Order Traversal|[Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})|Medium| O(n)| O(n)||49.8%| +|0144|Binary Tree Preorder Traversal|[Go]({{< relref "/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md" >}})|Medium| O(n)| O(1)||57.1%| +|0145|Binary Tree Postorder Traversal|[Go]({{< relref "/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md" >}})|Medium| O(n)| O(1)||57.1%| +|0150|Evaluate Reverse Polish Notation|[Go]({{< relref "/ChapterFour/0150.Evaluate-Reverse-Polish-Notation.md" >}})|Medium| O(n)| O(1)||37.6%| +|0155|Min Stack|[Go]({{< relref "/ChapterFour/0155.Min-Stack.md" >}})|Easy| O(n)| O(n)||46.0%| +|0173|Binary Search Tree Iterator|[Go]({{< relref "/ChapterFour/0173.Binary-Search-Tree-Iterator.md" >}})|Medium| O(n)| O(1)||59.6%| +|0224|Basic Calculator|[Go]({{< relref "/ChapterFour/0224.Basic-Calculator.md" >}})|Hard| O(n)| O(n)||38.0%| +|0225|Implement Stack using Queues|[Go]({{< relref "/ChapterFour/0225.Implement-Stack-using-Queues.md" >}})|Easy| O(n)| O(n)||46.9%| +|0232|Implement Queue using Stacks|[Go]({{< relref "/ChapterFour/0232.Implement-Queue-using-Stacks.md" >}})|Easy| O(n)| O(n)||51.6%| +|0331|Verify Preorder Serialization of a Binary Tree|[Go]({{< relref "/ChapterFour/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md" >}})|Medium| O(n)| O(1)||40.9%| +|0385|Mini Parser|[Go]({{< relref "/ChapterFour/0385.Mini-Parser.md" >}})|Medium||||34.3%| +|0394|Decode String|[Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})|Medium| O(n)| O(n)||52.3%| +|0402|Remove K Digits|[Go]({{< relref "/ChapterFour/0402.Remove-K-Digits.md" >}})|Medium| O(n)| O(1)||28.6%| +|0456|132 Pattern|[Go]({{< relref "/ChapterFour/0456.132-Pattern.md" >}})|Medium| O(n)| O(n)||30.6%| +|0496|Next Greater Element I|[Go]({{< relref "/ChapterFour/0496.Next-Greater-Element-I.md" >}})|Easy| O(n)| O(n)||65.1%| +|0503|Next Greater Element II|[Go]({{< relref "/ChapterFour/0503.Next-Greater-Element-II.md" >}})|Medium| O(n)| O(n)||58.1%| +|0636|Exclusive Time of Functions|[Go]({{< relref "/ChapterFour/0636.Exclusive-Time-of-Functions.md" >}})|Medium| O(n)| O(n)||53.9%| +|0682|Baseball Game|[Go]({{< relref "/ChapterFour/0682.Baseball-Game.md" >}})|Easy| O(n)| O(n)||66.1%| +|0726|Number of Atoms|[Go]({{< relref "/ChapterFour/0726.Number-of-Atoms.md" >}})|Hard| O(n)| O(n) |❤️|51.0%| +|0735|Asteroid Collision|[Go]({{< relref "/ChapterFour/0735.Asteroid-Collision.md" >}})|Medium| O(n)| O(n) ||43.2%| +|0739|Daily Temperatures|[Go]({{< relref "/ChapterFour/0739.Daily-Temperatures.md" >}})|Medium| O(n)| O(n) ||64.3%| +|0844|Backspace String Compare|[Go]({{< relref "/ChapterFour/0844.Backspace-String-Compare.md" >}})|Easy| O(n)| O(n) ||46.8%| +|0856|Score of Parentheses|[Go]({{< relref "/ChapterFour/0856.Score-of-Parentheses.md" >}})|Medium| O(n)| O(n)||62.2%| +|0880|Decoded String at Index|[Go]({{< relref "/ChapterFour/0880.Decoded-String-at-Index.md" >}})|Medium| O(n)| O(n)||28.3%| +|0895|Maximum Frequency Stack|[Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})|Hard| O(n)| O(n) ||62.1%| +|0901|Online Stock Span|[Go]({{< relref "/ChapterFour/0901.Online-Stock-Span.md" >}})|Medium| O(n)| O(n) ||61.1%| +|0907|Sum of Subarray Minimums|[Go]({{< relref "/ChapterFour/0907.Sum-of-Subarray-Minimums.md" >}})|Medium| O(n)| O(n)|❤️|33.2%| +|0921|Minimum Add to Make Parentheses Valid|[Go]({{< relref "/ChapterFour/0921.Minimum-Add-to-Make-Parentheses-Valid.md" >}})|Medium| O(n)| O(n)||74.6%| +|0946|Validate Stack Sequences|[Go]({{< relref "/ChapterFour/0946.Validate-Stack-Sequences.md" >}})|Medium| O(n)| O(n)||63.4%| +|1003|Check If Word Is Valid After Substitutions|[Go]({{< relref "/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md" >}})|Medium| O(n)| O(1)||56.1%| +|1019|Next Greater Node In Linked List|[Go]({{< relref "/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md" >}})|Medium| O(n)| O(1)||58.2%| +|1021|Remove Outermost Parentheses|[Go]({{< relref "/ChapterFour/1021.Remove-Outermost-Parentheses.md" >}})|Easy| O(n)| O(1)||78.7%| +|1047|Remove All Adjacent Duplicates In String|[Go]({{< relref "/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md" >}})|Easy| O(n)| O(1)||70.2%| +|1673|Find the Most Competitive Subsequence|[Go]({{< relref "/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md" >}})|Medium||||38.3%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/String.md b/website/content/ChapterTwo/String.md index 1ea29de5..d129d222 100644 --- a/website/content/ChapterTwo/String.md +++ b/website/content/ChapterTwo/String.md @@ -5,26 +5,50 @@ type: docs # String -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|3. Longest Substring Without Repeating Characters | [Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})| Medium | O(n)| O(1)|❤️| -|17. Letter Combinations of a Phone Number | [Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})| Medium | O(log n)| O(1)|| -|20. Valid Parentheses | [Go]({{< relref "/ChapterFour/0020.Valid-Parentheses.md" >}})| Easy | O(log n)| O(1)|| -|22. Generate Parentheses | [Go]({{< relref "/ChapterFour/0022.Generate-Parentheses.md" >}})| Medium | O(log n)| O(1)|| -|28. Implement strStr() | [Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})| Easy | O(n)| O(1)|| -|30. Substring with Concatenation of All Words | [Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})| Hard | O(n)| O(n)|❤️| -|49. Group Anagrams | [Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})| Medium | O(n log n)| O(n)|| -|71. Simplify Path | [Go]({{< relref "/ChapterFour/0071.Simplify-Path.md" >}})| Medium | O(n)| O(n)|| -|76. Minimum Window Substring | [Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})| Hard | O(n)| O(n)|❤️| -|91. Decode Ways | [Go]({{< relref "/ChapterFour/0091.Decode-Ways.md" >}})| Medium | O(n)| O(n)|| -|93. Restore IP Addresses | [Go]({{< relref "/ChapterFour/0093.Restore-IP-Addresses.md" >}})| Medium | O(n)| O(n)|❤️| -|125. Valid Palindrome | [Go]({{< relref "/ChapterFour/0125.Valid-Palindrome.md" >}})| Easy | O(n)| O(1)|| -|126. Word Ladder II | [Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})| Hard | O(n)| O(n^2)|❤️| -|344. Reverse String | [Go]({{< relref "/ChapterFour/0344.Reverse-String.md" >}})| Easy | O(n)| O(1)|| -|345. Reverse Vowels of a String | [Go]({{< relref "/ChapterFour/0345.Reverse-Vowels-of-a-String.md" >}})| Easy | O(n)| O(1)|| -|767. Reorganize String | [Go]({{< relref "/ChapterFour/0767.Reorganize-String.md" >}})| Medium | O(n log n)| O(log n) |❤️| -|842. Split Array into Fibonacci Sequence | [Go]({{< relref "/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md" >}})| Medium | O(n^2)| O(1)|❤️| -|856. Score of Parentheses | [Go]({{< relref "/ChapterFour/0856.Score-of-Parentheses.md" >}})| Medium | O(n)| O(n)|| -|925. Long Pressed Name | [Go]({{< relref "/ChapterFour/0925.Long-Pressed-Name.md" >}})| Easy | O(n)| O(1)|| -|1003. Check If Word Is Valid After Substitutions | [Go]({{< relref "/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md" >}})| Medium | O(n)| O(1)|| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0003|Longest Substring Without Repeating Characters|[Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})|Medium| O(n)| O(1)|❤️|31.3%| +|0013|Roman to Integer|[Go]({{< relref "/ChapterFour/0013.Roman-to-Integer.md" >}})|Easy||||56.4%| +|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium| O(log n)| O(1)||48.6%| +|0020|Valid Parentheses|[Go]({{< relref "/ChapterFour/0020.Valid-Parentheses.md" >}})|Easy| O(log n)| O(1)||39.5%| +|0022|Generate Parentheses|[Go]({{< relref "/ChapterFour/0022.Generate-Parentheses.md" >}})|Medium| O(log n)| O(1)||64.8%| +|0028|Implement strStr()|[Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})|Easy| O(n)| O(1)||35.0%| +|0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.0%| +|0049|Group Anagrams|[Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})|Medium| O(n log n)| O(n)||58.8%| +|0067|Add Binary|[Go]({{< relref "/ChapterFour/0067.Add-Binary.md" >}})|Easy||||46.6%| +|0071|Simplify Path|[Go]({{< relref "/ChapterFour/0071.Simplify-Path.md" >}})|Medium| O(n)| O(n)||33.6%| +|0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|35.7%| +|0091|Decode Ways|[Go]({{< relref "/ChapterFour/0091.Decode-Ways.md" >}})|Medium| O(n)| O(n)||26.2%| +|0093|Restore IP Addresses|[Go]({{< relref "/ChapterFour/0093.Restore-IP-Addresses.md" >}})|Medium| O(n)| O(n)|❤️|37.2%| +|0125|Valid Palindrome|[Go]({{< relref "/ChapterFour/0125.Valid-Palindrome.md" >}})|Easy| O(n)| O(1)||37.9%| +|0126|Word Ladder II|[Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})|Hard| O(n)| O(n^2)|❤️|23.4%| +|0151|Reverse Words in a String|[Go]({{< relref "/ChapterFour/0151.Reverse-Words-in-a-String.md" >}})|Medium||||23.3%| +|0344|Reverse String|[Go]({{< relref "/ChapterFour/0344.Reverse-String.md" >}})|Easy| O(n)| O(1)||70.0%| +|0345|Reverse Vowels of a String|[Go]({{< relref "/ChapterFour/0345.Reverse-Vowels-of-a-String.md" >}})|Easy| O(n)| O(1)||44.9%| +|0385|Mini Parser|[Go]({{< relref "/ChapterFour/0385.Mini-Parser.md" >}})|Medium||||34.3%| +|0387|First Unique Character in a String|[Go]({{< relref "/ChapterFour/0387.First-Unique-Character-in-a-String.md" >}})|Easy||||53.7%| +|0537|Complex Number Multiplication|[Go]({{< relref "/ChapterFour/0537.Complex-Number-Multiplication.md" >}})|Medium||||68.3%| +|0541|Reverse String II|[Go]({{< relref "/ChapterFour/0541.Reverse-String-II.md" >}})|Easy||||49.0%| +|0557|Reverse Words in a String III|[Go]({{< relref "/ChapterFour/0557.Reverse-Words-in-a-String-III.md" >}})|Easy||||71.5%| +|0632|Smallest Range Covering Elements from K Lists|[Go]({{< relref "/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md" >}})|Hard||||53.9%| +|0767|Reorganize String|[Go]({{< relref "/ChapterFour/0767.Reorganize-String.md" >}})|Medium| O(n log n)| O(log n) |❤️|49.9%| +|0819|Most Common Word|[Go]({{< relref "/ChapterFour/0819.Most-Common-Word.md" >}})|Easy||||45.4%| +|0842|Split Array into Fibonacci Sequence|[Go]({{< relref "/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md" >}})|Medium| O(n^2)| O(1)|❤️|36.7%| +|0856|Score of Parentheses|[Go]({{< relref "/ChapterFour/0856.Score-of-Parentheses.md" >}})|Medium| O(n)| O(n)||62.2%| +|0925|Long Pressed Name|[Go]({{< relref "/ChapterFour/0925.Long-Pressed-Name.md" >}})|Easy| O(n)| O(1)||38.4%| +|1003|Check If Word Is Valid After Substitutions|[Go]({{< relref "/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md" >}})|Medium| O(n)| O(1)||56.1%| +|1108|Defanging an IP Address|[Go]({{< relref "/ChapterFour/1108.Defanging-an-IP-Address.md" >}})|Easy||||88.5%| +|1170|Compare Strings by Frequency of the Smallest Character|[Go]({{< relref "/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md" >}})|Easy||||59.5%| +|1189|Maximum Number of Balloons|[Go]({{< relref "/ChapterFour/1189.Maximum-Number-of-Balloons.md" >}})|Easy||||61.8%| +|1221|Split a String in Balanced Strings|[Go]({{< relref "/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md" >}})|Easy||||84.0%| +|1234|Replace the Substring for Balanced String|[Go]({{< relref "/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md" >}})|Medium||||34.4%| +|1455|Check If a Word Occurs As a Prefix of Any Word in a Sentence|[Go]({{< relref "/ChapterFour/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence.md" >}})|Easy||||64.7%| +|1573|Number of Ways to Split a String|[Go]({{< relref "/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md" >}})|Medium||||30.8%| +|1653|Minimum Deletions to Make String Balanced|[Go]({{< relref "/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}})|Medium||||49.7%| +|1662|Check If Two String Arrays are Equivalent|[Go]({{< relref "/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md" >}})|Easy||||83.7%| +|1668|Maximum Repeating Substring|[Go]({{< relref "/ChapterFour/1668.Maximum-Repeating-Substring.md" >}})|Easy||||38.7%| +|1678|Goal Parser Interpretation|[Go]({{< relref "/ChapterFour/1678.Goal-Parser-Interpretation.md" >}})|Easy||||86.7%| +|1684|Count the Number of Consistent Strings|[Go]({{< relref "/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md" >}})|Easy||||84.2%| +|1694|Reformat Phone Number|[Go]({{< relref "/ChapterFour/1694.Reformat-Phone-Number.md" >}})|Easy||||67.1%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Tree.md b/website/content/ChapterTwo/Tree.md index d8a1267e..352ddefa 100644 --- a/website/content/ChapterTwo/Tree.md +++ b/website/content/ChapterTwo/Tree.md @@ -5,39 +5,65 @@ type: docs # Tree -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|94. Binary Tree Inorder Traversal | [Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})| Medium | O(n)| O(1)|| -|96. Unique Binary Search Trees | [Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}})| Medium | O(n^2)| O(n)|| -|98. Validate Binary Search Tree | [Go]({{< relref "/ChapterFour/0098.Validate-Binary-Search-Tree.md" >}})| Medium | O(n)| O(1)|| -|99. Recover Binary Search Tree | [Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}})| Hard | O(n)| O(1)|| -|100. Same Tree | [Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}})| Easy | O(n)| O(1)|| -|101. Symmetric Tree | [Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})| Easy | O(n)| O(1)|| -|102. Binary Tree Level Order Traversal | [Go]({{< relref "/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md" >}})| Medium | O(n)| O(1)|| -|103. Binary Tree Zigzag Level Order Traversal | [Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})| Medium | O(n)| O(n)|| -|104. Maximum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| -|107. Binary Tree Level Order Traversal II | [Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})| Easy | O(n)| O(1)|| -|108. Convert Sorted Array to Binary Search Tree | [Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})| Easy | O(n)| O(1)|| -|110. Balanced Binary Tree | [Go]({{< relref "/ChapterFour/0110.Balanced-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| -|111. Minimum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| -|112. Path Sum | [Go]({{< relref "/ChapterFour/0112.Path-Sum.md" >}})| Easy | O(n)| O(1)|| -|113. Path Sum II | [Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}})| Medium | O(n)| O(1)|| -|114. Flatten Binary Tree to Linked List | [Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})| Medium | O(n)| O(1)|| -|124. Binary Tree Maximum Path Sum | [Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}})| Hard | O(n)| O(1)|| -|129. Sum Root to Leaf Numbers | [Go]({{< relref "/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md" >}})| Medium | O(n)| O(1)|| -|144. Binary Tree Preorder Traversal | [Go]({{< relref "/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md" >}})| Medium | O(n)| O(1)|| -|145. Binary Tree Postorder Traversal | [Go]({{< relref "/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md" >}})| Hard | O(n)| O(1)|| -|173. Binary Search Tree Iterator | [Go]({{< relref "/ChapterFour/0173.Binary-Search-Tree-Iterator.md" >}})| Medium | O(n)| O(1)|| -|199. Binary Tree Right Side View | [Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})| Medium | O(n)| O(1)|| -|222. Count Complete Tree Nodes | [Go]({{< relref "/ChapterFour/0222.Count-Complete-Tree-Nodes.md" >}})| Medium | O(n)| O(1)|| -|226. Invert Binary Tree | [Go]({{< relref "/ChapterFour/0226.Invert-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| -|230. Kth Smallest Element in a BST | [Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})| Medium | O(n)| O(1)|| -|235. Lowest Common Ancestor of a Binary Search Tree | [Go]({{< relref "/ChapterFour/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md" >}})| Easy | O(n)| O(1)|| -|236. Lowest Common Ancestor of a Binary Tree | [Go]({{< relref "/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md" >}})| Medium | O(n)| O(1)|| -|257. Binary Tree Paths | [Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})| Easy | O(n)| O(1)|| -|404. Sum of Left Leaves | [Go]({{< relref "/ChapterFour/0404.Sum-of-Left-Leaves.md" >}})| Easy | O(n)| O(1)|| -|437. Path Sum III | [Go]({{< relref "/ChapterFour/0437.Path-Sum-III.md" >}})| Easy | O(n)| O(1)|| -|515. Find Largest Value in Each Tree Row | [Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})| Medium | O(n)| O(n)|| -|637. Average of Levels in Binary Tree | [Go]({{< relref "/ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md" >}})| Easy | O(n)| O(n)|| -|993. Cousins in Binary Tree | [Go]({{< relref "/ChapterFour/0993.Cousins-in-Binary-Tree.md" >}})| Easy | O(n)| O(1)|| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0094|Binary Tree Inorder Traversal|[Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})|Medium| O(n)| O(1)||65.4%| +|0095|Unique Binary Search Trees II|[Go]({{< relref "/ChapterFour/0095.Unique-Binary-Search-Trees-II.md" >}})|Medium||||42.1%| +|0096|Unique Binary Search Trees|[Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}})|Medium| O(n^2)| O(n)||54.1%| +|0098|Validate Binary Search Tree|[Go]({{< relref "/ChapterFour/0098.Validate-Binary-Search-Tree.md" >}})|Medium| O(n)| O(1)||28.6%| +|0099|Recover Binary Search Tree|[Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}})|Hard| O(n)| O(1)||42.1%| +|0100|Same Tree|[Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}})|Easy| O(n)| O(1)||54.0%| +|0101|Symmetric Tree|[Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})|Easy| O(n)| O(1)||47.9%| +|0102|Binary Tree Level Order Traversal|[Go]({{< relref "/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md" >}})|Medium| O(n)| O(1)||56.2%| +|0103|Binary Tree Zigzag Level Order Traversal|[Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})|Medium| O(n)| O(n)||49.8%| +|0104|Maximum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||67.7%| +|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| +|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.1%| +|0107|Binary Tree Level Order Traversal II|[Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})|Easy| O(n)| O(1)||54.8%| +|0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||59.9%| +|0110|Balanced Binary Tree|[Go]({{< relref "/ChapterFour/0110.Balanced-Binary-Tree.md" >}})|Easy| O(n)| O(1)||44.6%| +|0111|Minimum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||39.2%| +|0112|Path Sum|[Go]({{< relref "/ChapterFour/0112.Path-Sum.md" >}})|Easy| O(n)| O(1)||42.1%| +|0113|Path Sum II|[Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}})|Medium| O(n)| O(1)||48.6%| +|0114|Flatten Binary Tree to Linked List|[Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})|Medium| O(n)| O(1)||51.4%| +|0124|Binary Tree Maximum Path Sum|[Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}})|Hard| O(n)| O(1)||35.2%| +|0129|Sum Root to Leaf Numbers|[Go]({{< relref "/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md" >}})|Medium| O(n)| O(1)||50.6%| +|0144|Binary Tree Preorder Traversal|[Go]({{< relref "/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md" >}})|Medium| O(n)| O(1)||57.1%| +|0145|Binary Tree Postorder Traversal|[Go]({{< relref "/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md" >}})|Medium| O(n)| O(1)||57.1%| +|0173|Binary Search Tree Iterator|[Go]({{< relref "/ChapterFour/0173.Binary-Search-Tree-Iterator.md" >}})|Medium| O(n)| O(1)||59.6%| +|0199|Binary Tree Right Side View|[Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})|Medium| O(n)| O(1)||55.7%| +|0222|Count Complete Tree Nodes|[Go]({{< relref "/ChapterFour/0222.Count-Complete-Tree-Nodes.md" >}})|Medium| O(n)| O(1)||48.8%| +|0226|Invert Binary Tree|[Go]({{< relref "/ChapterFour/0226.Invert-Binary-Tree.md" >}})|Easy| O(n)| O(1)||66.6%| +|0230|Kth Smallest Element in a BST|[Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})|Medium| O(n)| O(1)||62.1%| +|0235|Lowest Common Ancestor of a Binary Search Tree|[Go]({{< relref "/ChapterFour/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||51.4%| +|0236|Lowest Common Ancestor of a Binary Tree|[Go]({{< relref "/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md" >}})|Medium| O(n)| O(1)||48.1%| +|0257|Binary Tree Paths|[Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})|Easy| O(n)| O(1)||53.2%| +|0337|House Robber III|[Go]({{< relref "/ChapterFour/0337.House-Robber-III.md" >}})|Medium||||51.7%| +|0404|Sum of Left Leaves|[Go]({{< relref "/ChapterFour/0404.Sum-of-Left-Leaves.md" >}})|Easy| O(n)| O(1)||52.2%| +|0437|Path Sum III|[Go]({{< relref "/ChapterFour/0437.Path-Sum-III.md" >}})|Medium| O(n)| O(1)||48.0%| +|0508|Most Frequent Subtree Sum|[Go]({{< relref "/ChapterFour/0508.Most-Frequent-Subtree-Sum.md" >}})|Medium||||58.9%| +|0513|Find Bottom Left Tree Value|[Go]({{< relref "/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md" >}})|Medium||||62.3%| +|0515|Find Largest Value in Each Tree Row|[Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})|Medium| O(n)| O(n)||62.0%| +|0563|Binary Tree Tilt|[Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}})|Easy||||52.6%| +|0572|Subtree of Another Tree|[Go]({{< relref "/ChapterFour/0572.Subtree-of-Another-Tree.md" >}})|Easy||||44.4%| +|0637|Average of Levels in Binary Tree|[Go]({{< relref "/ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md" >}})|Easy| O(n)| O(n)||64.5%| +|0653|Two Sum IV - Input is a BST|[Go]({{< relref "/ChapterFour/0653.Two-Sum-IV---Input-is-a-BST.md" >}})|Easy||||56.1%| +|0662|Maximum Width of Binary Tree|[Go]({{< relref "/ChapterFour/0662.Maximum-Width-of-Binary-Tree.md" >}})|Medium||||40.0%| +|0684|Redundant Connection|[Go]({{< relref "/ChapterFour/0684.Redundant-Connection.md" >}})|Medium||||58.7%| +|0685|Redundant Connection II|[Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})|Hard||||32.9%| +|0834|Sum of Distances in Tree|[Go]({{< relref "/ChapterFour/0834.Sum-of-Distances-in-Tree.md" >}})|Hard||||45.5%| +|0863|All Nodes Distance K in Binary Tree|[Go]({{< relref "/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}})|Medium||||57.5%| +|0872|Leaf-Similar Trees|[Go]({{< relref "/ChapterFour/0872.Leaf-Similar-Trees.md" >}})|Easy||||64.5%| +|0897|Increasing Order Search Tree|[Go]({{< relref "/ChapterFour/0897.Increasing-Order-Search-Tree.md" >}})|Easy||||74.3%| +|0968|Binary Tree Cameras|[Go]({{< relref "/ChapterFour/0968.Binary-Tree-Cameras.md" >}})|Hard||||38.5%| +|0979|Distribute Coins in Binary Tree|[Go]({{< relref "/ChapterFour/0979.Distribute-Coins-in-Binary-Tree.md" >}})|Medium||||69.5%| +|0993|Cousins in Binary Tree|[Go]({{< relref "/ChapterFour/0993.Cousins-in-Binary-Tree.md" >}})|Easy| O(n)| O(1)||52.2%| +|1026|Maximum Difference Between Node and Ancestor|[Go]({{< relref "/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}})|Medium||||69.1%| +|1028|Recover a Tree From Preorder Traversal|[Go]({{< relref "/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md" >}})|Hard||||70.7%| +|1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||67.5%| +|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||67.8%| +|1145|Binary Tree Coloring Game|[Go]({{< relref "/ChapterFour/1145.Binary-Tree-Coloring-Game.md" >}})|Medium||||51.4%| +|1302|Deepest Leaves Sum|[Go]({{< relref "/ChapterFour/1302.Deepest-Leaves-Sum.md" >}})|Medium||||84.1%| +|1305|All Elements in Two Binary Search Trees|[Go]({{< relref "/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}})|Medium||||77.8%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Two_Pointers.md b/website/content/ChapterTwo/Two_Pointers.md index ece49e88..89c959a3 100644 --- a/website/content/ChapterTwo/Two_Pointers.md +++ b/website/content/ChapterTwo/Two_Pointers.md @@ -28,56 +28,63 @@ type: docs - 替换字母以后,相同字母能出现连续最长的长度。第 424 题。 - SUM 问题集。第 1 题,第 15 题,第 16 题,第 18 题,第 167 题,第 923 题,第 1074 题。 -| Title | Solution | Difficulty | Time | Space |收藏| -| ----- | :--------: | :----------: | :----: | :-----: | :-----: | -|3. Longest Substring Without Repeating Characters | [Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})| Medium | O(n)| O(1)|❤️| -|11. Container With Most Water | [Go]({{< relref "/ChapterFour/0011.Container-With-Most-Water.md" >}})| Medium | O(n)| O(1)|| -|15. 3Sum | [Go]({{< relref "/ChapterFour/0015.3Sum.md" >}})| Medium | O(n^2)| O(n)|❤️| -|16. 3Sum Closest | [Go]({{< relref "/ChapterFour/0016.3Sum-Closest.md" >}})| Medium | O(n^2)| O(1)|❤️| -|18. 4Sum | [Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})| Medium | O(n^3)| O(n^2)|❤️| -|19. Remove Nth Node From End of List | [Go]({{< relref "/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md" >}})| Medium | O(n)| O(1)|| -|26. Remove Duplicates from Sorted Array | [Go]({{< relref "/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md" >}})| Easy | O(n)| O(1)|| -|27. Remove Element | [Go]({{< relref "/ChapterFour/0027.Remove-Element.md" >}})| Easy | O(n)| O(1)|| -|28. Implement strStr() | [Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})| Easy | O(n)| O(1)|| -|30. Substring with Concatenation of All Words | [Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})| Hard | O(n)| O(n)|❤️| -|42. Trapping Rain Water | [Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})| Hard | O(n)| O(1)|❤️| -|61. Rotate List | [Go]({{< relref "/ChapterFour/0061.Rotate-List.md" >}})| Medium | O(n)| O(1)|| -|75. Sort Colors | [Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})| Medium| O(n)| O(1)|❤️| -|76. Minimum Window Substring | [Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})| Hard | O(n)| O(n)|❤️| -|80. Remove Duplicates from Sorted Array II | [Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})| Medium | O(n)| O(1|| -|86. Partition List | [Go]({{< relref "/ChapterFour/0086.Partition-List.md" >}})| Medium | O(n)| O(1)|❤️| -|88. Merge Sorted Array | [Go]({{< relref "/ChapterFour/0088.Merge-Sorted-Array.md" >}})| Easy | O(n)| O(1)|❤️| -|125. Valid Palindrome | [Go]({{< relref "/ChapterFour/0125.Valid-Palindrome.md" >}})| Easy | O(n)| O(1)|| -|141. Linked List Cycle | [Go]({{< relref "/ChapterFour/0141.Linked-List-Cycle.md" >}})| Easy | O(n)| O(1)|❤️| -|142. Linked List Cycle II | [Go]({{< relref "/ChapterFour/0142.Linked-List-Cycle-II.md" >}})| Medium | O(n)| O(1)|❤️| -|167. Two Sum II - Input array is sorted | [Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})| Easy | O(n)| O(1)|| -|209. Minimum Size Subarray Sum | [Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})| Medium | O(n)| O(1)|| -|234. Palindrome Linked List | [Go]({{< relref "/ChapterFour/0234.Palindrome-Linked-List.md" >}})| Easy | O(n)| O(1)|| -|283. Move Zeroes | [Go]({{< relref "/ChapterFour/0283.Move-Zeroes.md" >}})| Easy | O(n)| O(1)|| -|287. Find the Duplicate Number | [Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})| Easy | O(n)| O(1)|❤️| -|344. Reverse String | [Go]({{< relref "/ChapterFour/0344.Reverse-String.md" >}})| Easy | O(n)| O(1)|| -|345. Reverse Vowels of a String | [Go]({{< relref "/ChapterFour/0345.Reverse-Vowels-of-a-String.md" >}})| Easy | O(n)| O(1)|| -|349. Intersection of Two Arrays | [Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})| Easy | O(n)| O(n) || -|350. Intersection of Two Arrays II | [Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})| Easy | O(n)| O(n) || -|424. Longest Repeating Character Replacement | [Go]({{< relref "/ChapterFour/0424.Longest-Repeating-Character-Replacement.md" >}})| Medium | O(n)| O(1) || -|524. Longest Word in Dictionary through Deleting | [Go]({{< relref "/ChapterFour/0524.Longest-Word-in-Dictionary-through-Deleting.md" >}})| Medium | O(n)| O(1) || -|532. K-diff Pairs in an Array | [Go]({{< relref "/ChapterFour/0532.K-diff-Pairs-in-an-Array.md" >}})| Easy | O(n)| O(n)|| -|567. Permutation in String | [Go]({{< relref "/ChapterFour/0567.Permutation-in-String.md" >}})| Medium | O(n)| O(1)|❤️| -|713. Subarray Product Less Than K | [Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})| Medium | O(n)| O(1)|| -|763. Partition Labels | [Go]({{< relref "/ChapterFour/0763.Partition-Labels.md" >}})| Medium | O(n)| O(1)|❤️| -|826. Most Profit Assigning Work | [Go]({{< relref "/ChapterFour/0826.Most-Profit-Assigning-Work.md" >}})| Medium | O(n log n)| O(n)|| -|828. Unique Letter String | [Go]({{< relref "/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md" >}})| Hard | O(n)| O(1)|❤️| -|838. Push Dominoes | [Go]({{< relref "/ChapterFour/0838.Push-Dominoes.md" >}})| Medium | O(n)| O(n)|| -|844. Backspace String Compare | [Go]({{< relref "/ChapterFour/0844.Backspace-String-Compare.md" >}})| Easy | O(n)| O(n) || -|845. Longest Mountain in Array | [Go]({{< relref "/ChapterFour/0845.Longest-Mountain-in-Array.md" >}})| Medium | O(n)| O(1) || -|881. Boats to Save People | [Go]({{< relref "/ChapterFour/0881.Boats-to-Save-People.md" >}})| Medium | O(n log n)| O(1) || -|904. Fruit Into Baskets | [Go]({{< relref "/ChapterFour/0904.Fruit-Into-Baskets.md" >}})| Medium | O(n log n)| O(1) || -|923. 3Sum With Multiplicity | [Go]({{< relref "/ChapterFour/0923.3Sum-With-Multiplicity.md" >}})| Medium | O(n^2)| O(n) || -|925. Long Pressed Name | [Go]({{< relref "/ChapterFour/0925.Long-Pressed-Name.md" >}})| Easy | O(n)| O(1)|| -|930. Binary Subarrays With Sum | [Go]({{< relref "/ChapterFour/0930.Binary-Subarrays-With-Sum.md" >}})| Medium | O(n)| O(n) |❤️| -|977. Squares of a Sorted Array | [Go]({{< relref "/ChapterFour/0977.Squares-of-a-Sorted-Array.md" >}})| Easy | O(n)| O(1)|| -|986. Interval List Intersections | [Go]({{< relref "/ChapterFour/0986.Interval-List-Intersections.md" >}})| Medium | O(n)| O(1)|| -|992. Subarrays with K Different Integers | [Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})| Hard | O(n)| O(n)|❤️| -|1004. Max Consecutive Ones III | [Go]({{< relref "/ChapterFour/1004.Max-Consecutive-Ones-III.md" >}})| Medium | O(n)| O(1) || -|1093. Statistics from a Large Sample | [Go]({{< relref "/ChapterFour/1093.Statistics-from-a-Large-Sample.md" >}})| Medium | O(n)| O(1) || -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0003|Longest Substring Without Repeating Characters|[Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})|Medium| O(n)| O(1)|❤️|31.3%| +|0011|Container With Most Water|[Go]({{< relref "/ChapterFour/0011.Container-With-Most-Water.md" >}})|Medium| O(n)| O(1)||52.2%| +|0015|3Sum|[Go]({{< relref "/ChapterFour/0015.3Sum.md" >}})|Medium| O(n^2)| O(n)|❤️|27.8%| +|0016|3Sum Closest|[Go]({{< relref "/ChapterFour/0016.3Sum-Closest.md" >}})|Medium| O(n^2)| O(1)|❤️|46.2%| +|0018|4Sum|[Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})|Medium| O(n^3)| O(n^2)|❤️|34.6%| +|0019|Remove Nth Node From End of List|[Go]({{< relref "/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md" >}})|Medium| O(n)| O(1)||35.6%| +|0026|Remove Duplicates from Sorted Array|[Go]({{< relref "/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md" >}})|Easy| O(n)| O(1)||46.3%| +|0027|Remove Element|[Go]({{< relref "/ChapterFour/0027.Remove-Element.md" >}})|Easy| O(n)| O(1)||49.0%| +|0028|Implement strStr()|[Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})|Easy| O(n)| O(1)||35.0%| +|0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.0%| +|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|50.7%| +|0061|Rotate List|[Go]({{< relref "/ChapterFour/0061.Rotate-List.md" >}})|Medium| O(n)| O(1)||31.6%| +|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|48.9%| +|0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|35.7%| +|0080|Remove Duplicates from Sorted Array II|[Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})|Medium| O(n)| O(1||45.8%| +|0086|Partition List|[Go]({{< relref "/ChapterFour/0086.Partition-List.md" >}})|Medium| O(n)| O(1)|❤️|43.0%| +|0088|Merge Sorted Array|[Go]({{< relref "/ChapterFour/0088.Merge-Sorted-Array.md" >}})|Easy| O(n)| O(1)|❤️|40.6%| +|0125|Valid Palindrome|[Go]({{< relref "/ChapterFour/0125.Valid-Palindrome.md" >}})|Easy| O(n)| O(1)||37.9%| +|0141|Linked List Cycle|[Go]({{< relref "/ChapterFour/0141.Linked-List-Cycle.md" >}})|Easy| O(n)| O(1)|❤️|42.2%| +|0142|Linked List Cycle II|[Go]({{< relref "/ChapterFour/0142.Linked-List-Cycle-II.md" >}})|Medium| O(n)| O(1)|❤️|39.3%| +|0167|Two Sum II - Input array is sorted|[Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})|Easy| O(n)| O(1)||55.4%| +|0209|Minimum Size Subarray Sum|[Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})|Medium| O(n)| O(1)||39.2%| +|0234|Palindrome Linked List|[Go]({{< relref "/ChapterFour/0234.Palindrome-Linked-List.md" >}})|Easy| O(n)| O(1)||40.2%| +|0283|Move Zeroes|[Go]({{< relref "/ChapterFour/0283.Move-Zeroes.md" >}})|Easy| O(n)| O(1)||58.4%| +|0287|Find the Duplicate Number|[Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})|Medium| O(n)| O(1)|❤️|57.1%| +|0344|Reverse String|[Go]({{< relref "/ChapterFour/0344.Reverse-String.md" >}})|Easy| O(n)| O(1)||70.0%| +|0345|Reverse Vowels of a String|[Go]({{< relref "/ChapterFour/0345.Reverse-Vowels-of-a-String.md" >}})|Easy| O(n)| O(1)||44.9%| +|0349|Intersection of Two Arrays|[Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})|Easy| O(n)| O(n) ||64.4%| +|0350|Intersection of Two Arrays II|[Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})|Easy| O(n)| O(n) ||51.9%| +|0424|Longest Repeating Character Replacement|[Go]({{< relref "/ChapterFour/0424.Longest-Repeating-Character-Replacement.md" >}})|Medium| O(n)| O(1) ||48.0%| +|0457|Circular Array Loop|[Go]({{< relref "/ChapterFour/0457.Circular-Array-Loop.md" >}})|Medium||||30.0%| +|0524|Longest Word in Dictionary through Deleting|[Go]({{< relref "/ChapterFour/0524.Longest-Word-in-Dictionary-through-Deleting.md" >}})|Medium| O(n)| O(1) ||48.9%| +|0532|K-diff Pairs in an Array|[Go]({{< relref "/ChapterFour/0532.K-diff-Pairs-in-an-Array.md" >}})|Medium| O(n)| O(n)||34.9%| +|0567|Permutation in String|[Go]({{< relref "/ChapterFour/0567.Permutation-in-String.md" >}})|Medium| O(n)| O(1)|❤️|44.6%| +|0632|Smallest Range Covering Elements from K Lists|[Go]({{< relref "/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md" >}})|Hard||||53.9%| +|0713|Subarray Product Less Than K|[Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})|Medium| O(n)| O(1)||40.4%| +|0763|Partition Labels|[Go]({{< relref "/ChapterFour/0763.Partition-Labels.md" >}})|Medium| O(n)| O(1)|❤️|77.9%| +|0826|Most Profit Assigning Work|[Go]({{< relref "/ChapterFour/0826.Most-Profit-Assigning-Work.md" >}})|Medium| O(n log n)| O(n)||38.9%| +|0828|Count Unique Characters of All Substrings of a Given String|[Go]({{< relref "/ChapterFour/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md" >}})|Hard| O(n)| O(1)|❤️|46.8%| +|0838|Push Dominoes|[Go]({{< relref "/ChapterFour/0838.Push-Dominoes.md" >}})|Medium| O(n)| O(n)||49.7%| +|0844|Backspace String Compare|[Go]({{< relref "/ChapterFour/0844.Backspace-String-Compare.md" >}})|Easy| O(n)| O(n) ||46.8%| +|0845|Longest Mountain in Array|[Go]({{< relref "/ChapterFour/0845.Longest-Mountain-in-Array.md" >}})|Medium| O(n)| O(1) ||38.5%| +|0881|Boats to Save People|[Go]({{< relref "/ChapterFour/0881.Boats-to-Save-People.md" >}})|Medium| O(n log n)| O(1) ||48.7%| +|0904|Fruit Into Baskets|[Go]({{< relref "/ChapterFour/0904.Fruit-Into-Baskets.md" >}})|Medium| O(n log n)| O(1) ||42.9%| +|0923|3Sum With Multiplicity|[Go]({{< relref "/ChapterFour/0923.3Sum-With-Multiplicity.md" >}})|Medium| O(n^2)| O(n) ||36.0%| +|0925|Long Pressed Name|[Go]({{< relref "/ChapterFour/0925.Long-Pressed-Name.md" >}})|Easy| O(n)| O(1)||38.4%| +|0930|Binary Subarrays With Sum|[Go]({{< relref "/ChapterFour/0930.Binary-Subarrays-With-Sum.md" >}})|Medium| O(n)| O(n) |❤️|44.3%| +|0977|Squares of a Sorted Array|[Go]({{< relref "/ChapterFour/0977.Squares-of-a-Sorted-Array.md" >}})|Easy| O(n)| O(1)||72.3%| +|0986|Interval List Intersections|[Go]({{< relref "/ChapterFour/0986.Interval-List-Intersections.md" >}})|Medium| O(n)| O(1)||68.1%| +|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n)|❤️|50.4%| +|1004|Max Consecutive Ones III|[Go]({{< relref "/ChapterFour/1004.Max-Consecutive-Ones-III.md" >}})|Medium| O(n)| O(1) ||60.5%| +|1093|Statistics from a Large Sample|[Go]({{< relref "/ChapterFour/1093.Statistics-from-a-Large-Sample.md" >}})|Medium| O(n)| O(1) ||49.3%| +|1234|Replace the Substring for Balanced String|[Go]({{< relref "/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md" >}})|Medium||||34.4%| +|1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.6%| +|1695|Maximum Erasure Value|[Go]({{< relref "/ChapterFour/1695.Maximum-Erasure-Value.md" >}})|Medium||||49.5%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| +| diff --git a/website/content/ChapterTwo/Union_Find.md b/website/content/ChapterTwo/Union_Find.md index 79b693d5..c72622df 100644 --- a/website/content/ChapterTwo/Union_Find.md +++ b/website/content/ChapterTwo/Union_Find.md @@ -15,24 +15,26 @@ type: docs - 能用并查集的题目,一般也可以用 DFS 和 BFS 解答,只不过时间复杂度会高一点。 -| Title | Solution | Difficulty | Time | Space | 收藏 | -| ----- | :--------: | :----------: | :----: | :-----: |:-----: | -|128. Longest Consecutive Sequence | [Go]({{< relref "/ChapterFour/0128.Longest-Consecutive-Sequence.md" >}})| Hard | O(n)| O(n)|❤️| -|130. Surrounded Regions | [Go]({{< relref "/ChapterFour/0130.Surrounded-Regions.md" >}})| Medium | O(m\*n)| O(m\*n)|| -|200. Number of Islands | [Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})| Medium | O(m\*n)| O(m\*n)|| -|399. Evaluate Division | [Go]({{< relref "/ChapterFour/0399.Evaluate-Division.md" >}})| Medium | O(n)| O(n)|| -|547. Friend Circles | [Go]({{< relref "/ChapterFour/0547.Friend-Circles.md" >}})| Medium | O(n^2)| O(n)|| -|684. Redundant Connection | [Go]({{< relref "/ChapterFour/0684.Redundant-Connection.md" >}})| Medium | O(n)| O(n)|| -|685. Redundant Connection II | [Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})| Hard | O(n)| O(n)|| -|721. Accounts Merge | [Go]({{< relref "/ChapterFour/0721.Accounts-Merge.md" >}})| Medium | O(n)| O(n)|❤️| -|765. Couples Holding Hands | [Go]({{< relref "/ChapterFour/0765.Couples-Holding-Hands.md" >}})| Hard | O(n)| O(n)|❤️| -|778. Swim in Rising Water | [Go]({{< relref "/ChapterFour/0778.Swim-in-Rising-Water.md" >}})| Hard | O(n^2)| O(n)|❤️| -|803. Bricks Falling When Hit | [Go]({{< relref "/ChapterFour/0803.Bricks-Falling-When-Hit.md" >}})| Hard | O(n^2)| O(n)|❤️| -|839. Similar String Groups | [Go]({{< relref "/ChapterFour/0839.Similar-String-Groups.md" >}})| Hard | O(n^2)| O(n)|| -|924. Minimize Malware Spread | [Go]({{< relref "/ChapterFour/0924.Minimize-Malware-Spread.md" >}})| Hard | O(m\*n)| O(n)|| -|928. Minimize Malware Spread II | [Go]({{< relref "/ChapterFour/0928.Minimize-Malware-Spread-II.md" >}})| Hard | O(m\*n)| O(n)|❤️| -|947. Most Stones Removed with Same Row or Column | [Go]({{< relref "/ChapterFour/0947.Most-Stones-Removed-with-Same-Row-or-Column.md" >}})| Medium | O(n)| O(n)|| -|952. Largest Component Size by Common Factor | [Go]({{< relref "/ChapterFour/0952.Largest-Component-Size-by-Common-Factor.md" >}})| Hard | O(n)| O(n)|❤️| -|959. Regions Cut By Slashes | [Go]({{< relref "/ChapterFour/0959.Regions-Cut-By-Slashes.md" >}})| Medium | O(n^2)| O(n^2)|❤️| -|990. Satisfiability of Equality Equations | [Go]({{< relref "/ChapterFour/0990.Satisfiability-of-Equality-Equations.md" >}})| Medium | O(n)| O(n)|| -|---------------------------------------|---------------------------------|--------------------------|-----------------------|-----------|--------| \ No newline at end of file + +| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | +|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | +|0128|Longest Consecutive Sequence|[Go]({{< relref "/ChapterFour/0128.Longest-Consecutive-Sequence.md" >}})|Hard| O(n)| O(n)|❤️|46.0%| +|0130|Surrounded Regions|[Go]({{< relref "/ChapterFour/0130.Surrounded-Regions.md" >}})|Medium| O(m\*n)| O(m\*n)||29.2%| +|0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})|Medium| O(m\*n)| O(m\*n)||48.6%| +|0399|Evaluate Division|[Go]({{< relref "/ChapterFour/0399.Evaluate-Division.md" >}})|Medium| O(n)| O(n)||54.0%| +|0547|Number of Provinces|[Go]({{< relref "/ChapterFour/0547.Number-of-Provinces.md" >}})|Medium| O(n^2)| O(n)||60.1%| +|0684|Redundant Connection|[Go]({{< relref "/ChapterFour/0684.Redundant-Connection.md" >}})|Medium| O(n)| O(n)||58.7%| +|0685|Redundant Connection II|[Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})|Hard| O(n)| O(n)||32.9%| +|0721|Accounts Merge|[Go]({{< relref "/ChapterFour/0721.Accounts-Merge.md" >}})|Medium| O(n)| O(n)|❤️|51.2%| +|0765|Couples Holding Hands|[Go]({{< relref "/ChapterFour/0765.Couples-Holding-Hands.md" >}})|Hard| O(n)| O(n)|❤️|55.3%| +|0778|Swim in Rising Water|[Go]({{< relref "/ChapterFour/0778.Swim-in-Rising-Water.md" >}})|Hard| O(n^2)| O(n)|❤️|54.4%| +|0803|Bricks Falling When Hit|[Go]({{< relref "/ChapterFour/0803.Bricks-Falling-When-Hit.md" >}})|Hard| O(n^2)| O(n)|❤️|31.2%| +|0839|Similar String Groups|[Go]({{< relref "/ChapterFour/0839.Similar-String-Groups.md" >}})|Hard| O(n^2)| O(n)||40.0%| +|0924|Minimize Malware Spread|[Go]({{< relref "/ChapterFour/0924.Minimize-Malware-Spread.md" >}})|Hard| O(m\*n)| O(n)||41.8%| +|0928|Minimize Malware Spread II|[Go]({{< relref "/ChapterFour/0928.Minimize-Malware-Spread-II.md" >}})|Hard| O(m\*n)| O(n)|❤️|41.2%| +|0947|Most Stones Removed with Same Row or Column|[Go]({{< relref "/ChapterFour/0947.Most-Stones-Removed-with-Same-Row-or-Column.md" >}})|Medium| O(n)| O(n)||55.4%| +|0952|Largest Component Size by Common Factor|[Go]({{< relref "/ChapterFour/0952.Largest-Component-Size-by-Common-Factor.md" >}})|Hard| O(n)| O(n)|❤️|36.1%| +|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0959.Regions-Cut-By-Slashes.md" >}})|Medium| O(n^2)| O(n^2)|❤️|66.8%| +|0990|Satisfiability of Equality Equations|[Go]({{< relref "/ChapterFour/0990.Satisfiability-of-Equality-Equations.md" >}})|Medium| O(n)| O(n)||46.4%| +|1202|Smallest String With Swaps|[Go]({{< relref "/ChapterFour/1202.Smallest-String-With-Swaps.md" >}})|Medium||||48.3%| +|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/menu/index.md b/website/content/menu/index.md index de7f9a68..60a9f27c 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -184,7 +184,7 @@ headless: true - [0208.Implement-Trie-Prefix-Tree]({{< relref "/ChapterFour/0208.Implement-Trie-Prefix-Tree.md" >}}) - [0209.Minimum-Size-Subarray-Sum]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}}) - [0210.Course-Schedule-II]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}}) - - [0211.Add-and-Search-Word---Data-structure-design]({{< relref "/ChapterFour/0211.Add-and-Search-Word---Data-structure-design.md" >}}) + - [0211.Design-Add-and-Search-Words-Data-Structure]({{< relref "/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md" >}}) - [0212.Word-Search-II]({{< relref "/ChapterFour/0212.Word-Search-II.md" >}}) - [0213.House-Robber-II]({{< relref "/ChapterFour/0213.House-Robber-II.md" >}}) - [0215.Kth-Largest-Element-in-an-Array]({{< relref "/ChapterFour/0215.Kth-Largest-Element-in-an-Array.md" >}}) From e1a090b451913df191f067583b9cf02d89b42d3e Mon Sep 17 00:00:00 2001 From: YDZ Date: Sat, 16 Jan 2021 19:28:27 +0800 Subject: [PATCH 76/82] Add pre-next --- README_old.md | 1173 +++++++++++++++++ ctl/label.go | 248 +++- ctl/render.go | 5 +- ctl/util/util.go | 30 +- go.mod | 16 + go.sum | 321 +++++ ...owest-Common-Ancestor-of-Deepest-Leaves.md | 2 +- website/content/ChapterOne/Algorithm.md | 9 +- website/content/ChapterOne/Data_Structure.md | 9 +- website/content/ChapterOne/_index.md | 7 +- website/content/ChapterThree/LFUCache.md | 9 +- website/content/ChapterThree/LRUCache.md | 9 +- website/content/ChapterThree/Segment_Tree.md | 9 +- website/content/ChapterThree/UnionFind.md | 9 +- website/content/ChapterThree/_index.md | 9 +- website/content/ChapterTwo/Array.md | 7 + website/content/ChapterTwo/Backtracking.md | 7 + .../content/ChapterTwo/Binary_Indexed_Tree.md | 7 + website/content/ChapterTwo/Binary_Search.md | 8 +- .../content/ChapterTwo/Bit_Manipulation.md | 7 + .../ChapterTwo/Breadth_First_Search.md | 7 + .../content/ChapterTwo/Depth_First_Search.md | 7 + .../content/ChapterTwo/Dynamic_Programming.md | 7 + website/content/ChapterTwo/Hash_Table.md | 7 + website/content/ChapterTwo/Linked_List.md | 7 + website/content/ChapterTwo/Math.md | 7 + website/content/ChapterTwo/Segment_Tree.md | 7 + website/content/ChapterTwo/Sliding_Window.md | 7 + website/content/ChapterTwo/Sort.md | 7 + website/content/ChapterTwo/Stack.md | 7 + website/content/ChapterTwo/String.md | 7 + website/content/ChapterTwo/Tree.md | 7 + website/content/ChapterTwo/Two_Pointers.md | 9 +- website/content/ChapterTwo/Union_Find.md | 7 + website/content/ChapterTwo/_index.md | 7 + 35 files changed, 1993 insertions(+), 15 deletions(-) create mode 100644 README_old.md create mode 100644 go.mod create mode 100644 go.sum diff --git a/README_old.md b/README_old.md new file mode 100644 index 00000000..bc1892c4 --- /dev/null +++ b/README_old.md @@ -0,0 +1,1173 @@ + +# LeetCode by Go +[LeetCode Online Judge] (https://leetcode.com/) is a website containing many **algorithm questions**. Most of them are real interview questions of **Google, Facebook, LinkedIn, Apple**, etc. This repo shows my solutions by Go with the code style strictly follows the [Google Golang Style Guide](https://github.com/golang/go/wiki/CodeReviewComments). Please feel free to reference and **STAR** to support this repo, thank you! + + +

+ +

+ + + + +## 数据结构 + +| 数据结构 | 变种 | 相关题目 | +|:-------:|:-------|:------| +|顺序线性表:向量||| +|单链表|1.双链表
2.静态链表
3.对称矩阵
4.稀疏矩阵|| +|栈|广义栈|| +|队列|1.链表实现
2.循环数组实现
3.双端队列|| +|字符串|1.KMP算法
2.有限状态自动机
3.模式匹配有限状态自动机
4.BM模式匹配算法
5.BM-KMP算法|| +|树|1.二叉树
2.并查集
3.Huffman数|| +|数组实现的堆|1.极大堆和极小堆
2.极大极小堆
3.双端堆
4.d叉堆|| +|树实现的堆|1.左堆
2.扁堆
3.二项式堆
4.斐波那契堆
5.配对堆|| +|查找|1.哈希表
2.跳跃表
3.排序二叉树
4.AVL树
5.B树
6.AA树
7.红黑树
8.排序二叉堆
9.Splay树
10.双链树
11.Trie树|| + + +## Data Structures + +> 标识了 (已全部做完) 的专题是全部完成了的,没有标识的是还没有做完的 + +* [Array](#array) +* [String](#string) +* [Linked List](#linked-list) +* [Stack](#stack) +* [Tree](#tree) +* [Dynamic programming](#dynamic-programming) +* [Depth-first search](#depth-first-search) +* [Math](#math) +* [Search](#search) +* [Sort](#sort) +* [Union Find](#union-find) + +## Companies +* [Google](#google) +* [Facebook](#facebook) +* [Snapchat](#snapchat) +* [Uber](#uber) +* [Airbnb](#airbnb) +* [LinkedIn](#linkedin) +* [Amazon](#amazon) +* [Microsoft](#microsoft) + + +## 算法 + + +## 一. 目录 + +|题号|题目|通过率|难度|收藏| +|:--:|:--|:--: | :--: | :--: | +|1|[Two Sum](./Algorithms/1.two-sum)|38%|Easy|| +|2|[Add Two Numbers](./Algorithms/2.add-two-numbers)|28%|Medium|| +|3|[Longest Substring Without Repeating Characters](./Algorithms/3.longest-substring-without-repeating-characters)|24%|Medium|| +|4|[Median of Two Sorted Arrays](./Algorithms/4.median-of-two-sorted-arrays)|23%|Hard|| +|5|[Longest Palindromic Substring](./Algorithms/5.longest-palindromic-substring)|25%|Medium|| +|6|[ZigZag Conversion](./Algorithms/6.zigzag-conversion)|27%|Medium|| +|7|[Reverse Integer](./Algorithms/7.reverse-integer)|24%|Easy|| +|8|[String to Integer (atoi)](./Algorithms/8.string-to-integer-atoi)|14%|Medium|| +|9|[Palindrome Number](./Algorithms/9.palindrome-number)|35%|Easy|| +|10|[Regular Expression Matching](./Algorithms/10.regular-expression-matching)|24%|Hard|❤️| +|11|[Container With Most Water](./Algorithms/11.container-with-most-water)|37%|Medium|| +|12|[Integer to Roman](./Algorithms/12.integer-to-roman)|46%|Medium|| +|13|[Roman to Integer](./Algorithms/13.roman-to-integer)|48%|Easy|| +|14|[Longest Common Prefix](./Algorithms/14.longest-common-prefix)|31%|Easy|| +|15|[3Sum](./Algorithms/15.3sum)|21%|Medium|| +|16|[3Sum Closest](./Algorithms/16.3sum-closest)|31%|Medium|| +|17|[Letter Combinations of a Phone Number](./Algorithms/17.letter-combinations-of-a-phone-number)|36%|Medium|| +|18|[4Sum](./Algorithms/18.4sum)|27%|Medium|| +|19|[Remove Nth Node From End of List](./Algorithms/19.remove-nth-node-from-end-of-list)|33%|Medium|| +|20|[Valid Parentheses](./Algorithms/20.Valid-Parentheses)|33%|Easy|| +|21|[Merge Two Sorted Lists](./Algorithms/21.merge-two-sorted-lists)|41%|Easy|| +|22|[Generate Parentheses](./Algorithms/22.generate-parentheses)|48%|Medium|❤️| +|23|[Merge k Sorted Lists](./Algorithms/23.merge-k-sorted-lists)|28%|Hard|| +|24|[Swap Nodes in Pairs](./Algorithms/24.Swap-Nodes-In-Pairs)|39%|Medium|❤️| +|25|[Reverse Nodes in k-Group](./Algorithms/25.Reverse-Nodes-In-k-Group)|31%|Hard|❤️| +|26|[Remove Duplicates from Sorted Array](./Algorithms/26.remove-duplicates-from-sorted-array)|36%|Easy|❤️| +|27|[Remove Element](./Algorithms/27.remove-element)|40%|Easy|| +|28|[Implement strStr()](./Algorithms/28.implement-strstr)|28%|Easy|| +|29|[Divide Two Integers](./Algorithms/29.divide-two-integers)|15%|Medium|| +|30|[Substring with Concatenation of All Words](./Algorithms/30.substring-with-concatenation-of-all-words)|22%|Hard|❤️| +|31|[Next Permutation](./Algorithms/31.next-permutation)|29%|Medium|❤️| +|32|[Longest Valid Parentheses](./Algorithms/32.longest-valid-parentheses)|23%|Hard|| +|33|[Search in Rotated Sorted Array](./Algorithms/33.search-in-rotated-sorted-array)|31%|Medium|❤️| +|34|[Search for a Range](./Algorithms/34.search-for-a-range)|31%|Medium|| +|35|[Search Insert Position](./Algorithms/35.search-insert-position)|40%|Easy|| +|36|[Valid Sudoku](./Algorithms/36.valid-sudoku)|37%|Medium|❤️| +|37|[Sudoku Solver](./Algorithms/37.sudoku-solver)|32%|Hard|❤️| +|38|[Count and Say](./Algorithms/38.count-and-say)|36%|Easy|| +|39|[Combination Sum](./Algorithms/39.combination-sum)|41%|Medium|| +|40|[Combination Sum II](./Algorithms/40.combination-sum-ii)|35%|Medium|| +|41|[First Missing Positive](./Algorithms/41.First-Missing-Positive)|25%|Hard|| +|42|[Trapping Rain Water](./Algorithms/42.trapping-rain-water)|37%|Hard|| +|43|[Multiply Strings](./Algorithms/43.multiply-strings)|28%|Medium|| +|44|[Wildcard Matching](./Algorithms/44.wildcard-matching)|21%|Hard|❤️| +|45|[Jump Game II](./Algorithms/45.jump-game-ii)|26%|Hard|| +|46|[Permutations](./Algorithms/46.permutations)|47%|Medium|| +|47|[Permutations II](./Algorithms/47.permutations-ii)|35%|Medium|| +|48|[Rotate Image](./Algorithms/48.rotate-image)|41%|Medium|| +|49|[Group Anagrams](./Algorithms/49.group-anagrams)|38%|Medium|❤️| +|50|[Pow(x, n)](./Algorithms/50.powx-n)|26%|Medium|| +|51|[N-Queens](./Algorithms/51.n-queens)|33%|Hard|| +|52|[N-Queens II](./Algorithms/52.n-queens-ii)|46%|Hard|| +|53|[Maximum Subarray](./Algorithms/53.maximum-subarray)|40%|Easy|❤️| +|54|[Spiral Matrix](./Algorithms/54.spiral-matrix)|27%|Medium|❤️| +|55|[Jump Game](./Algorithms/55.jump-game)|29%|Medium|| +|56|[Merge Intervals](./Algorithms/56.merge-intervals)|31%|Medium|❤️| +|57|[Insert Interval](./Algorithms/57.insert-interval)|28%|Hard|| +|58|[Length of Last Word](./Algorithms/58.length-of-last-word)|32%|Easy|| +|59|[Spiral Matrix II](./Algorithms/59.spiral-matrix-ii)|41%|Medium|❤️| +|60|[Permutation Sequence](./Algorithms/60.permutation-sequence)|29%|Medium|| +|61|[Rotate List](./Algorithms/61.rotate-list)|24%|Medium|❤️| +|62|[Unique Paths](./Algorithms/62.unique-paths)|42%|Medium|❤️| +|63|[Unique Paths II](./Algorithms/63.unique-paths-ii)|32%|Medium|| +|64|[Minimum Path Sum](./Algorithms/64.minimum-path-sum)|40%|Medium|| +|65|[Valid Number](./Algorithms/65.valid-number)|12%|Hard|| +|66|[Plus One](./Algorithms/66.plus-one)|39%|Easy|| +|67|[Add Binary](./Algorithms/67.add-binary)|34%|Easy|| +|68|[Text Justification](./Algorithms/68.text-justification)|20%|Hard|| +|69|[Sqrt(x)](./Algorithms/69.sqrtx)|28%|Easy|| +|70|[Climbing Stairs](./Algorithms/70.climbing-stairs)|41%|Easy|| +|71|[Simplify Path](./Algorithms/71.simplify-path)|26%|Medium|| +|72|[Edit Distance](./Algorithms/72.edit-distance)|32%|Hard|❤️| +|73|[Set Matrix Zeroes](./Algorithms/73.set-matrix-zeroes)|36%|Medium|❤️| +|74|[Search a 2D Matrix](./Algorithms/74.search-a-2d-matrix)|34%|Medium|| +|75|[Sort Colors](./Algorithms/75.sort-colors)|38%|Medium|❤️| +|76|[Minimum Window Substring](./Algorithms/76.minimum-window-substring)|26%|Hard|❤️| +|77|[Combinations](./Algorithms/77.combinations)|41%|Medium|| +|78|[Subsets](./Algorithms/78.subsets)|44%|Medium|❤️| +|79|[Word Search](./Algorithms/79.word-search)|28%|Medium|| +|80|[Remove Duplicates from Sorted Array II](./Algorithms/80.remove-duplicates-from-sorted-array-ii)|36%|Medium|❤️| +|81|[Search in Rotated Sorted Array II](./Algorithms/81.search-in-rotated-sorted-array-ii)|32%|Medium|| +|82|[Remove Duplicates from Sorted List II](./Algorithms/82.remove-duplicates-from-sorted-list-ii)|29%|Medium|❤️| +|83|[Remove Duplicates from Sorted List](./Algorithms/83.remove-duplicates-from-sorted-list)|40%|Easy|| +|84|[Largest Rectangle in Histogram](./Algorithms/84.largest-rectangle-in-histogram)|27%|Hard|❤️| +|85|[Maximal Rectangle](./Algorithms/85.maximal-rectangle)|29%|Hard|❤️| +|86|[Partition List](./Algorithms/86.partition-list)|33%|Medium|| +|87|[Scramble String](./Algorithms/87.scramble-string)|29%|Hard|❤️| +|88|[Merge Sorted Array](./Algorithms/88.Merge-Sorted-Array)|32%|Easy|| +|89|[Gray Code](./Algorithms/89.gray-code)|42%|Medium|| +|90|[Subsets II](./Algorithms/90.subsets-ii)|38%|Medium|❤️| +|91|[Decode Ways](./Algorithms/91.decode-ways)|20%|Medium|❤️| +|92|[Reverse Linked List II](./Algorithms/92.reverse-linked-list-ii)|31%|Medium|| +|93|[Restore IP Addresses](./Algorithms/93.restore-ip-addresses)|28%|Medium|❤️| +|94|[Binary Tree Inorder Traversal](./Algorithms/94.binary-tree-inorder-traversal)|49%|Medium|| +|95|[Unique Binary Search Trees II](./Algorithms/95.unique-binary-search-trees-ii)|32%|Medium|❤️| +|96|[Unique Binary Search Trees](./Algorithms/96.unique-binary-search-trees)|41%|Medium|| +|97|[Interleaving String](./Algorithms/97.interleaving-string)|25%|Hard|❤️| +|98|[Validate Binary Search Tree](./Algorithms/98.validate-binary-search-tree)|24%|Medium|❤️| +|99|[Recover Binary Search Tree](./Algorithms/99.recover-binary-search-tree)|31%|Hard|❤️| +|100|[Same Tree](./Algorithms/100.same-tree)|47%|Easy|| +|101|[Symmetric Tree](./Algorithms/101.symmetric-tree)|40%|Easy|❤️| +|102|[Binary Tree Level Order Traversal](./Algorithms/102.binary-tree-level-order-traversal)|42%|Medium|| +|103|[Binary Tree Zigzag Level Order Traversal](./Algorithms/103.binary-tree-zigzag-level-order-traversal)|36%|Medium|| +|104|[Maximum Depth of Binary Tree](./Algorithms/104.maximum-depth-of-binary-tree)|54%|Easy|| +|105|[Construct Binary Tree from Preorder and Inorder Traversal](./Algorithms/105.construct-binary-tree-from-preorder-and-inorder-traversal)|34%|Medium|❤️| +|106|[Construct Binary Tree from Inorder and Postorder Traversal](./Algorithms/106.construct-binary-tree-from-inorder-and-postorder-traversal)|33%|Medium|❤️| +|107|[Binary Tree Level Order Traversal II](./Algorithms/107.binary-tree-level-order-traversal-ii)|42%|Easy|| +|108|[Convert Sorted Array to Binary Search Tree](./Algorithms/108.convert-sorted-array-to-binary-search-tree)|44%|Easy|| +|109|[Convert Sorted List to Binary Search Tree](./Algorithms/109.convert-sorted-list-to-binary-search-tree)|35%|Medium|| +|110|[Balanced Binary Tree](./Algorithms/110.balanced-binary-tree)|38%|Easy|| +|111|[Minimum Depth of Binary Tree](./Algorithms/111.minimum-depth-of-binary-tree)|33%|Easy|| +|112|[Path Sum](./Algorithms/112.path-sum)|34%|Easy|| +|113|[Path Sum II](./Algorithms/113.path-sum-ii)|35%|Medium|| +|114|[Flatten Binary Tree to Linked List](./Algorithms/114.flatten-binary-tree-to-linked-list)|36%|Medium|❤️| +|115|[Distinct Subsequences](./Algorithms/115.distinct-subsequences)|32%|Hard|❤️| +|118|[Pascal's Triangle](./Algorithms/118.pascals-triangle)|40%|Easy|| +|119|[Pascal's Triangle II](./Algorithms/119.pascals-triangle-ii)|38%|Easy|| +|120|[Triangle](./Algorithms/120.triangle)|34%|Medium|❤️| +|121|[Best Time to Buy and Sell Stock](./Algorithms/121.best-time-to-buy-and-sell-stock)|42%|Easy|| +|122|[Best Time to Buy and Sell Stock II](./Algorithms/122.best-time-to-buy-and-sell-stock-ii)|47%|Easy|| +|123|[Best Time to Buy and Sell Stock III](./Algorithms/123.best-time-to-buy-and-sell-stock-iii)|30%|Hard|| +|124|[Binary Tree Maximum Path Sum](./Algorithms/124.binary-tree-maximum-path-sum)|27%|Hard|❤️| +|125|[Valid Palindrome](./Algorithms/125.Valid-Palindrome)|27.0%|Easy|| +|126|[Word Ladder II](./Algorithms/126.word-ladder-ii)|14%|Hard|❤️| +|127|[Word Ladder](./Algorithms/127.word-ladder)|20%|Medium|❤️| +|128|[Longest Consecutive Sequence](./Algorithms/128.longest-consecutive-sequence)|38%|Hard|| +|129|[Sum Root to Leaf Numbers](./Algorithms/129.sum-root-to-leaf-numbers)|37%|Medium|| +|130|[Surrounded Regions](./Algorithms/130.surrounded-regions)|19%|Medium|❤️| +|131|[Palindrome Partitioning](./Algorithms/131.palindrome-partitioning)|35%|Medium|❤️| +|132|[Palindrome Partitioning II](./Algorithms/132.palindrome-partitioning-ii)|24%|Hard|❤️| +|134|[Gas Station](./Algorithms/134.gas-station)|29%|Medium|❤️| +|135|[Candy](./Algorithms/135.candy)|25%|Hard|| +|136|[Single Number](./Algorithms/136.single-number)|55%|Easy|| +|137|[Single Number II](./Algorithms/137.single-number-ii)|42%|Medium|❤️| +|139|[Word Break](./Algorithms/139.word-break)|31%|Medium|❤️| +|140|[Word Break II](./Algorithms/140.word-break-ii)|24%|Hard|❤️| +|141|[Linked List Cycle](./Algorithms/140.Linked-List-Cycle)|24%|Hard|❤️| +|142|[Linked List Cycle II](./Algorithms/140.Linked-List-Cycle-II)|24%|Hard|❤️| +|143|[Reorder List](./Algorithms/143.reorder-list)|26%|Medium|❤️| +|144|[Binary Tree Preorder Traversal](./Algorithms/144.binary-tree-preorder-traversal)|46%|Medium|❤️| +|145|[Binary Tree Postorder Traversal](./Algorithms/145.binary-tree-postorder-traversal)|42%|Hard|| +|146|[LRU Cache](./Algorithms/146.lru-cache)|19%|Hard|❤️| +|147|[Insertion Sort List](./Algorithms/147.insertion-sort-list)|33%|Medium|❤️| +|148|[Sort List](./Algorithms/148.sort-list)|29%|Medium|❤️| +|149|[Max Points on a Line](./Algorithms/149.max-points-on-a-line)|15%|Hard|❤️| +|150|[Evaluate Reverse Polish Notation](./Algorithms/150.evaluate-reverse-polish-notation)|28%|Medium|| +|152|[Maximum Product Subarray](./Algorithms/152.maximum-product-subarray)|26%|Medium|❤️| +|153|[Find Minimum in Rotated Sorted Array](./Algorithms/153.find-minimum-in-rotated-sorted-array)|40%|Medium|| +|154|[Find Minimum in Rotated Sorted Array II](./Algorithms/154.find-minimum-in-rotated-sorted-array-ii)|37%|Hard|| +|155|[Min Stack](./Algorithms/155.min-stack)|31%|Easy|| +|162|[Find Peak Element](./Algorithms/162.find-peak-element)|38%|Medium|| +|164|[Maximum Gap](./Algorithms/164.maximum-gap)|30%|Hard|| +|165|[Compare Version Numbers](./Algorithms/165.compare-version-numbers)|20%|Medium|| +|166|[Fraction to Recurring Decimal](./Algorithms/166.fraction-to-recurring-decimal)|18%|Medium|❤️| +|167|[Two Sum II - Input array is sorted](./Algorithms/167.two-sum-ii-input-array-is-sorted)|47%|Easy|| +|168|[Excel Sheet Column Title](./Algorithms/168.excel-sheet-column-title)|27%|Easy|❤️| +|169|[Majority Element](./Algorithms/169.majority-element)|48%|Easy|❤️| +|171|[Excel Sheet Column Number](./Algorithms/171.excel-sheet-column-number)|48%|Easy|| +|172|[Factorial Trailing Zeroes](./Algorithms/172.factorial-trailing-zeroes)|36%|Easy|| +|174|[Dungeon Game](./Algorithms/174.dungeon-game)|24%|Hard|❤️| +|179|[Largest Number](./Algorithms/179.largest-number)|23%|Medium|❤️| +|187|[Repeated DNA Sequences](./Algorithms/187.repeated-dna-sequences)|33%|Medium|| +|188|[Best Time to Buy and Sell Stock IV](./Algorithms/188.best-time-to-buy-and-sell-stock-iv)|24%|Hard|❤️| +|189|[Rotate Array](./Algorithms/189.rotate-array)|25%|Easy|| +|198|[House Robber](./Algorithms/198.house-robber)|39%|Easy|❤️| +|199|[Binary Tree Right Side View](./Algorithms/199.binary-tree-right-side-view)|42%|Medium|| +|200|[Number of Islands](./Algorithms/200.number-of-islands)|36%|Medium|| +|201|[Bitwise AND of Numbers Range](./Algorithms/201.bitwise-and-of-numbers-range)|34%|Medium|❤️| +|202|[Happy Number](./Algorithms/202.happy-number)|41%|Easy|| +|203|[Remove Linked List Elements](./Algorithms/203.remove-linked-list-elements)|33%|Easy|| +|204|[Count Primes](./Algorithms/204.count-primes)|26%|Easy|❤️| +|205|[Isomorphic Strings](./Algorithms/205.isomorphic-strings)|34%|Easy|❤️| +|206|[Reverse Linked List](./Algorithms/206.Reverse-Linked-List)|46%|Easy|| +|207|[Course Schedule](./Algorithms/207.course-schedule)|33%|Medium|❤️| +|208|[Implement Trie (Prefix Tree)](./Algorithms/208.implement-trie-prefix-tree)|30%|Medium|❤️| +|209|[Minimum Size Subarray Sum](./Algorithms/209.minimum-size-subarray-sum)|32%|Medium|| +|210|[Course Schedule II](./Algorithms/210.course-schedule-ii)|30%|Medium|| +|211|[Add and Search Word - Data structure design](./Algorithms/211.add-and-search-word-data-structure-design)|25%|Medium|❤️| +|212|[Word Search II](./Algorithms/212.word-search-ii)|24%|Hard|❤️| +|213|[House Robber II](./Algorithms/213.house-robber-ii)|34%|Medium|| +|214|[Shortest Palindrome](./Algorithms/214.shortest-palindrome)|25%|Hard|❤️| +|215|[Kth Largest Element in an Array](./Algorithms/215.kth-largest-element-in-an-array)|40%|Medium|❤️| +|216|[Combination Sum III](./Algorithms/216.combination-sum-iii)|47%|Medium|| +|217|[Contains Duplicate](./Algorithms/217.contains-duplicate)|47%|Easy|| +|218|[The Skyline Problem](./Algorithms/218.the-skyline-problem)|29%|Hard|❤️| +|219|[Contains Duplicate II](./Algorithms/219.contains-duplicate-ii)|32%|Easy|| +|220|[Contains Duplicate III](./Algorithms/220.contains-duplicate-iii)|18%|Medium|❤️| +|221|[Maximal Square](./Algorithms/221.maximal-square)|30%|Medium|❤️| +|223|[Rectangle Area](./Algorithms/223.rectangle-area)|33%|Medium|| +|224|[Basic Calculator](./Algorithms/224.basic-calculator)|28%|Hard|| +|225|[Implement Stack using Queues](./Algorithms/225.implement-stack-using-queues)|34%|Easy|| +|226|[Invert Binary Tree](./Algorithms/226.invert-binary-tree)|53%|Easy|| +|227|[Basic Calculator II](./Algorithms/227.basic-calculator-ii)|30%|Medium|| +|228|[Summary Ranges](./Algorithms/228.summary-ranges)|32%|Medium|| +|229|[Majority Element II](./Algorithms/229.majority-element-ii)|29%|Medium|❤️| +|230|[Kth Smallest Element in a BST](./Algorithms/230.kth-smallest-element-in-a-bst)|45%|Medium|| +|231|[Power of Two](./Algorithms/231.power-of-two)|40%|Easy|| +|232|[Implement Queue using Stacks](./Algorithms/232.implement-queue-using-stacks)|38%|Easy|| +|233|[Number of Digit One](./Algorithms/233.number-of-digit-one)|29%|Hard|❤️| +|234|[Palindrome Linked List](./Algorithms/234.palindrome-linked-list)|33%|Easy|| +|238|[Product of Array Except Self](./Algorithms/238.product-of-array-except-self)|50%|Medium|| +|239|[Sliding Window Maximum](./Algorithms/239.sliding-window-maximum)|34%|Hard|❤️| +|240|[Search a 2D Matrix II](./Algorithms/240.search-a-2d-matrix-ii)|39%|Medium|❤️| +|241|[Different Ways to Add Parentheses](./Algorithms/241.different-ways-to-add-parentheses)|46%|Medium|| +|242|[Valid Anagram](./Algorithms/242.valid-anagram)|47%|Easy|| +|257|[Binary Tree Paths](./Algorithms/257.binary-tree-paths)|41%|Easy|| +|258|[Add Digits](./Algorithms/258.add-digits)|51%|Easy|| +|260|[Single Number III](./Algorithms/260.single-number-iii)|53%|Medium|❤️| +|263|[Ugly Number](./Algorithms/263.ugly-number)|39%|Easy|| +|264|[Ugly Number II](./Algorithms/264.ugly-number-ii)|33%|Medium|❤️| +|268|[Missing Number](./Algorithms/268.missing-number)|45%|Easy|| +|273|[Integer to English Words](./Algorithms/273.integer-to-english-words)|22%|Hard|❤️| +|274|[H-Index](./Algorithms/274.h-index)|33%|Medium|| +|275|[H-Index II](./Algorithms/275.h-index-ii)|34%|Medium|❤️| +|279|[Perfect Squares](./Algorithms/279.perfect-squares)|37%|Medium|❤️| +|282|[Expression Add Operators](./Algorithms/282.expression-add-operators)|30%|Hard|❤️| +|283|[Move Zeroes](./Algorithms/283.move-zeroes)|51%|Easy|| +|287|[Find the Duplicate Number](./Algorithms/287.find-the-duplicate-number)|44%|Medium|❤️| +|289|[Game of Life](./Algorithms/289.game-of-life)|37%|Medium|❤️| +|290|[Word Pattern](./Algorithms/290.word-pattern)|33%|Easy|| +|292|[Nim Game](./Algorithms/292.nim-game)|55%|Easy|❤️| +|295|[Find Median from Data Stream](./Algorithms/295.find-median-from-data-stream)|29%|Hard|❤️| +|299|[Bulls and Cows](./Algorithms/299.bulls-and-cows)|35%|Medium|| +|300|[Longest Increasing Subsequence](./Algorithms/300.longest-increasing-subsequence)|38%|Medium|❤️| +|301|[Remove Invalid Parentheses](./Algorithms/301.remove-invalid-parentheses)|35%|Hard|❤️| +|303|[Range Sum Query - Immutable](./Algorithms/303.range-sum-query-immutable)|32%|Easy|| +|304|[Range Sum Query 2D - Immutable](./Algorithms/304.range-sum-query-2d-immutable)|27%|Medium|| +|306|[Additive Number](./Algorithms/306.additive-number)|27%|Medium|| +|307|[Range Sum Query - Mutable](./Algorithms/307.range-sum-query-mutable)|22%|Medium|| +|309|[Best Time to Buy and Sell Stock with Cooldown](./Algorithms/309.best-time-to-buy-and-sell-stock-with-cooldown)|41%|Medium|❤️| +|310|[Minimum Height Trees](./Algorithms/310.minimum-height-trees)|28%|Medium|| +|312|[Burst Balloons](./Algorithms/312.burst-balloons)|43%|Hard|❤️| +|313|[Super Ugly Number](./Algorithms/313.super-ugly-number)|38%|Medium|❤️| +|315|[Count of Smaller Numbers After Self](./Algorithms/315.count-of-smaller-numbers-after-self)|34%|Hard|❤️| +|316|[Remove Duplicate Letters](./Algorithms/316.remove-duplicate-letters)|30%|Hard|❤️| +|318|[Maximum Product of Word Lengths](./Algorithms/318.maximum-product-of-word-lengths)|45%|Medium|❤️| +|319|[Bulb Switcher](./Algorithms/319.bulb-switcher)|42%|Medium|❤️| +|321|[Create Maximum Number](./Algorithms/321.create-maximum-number)|24%|Hard|❤️| +|322|[Coin Change](./Algorithms/322.coin-change)|26%|Medium|❤️| +|324|[Wiggle Sort II](./Algorithms/324.wiggle-sort-ii)|26%|Medium|| +|326|[Power of Three](./Algorithms/326.power-of-three)|40%|Easy|❤️| +|327|[Count of Range Sum](./Algorithms/327.count-of-range-sum)|30%|Hard|❤️| +|328|[Odd Even Linked List](./Algorithms/328.odd-even-linked-list)|44%|Medium|❤️| +|329|[Longest Increasing Path in a Matrix](./Algorithms/329.longest-increasing-path-in-a-matrix)|37%|Hard|❤️| +|330|[Patching Array](./Algorithms/330.patching-array)|32%|Hard|| +|331|[Verify Preorder Serialization of a Binary Tree](./Algorithms/331.verify-preorder-serialization-of-a-binary-tree)|37%|Medium|❤️| +|332|[Reconstruct Itinerary](./Algorithms/332.reconstruct-itinerary)|29%|Medium|❤️| +|334|[Increasing Triplet Subsequence](./Algorithms/334.increasing-triplet-subsequence)|39%|Medium|❤️| +|335|[Self Crossing](./Algorithms/335.self-crossing)|26%|Hard|| +|336|[Palindrome Pairs](./Algorithms/336.palindrome-pairs)|27%|Hard|❤️| +|337|[House Robber III](./Algorithms/337.house-robber-iii)|44%|Medium|❤️| +|338|[Counting Bits](./Algorithms/338.counting-bits)|62%|Medium|| +|342|[Power of Four](./Algorithms/342.power-of-four)|39%|Easy|| +|343|[Integer Break](./Algorithms/343.integer-break)|46%|Medium|| +|344|[Reverse String](./Algorithms/344.reverse-string)|60%|Easy|| +|345|[Reverse Vowels of a String](./Algorithms/345.reverse-vowels-of-a-string)|39%|Easy|| +|347|[Top K Frequent Elements](./Algorithms/347.top-k-frequent-elements)|49%|Medium|| +|349|[Intersection of Two Arrays](./Algorithms/349.intersection-of-two-arrays)|48%|Easy|| +|350|[Intersection of Two Arrays II](./Algorithms/350.intersection-of-two-arrays-ii)|44%|Easy|❤️| +|352|[Data Stream as Disjoint Intervals](./Algorithms/352.data-stream-as-disjoint-intervals)|41%|Hard|| +|354|[Russian Doll Envelopes](./Algorithms/354.russian-doll-envelopes)|32%|Hard|❤️| +|355|[Design Twitter](./Algorithms/355.design-twitter)|25%|Medium|❤️| +|357|[Count Numbers with Unique Digits](./Algorithms/357.count-numbers-with-unique-digits)|46%|Medium|❤️| +|363|[Max Sum of Rectangle No Larger Than K](./Algorithms/363.max-sum-of-rectangle-no-larger-than-k)|33%|Hard|❤️| +|365|[Water and Jug Problem](./Algorithms/365.water-and-jug-problem)|28%|Medium|❤️| +|367|[Valid Perfect Square](./Algorithms/367.valid-perfect-square)|38%|Easy|| +|368|[Largest Divisible Subset](./Algorithms/368.largest-divisible-subset)|33%|Medium|❤️| +|371|[Sum of Two Integers](./Algorithms/371.sum-of-two-integers)|50%|Easy|❤️| +|372|[Super Pow](./Algorithms/372.super-pow)|34%|Medium|| +|373|[Find K Pairs with Smallest Sums](./Algorithms/373.find-k-pairs-with-smallest-sums)|31%|Medium|❤️| +|375|[Guess Number Higher or Lower II](./Algorithms/375.guess-number-higher-or-lower-ii)|36%|Medium|| +|376|[Wiggle Subsequence](./Algorithms/376.wiggle-subsequence)|36%|Medium|❤️| +|377|[Combination Sum IV](./Algorithms/377.combination-sum-iv)|42%|Medium|| +|378|[Kth Smallest Element in a Sorted Matrix](./Algorithms/378.kth-smallest-element-in-a-sorted-matrix)|45%|Medium|❤️| +|380|[Insert Delete GetRandom O(1)](./Algorithms/380.insert-delete-getrandom-o1)|39%|Medium|❤️| +|381|[Insert Delete GetRandom O(1) - Duplicates allowed](./Algorithms/381.insert-delete-getrandom-o1-duplicates-allowed)|29%|Hard|❤️| +|382|[Linked List Random Node](./Algorithms/382.linked-list-random-node)|47%|Medium|| +|383|[Ransom Note](./Algorithms/383.ransom-note)|47%|Easy|| +|384|[Shuffle an Array](./Algorithms/384.shuffle-an-array)|47%|Medium|❤️| +|385|[Mini Parser](./Algorithms/385.mini-parser)|30%|Medium|❤️| +|387|[First Unique Character in a String](./Algorithms/387.first-unique-character-in-a-string)|47%|Easy|| +|388|[Longest Absolute File Path](./Algorithms/388.longest-absolute-file-path)|37%|Medium|| +|389|[Find the Difference](./Algorithms/389.find-the-difference)|51%|Easy|| +|390|[Elimination Game](./Algorithms/390.elimination-game)|42%|Medium|❤️| +|391|[Perfect Rectangle](./Algorithms/391.perfect-rectangle)|27%|Hard|| +|392|[Is Subsequence](./Algorithms/392.is-subsequence)|44%|Medium|❤️| +|393|[UTF-8 Validation](./Algorithms/393.utf-8-validation)|34%|Medium|❤️| +|394|[Decode String](./Algorithms/394.decode-string)|42%|Medium|| +|395|[Longest Substring with At Least K Repeating Characters](./Algorithms/395.longest-substring-with-at-least-k-repeating-characters)|35%|Medium|| +|396|[Rotate Function](./Algorithms/396.rotate-function)|33%|Medium|❤️| +|397|[Integer Replacement](./Algorithms/397.integer-replacement)|30%|Medium|❤️| +|398|[Random Pick Index](./Algorithms/398.random-pick-index)|44%|Medium|| +|399|[Evaluate Division](./Algorithms/399.evaluate-division)|42%|Medium|❤️| +|400|[Nth Digit](./Algorithms/400.nth-digit)|30%|Easy|❤️| +|401|[Binary Watch](./Algorithms/401.binary-watch)|44%|Easy|| +|402|[Remove K Digits](./Algorithms/402.remove-k-digits)|25%|Medium|❤️| +|403|[Frog Jump](./Algorithms/403.frog-jump)|32%|Hard|❤️| +|404|[Sum of Left Leaves](./Algorithms/404.sum-of-left-leaves)|47%|Easy|| +|405|[Convert a Number to Hexadecimal](./Algorithms/405.convert-a-number-to-hexadecimal)|41%|Easy|| +|406|[Queue Reconstruction by Height](./Algorithms/406.queue-reconstruction-by-height)|56%|Medium|❤️| +|407|[Trapping Rain Water II](./Algorithms/407.trapping-rain-water-ii)|37%|Hard|| +|409|[Longest Palindrome](./Algorithms/409.longest-palindrome)|45%|Easy|| +|410|[Split Array Largest Sum](./Algorithms/410.split-array-largest-sum)|39%|Hard|| +|412|[Fizz Buzz](./Algorithms/412.Fizz-Buzz)|58%|Easy|| +|413|[Arithmetic Slices](./Algorithms/413.arithmetic-slices)|54%|Medium|| +|414|[Third Maximum Number](./Algorithms/414.third-maximum-number)|28%|Easy|| +|415|[Add Strings](./Algorithms/415.add-strings)|41%|Easy|| +|416|[Partition Equal Subset Sum](./Algorithms/416.partition-equal-subset-sum)|38%|Medium|❤️| +|417|[Pacific Atlantic Water Flow](./Algorithms/417.pacific-atlantic-water-flow)|34%|Medium|| +|419|[Battleships in a Board](./Algorithms/419.battleships-in-a-board)|63%|Medium|| +|420|[Strong Password Checker](./Algorithms/420.strong-password-checker)|19%|Hard|❤️| +|421|[Maximum XOR of Two Numbers in an Array](./Algorithms/421.maximum-xor-of-two-numbers-in-an-array)|47%|Medium|❤️| +|423|[Reconstruct Original Digits from English](./Algorithms/423.reconstruct-original-digits-from-english)|44%|Medium|| +|424|[Longest Repeating Character Replacement](./Algorithms/424.longest-repeating-character-replacement)|42%|Medium|❤️| +|432|[All O`one Data Structure](./Algorithms/432.all-oone-data-structure)|27%|Hard|❤️| +|434|[Number of Segments in a String](./Algorithms/434.number-of-segments-in-a-string)|36%|Easy|| +|435|[Non-overlapping Intervals](./Algorithms/435.non-overlapping-intervals)|41%|Medium|❤️| +|436|[Find Right Interval](./Algorithms/436.find-right-interval)|41%|Medium|| +|437|[Path Sum III](./Algorithms/437.path-sum-iii)|40%|Easy|❤️| +|438|[Find All Anagrams in a String](./Algorithms/438.find-all-anagrams-in-a-string)|33%|Easy|| +|440|[K-th Smallest in Lexicographical Order](./Algorithms/440.k-th-smallest-in-lexicographical-order)|25%|Hard|❤️| +|441|[Arranging Coins](./Algorithms/441.arranging-coins)|36%|Easy|| +|442|[Find All Duplicates in an Array](./Algorithms/442.find-all-duplicates-in-an-array)|56%|Medium|| +|443|[String Compression](./Algorithms/443.string-compression)|35%|Easy|❤️| +|445|[Add Two Numbers II](./Algorithms/445.add-two-numbers-ii)|46%|Medium|❤️| +|446|[Arithmetic Slices II - Subsequence](./Algorithms/446.arithmetic-slices-ii-subsequence)|28%|Hard|❤️| +|447|[Number of Boomerangs](./Algorithms/447.number-of-boomerangs)|46%|Easy|| +|448|[Find All Numbers Disappeared in an Array](./Algorithms/448.find-all-numbers-disappeared-in-an-array)|51%|Easy|| +|450|[Delete Node in a BST](./Algorithms/450.delete-node-in-a-bst)|37%|Medium|❤️| +|451|[Sort Characters By Frequency](./Algorithms/451.sort-characters-by-frequency)|51%|Medium|| +|452|[Minimum Number of Arrows to Burst Balloons](./Algorithms/452.minimum-number-of-arrows-to-burst-balloons)|44%|Medium|| +|453|[Minimum Moves to Equal Array Elements](./Algorithms/453.minimum-moves-to-equal-array-elements)|48%|Easy|| +|454|[4Sum II](./Algorithms/454.4sum-ii)|47%|Medium|| +|455|[Assign Cookies](./Algorithms/455.assign-cookies)|47%|Easy|| +|456|[132 Pattern](./Algorithms/456.132-pattern)|27%|Medium|❤️| +|459|[Repeated Substring Pattern](./Algorithms/459.repeated-substring-pattern)|38%|Easy|❤️| +|460|[LFU Cache](./Algorithms/460.lfu-cache)|25%|Hard|| +|461|[Hamming Distance](./Algorithms/461.hamming-distance)|69%|Easy|| +|462|[Minimum Moves to Equal Array Elements II](./Algorithms/462.minimum-moves-to-equal-array-elements-ii)|51%|Medium|| +|463|[Island Perimeter](./Algorithms/463.island-perimeter)|57%|Easy|| +|464|[Can I Win](./Algorithms/464.can-i-win)|25%|Medium|❤️| +|466|[Count The Repetitions](./Algorithms/466.count-the-repetitions)|27%|Hard|❤️| +|467|[Unique Substrings in Wraparound String](./Algorithms/467.unique-substrings-in-wraparound-string)|33%|Medium|❤️| +|468|[Validate IP Address](./Algorithms/468.validate-ip-address)|20%|Medium|| +|472|[Concatenated Words](./Algorithms/472.concatenated-words)|30%|Hard|| +|473|[Matchsticks to Square](./Algorithms/473.matchsticks-to-square)|35%|Medium|❤️| +|474|[Ones and Zeroes](./Algorithms/474.ones-and-zeroes)|38%|Medium|| +|475|[Heaters](./Algorithms/475.heaters)|29%|Easy|| +|476|[Number Complement](./Algorithms/476.number-complement)|61%|Easy|| +|477|[Total Hamming Distance](./Algorithms/477.total-hamming-distance)|47%|Medium|❤️| +|479|[Largest Palindrome Product](./Algorithms/479.largest-palindrome-product)|25%|Easy|| +|480|[Sliding Window Median](./Algorithms/480.sliding-window-median)|30%|Hard|❤️| +|481|[Magical String](./Algorithms/481.magical-string)|45%|Medium|| +|482|[License Key Formatting](./Algorithms/482.license-key-formatting)|39%|Easy|| +|483|[Smallest Good Base](./Algorithms/483.smallest-good-base)|33%|Hard|❤️| +|485|[Max Consecutive Ones](./Algorithms/485.max-consecutive-ones)|53%|Easy|| +|486|[Predict the Winner](./Algorithms/486.predict-the-winner)|45%|Medium|| +|488|[Zuma Game](./Algorithms/488.zuma-game)|37%|Hard|❤️| +|491|[Increasing Subsequences](./Algorithms/491.increasing-subsequences)|38%|Medium|❤️| +|492|[Construct the Rectangle](./Algorithms/492.construct-the-rectangle)|48%|Easy|❤️| +|493|[Reverse Pairs](./Algorithms/493.reverse-pairs)|20%|Hard|| +|494|[Target Sum](./Algorithms/494.target-sum)|43%|Medium|❤️| +|495|[Teemo Attacking](./Algorithms/495.teemo-attacking)|51%|Medium|| +|496|[Next Greater Element I](./Algorithms/496.next-greater-element-i)|56%|Easy|| +|498|[Diagonal Traverse](./Algorithms/498.diagonal-traverse)|46%|Medium|| +|500|[Keyboard Row](./Algorithms/500.keyboard-row)|59%|Easy|| +|501|[Find Mode in Binary Search Tree](./Algorithms/501.find-mode-in-binary-search-tree)|37%|Easy|❤️| +|502|[IPO](./Algorithms/502.ipo)|36%|Hard|| +|503|[Next Greater Element II](./Algorithms/503.next-greater-element-ii)|48%|Medium|❤️| +|504|[Base 7](./Algorithms/504.base-7)|43%|Easy|| +|506|[Relative Ranks](./Algorithms/506.relative-ranks)|46%|Easy|| +|507|[Perfect Number](./Algorithms/507.perfect-number)|32%|Easy|| +|508|[Most Frequent Subtree Sum](./Algorithms/508.most-frequent-subtree-sum)|52%|Medium|| +|513|[Find Bottom Left Tree Value](./Algorithms/513.find-bottom-left-tree-value)|56%|Medium|| +|514|[Freedom Trail](./Algorithms/514.freedom-trail)|39%|Hard|| +|515|[Find Largest Value in Each Tree Row](./Algorithms/515.find-largest-value-in-each-tree-row)|55%|Medium|| +|516|[Longest Palindromic Subsequence](./Algorithms/516.longest-palindromic-subsequence)|42%|Medium|❤️| +|517|[Super Washing Machines](./Algorithms/517.super-washing-machines)|36%|Hard|❤️| +|520|[Detect Capital](./Algorithms/520.detect-capital)|51%|Easy|| +|521|[Longest Uncommon Subsequence I](./Algorithms/521.longest-uncommon-subsequence-i)|55%|Easy|| +|522|[Longest Uncommon Subsequence II](./Algorithms/522.longest-uncommon-subsequence-ii)|31%|Medium|| +|523|[Continuous Subarray Sum](./Algorithms/523.continuous-subarray-sum)|23%|Medium|❤️| +|524|[Longest Word in Dictionary through Deleting](./Algorithms/524.longest-word-in-dictionary-through-deleting)|43%|Medium|| +|525|[Contiguous Array](./Algorithms/525.contiguous-array)|41%|Medium|❤️| +|526|[Beautiful Arrangement](./Algorithms/526.beautiful-arrangement)|53%|Medium|❤️| +|529|[Minesweeper](./Algorithms/529.minesweeper)|49%|Medium|| +|530|[Minimum Absolute Difference in BST](./Algorithms/530.minimum-absolute-difference-in-bst)|47%|Easy|❤️| +|532|[K-diff Pairs in an Array](./Algorithms/532.k-diff-pairs-in-an-array)|28%|Easy|| +|537|[Complex Number Multiplication](./Algorithms/537.complex-number-multiplication)|63%|Medium|| +|538|[Convert BST to Greater Tree](./Algorithms/538.convert-bst-to-greater-tree)|48%|Easy|| +|539|[Minimum Time Difference](./Algorithms/539.minimum-time-difference)|46%|Medium|| +|540|[Single Element in a Sorted Array](./Algorithms/540.single-element-in-a-sorted-array)|55%|Medium|| +|541|[Reverse String II](./Algorithms/541.reverse-string-ii)|43%|Easy|| +|542|[01 Matrix](./Algorithms/542.01-matrix)|33%|Medium|❤️| +|543|[Diameter of Binary Tree](./Algorithms/543.diameter-of-binary-tree)|44%|Easy|| +|546|[Remove Boxes](./Algorithms/546.remove-boxes)|35%|Hard|❤️| +|547|[Friend Circles](./Algorithms/547.friend-circles)|49%|Medium|❤️| +|551|[Student Attendance Record I](./Algorithms/551.student-attendance-record-i)|44%|Easy|| +|552|[Student Attendance Record II](./Algorithms/552.student-attendance-record-ii)|31%|Hard|❤️| +|553|[Optimal Division](./Algorithms/553.optimal-division)|55%|Medium|| +|554|[Brick Wall](./Algorithms/554.brick-wall)|46%|Medium|| +|556|[Next Greater Element III](./Algorithms/556.next-greater-element-iii)|28%|Medium|| +|557|[Reverse Words in a String III](./Algorithms/557.reverse-words-in-a-string-iii)|60%|Easy|| +|560|[Subarray Sum Equals K](./Algorithms/560.subarray-sum-equals-k)|39%|Medium|❤️| +|561|[Array Partition I](./Algorithms/561.array-partition-i)|66%|Easy|| +|563|[Binary Tree Tilt](./Algorithms/563.binary-tree-tilt)|47%|Easy|| +|564|[Find the Closest Palindrome](./Algorithms/564.find-the-closest-palindrome)|17%|Hard|| +|565|[Array Nesting](./Algorithms/565.array-nesting)|49%|Medium|| +|566|[Reshape the Matrix](./Algorithms/566.reshape-the-matrix)|57%|Easy|| +|567|[Permutation in String](./Algorithms/567.permutation-in-string)|36%|Medium|| +|572|[Subtree of Another Tree](./Algorithms/572.subtree-of-another-tree)|40%|Easy|❤️| +|575|[Distribute Candies](./Algorithms/575.distribute-candies)|57%|Easy|| +|576|[Out of Boundary Paths](./Algorithms/576.out-of-boundary-paths)|30%|Medium|❤️| +|581|[Shortest Unsorted Continuous Subarray](./Algorithms/581.shortest-unsorted-continuous-subarray)|29%|Easy|❤️| +|583|[Delete Operation for Two Strings](./Algorithms/583.delete-operation-for-two-strings)|44%|Medium|❤️| +|587|[Erect the Fence](./Algorithms/587.erect-the-fence)|33%|Hard|❤️| +|591|[Tag Validator](./Algorithms/591.tag-validator)|31%|Hard|❤️| +|592|[Fraction Addition and Subtraction](./Algorithms/592.fraction-addition-and-subtraction)|46%|Medium|| +|593|[Valid Square](./Algorithms/593.valid-square)|39%|Medium|| +|594|[Longest Harmonious Subsequence](./Algorithms/594.longest-harmonious-subsequence)|40%|Easy|| +|598|[Range Addition II](./Algorithms/598.range-addition-ii)|48%|Easy|| +|599|[Minimum Index Sum of Two Lists](./Algorithms/599.minimum-index-sum-of-two-lists)|46%|Easy|| +|600|[Non-negative Integers without Consecutive Ones](./Algorithms/600.non-negative-integers-without-consecutive-ones)|31%|Hard|❤️| +|605|[Can Place Flowers](./Algorithms/605.can-place-flowers)|30%|Easy|❤️| +|606|[Construct String from Binary Tree](./Algorithms/606.construct-string-from-binary-tree)|49%|Easy|| +|609|[Find Duplicate File in System](./Algorithms/609.find-duplicate-file-in-system)|52%|Medium|| +|611|[Valid Triangle Number](./Algorithms/611.valid-triangle-number)|42%|Medium|❤️| +|617|[Merge Two Binary Trees](./Algorithms/617.merge-two-binary-trees)|67%|Easy|| +|621|[Task Scheduler](./Algorithms/621.task-scheduler)|42%|Medium|❤️| +|623|[Add One Row to Tree](./Algorithms/623.add-one-row-to-tree)|46%|Medium|| +|628|[Maximum Product of Three Numbers](./Algorithms/628.maximum-product-of-three-numbers)|44%|Easy|❤️| +|629|[K Inverse Pairs Array](./Algorithms/629.k-inverse-pairs-array)|27%|Hard|| +|630|[Course Schedule III](./Algorithms/630.course-schedule-iii)|29%|Hard|❤️| +|632|[Smallest Range](./Algorithms/632.smallest-range)|41%|Hard|| +|633|[Sum of Square Numbers](./Algorithms/633.sum-of-square-numbers)|32%|Easy|| +|636|[Exclusive Time of Functions](./Algorithms/636.exclusive-time-of-functions)|44%|Medium|❤️| +|637|[Average of Levels in Binary Tree](./Algorithms/637.average-of-levels-in-binary-tree)|55%|Easy|| +|638|[Shopping Offers](./Algorithms/638.shopping-offers)|45%|Medium|❤️| +|639|[Decode Ways II](./Algorithms/639.decode-ways-ii)|24%|Hard|| +|640|[Solve the Equation](./Algorithms/640.solve-the-equation)|38%|Medium|| +|643|[Maximum Average Subarray I](./Algorithms/643.maximum-average-subarray-i)|37%|Easy|| +|645|[Set Mismatch](./Algorithms/645.set-mismatch)|39%|Easy|❤️| +|646|[Maximum Length of Pair Chain](./Algorithms/646.maximum-length-of-pair-chain)|47%|Medium|| +|647|[Palindromic Substrings](./Algorithms/647.palindromic-substrings)|54%|Medium|❤️| +|648|[Replace Words](./Algorithms/648.replace-words)|47%|Medium|| +|649|[Dota2 Senate](./Algorithms/649.dota2-senate)|36%|Medium|❤️| +|650|[2 Keys Keyboard](./Algorithms/650.2-keys-keyboard)|44%|Medium|| +|652|[Find Duplicate Subtrees](./Algorithms/652.find-duplicate-subtrees)|36%|Medium|| +|653|[Two Sum IV - Input is a BST](./Algorithms/653.two-sum-iv-input-is-a-bst)|49%|Easy|| +|654|[Maximum Binary Tree](./Algorithms/654.maximum-binary-tree)|69%|Medium|❤️| +|655|[Print Binary Tree](./Algorithms/655.print-binary-tree)|49%|Medium|| +|657|[Judge Route Circle](./Algorithms/657.judge-route-circle)|68%|Easy|| +|658|[Find K Closest Elements](./Algorithms/658.find-k-closest-elements)|34%|Medium|❤️| +|659|[Split Array into Consecutive Subsequences](./Algorithms/659.split-array-into-consecutive-subsequences)|36%|Medium|❤️| +|661|[Image Smoother](./Algorithms/661.image-smoother)|46%|Easy|| +|662|[Maximum Width of Binary Tree](./Algorithms/662.maximum-width-of-binary-tree)|37%|Medium|| +|664|[Strange Printer](./Algorithms/664.strange-printer)|34%|Hard|❤️| +|665|[Non-decreasing Array](./Algorithms/665.non-decreasing-array)|20%|Easy|| +|667|[Beautiful Arrangement II](./Algorithms/667.beautiful-arrangement-ii)|51%|Medium|| +|668|[Kth Smallest Number in Multiplication Table](./Algorithms/668.kth-smallest-number-in-multiplication-table)|40%|Hard|| +|669|[Trim a Binary Search Tree](./Algorithms/669.trim-a-binary-search-tree)|58%|Easy|| +|670|[Maximum Swap](./Algorithms/670.maximum-swap)|38%|Medium|❤️| +|671|[Second Minimum Node In a Binary Tree](./Algorithms/671.second-minimum-node-in-a-binary-tree)|41%|Easy|| +|672|[Bulb Switcher II](./Algorithms/672.bulb-switcher-ii)|49%|Medium|| +|673|[Number of Longest Increasing Subsequence](./Algorithms/673.number-of-longest-increasing-subsequence)|31%|Medium|❤️| +|674|[Longest Continuous Increasing Subsequence](./Algorithms/674.longest-continuous-increasing-subsequence)|42%|Easy|| +|675|[Cut Off Trees for Golf Event](./Algorithms/675.cut-off-trees-for-golf-event)|27%|Hard|❤️| +|676|[Implement Magic Dictionary](./Algorithms/676.implement-magic-dictionary)|49%|Medium|| +|677|[Map Sum Pairs](./Algorithms/677.map-sum-pairs)|51%|Medium|❤️| +|678|[Valid Parenthesis String](./Algorithms/678.valid-parenthesis-string)|29%|Medium|❤️| +|679|[24 Game](./Algorithms/679.24-game)|38%|Hard|❤️| +|680|[Valid Palindrome II](./Algorithms/680.valid-palindrome-ii)|32%|Easy|| +|682|[Baseball Game](./Algorithms/682.baseball-game)|58%|Easy|| +|684|[Redundant Connection](./Algorithms/684.redundant-connection)|43%|Medium|| +|685|[Redundant Connection II](./Algorithms/685.redundant-connection-ii)|27%|Hard|❤️| +|686|[Repeated String Match](./Algorithms/686.repeated-string-match)|32%|Easy|❤️| +|687|[Longest Univalue Path](./Algorithms/687.longest-univalue-path)|32%|Easy|| +|688|[Knight Probability in Chessboard](./Algorithms/688.knight-probability-in-chessboard)|39%|Medium|| +|689|[Maximum Sum of 3 Non-Overlapping Subarrays](./Algorithms/689.maximum-sum-of-3-non-overlapping-subarrays)|41%|Hard|| +|691|[Stickers to Spell Word](./Algorithms/691.stickers-to-spell-word)|34%|Hard|❤️| +|692|[Top K Frequent Words](./Algorithms/692.top-k-frequent-words)|41%|Medium|| +|693|[Binary Number with Alternating Bits](./Algorithms/693.binary-number-with-alternating-bits)|55%|Easy|| +|695|[Max Area of Island](./Algorithms/695.max-area-of-island)|51%|Easy|❤️| +|696|[Count Binary Substrings](./Algorithms/696.count-binary-substrings)|50%|Easy|| +|697|[Degree of an Array](./Algorithms/697.degree-of-an-array)|46%|Easy|| +|698|[Partition to K Equal Sum Subsets](./Algorithms/698.partition-to-k-equal-sum-subsets)|37%|Medium|❤️| +|699|[Falling Squares](./Algorithms/699.falling-squares)|37%|Hard|| +|712|[Minimum ASCII Delete Sum for Two Strings](./Algorithms/712.minimum-ascii-delete-sum-for-two-strings)|51%|Medium|❤️| +|713|[Subarray Product Less Than K](./Algorithms/713.subarray-product-less-than-k)|33%|Medium|❤️| +|714|[Best Time to Buy and Sell Stock with Transaction Fee](./Algorithms/714.best-time-to-buy-and-sell-stock-with-transaction-fee)|45%|Medium|❤️| +|715|[Range Module](./Algorithms/715.range-module)|31%|Hard|| +|717|[1-bit and 2-bit Characters](./Algorithms/717.1-bit-and-2-bit-characters)|49%|Easy|| +|718|[Maximum Length of Repeated Subarray](./Algorithms/718.maximum-length-of-repeated-subarray)|41%|Medium|❤️| +|719|[Find K-th Smallest Pair Distance](./Algorithms/719.find-k-th-smallest-pair-distance)|27%|Hard|❤️| +|720|[Longest Word in Dictionary](./Algorithms/720.longest-word-in-dictionary)|41%|Easy|| +|721|[Accounts Merge](./Algorithms/721.accounts-merge)|32%|Medium|❤️| +|722|[Remove Comments](./Algorithms/722.remove-comments)|27%|Medium|❤️| +|724|[Find Pivot Index](./Algorithms/724.find-pivot-index)|39%|Easy|| +|725|[Split Linked List in Parts](./Algorithms/725.split-linked-list-in-parts)|47%|Medium|| +|726|[Number of Atoms](./Algorithms/726.number-of-atoms)|43%|Hard|❤️| +|728|[Self Dividing Numbers](./Algorithms/728.self-dividing-numbers)|66%|Easy|| +|729|[My Calendar I](./Algorithms/729.my-calendar-i)|42%|Medium|| +|730|[Count Different Palindromic Subsequences](./Algorithms/730.count-different-palindromic-subsequences)|34%|Hard|❤️| +|731|[My Calendar II](./Algorithms/731.my-calendar-ii)|37%|Medium|❤️| +|732|[My Calendar III](./Algorithms/732.my-calendar-iii)|50%|Hard|| +|733|[Flood Fill](./Algorithms/733.flood-fill)|47%|Easy|| +|735|[Asteroid Collision](./Algorithms/735.asteroid-collision)|37%|Medium|| +|736|[Parse Lisp Expression](./Algorithms/736.parse-lisp-expression)|42%|Hard|❤️| +|738|[Monotone Increasing Digits](./Algorithms/738.monotone-increasing-digits)|40%|Medium|| +|739|[Daily Temperatures](./Algorithms/739.daily-temperatures)|52%|Medium|❤️| +|740|[Delete and Earn](./Algorithms/740.delete-and-earn)|43%|Medium|❤️| +|741|[Cherry Pickup](./Algorithms/741.cherry-pickup)|23%|Hard|| +|743|[Network Delay Time](./Algorithms/743.network-delay-time)|34%|Medium|| +|744|[Find Smallest Letter Greater Than Target](./Algorithms/744.find-smallest-letter-greater-than-target)|44%|Easy|| +|745|[Prefix and Suffix Search](./Algorithms/745.prefix-and-suffix-search)|25%|Hard|| +|746|[Min Cost Climbing Stairs](./Algorithms/746.min-cost-climbing-stairs)|43%|Easy|| +|747|[Largest Number At Least Twice of Others](./Algorithms/747.largest-number-at-least-twice-of-others)|41%|Easy|| +|748|[Shortest Completing Word](./Algorithms/748.shortest-completing-word)|51%|Medium|| +|749|[Contain Virus](./Algorithms/749.contain-virus)|39%|Hard|| +|752|[Open the Lock](./Algorithms/752.open-the-lock)|38%|Medium|❤️| +|753|[Cracking the Safe](./Algorithms/753.cracking-the-safe)|39%|Hard|❤️| +|754|[Reach a Number](./Algorithms/754.reach-a-number)|26%|Medium|❤️| +|756|[Pyramid Transition Matrix](./Algorithms/756.pyramid-transition-matrix)|45%|Medium|❤️| +|757|[Set Intersection Size At Least Two](./Algorithms/757.set-intersection-size-at-least-two)|34%|Hard|| +|761|[Special Binary String](./Algorithms/761.special-binary-string)|41%|Hard|| +|762|[Prime Number of Set Bits in Binary Representation](./Algorithms/762.prime-number-of-set-bits-in-binary-representation)|55%|Easy|| +|763|[Partition Labels](./Algorithms/763.partition-labels)|64%|Medium|| +|764|[Largest Plus Sign](./Algorithms/764.largest-plus-sign)|37%|Medium|| +|765|[Couples Holding Hands](./Algorithms/765.couples-holding-hands)|48%|Hard|| +|766|[Toeplitz Matrix](./Algorithms/766.toeplitz-matrix)|57%|Easy|| +|767|[Reorganize String](./Algorithms/767.reorganize-string)|35%|Medium|| +|768|[Max Chunks To Make Sorted II](./Algorithms/768.max-chunks-to-make-sorted-ii)|42%|Hard|| +|769|[Max Chunks To Make Sorted](./Algorithms/769.max-chunks-to-make-sorted)|47%|Medium|| +|770|[Basic Calculator IV](./Algorithms/770.basic-calculator-iv)|43%|Hard|❤️| +|771|[Jewels and Stones](./Algorithms/771.jewels-and-stones)|82%|Easy|| +|773|[Sliding Puzzle](./Algorithms/773.sliding-puzzle)|47%|Hard|| +|775|[Global and Local Inversions](./Algorithms/775.global-and-local-inversions)|31%|Medium|| +|777|[Swap Adjacent in LR String](./Algorithms/777.swap-adjacent-in-lr-string)|27%|Medium|| +|778|[Swim in Rising Water](./Algorithms/778.swim-in-rising-water)|44%|Hard|| +|779|[K-th Symbol in Grammar](./Algorithms/779.k-th-symbol-in-grammar)|35%|Medium|| +|780|[Reaching Points](./Algorithms/780.reaching-points)|21%|Hard|| +|781|[Rabbits in Forest](./Algorithms/781.rabbits-in-forest)|49%|Medium|| +|782|[Transform to Chessboard](./Algorithms/782.transform-to-chessboard)|35%|Hard|| +|783|[Minimum Distance Between BST Nodes](./Algorithms/783.minimum-distance-between-bst-nodes)|47%|Easy|| +|784|[Letter Case Permutation](./Algorithms/784.letter-case-permutation)|52%|Easy|❤️| +|785|[Is Graph Bipartite?](./Algorithms/785.is-graph-bipartite)|38%|Medium|❤️| +|786|[K-th Smallest Prime Fraction](./Algorithms/786.k-th-smallest-prime-fraction)|29%|Hard|❤️| +|787|[Cheapest Flights Within K Stops](./Algorithms/787.cheapest-flights-within-k-stops)|30%|Medium|❤️| +|788|[Rotated Digits](./Algorithms/788.rotated-digits)|50%|Easy|| +|789|[Escape The Ghosts](./Algorithms/789.escape-the-ghosts)|47%|Medium|| +|790|[Domino and Tromino Tiling](./Algorithms/790.domino-and-tromino-tiling)|32%|Medium|❤️| +|791|[Custom Sort String](./Algorithms/791.custom-sort-string)|60%|Medium|| +|792|[Number of Matching Subsequences](./Algorithms/792.number-of-matching-subsequences)|35%|Medium|❤️| +|793| * Preimage Size of Factorial Zeroes Function|45%|Hard|| +|794| * Valid Tic-Tac-Toe State|27%|Medium|| +|795| * Number of Subarrays with Bounded Maximum|40%|Medium|| +|796| * Rotate String|54%|Easy|| +|797| * All Paths From Source to Target|69%|Medium|| +|798| * Smallest Rotation with Highest Score|31%|Hard|| +|799| * Champagne Tower|28%|Medium|| +|801| * Minimum Swaps To Make Sequences Increasing|23%|Medium|| +|802| * Find Eventual Safe States|35%|Medium|| +|803| * Bricks Falling When Hit|20%|Hard|| +|804| * Unique Morse Code Words|76%|Easy|| +|805| * Split Array With Same Average|19%|Hard|| +|806| * Number of Lines To Write String|64%|Easy|| +|807| * Max Increase to Keep City Skyline|82%|Medium|| +|808| * Soup Servings|30%|Medium|| +|809| * Expressive Words|34%|Medium|| +|810| * Chalkboard XOR Game|35%|Hard|| +|811| * Subdomain Visit Count|65%|Easy|| +|812| * Largest Triangle Area :new: |51%|Easy|| +|813| * Largest Sum of Averages :new: |37%|Medium|| +|814| * Binary Tree Pruning :new: |73%|Medium|| +|815| * Bus Routes :new: |30%|Hard|| + + +------------------------------------------------------------------ + +以下免费的算法题,暂时不能使用 Go 解答 + +- [116.Populating Next Right Pointers in Each Node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/) +- [117.Populating Next Right Pointers in Each Node II](https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/) +- [133.Clone Graph](https://leetcode.com/problems/clone-graph/) +- [138.Copy List with Random Pointer](https://leetcode.com/problems/copy-list-with-random-pointer/) +- [141.Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/) +- [142.Linked List Cycle II](https://leetcode.com/problems/linked-list-cycle-ii/) +- [151.Reverse Words in a String](https://leetcode.com/problems/reverse-words-in-a-string/) +- [160.Intersection of Two Linked Lists](https://leetcode.com/problems/intersection-of-two-linked-lists/) +- [173.Binary Search Tree Iterator](https://leetcode.com/problems/binary-search-tree-iterator/) +- [190.Reverse Bits](https://leetcode.com/problems/reverse-bits/) +- [191.Number of 1 Bits](https://leetcode.com/problems/number-of-1-bits/) +- [222.Count Complete Tree Nodes](https://leetcode.com/problems/count-complete-tree-nodes/) +- [235.Lowest Common Ancestor of a Binary Search Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/) +- [236.Lowest Common Ancestor of a Binary Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/) +- [237.Delete Node in a Linked List](https://leetcode.com/problems/delete-node-in-a-linked-list/) +- [278.First Bad Version](https://leetcode.com/problems/first-bad-version/) +- [284.Peeking Iterator](https://leetcode.com/problems/peeking-iterator/) +- [297.Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/) +- [341.Flatten Nested List Iterator](https://leetcode.com/problems/flatten-nested-list-iterator/) +- [374.Guess Number Higher or Lower](https://leetcode.com/problems/guess-number-higher-or-lower/) +- [386.Lexicographical Numbers](https://leetcode.com/problems/lexicographical-numbers/) +- [449.Serialize and Deserialize BST](https://leetcode.com/problems/serialize-and-deserialize-bst/) +- [535.Encode and Decode TinyURL](https://leetcode.com/problems/encode-and-decode-tinyurl/) +- [690.Employee Importance](https://leetcode.com/problems/employee-importance/) + +------------------------------------------------------------------ + +## 二.分类 + +## Array + +| Title | Solution | Difficulty | Time | Space |收藏| +| ----- | :--------: | :----------: | :----: | :-----: | :-----: | +|[1. Two Sum](https://leetcode.com/problems/two-sum/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0001.%20Two%20Sum)| Easy | O(n)| O(n)|| +|[11. Container With Most Water](https://leetcode.com/problems/container-with-most-water/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0011.%20Container%20With%20Most%20Water)| Medium | O(n)| O(1)|| +|[15. 3Sum](https://leetcode.com/problems/3sum)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0015.%203Sum)| Medium | O(n^2)| O(n)|| +|[16. 3Sum Closest](https://leetcode.com/problems/3sum-closest)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0016.%203Sum%20Closest)| Medium | O(n^2)| O(1)|| +|[18. 4Sum](https://leetcode.com/problems/4sum)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0018.%204Sum)| Medium | O(n^3)| O(n^2)|| +|[26. Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0026.%20Remove%20Duplicates%20from%20Sorted%20Array)| Easy | O(n)| O(1)|| +|[27. Remove Element](https://leetcode.com/problems/remove-element)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0027.%20Remove%20Element)| Easy | O(n)| O(1)|| +|[39. Combination Sum](https://leetcode.com/problems/combination-sum)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0039.%20Combination%20Sum)| Medium | O(n log n)| O(n)|| +|[40. Combination Sum II](https://leetcode.com/problems/combination-sum-ii)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0040.%20Combination%20Sum%20II)| Medium | O(n log n)| O(n)|| +|[41. First Missing Positive](https://leetcode.com/problems/first-missing-positive)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0041.%20First-Missing-Positive)| Hard | O(n)| O(n)|| +|[42. Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0042.%20Trapping%20Rain%20Water)| Hard | O(n)| O(1)|| +|[48. Rotate Image](https://leetcode.com/problems/rotate-image)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0048.%20Rotate%20Image)| Medium | O(n)| O(1)|| +|[53. Maximum Subarray](https://leetcode.com/problems/maximum-subarray)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0053.%20Maximum%20Subarray)| Easy | O(n)| O(n)|| +|[54. Spiral Matrix](https://leetcode.com/problems/spiral-matrix)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0054.%20Spiral%20Matrix)| Medium | O(n)| O(n^2)|| +|[56. Merge Intervals](https://leetcode.com/problems/merge-intervals)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0056.%20Merge%20Intervals)| Medium | O(n log n)| O(1)|| +|[57. Insert Interval](https://leetcode.com/problems/insert-interval)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0057.%20Insert%20Interval)| Hard | O(n)| O(1)|| +|[59. Spiral Matrix II](https://leetcode.com/problems/spiral-matrix-ii)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0059.%20Spiral%20Matrix%20II)| Medium | O(n)| O(n^2)|| +|[62. Unique Paths](https://leetcode.com/problems/unique-paths)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0062.%20Unique%20Paths)| Medium | O(n^2)| O(n^2)|| +|[63. Unique Paths II](https://leetcode.com/problems/unique-paths-ii)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0063.%20Unique%20Paths%20II)| Medium | O(n^2)| O(n^2)|| +|[64. Minimum Path Sum](https://leetcode.com/problems/minimum-path-sum)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0064.%20Minimum%20Path%20Sum)| Medium | O(n^2)| O(n^2)|| +|[75. Sort Colors](https://leetcode.com/problems/sort-colors)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0075.%20Sort%20Colors)| Medium | O(n)| O(1)|| +|[78. Subsets](https://leetcode.com/problems/subsets)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0078.%20Subsets)| Medium | O(n^2)| O(n)|| +|[79. Word Search](https://leetcode.com/problems/word-search)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0079.%20Word%20Search)| Medium | O(n^2)| O(n^2)|| +|[80. Remove Duplicates from Sorted Array II](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0080.%20Remove%20Duplicates%20from%20Sorted%20Array%20II)| Medium | O(n^2)| O(n^2)|| +|[84. Largest Rectangle in Histogram](https://leetcode.com/problems/largest-rectangle-in-histogram)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0084.%20Largest%20Rectangle%20in%20Histogram)| Medium | O(n)| O(n)|| +|[88. Merge Sorted Array](https://leetcode.com/problems/merge-sorted-array)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0088.%20Merge-Sorted-Array)| Easy | O(n)| O(1)|| +|[90. Subsets II](https://leetcode.com/problems/subsets-ii)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0090.%20Subsets%20II)| Medium | O(n^2)| O(n)|| +|[120. Triangle](https://leetcode.com/problems/triangle)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0120.%20Triangle)| Medium | O(n^2)| O(n)|| +|[121. Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0121.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock)| Easy | O(n)| O(1)|| +|[122. Best Time to Buy and Sell Stock II](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0122.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20II)| Easy | O(n)| O(1)|| +|[126. Word Ladder II](https://leetcode.com/problems/word-ladder-ii)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0126.%20Word%20Ladder%20II)| Hard | O(n)| O(n^2)|| +|[152. Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0152.%20Maximum%20Product%20Subarray)| Medium | O(n)| O(1)|| +|[167. Two Sum II - Input array is sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0167.%20Two%20Sum%20II%20-%20Input%20array%20is%20sorted)| Easy | O(n)| O(1)|| +|[209. Minimum Size Subarray Sum](https://leetcode.com/problems/minimum-size-subarray-sum)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0209.%20Minimum%20Size%20Subarray%20Sum)| Medium | O(n)| O(1)|| +|[216. Combination Sum III](https://leetcode.com/problems/combination-sum-iii)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0216.%20Combination%20Sum%20III)| Medium | O(n)| O(1)|| +|[217. Contains Duplicate](https://leetcode.com/problems/contains-duplicate)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0217.%20Contains%20Duplicate)| Easy | O(n)| O(n)|| +|[219. Contains Duplicate II](https://leetcode.com/problems/contains-duplicate-ii)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0219.%20Contains%20Duplicate%20II)| Easy | O(n)| O(n)|| +|[283. Move Zeroes](https://leetcode.com/problems/move-zeroes)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0283.%20Move%20Zeroes)| Easy | O(n)| O(1)|| +|[287. Find the Duplicate Number](https://leetcode.com/problems/find-the-duplicate-number)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0287.%20Find%20the%20Duplicate%20Number)| Easy | O(n)| O(1)|| +|[532. K-diff Pairs in an Array](https://leetcode.com/problems/k-diff-pairs-in-an-array)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0532.%20K-diff%20Pairs%20in%20an%20Array)| Easy | O(n)| O(n)|| +|[566. Reshape the Matrix](https://leetcode.com/problems/reshape-the-matrix)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0566.%20Reshape%20the%20Matrix)| Easy | O(n^2)| O(n^2)|| +|[628. Maximum Product of Three Numbers](https://leetcode.com/problems/maximum-product-of-three-numbers)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0628.%20Maximum%20Product%20of%20Three%20Numbers)| Easy | O(n)| O(1)|| +|[713. Subarray Product Less Than K](https://leetcode.com/problems/subarray-product-less-than-k)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0713.%20Subarray%20Product%20Less%20Than%20K)| Medium | O(n)| O(1)|| +|[714. Best Time to Buy and Sell Stock with Transaction Fee](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0714.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20with%20Transaction%20Fee)| Medium | O(n)| O(1)|| +|[746. Min Cost Climbing Stairs](https://leetcode.com/problems/min-cost-climbing-stairs)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0746.%20Min%20Cost%20Climbing%20Stairs)| Easy | O(n)| O(1)|| +|[766. Toeplitz Matrix](https://leetcode.com/problems/toeplitz-matrix)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0766.%20Toeplitz%20Matrix)| Easy | O(n)| O(1)|| +|[867. Transpose Matrix](https://leetcode.com/problems/transpose-matrix)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0867.%20Transpose%20Matrix)| Easy | O(n)| O(1)|| +|[891. Sum of Subsequence Widths](https://leetcode.com/problems/sum-of-subsequence-widths)| [Go]()| Hard | O(n)| O(1)|| +|[907. Sum of Subarray Minimums](https://leetcode.com/problems/sum-of-subarray-minimums)| [Go]()| Medium | O(n)| O(1)|| +|[922. Sort Array By Parity II](https://leetcode.com/problems/sum-of-subarray-minimums)| [Go]()| Medium | O(n)| O(1)|| +|[969. Pancake Sorting](https://leetcode.com/problems/pancake-sorting)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0969.%20Pancake%20Sorting)| Medium | O(n)| O(1)|| +|[977. Squares of a Sorted Array](https://leetcode.com/problems/squares-of-a-sorted-array)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0977.%20Squares%20of%20a%20Sorted%20Array)| Easy | O(n)| O(1)|| + + + + +| Title | Solution | Difficulty | Time | Space | +| ----- | -------- | ---------- | ---- | ----- | +[Max Consecutive Ones](https://leetcode.com/problems/max-consecutive-ones/)| [Go](./Array/MaxConsecutiveOnes.Go)| Easy| O(n)| O(1)| +[Heaters](https://leetcode.com/problems/heaters/)| [Go](./Array/Heaters.Go)| Easy| O(nlogn)| O(1)| +[Number of Boomerangs](https://leetcode.com/problems/number-of-boomerangs/)| [Go](./Array/NumberBoomerangs.Go)| Easy| O(n ^ 2)| O(n)| +[Island Perimeter](https://leetcode.com/problems/island-perimeter/)| [Go](./Array/IslandPerimeter.Go)| Easy| O(nm)| O(1)| +[Majority Element](https://leetcode.com/problems/majority-element/)| [Go](./Array/MajorityElement.Go)| Easy| O(n)| O(1)| +[Majority Element II](https://leetcode.com/problems/majority-element-ii/)| [Go](./Array/MajorityElementII.Go)| Medium| O(n)| O(1)| +[Intersection of Two Arrays](https://leetcode.com/problems/intersection-of-two-arrays/)| [Go](./Array/IntersectionTwoArrays.Go)| Easy| O(n)| O(n)| +[Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii/)| [Go](./Array/IntersectionTwoArraysII.Go)| Easy| O(n)| O(n)| +[Contains Duplicate](https://leetcode.com/problems/contains-duplicate/)| [Go](./Array/ContainsDuplicate.Go)| Easy| O(n)| O(n)| +[Contains Duplicate II](https://leetcode.com/problems/contains-duplicate-ii/)| [Go](./Array/ContainsDuplicateII.Go)| Easy| O(n)| O(n)| +[Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/)| [Go](./Array/RemoveDuplicatesFromSortedArray.Go)| Easy| O(n)| O(1)| +[Remove Duplicates from Sorted Array II](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/)| [Go](./Array/RemoveDuplicatesFromSortedArrayII.Go)| Medium| O(n)| O(1)| +[Move Zeroes](https://leetcode.com/problems/move-zeroes/)| [Go](./Array/MoveZeroes.Go)| Easy| O(n)| O(1)| +[Remove Element](https://leetcode.com/problems/remove-element/)| [Go](./Array/RemoveElement.Go)| Easy| O(n)| O(1)| +[Two Sum](https://leetcode.com/problems/two-sum/)| [Go](./Array/TwoSum.Go)| Easy| O(n)| O(n)| +[3Sum](https://leetcode.com/problems/3sum/)| [Go](./Array/ThreeSum.Go)| Medium| O(n^2)| O(nC3)| +[3Sum Closest](https://leetcode.com/problems/3sum-closest/)| [Go](./Array/ThreeSum.Go)| Medium| O(n^2)| O(nC3)| +[4Sum](https://leetcode.com/problems/4sum/)| [Go](./Array/FourSum.Go)| Medium| O(n^3)| O(nC4)| +[Summary Ranges](https://leetcode.com/problems/summary-ranges/)| [Go](./Array/SummaryRanges.Go)| Medium| O(n)| O(n)| +[Shortest Word Distance](https://leetcode.com/problems/shortest-word-distance/)| [Go](./Array/ShortestWordDistance.Go)| Easy| O(n)| O(1)| +[Shortest Word Distance III](https://leetcode.com/problems/shortest-word-distance-iii/)| [Go](./Array/ShortestWordDistanceIII.Go)| Medium| O(n)| O(1)| +[Minimum Size Subarray Sum](https://leetcode.com/problems/minimum-size-subarray-sum/)| [Go](./Array/MinimumSizeSubarraySum.Go)| Medium| O(n)| O(1)| +[Maximum Size Subarray Sum Equals k](https://leetcode.com/problems/maximum-size-subarray-sum-equals-k/)| [Go](./Array/MaximumSizeSubarraySumEqualsK.Go)| Medium| O(n)| O(n)| +[Smallest Range](https://leetcode.com/problems/smallest-range/)| [Go](./Array/SmallestRange.Go)| Hard | O(nm)| O(nm)| +[Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/)| [Go](./Array/ProductExceptSelf.Go)| Medium| O(n)| O(n)| +[Rotate Array](https://leetcode.com/problems/rotate-array/)| [Go](./Array/RotateArray.Go)| Easy| O(n)| O(1)| +[Rotate Image](https://leetcode.com/problems/rotate-image/)| [Go](./Array/RotateImage.Go)| Medium| O(n^2)| O(1)| +[Spiral Matrix](https://leetcode.com/problems/spiral-matrix/)| [Go](./Array/SpiralMatrix.Go)| Medium| O(n^2)| O(1)| +[Spiral Matrix II](https://leetcode.com/problems/spiral-matrix/)| [Go](./Array/SpiralMatrixII.Go)| Medium| O(n^2)| O(1)| +[Valid Sudoku](https://leetcode.com/problems/valid-sudoku/)| [Go](./Array/ValidSudoku.Go)| Easy| O(n^2)| O(n)| +[Set Matrix Zero](https://leetcode.com/problems/set-matrix-zeroes/)| [Go](./Array/SetMatrixZero.Go)| Medium| O(n^2)| O(1)| +[Next Permutation](https://leetcode.com/problems/next-permutation/)| [Go](./Array/NextPermutation.Go)| Medium| O(n)| O(1)| +[Gas Station](https://leetcode.com/problems/gas-station/)| [Go](./Array/GasStation.Go)| Medium| O(n)| O(1)| +[Game of Life](https://leetcode.com/problems/game-of-life/)| [Go](./Array/GameLife.Go)| Medium| O(n)| O(1)| +[Task Scheduler](https://leetcode.com/problems/task-scheduler/)| [Go](./Array/TaskScheduler.Go)| Medium| O(nlogn)| O(n)| +[Sliding Window Maximum ](https://leetcode.com/problems/sliding-window-maximum/)| [Go](./Array/SlidingWindowMaximum.Go)| Hard| O(n)| O(n)| +[Longest Consecutive Sequence](https://leetcode.com/problems/longest-consecutive-sequence/)| [Go](./Array/LongestConsecutiveSequence.Go)| Hard| O(n)| O(n)| + + +## String +| Title | Solution | Difficulty | Time | Space | +| ----- | -------- | ---------- | ---- | ----- | +[Fizz Buzz](https://leetcode.com/problems/fizz-buzz/)| [Go](./String/FizzBuzz.Go)| Easy| O(n)| O(1)| +[First Unique Character in a String](https://leetcode.com/problems/first-unique-character-in-a-string/)| [Go](./String/FirstUniqueCharacterInString.Go)| Easy| O(n)| O(1)| +[Keyboard Row](https://leetcode.com/problems/keyboard-row/)| [Go](./String/KeyboardRow.Go)| Easy| O(nm)| O(n)| +[Valid Palindrome](https://leetcode.com/problems/valid-palindrome/)| [Go](./String/ValidPalindrome.Go)| Easy| O(n)| O(n)| +[Valid Palindrome II](https://leetcode.com/problems/valid-palindrome-ii/)| [Go](./String/ValidPalindromeII.Go)| Easy| O(n)| O(n)| +[Detect Capital](https://leetcode.com/problems/detect-capital/)| [Go](./String/DetectCapital.Go)| Easy| O(n)| O(1)| +[Count and Say](https://leetcode.com/problems/count-and-say/)| [Go](./String/CountAndSay.Go)| Easy| O(n^2)| O(n)| +[Flip Game](https://leetcode.com/problems/flip-game/)| [Go](./String/FlipGame.Go)| Easy| O(n)| O(n)| +[Implement strStr()](https://leetcode.com/problems/implement-strstr/)| [Go](./String/StrStr.Go)| Easy| O(nm)| O(n)| +[Isomorphic Strings](https://leetcode.com/problems/isomorphic-strings/)| [Go](./String/IsomorphicStrings.Go)| Easy| O(n)| O(n)| +[Reverse String](https://leetcode.com/problems/reverse-string/)| [Go](./String/ReverseString.Go)| Easy| O(n)| O(n)| +[Reverse String II](https://leetcode.com/problems/reverse-string-ii/)| [Go](./String/ReverseStringII.Go)| Easy| O(n)| O(n)| +[Reverse Vowels of a String](https://leetcode.com/problems/reverse-vowels-of-a-string/)| [Go](./String/ReverseVowelsOfAString.Go)| Easy| O(n)| O(n)| +[Length of Last Word](https://leetcode.com/problems/length-of-last-word/)| [Go](./String/AddStrings.Go)| Easy| O(n)| O(n)| +[Add Strings](https://leetcode.com/problems/add-strings/)| [Go](./String/LengthLastWord.Go)| Easy| O(n)| O(1)| +[Multiply Strings](https://leetcode.com/problems/multiply-strings/)| [Go](./String/MultiplyStrings.Go)| Medium| O(n)| O(1)| +[Palindrome Permutation](https://leetcode.com/problems/palindrome-permutation/)| [Go](./String/PalindromePermutation.Go)| Easy| O(n)| O(n)| +[Valid Anagram](https://leetcode.com/problems/valid-anagram/)| [Go](./String/ValidAnagram.Go)| Easy| O(nlogn)| O(1)| +[Ransom Note](https://leetcode.com/problems/ransom-note/)| [Go](./String/RansomNote.Go)| Easy| O(n)| O(n)| +[Group Anagrams](https://leetcode.com/problems/anagrams/)| [Go](./String/GroupAnagrams.Go)| Medium| O(nmlogm + nlogn)| O(n) +[Longest Common Prefix](https://leetcode.com/problems/longest-common-prefix/)| [Go](./String/LongestCommonPrefix.Go)| Easy| O(nm)| O(m)| +[Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/)| [Go](./String/LongestSubstringWithoutRepeatingCharacters.Go)| Medium| O(n)| O(n)| +[One Edit Distance](https://leetcode.com/problems/one-edit-distance/)| [Go](./String/OneEditDistance.Go)| Medium| O(n)| O(n)| +[Word Pattern](https://leetcode.com/problems/word-pattern/)| [Go](./String/WordPattern.Go)| Easy| O(n)| O(n)| +[Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring/)| [Go](./Array/MinimumWindowSubstring.Go)| Hard| O(n^2)| O(n)| +[Text Justification](https://leetcode.com/problems/text-justification/)| [Go](./String/TextJustification.Go)| Hard| O(n)| O(n)| + +## Linked List (已全部做完) + +- 巧妙的构造虚拟头结点。可以使遍历处理逻辑更加统一。 +- 灵活使用递归。构造递归条件,使用递归可以巧妙的解题。不过需要注意有些题目不能使用递归,因为递归深度太深会导致超时和栈溢出。 +- 链表区间逆序。第 92 题。 +- 链表寻找中间节点。第 876 题。链表寻找倒数第 n 个节点。第 19 题。只需要一次遍历就可以得到答案。 +- 合并 K 个有序链表。第 21 题,第 23 题。 +- 链表归类。第 86 题,第 328 题。 +- 链表排序,时间复杂度要求 O(n * log n),空间复杂度 O(1)。只有一种做法,归并排序,至顶向下归并。第 148 题。 +- 判断链表是否存在环,如果有环,输出环的交叉点的下标;判断 2 个链表是否有交叉点,如果有交叉点,输出交叉点。第 141 题,第 142 题,第 160 题。 + + + +| Title | Solution | Difficulty | Time | Space |收藏| +| ----- | :--------: | :----------: | :----: | :-----: | :-----: | +|[2. Add Two Numbers](https://leetcode.com/problems/add-two-numbers)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0002.%20Add-Two-Number)| Medium | O(n)| O(1)|| +|[19. Remove Nth Node From End of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0019.%20Remove%20Nth%20Node%20From%20End%20of%20List)| Medium | O(n)| O(1)|| +|[21. Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0021.%20Merge%20Two%20Sorted%20Lists)| Easy | O(log n)| O(1)|| +|[23. Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0023.%20Merge%20k%20Sorted%20Lists)| Hard | O(log n)| O(1)|❤️| +|[24. Swap Nodes in Pairs](https://leetcode.com/problems/swap-nodes-in-pairs/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0024.%20Swap%20Nodes%20in%20Pairs)| Medium | O(n)| O(1)|| +|[25. Reverse Nodes in k-Group](https://leetcode.com/problems/reverse-nodes-in-k-group/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0025.%20Reverse%20Nodes%20in%20k%20Group)| Hard | O(log n)| O(1)|❤️| +|[61. Rotate List](https://leetcode.com/problems/rotate-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0061.%20Rotate%20List)| Medium | O(n)| O(1)|| +|[82. Remove Duplicates from Sorted List II](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0082.%20Remove%20Duplicates%20from%20Sorted%20List%20II)| Medium | O(n)| O(1)|| +|[83. Remove Duplicates from Sorted List](https://leetcode.com/problems/remove-duplicates-from-sorted-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0083.%20Remove%20Duplicates%20from%20Sorted%20List)| Easy | O(n)| O(1)|| +|[86. Partition List](https://leetcode.com/problems/partition-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0086.%20Partition%20List)| Medium | O(n)| O(1)|❤️| +|[92. Reverse Linked List II](https://leetcode.com/problems/reverse-linked-list-ii/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0092.%20Reverse%20Linked%20List%20II)| Medium | O(n)| O(1)|❤️| +|[109. Convert Sorted List to Binary Search Tree](https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0109.%20Convert%20Sorted%20List%20to%20Binary%20Search%20Tree)| Medium | O(log n)| O(n)|| +|[141. Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0141.%20Linked%20List%20Cycle)| Easy | O(n)| O(1)|❤️| +|[142. Linked List Cycle II](https://leetcode.com/problems/linked-list-cycle-ii/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0142.%20Linked%20List%20Cycle%20II)| Medium | O(n)| O(1)|❤️| +|[143. Reorder List](https://leetcode.com/problems/reorder-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0143.%20Reorder%20List)| Medium | O(n)| O(1)|❤️| +|[147. Insertion Sort List](https://leetcode.com/problems/insertion-sort-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0147.%20Insertion%20Sort%20List)| Medium | O(n)| O(1)|| +|[148. Sort List](https://leetcode.com/problems/sort-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0148.%20Sort%20List)| Medium | O(log n)| O(n)|❤️| +|[160. Intersection of Two Linked Lists](https://leetcode.com/problems/intersection-of-two-linked-lists/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0160.%20Intersection%20of%20Two%20Linked%20Lists)| Easy | O(n)| O(1)|❤️| +|[203. Remove Linked List Elements](https://leetcode.com/problems/remove-linked-list-elements/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0203.%20Remove%20Linked%20List%20Elements)| Easy | O(n)| O(1)|| +|[206. Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0206.%20Reverse-Linked-List)| Easy | O(n)| O(1)|| +|[234. Palindrome Linked List](https://leetcode.com/problems/palindrome-linked-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0234.%20Palindrome%20Linked%20List)| Easy | O(n)| O(1)|| +|[237. Delete Node in a Linked List](https://leetcode.com/problems/delete-node-in-a-linked-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0237.%20Delete%20Node%20in%20a%20Linked%20List)| Easy | O(n)| O(1)|| +|[328. Odd Even Linked List](https://leetcode.com/problems/odd-even-linked-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0328.%20Odd%20Even%20Linked%20List)| Medium | O(n)| O(1)|| +|[445. Add Two Numbers II](https://leetcode.com/problems/add-two-numbers-ii/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0445.%20Add%20Two%20Numbers%20II)| Medium | O(n)| O(n)|| +|[725. Split Linked List in Parts](https://leetcode.com/problems/split-linked-list-in-parts/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0725.%20Split%20Linked%20List%20in%20Parts)| Medium | O(n)| O(1)|| +|[817. Linked List Components](https://leetcode.com/problems/linked-list-components/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0817.%20Linked%20List%20Components)| Medium | O(n)| O(1)|| +|[707. Design Linked List](https://leetcode.com/problems/design-linked-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0707.%20Design%20Linked%20List)| Easy | O(n)| O(1)|| +|[876. Middle of the Linked List](https://leetcode.com/problems/middle-of-the-linked-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0876.%20Middle%20of%20the%20Linked%20List)| Easy | O(n)| O(1)|❤️| +|[1019. Next Greater Node In Linked List](https://leetcode.com/problems/next-greater-node-in-linked-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/1019.%20Next%20Greater%20Node%20In%20Linked%20List)| Medium | O(n)| O(1)|| +|----------------------------------------------------------------------------|-------------|-------------| -------------| -------------|-------------| + +## Stack (已全部做完) + +| Title | Solution | Difficulty | Time | Space | +| ----- | -------- | ---------- | ---- | ----- | +[Valid Parentheses](https://leetcode.com/problems/valid-parentheses/)| [Go](./Stack/ValidParentheses.Go)| Easy| O(n)| O(n)| +[Longest Valid Parentheses](https://leetcode.com/problems/longest-valid-parentheses/)| [Go](./Stack/LongestValidParentheses.Go)| Hard| O(n)| O(n)| +[Evaluate Reverse Polish Notation](https://leetcode.com/problems/evaluate-reverse-polish-notation/)| [Go](./Stack/EvaluateReversePolishNotation.Go)| Medium| O(n)| O(n)| +[Simplify Path](https://leetcode.com/problems/simplify-path/)| [Go](./Stack/SimplifyPath.Go)| Medium| O(n)| O(n)| +[Remove K Digits](https://leetcode.com/problems/remove-k-digits/)| [Go](./Stack/RemoveKDigits.Go)| Medium| O(n)| O(n)| +[Ternary Expression Parser](https://leetcode.com/problems/ternary-expression-parser/)| [Go](./Stack/TernaryExpressionParser.Go)| Medium| O(n)| O(n)| +[Binary Tree Preorder Traversal](https://leetcode.com/problems/binary-tree-preorder-traversal/)| [Go](./Stack/PreorderTraversal.Go)| Medium| O(n)| O(n)| +[Binary Tree Inorder Traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/)| [Go](./Stack/InorderTraversal.Go)| Medium| O(n)| O(n)| +[Binary Tree Postorder Traversal](https://leetcode.com/problems/binary-tree-postorder-traversal/)| [Go](./Stack/PostorderTraversal.Go)| Hard| O(n)| O(n)| + + +## Tree +| Title | Solution | Difficulty | Time | Space | +| ----- | -------- | ---------- | ---- | ----- | +[Same Tree](https://oj.leetcode.com/problems/same-tree/)| [Go](./Tree/SameTree.Go)| Easy| O(n)| O(n)| +[Symmetric Tree](https://leetcode.com/problems/symmetric-tree/)| [Go](./Tree/SymmetricTree.Go)| Easy| O(n)| O(n)| +[Invert Binary Tree](https://leetcode.com/problems/invert-binary-tree/)| [Go](./Tree/InvertBinaryTree)| Easy| O(n)| O(n)| +[Binary Tree Upside Down](https://leetcode.com/problems/binary-tree-upside-down/)| [Go](./Tree/BinaryTreeUpsideDown)| Medium| O(n)| O(1)| +[Minimum Depth of Binary Tree](https://leetcode.com/problems/minimum-depth-of-binary-tree/)| [Go](./Tree/MinimumDepthOfBinaryTree.Go)| Easy| O(n)| O(1)| +[Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/)| [Go](./Tree/MaximumDepthOfBinaryTree.Go)| Easy| O(n)| O(1)| +[Diameter of Binary Tree](https://leetcode.com/problems/diameter-of-binary-tree/)| [Go](./Tree/DiameterBinaryTree.Go)| Easy| O(n)| O(1)| +[Balanced Binary Tree](https://leetcode.com/problems/balanced-binary-tree/)| [Go](./Tree/BalancedBinaryTree.Go)| Easy| O(n)| O(n)| +[Sum of Left Leaves](https://leetcode.com/problems/sum-of-left-leaves/)| [Go](./Tree/SumLeftLeaves.Go)| Easy| O(n)| O(1)| +[Flatten Binary Tree to Linked List](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/)| [Go](./Tree/FlattenBinaryTreeLinkedList.Go)| Medium| O(n)| O(1)| +[Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/)| [Go](./Tree/ValidateBinarySearchTree.Go)| Medium| O(n)| O(n)| +[Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/)| [Go](./Tree/BinaryTreeLevelOrderTraversal.Go)| Easy| O(n)| O(n)| +[Binary Tree Level Order Traversal II](https://leetcode.com/problems/binary-tree-level-order-traversal-ii/)| [Go](./Tree/BinaryTreeLevelOrderTraversalII.Go)| Easy| O(n)| O(n)| +[Binary Tree Zigzag Level Order Traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/)| [Go](./Tree/BinaryTreeZigzagLevelOrderTraversal.Go)| Medium| O(n)| O(n)| +[Binary Tree Vertical Order Traversal](https://leetcode.com/problems/binary-tree-vertical-order-traversal/)| [Go](./Tree/BinaryTreeVerticalOrderTraversal.Go)| Medium| O(n)| O(n)| +[Binary Tree Right Side View](https://leetcode.com/problems/binary-tree-right-side-view/)| [Go](./Tree/BinaryTreeRightSideView.Go)| Medium| O(n)| O(n)| +[Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/)| [Go](./Tree/ConstructBinaryTreePreorderInorder.Go)| Medium| O(n)| O(n)| +[Construct Binary Tree from Inorder and Postorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/)| [Go](./Tree/ConstructBinaryTreeInorderPostorder.Go)| Medium| O(n)| O(n)| +[Path Sum](https://leetcode.com/problems/path-sum/)| [Go](./Tree/PathSum.Go)| Easy| O(n)| O(n)| +[Path Sum II](https://leetcode.com/problems/path-sum-ii/)| [Go](./Tree/PathSumII.Go)| Medium| O(n)| O(n)| +[Path Sum III](https://leetcode.com/problems/path-sum-iiI/)| [Go](./Tree/PathSumIII.Go)| Easy| O(n^2)| O(1)| +[Bnary Tree Paths](https://leetcode.com/problems/binary-tree-paths/)| [Go](./Tree/BnaryTreePaths.Go)| Easy| O(n)| O(n)| +[Unique Binary Search Trees](https://leetcode.com/problems/unique-binary-search-trees/)| [Go](./Tree/UniqueBinarySearchTrees.Go)| Medium| O(n^2)| O(n)| +[Recover Binary Search Tree](https://leetcode.com/problems/recover-binary-search-tree/)| [Go](./Tree/RecoverBinarySearchTree.Go)| Hard| O(n)| O(1)| +[Merge Two Binary Trees](https://leetcode.com/problems/merge-two-binary-trees/description/) | [Go](./Tree/MergeTwoBinaryTrees.Go) | Easy | O(n) | O(n) | + +## Dynamic programming +| Title | Solution | Difficulty | Time | Space | +| ----- | -------- | ---------- | ---- | ----- | +[Nested List Weight Sum](https://leetcode.com/problems/nested-list-weight-sum/)| [Go](./DP/NestedListWeightSum.Go)| Easy| O(n)| O(1)| +[Climbing Stairs](https://leetcode.com/problems/climbing-stairs/)| [Go](./DP/ClimbingStairs.Go)| Easy| O(n)| O(1)| +[Min Cost Climbing Stairs](https://leetcode.com/problems/min-cost-climbing-stairs/)| [Go](./DP/MinCostClimbingStairs.Go)| Easy| O(n)| O(n)| +[Unique Paths](https://leetcode.com/problems/unique-paths/)| [Go](./DP/UniquePaths.Go)| Medium| O(mn)| O(mn)| +[Unique Paths II](https://leetcode.com/problems/unique-paths-ii/)| [Go](./DP/UniquePathsII.Go)| Medium| O(mn)| O(mn)| +[Decode Ways](https://leetcode.com/problems/decode-ways/)| [Go](./DP/DecodeWays.Go) | O(n)|O(n)| +[Minimum Path Sum](https://leetcode.com/problems/minimum-path-sum/)| [Go](./DP/MinimumPathSum.Go)| Medium| O(mn)| O(mn)| +[Generate Parentheses](https://leetcode.com/problems/generate-parentheses/)| [Go](./DP/GenerateParentheses.Go)| Medium| O(2^n)| O(n)| +[Different Ways to Add Parentheses](https://leetcode.com/problems/different-ways-to-add-parentheses/)| [Go](./DP/DifferentWaysAddParentheses.Go)| Medium| O(n^n)| O(n)| +[Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)| [Go](./DP/BestTimeBuySellStock.Go)| Easy| O(n)| O(1)| +[Best Time to Buy and Sell Stock II](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/)| [Go](./DP/BestTimeBuySellStockII.Go)| Medium| O(n)| O(1)| +[Best Time to Buy and Sell Stock III](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/)| [Go](./DP/BestTimeBuySellStockIII.Go)| Hard| O(n)| O(n)| +[Best Time to Buy and Sell Stock IV](https://leetcode.com/problems/https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/)| [Go](./DP/BestTimeBuySellStockIV.Go)| Hard| O(n^2)| O(n)| +[Best Time to Buy and Sell Stock with Cooldown](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/)| [Go](./DP/BestTimeBuySellStockCooldown.Go)| Medium| O(n^2)| O(n)| +[Coin Change](https://leetcode.com/problems/coin-change/)| [Go](./DP/CoinChange.Go)| Medium| O(n^2)| O(n)| +[Coin Change II](https://leetcode.com/problems/coin-change-ii/)| [Go](./DP/CoinChangeII.Go)| Medium| O(n^2)| O(n)| +[Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/)| [Go](./DP/LongestIncreasingSubsequence.Go)| Medium| O(n^2)| O(n)| +[Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/)| [Go](./DP/LongestPalindromicSubstring.Go)| Medium| O(n^2)| O(n^2)| +[Perfect Squares](https://leetcode.com/problems/perfect-squares/)| [Go](./DP/PerfectSquares.Go)| Medium| O(n^2)| O(n)| +[House Robber](https://leetcode.com/problems/house-robber/)| [Go](./DP/HouseRobber.Go)| Easy| O(n)| O(1)| +[House Robber II](https://leetcode.com/problems/house-robber-ii/)| [Go](./DP/HouseRobberII.Go)| Medium| O(n)| O(1)| +[Paint Fence](https://leetcode.com/problems/paint-fence/)| [Go](./DP/PaintFence.Go)| Easy| O(n)| O(n)| +[Maximum Subarray](https://leetcode.com/problems/maximum-subarray/)| [Go](./DP/MaximumSubarray.Go)| Medium| O(n)| O(1)| +[Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/)| [Go](./DP/MaximumProductSubarray.Go)| Medium| O(n)| O(1)| +[Maximal Square](https://leetcode.com/problems/maximal-square/)| [Go](./DP/MaximalSquare.Go)| Medium| O(mn)| O(mn)| +[Edit Distance](https://leetcode.com/problems/edit-distance/)| [Go](./DP/EditDistance.Go)| Hard| O(mn)| O(mn)| +[Combination Sum IV](https://leetcode.com/problems/combination-sum-iv/)| [Go](./DP/CombinationSumIV.Go)| Medium| O(2^n)| O(n)| +[Triangle](https://leetcode.com/problems/triangle/)| [Go](./DP/Triangle.Go)| Medium| O(2^n - 1)| O(m)| +[Guess Number Higher or Lower II](https://leetcode.com/problems/guess-number-higher-or-lower-ii/)| [Go](./DP/GuessNumberHigherOrLowerII.Go)| Medium| O(nlogn)| O(n^2)| +[Burst Ballons](https://leetcode.com/problems/burst-balloons/)| [Go](./DP/BurstBalloons.Go)| Hard| O(n^3)| O(n)| +[Frog Jump](https://leetcode.com/problems/frog-jump/)| [Go](./DP/FrogJump.Go)| Hard| O(n^2)| O(n)| + +## Depth-first search +| Title | Solution | Difficulty | Time | Space | +| ----- | -------- | ---------- | ---- | ----- | +[Permutations](https://leetcode.com/problems/permutations/)| [Go](./DFS/Permutations.Go)| Medium| O(n!)| O(n)| +[Permutations II](https://leetcode.com/problems/permutations-ii/)| [Go](./DFS/PermutationsII.Go)| Medium| O(n!)| O(n)| +[Subsets](https://leetcode.com/problems/subsets/)| [Go](./DFS/Subsets.Go)| Medium| O(n!)| O(n)| +[Subsets II](https://leetcode.com/problems/subsets-ii/)| [Go](./DFS/SubsetsII.Go)| Medium| O(n!)| O(n)| +[Combinations](https://leetcode.com/problems/combinations/)| [Go](./DFS/Combinations.Go)| Medium| O(n!)| O(n)| +[Combination Sum](https://leetcode.com/problems/combination-sum/)| [Go](./DFS/CombinationSum.Go)| Medium| O(n^n)| O(2^n - 1)| +[Combination Sum II](https://leetcode.com/problems/combination-sum-ii/)| [Go](./DFS/CombinationSumII.Go)| Medium| O(n!)| O(2^n - 2)| +[Combination Sum III](https://leetcode.com/problems/combination-sum-iii/)| [Go](./DFS/CombinationSumIII.Go)| Medium| O(n!)| O(nCk)| +[Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/)| [Go](./DFS/LetterCombinationsPhoneNumber.Go)| Medium| O(mn)| O(n)| +[Factor Combinations](https://leetcode.com/problems/factor-combinations/)| [Go](./DFS/FactorCombinations.Go)| Medium| O(n^n))| O(2^n - 1)| +[Generalized Abbreviation](https://leetcode.com/problems/generalized-abbreviation/)| [Go](./DFS/GeneralizedAbbreviation.Go)| Medium| O(n!)| O(2^n)| +[Palindrome Partitioning](https://leetcode.com/problems/palindrome-partitioning/)| [Go](./DFS/PalindromePartitioning.Go)| Medium| O(n!)| O(n)| +[Number of Islands](https://leetcode.com/problems/number-of-islands/)| [Go](./DFS/NumberofIslands.Go)| Medium| O((mn)^2)| O(1)| +[Walls and Gates](https://leetcode.com/problems/walls-and-gates/)| [Go](./DFS/WallsGates.Go)| Medium| O(n!)| O(2^n)| +[Word Search](https://leetcode.com/problems/word-search/)| [Go](./DFS/WordSearch.Go)| Medium| O((n^2)!)| O(n^2)| +[Word Search II](https://leetcode.com/problems/word-search-ii/)| [Go](./DFS/WordSearchII.Go)| Hard| O(((mn)^2))| O(n^2)| +[Add and Search Word - Data structure design](https://leetcode.com/problems/add-and-search-word-data-structure-design/)| [Go](./DFS/WordDictionary.Go)| Medium| O(n)| O(n)| +[N-Queens](https://leetcode.com/problems/n-queens/)| [Go](./DFS/NQueens.Go)| Hard| O((n^4))| O(n^2)| +[N-Queens II](https://leetcode.com/problems/n-queens-ii/)| [Go](./DFS/NQueensII.Go)| Hard| O((n^3))| O(n)| +[Sudoku Solver](https://leetcode.com/problems/sudoku-solver/)| [Go](./DFS/SudokuSolver.Go)| Hard| O(n^4)| O(1)| +[Remove Invalid Parentheses](https://leetcode.com/problems/remove-invalid-parentheses/)| [Go](./DFS/RemoveInvalidParentheses.Go)| Hard| O(n!)| O(n)| +[Expression Add Operators](https://leetcode.com/problems/expression-add-operators/)| [Go](./DFS/ExpressionAddOperators.Go)| Hard| O(n!)| O(n)| + +## Math + +| Title | Solution | Difficulty | Time | Space | +| ----- | -------- | ---------- | ---- | ----- | +[Add Binary](https://leetcode.com/problems/add-binary/)| [Go](./Math/AddBinary.Go)| Easy| O(n)| O(n)| +[Add Two Numbers](https://leetcode.com/problems/add-two-numbers/)| [Go](./Math/AddTwoNumbers.Go)| Medium| O(n)| O(1)| +[Add Digits](https://leetcode.com/problems/add-digits/)| [Go](./Math/AddDigits.Go)| Easy| O(1)| O(1)| +[Plus One](https://leetcode.com/problems/plus-one/)| [Go](./Math/PlusOne.Go)| Easy| O(n)| O(1)| +[Divide Two Integers](https://leetcode.com/problems/divide-two-integers/)| [Go](./Math/DivideTwoIntegers.Go)| Medium| O(logn)| O(1)| +[Number Complement](https://leetcode.com/problems/number-complement/)| [Go](./Math/NumberComplement.Go)| Easy| O(n)| O(1)| +[Hamming Distance](https://leetcode.com/problems/hamming-distance/)| [Go](./Math/HammingDistance.Go)| Easy| O(n)| O(1)| +[Integer Break](https://leetcode.com/problems/integer-break/)| [Go](./Math/IntegerBreak.Go)| Medium| O(logn)| O(1)| +[Happy Number](https://leetcode.com/problems/happy-number/)| [Go](./Math/HappyNumber.Go)| Easy| O(n)| O(n)| +[Single Number](https://leetcode.com/problems/single-number/)| [Go](./Math/SingleNumber.Go)| Medium| O(n)| O(1)| +[Ugly Number](https://leetcode.com/problems/ugly-number/)| [Go](./Math/UglyNumber.Go)| Easy| O(logn)| O(1)| +[Ugly Number II](https://leetcode.com/problems/ugly-number-ii/)| [Go](./Math/UglyNumberII.Go)| Medium| O(n)| O(n)| +[Super Ugly Number](https://leetcode.com/problems/super-ugly-number/)| [Go](./Math/SuperUglyNumber.Go)| Medium| O(n^2)| O(n)| +[Count Primes](https://leetcode.com/problems/count-primes/)| [Go](./Math/CountPrimes.Go)| Easy| O(n)| O(n)| +[String to Integer (atoi)](https://leetcode.com/problems/string-to-integer-atoi/)| [Go](./Math/Atoi.Go)| Easy| O(n)| O(1)| +[Pow(x, n)](https://leetcode.com/problems/isomorphic-strings/)| [Go](./Math/Pow.Go)| Medium| O(logn)| O(1)| +[Power of Two](https://leetcode.com/problems/power-of-two/)| [Go](./Math/PowerTwo.Go)| Easy| O(1)| O(1)| +[Power of Three](https://leetcode.com/problems/power-of-three/)| [Go](./Math/PowerThree.Go)| Easy| O(1)| O(1)| +[Super Power](https://leetcode.com/problems/super-pow/)| [Go](./Math/SuperPow.Go)| Medium| O(n)| O(1)| +[Sum of Two Integers](https://leetcode.com/problems/sum-of-two-integers/)| [Go](./Math/SumTwoIntegers.Go)| Easy| O(n)| O(1)| +[Reverse Integer](https://leetcode.com/problems/reverse-integer/)| [Go](./Math/ReverseInteger.Go)| Easy| O(n)| O(1)| +[Excel Sheet Column Number](https://leetcode.com/problems/excel-sheet-column-number/)| [Go](./Math/ExcelSheetColumnNumber.Go)| Easy| O(n)| O(1)| +[Integer to Roman](https://leetcode.com/problems/integer-to-roman/)| [Go](./Math/IntegerToRoman.Go)| Medium| O(n)| O(1)| +[Roman to Integer](https://leetcode.com/problems/roman-to-integer/)| [Go](./Math/RomanToInteger.Go)| Easy| O(n)| O(n)| +[Integer to English Words](https://leetcode.com/problems/integer-to-english-words/)| [Go](./Math/IntegerEnglishWords.Go)| Hard| O(n)| O(1)| +[Rectangle Area](https://leetcode.com/problems/rectangle-area/)| [Go](./Math/RectangleArea.Go)| Easy| O(1)| O(1)| +[Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/)| [Go](./Math/TrappingRainWater.Go)| Hard| O(n)| O(n)| +[Container With Most Water](https://leetcode.com/problems/container-with-most-water/)| [Go](./Math/ContainerMostWater.Go)| Medium| O(n)| O(1)| +[Counting Bits](https://leetcode.com/problems/counting-bits/)| [Go](./Math/CountingBits.Go)| Medium| O(n)| O(n)| +[K-th Smallest in Lexicographical Order](https://leetcode.com/problems/k-th-smallest-in-lexicographical-order/)| [Go](./Math/KthSmallestLexicographicalOrder.Go)| Hard| O(n)| O(1)| + +## Search + +| Title | Solution | Difficulty | Time | Space | +| ----- | -------- | ---------- | ---- | ----- | +[Closest Binary Search Tree Value](https://leetcode.com/problems/closest-binary-search-tree-value/)| [Go](./Search/ClosestBinarySearchTreeValue.Go)| Easy| O(logn)| O(1)| +[Closest Binary Search Tree Value II](https://leetcode.com/problems/closest-binary-search-tree-value-ii/)| [Go](./Search/ClosestBinarySearchTreeValueII.Go)| Hard| O(n)| O(n)| +[Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/)| [Go](./Search/SearchInRotatedSortedArray.Go)| Hard| O(logn)| O(1)| +[Search in Rotated Sorted Array II](https://leetcode.com/problems/search-in-rotated-sorted-array-ii/)| [Go](./Search/SearchInRotatedSortedArrayII.Go)| Medium| O(logn)| O(1)| +[Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/)| [Go](./Search/FindMinimumRotatedSortedArray.Go)| Medium| O(logn)| O(1)| +[Find Minimum in Rotated Sorted Array II](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/)| [Go](./Search/FindMinimumRotatedSortedArrayII.Go)| Hard| O(logn)| O(1)| +[Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/)| [Go](./Search/Search2DMatrix.Go)| Medium| O(log(m + n))| O(1)| +[Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/)| [Go](./Search/Search2DMatrixII.Go)| Medium| O(m + n)| O(1)| +[Search for a Range](https://leetcode.com/problems/search-for-a-range/)| [Go](./Search/SearchForARange.Go)| Medium| O(logn)| O(1)| +[Search Insert Position](https://leetcode.com/problems/search-insert-position/)| [Go](./Search/SearchForARange.Go)| Medium| O(logn)| O(1)| +[Find Peak Element](https://leetcode.com/problems/find-peak-element/)| [Go](./Search/FindPeakElement.Go)| Medium| O(logn)| O(1)| +[Sqrt(x)](https://leetcode.com/problems/sqrtx/)| [Go](./Search/Sqrtx.Go)| Medium| O(logn)| O(1)| +[Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/)| [Go](./Search/MedianTwoSortedArrays.Go)| Hard| O(log(m + n))| O(1)| + + +## Sort (已全部做完) + +- 深刻的理解多路快排。第 75 题。 +- 链表的排序,插入排序(第 147 题)和归并排序(第 148 题) +- 桶排序和基数排序。第 164 题。 +- "摆动排序"。第 324 题。 +- 两两不相邻的排序。第 767 题,第 1054 题。 +- "饼子排序"。第 969 题。 + +| Title | Solution | Difficulty | Time | Space | 收藏 | +| ----- | :--------: | :----------: | :----: | :-----: |:-----: | +|[56. Merge Intervals](https://leetcode.com/problems/merge-intervals/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0056.%20Merge%20Intervals)| Medium | O(n log n)| O(log n)|| +|[57. Insert Interval](https://leetcode.com/problems/insert-interval/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0057.%20Insert%20Interval)| Hard | O(n)| O(1)|| +|[75. Sort Colors](https://leetcode.com/problems/sort-colors/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0075.%20Sort%20Colors)| Medium| O(n)| O(1)|❤️| +|[147. Insertion Sort List](https://leetcode.com/problems/insertion-sort-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0147.%20Insertion%20Sort%20List)| Medium | O(n)| O(1) |❤️| +|[148. Sort List](https://leetcode.com/problems/sort-list/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0148.%20Sort%20List)| Medium |O(n log n)| O(log n)|❤️| +|[164. Maximum Gap](https://leetcode.com/problems/maximum-gap/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0164.%20Maximum%20Gap)| Hard | O(n log n)| O(log n) |❤️| +|[179. Largest Number](https://leetcode.com/problems/largest-number/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0179.%20Largest%20Number)| Medium | O(n log n)| O(log n) |❤️| +|[220. Contains Duplicate III](https://leetcode.com/problems/contains-duplicate-iii/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0220.%20Contains%20Duplicate%20III)| Medium | O(n^2)| O(1) || +|[242. Valid Anagram](https://leetcode.com/problems/valid-anagram/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0242.%20Valid%20Anagram)| Easy | O(n)| O(n) || +|[274. H-Index](https://leetcode.com/problems/h-index/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0274.%20H-Index)| Medium | O(n)| O(n) || +|[324. Wiggle Sort II](https://leetcode.com/problems/wiggle-sort-ii/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0324.%20Wiggle%20Sort%20II)| Medium| O(n)| O(n)|❤️| +|[349. Intersection of Two Arrays](https://leetcode.com/problems/intersection-of-two-arrays/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0349.%20Intersection%20of%20Two%20Arrays)| Easy | O(n)| O(n) || +|[350. Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0350.%20Intersection%20of%20Two%20Arrays%20II)| Easy | O(n)| O(n) || +|[524. Longest Word in Dictionary through Deleting](https://leetcode.com/problems/longest-word-in-dictionary-through-deleting/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0524.%20Longest%20Word%20in%20Dictionary%20through%20Deleting)| Medium | O(n)| O(1) || +|[767. Reorganize String](https://leetcode.com/problems/reorganize-string/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0767.%20Reorganize%20String)| Medium | O(n log n)| O(log n) |❤️| +|[853. Car Fleet](https://leetcode.com/problems/car-fleet/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0853.%20Car%20Fleet)| Medium | O(n log n)| O(log n) || +|[710. Random Pick with Blacklist](https://leetcode.com/problems/random-pick-with-blacklist/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0710.%20Random%20Pick%20with%20Blacklist)| Hard | O(n)| O(n) || +|[922. Sort Array By Parity II](https://leetcode.com/problems/sort-array-by-parity-ii/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0922.%20Sort%20Array%20By%20Parity%20II)| Easy | O(n)| O(1) || +|[969. Pancake Sorting](https://leetcode.com/problems/pancake-sorting/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0969.%20Pancake%20Sorting)| Medium | O(n log n)| O(log n) |❤️| +|[973. K Closest Points to Origin](https://leetcode.com/problems/k-closest-points-to-origin/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0973.%20K%20Closest%20Points%20to%20Origin)| Medium | O(n log n)| O(log n) || +|[976. Largest Perimeter Triangle](https://leetcode.com/problems/largest-perimeter-triangle/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/0976.%20Largest%20Perimeter%20Triangle)| Easy | O(n log n)| O(log n) || +|[1030. Matrix Cells in Distance Order](https://leetcode.com/problems/matrix-cells-in-distance-order/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/1030.%20Matrix%20Cells%20in%20Distance%20Order)| Easy | O(n^2)| O(1) || +|[1054. Distant Barcodes](https://leetcode.com/problems/distant-barcodes/)| [Go](https://github.com/halfrost/LeetCode-Go/tree/master/Algorithms/1054.%20Distant%20Barcodes)| Medium | O(n log n)| O(log n) || +|-----------------------------------------------------------------|-------------|-------------| --------------------------| --------------------------|-------------| + + +## Union Find +| Title | Solution | Difficulty | Time | Space | +| ----- | -------- | ---------- | ---- | ----- | +[Number of Connected Components in an Undirected Graph](https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/)| [Go](./UnionFind/NumberConnectedComponentsUndirectedGraph.Go)| Medium| O(nlogn)| O(n)| +[Graph Valid Tree](https://leetcode.com/problems/graph-valid-tree/)| [Go](./UnionFind/GraphValidTree.Go)| Medium| O(nlogn)| O(n)| + +## Google +| Title | Solution | Difficulty | Frequency | +| ----- | -------- | ---------- | --------- | +[Plus One](https://leetcode.com/problems/plus-one/)| [Go](./Math/PlusOne.Go)| Easy| ★★★★★★| +[Number of Islands](https://leetcode.com/problems/number-of-islands/)| [Go](./DFS/NumberofIslands.Go)| Medium| ★★★★| +[Summary Ranges](https://leetcode.com/problems/summary-ranges/)| [Go](./Array/SummaryRanges.Go)| Medium| ★★★★| +[Perfect Squares](https://leetcode.com/problems/perfect-squares/)| [Go](./DP/PerfectSquares.Go)| Medium| ★★★★| +[Merge Intervals](https://leetcode.com/problems/merge-intervals/)| [Go](./Sort/MergeIntervals.Go)| Hard| ★★★| +[Valid Parentheses](https://leetcode.com/problems/valid-parentheses/)| [Go](./Stack/ValidParentheses.Go)| Easy| ★★★| +[Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/)| [Go](./Math/TrappingRainWater.Go)| Hard| ★★| +[Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/)| [Go](./LinkedList/MergeKSortedLists.Go)| Hard| ★★| +[Longest Consecutive Sequence](https://leetcode.com/problems/longest-consecutive-sequence/)| [Go](./Array/LongestConsecutiveSequence.Go)| Hard| ★★| +[Find Peak Element](https://leetcode.com/problems/find-peak-element/)| [Go](./Search/FindPeakElement.Go)| Medium| ★★| +[Power of Two](https://leetcode.com/problems/power-of-two/)| [Go](./Math/PowerTwo.Go)| Easy| ★★| +[Spiral Matrix](https://leetcode.com/problems/spiral-matrix/)| [Go](./Array/SpiralMatrix.Go)| Medium| ★★| +[Sliding Window Maximum ](https://leetcode.com/problems/sliding-window-maximum/)| [Go](./Array/SlidingWindowMaximum.Go)| Hard| ★★| +[Pow(x, n)](https://leetcode.com/problems/isomorphic-strings/)| [Go](./Math/Pow.Go)| Medium| ★★| +[Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/)| [Go](./DFS/LetterCombinationsPhoneNumber.Go)| Medium| ★★| +[Heaters](https://leetcode.com/problems/heaters/)| [Go](./Array/Heaters.Go)| Easy| ★| + +## Facebook +| Title | Solution | Difficulty | Frequency | +| ----- | -------- | ---------- | --------- | +[3Sum](https://leetcode.com/problems/3sum/)| [Go](./Array/ThreeSum.Go)| Medium| ★★★★★★| +[Valid Palindrome](https://leetcode.com/problems/valid-palindrome/)| [Go](./String/ValidPalindrome.Go)| Easy| ★★★★★★| +[Valid Palindrome II](https://leetcode.com/problems/valid-palindrome-ii/)| [Go](./String/ValidPalindromeII.Go)| Easy| ★★★★★★| +[Move Zeroes](https://leetcode.com/problems/move-zeroes/)| [Go](./Array/MoveZeroes.Go)| Easy| ★★★★★★| +[Remove Invalid Parentheses](https://leetcode.com/problems/remove-invalid-parentheses/)| [Go](./DFS/RemoveInvalidParentheses.Go)| Hard| ★★★★★★| +[Add Binary](https://leetcode.com/problems/add-binary/)| [Go](./Math/AddBinary.Go)| Easy| ★★★★★| +[Two Sum](https://leetcode.com/problems/two-sum/)| [Go](./Array/TwoSum.Go)| Easy| ★★★★★| +[Bnary Tree Paths](https://leetcode.com/problems/binary-tree-paths/)| [Go](./Tree/BnaryTreePaths.Go)| Easy| ★★★★| +[Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/)| [Go](./DFS/LetterCombinationsPhoneNumber.Go)| Medium| ★★★★| +[Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/)| [Go](./LinkedList/MergeKSortedLists.Go)| Hard| ★★★★| +[Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/)| [Go](./LinkedList/ReverseLinkedList.Go)| Easy| ★★★| +[Merge Intervals](https://leetcode.com/problems/merge-intervals/)| [Go](./Sort/MergeIntervals.Go)| Hard| ★★★| +[Number of Islands](https://leetcode.com/problems/number-of-islands/)| [Go](./DFS/NumberofIslands.Go)| Medium| ★★★| +[Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/)| [Go](./LinkedList/ReverseLinkedList.Go)| Easy| ★★★| +[Expression Add Operators](https://leetcode.com/problems/expression-add-operators/)| [Go](./DFS/ExpressionAddOperators.Go)| Hard| ★★★| +[Subsets](https://leetcode.com/problems/subsets/)| [Go](./DFS/Subsets.Go)| Medium| ★★★| +[Sort Colors](https://leetcode.com/problems/sort-colors/)| [Go](./Sort/SortColors.Go)| Medium| ★★| + +## Snapchat +| Title | Solution | Difficulty | Frequency | +| ----- | -------- | ---------- | --------- | +[Game of Life](https://leetcode.com/problems/game-of-life/) | [Go](./Array/GameLife.Go)| Medium| ★★★★★★| +[Meeting Rooms II](https://leetcode.com/problems/meeting-rooms-ii/)| [Go](./Sort/MeetingRoomsII.Go)| Medium| ★★★★★★| +[Valid Sudoku](https://leetcode.com/problems/valid-sudoku/)| [Go](./Array/ValidSudoku.Go)| Easy| ★★★★★| +[Binary Tree Vertical Order Traversal](https://leetcode.com/problems/binary-tree-vertical-order-traversal/)| [Go](./Tree/BinaryTreeVerticalOrderTraversal.Go)| Medium| ★★★★| +[Alien Dictionary](https://leetcode.com/problems/alien-dictionary/)| [Go](./Sort/AlienDictionary.Go)| Hard| ★★★★| +[One Edit Distance](https://leetcode.com/problems/one-edit-distance/)| [Go](./String/OneEditDistance.Go)| Medium| ★★★| +[Sudoku Solver](https://leetcode.com/problems/sudoku-solver/)| [Go](./Math/SudokuSolver.Go)| Hard| ★★★| +[Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/)| [Go](./LinkedList/ReverseLinkedList.Go)| Easy| ★★| +[Unique Binary Search Trees](https://leetcode.com/problems/unique-binary-search-trees/)| [Go](./Tree/UniqueBinarySearchTrees.Go)| Medium| ★★| +[Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring/)| [Go](./Array/MinimumWindowSubstring.Go)| Hard| ★★| +[Remove K Digits](https://leetcode.com/problems/remove-k-digits/)| [Go](./Stack/RemoveKDigits.Go)| Medium| ★| +[Ternary Expression Parser](https://leetcode.com/problems/ternary-expression-parser/)| [Go](./Stack/TernaryExpressionParser.Go)| Medium| ★| + +## Uber +| Title | Solution | Difficulty | Frequency | +| ----- | -------- | ---------- | --------- | +[Valid Sudoku](https://leetcode.com/problems/valid-sudoku/)| [Go](./Array/ValidSudoku.Go)| Easy| ★★★★| +[Spiral Matrix](https://leetcode.com/problems/spiral-matrix/)| [Go](./Array/SpiralMatrix.Go)| Medium| ★★★★| +[Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/)| [Go](./DFS/LetterCombinationsPhoneNumber.Go)| Medium| ★★★★| +[Group Anagrams](https://leetcode.com/problems/anagrams/)| [Go](./String/GroupAnagrams.Go)| Medium| ★★★★| +[Word Pattern](https://leetcode.com/problems/word-pattern/)| [Go](./String/WordPattern.Go)| Easy| ★★★| +[Roman to Integer](https://leetcode.com/problems/roman-to-integer/)| [Go](./Math/RomanToInteger.Go)| Easy| ★★★| +[Combination Sum](https://leetcode.com/problems/combination-sum/)| [Go](./DFS/CombinationSum.Go)| Medium| ★★| + +## Airbnb +| Title | Solution | Difficulty | Frequency | +| ----- | -------- | ---------- | --------- | +[Two Sum](https://leetcode.com/problems/two-sum/)| [Go](./Array/TwoSum.Go)| Easy| ★★★★★| +[Text Justification](https://leetcode.com/problems/text-justification/)| [Go](./String/TextJustification.Go)| Hard| ★★★★| +[House Robber](https://leetcode.com/problems/house-robber/)| [Go](./DP/HouseRobber.Go)| Easy| ★★| +[Single Number](https://leetcode.com/problems/single-number/)| [Go](./Math/SingleNumber.Go)| Medium| ★★| +[Word Search II](https://leetcode.com/problems/word-search-ii/)| [Go](./DFS/WordSearchII.Go)| Hard| ★★| +[Add Two Numbers](https://leetcode.com/problems/add-two-numbers/)| [Go](./Math/AddTwoNumbers.Go)| Medium| ★★| + +## LinkedIn +| Title | Solution | Difficulty | Frequency | +| ----- | -------- | ---------- | --------- | +[Maximum Subarray](https://leetcode.com/problems/maximum-subarray/)| [Go](./DP/MaximumSubarray.Go)| Medium| ★★★★★★| +[Pow(x, n)](https://leetcode.com/problems/isomorphic-strings/)| [Go](./Math/Pow.Go)| Medium| ★★★★★★| +[Merge Intervals](https://leetcode.com/problems/merge-intervals/)| [Go](./Sort/MergeIntervals.Go)| Hard| ★★★★★★| +[Isomorphic Strings](https://leetcode.com/problems/isomorphic-strings/)| [Go](./String/IsomorphicStrings.Go)| Easy| ★★★★★★| +[Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/)| [Go](./Search/SearchInRotatedSortedArray.Go)| Hard| ★★★★★| +[Search for a Range](https://leetcode.com/problems/search-for-a-range/)| [Go](./Search/SearchForARange.Go)| Medium| ★★★★★| +[Two Sum](https://leetcode.com/problems/two-sum/)| [Go](./Array/TwoSum.Go)| Easy| ★★★★| +[Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/)| [Go](./Tree/BinaryTreeLevelOrderTraversal.Go)| Easy| ★★★★| +[Evaluate Reverse Polish Notation](https://leetcode.com/problems/evaluate-reverse-polish-notation/)| [Go](./Stack/EvaluateReversePolishNotation.Go)| Medium| ★★★| +[Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/)| [Go](./DP/MaximumProductSubarray.Go)| Medium| ★★★| +[Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/)| [Go](./Array/ProductExceptSelf.Go)| Medium| ★★★| +[Symmetric Tree](https://leetcode.com/problems/symmetric-tree/)| [Go](./Tree/SymmetricTree.Go)| Easy| ★★| + +## Amazon +| Title | Solution | Difficulty | Frequency | +| ----- | -------- | ---------- | --------- | +[Two Sum](https://leetcode.com/problems/two-sum/)| [Go](./Array/TwoSum.Go)| Easy| ★★★★★★| +[Min Cost Climbing Stairs](https://leetcode.com/problems/min-cost-climbing-stairs/)| [Go](./DP/MinCostClimbingStairs.Go)| Easy| ★★★★| +[Number of Islands](https://leetcode.com/problems/number-of-islands/)| [Go](./DFS/NumberofIslands.Go)| Medium| ★★| +[Add Two Numbers](https://leetcode.com/problems/add-two-numbers/)| [Go](./Math/AddTwoNumbers.Go)| Medium| ★★| +[Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/)| [Go](./LinkedList/ReverseLinkedList.Go)| Easy| ★★| +[Valid Parentheses](https://leetcode.com/problems/valid-parentheses/)| [Go](./Stack/ValidParentheses.Go)| Easy| ★★| +[Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/)| [Go](./DP/LongestPalindromicSubstring.Go)| Medium| ★★| +[Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/)| [Go](./Math/TrappingRainWater.Go)| Hard| ★★| +[Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/)| [Go](./String/LongestSubstringWithoutRepeatingCharacters.Go)| Medium| ★★| +[Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/)| [Go](./DFS/LetterCombinationsPhoneNumber.Go)| Medium| ★★| +[Valid Anagram](https://leetcode.com/problems/valid-anagram/)| [Go](./String/ValidAnagram.Go)| Easy| ★★| +[Rotate Image](https://leetcode.com/problems/rotate-image/)| [Go](./Array/RotateImage.Go)| Medium| ★★| +[Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)| [Go](./DP/BestTimeBuySellStock.Go)| Easy| ★★| +[3Sum](https://leetcode.com/problems/3sum/)| [Go](./Array/ThreeSum.Go)| Medium| ★★| +[Sliding Window Maximum ](https://leetcode.com/problems/sliding-window-maximum/)| [Go](./Array/SlidingWindowMaximum.Go)| Hard| ★★| + +## Microsoft +| Title | Solution | Difficulty | Frequency | +| ----- | -------- | ---------- | --------- | +[Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/)| [Go](./LinkedList/ReverseLinkedList.Go)| Easy| ★★★★★★| +[Two Sum](https://leetcode.com/problems/two-sum/)| [Go](./Array/TwoSum.Go)| Easy| ★★★★★| +[String to Integer (atoi)](https://leetcode.com/problems/string-to-integer-atoi/)| [Go](./Math/Atoi.Go)| Easy| ★★★★| +[Add Two Numbers](https://leetcode.com/problems/add-two-numbers/)| [Go](./Math/AddTwoNumbers.Go)| Medium| ★★★★| +[Excel Sheet Column Number](https://leetcode.com/problems/excel-sheet-column-number/)| [Go](./Math/ExcelSheetColumnNumber.Go)| Easy| ★★★★| +[Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/)| [Go](./Tree/ValidateBinarySearchTree.Go)| Medium| ★★★| +[Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists/)| [Go](./LinkedList/MergeTwoSortedLists.Go)| Easy| ★★★| \ No newline at end of file diff --git a/ctl/label.go b/ctl/label.go index d8fd94d4..89f31ceb 100644 --- a/ctl/label.go +++ b/ctl/label.go @@ -1,9 +1,50 @@ package main import ( + "bufio" + // "encoding/json" + "fmt" + // m "github.com/halfrost/LeetCode-Go/ctl/models" + // "github.com/halfrost/LeetCode-Go/ctl/util" + "github.com/halfrost/LeetCode-Go/ctl/util" "github.com/spf13/cobra" + "io" + "os" + "regexp" + // "sort" + // "strconv" + "errors" + "io/ioutil" + "strings" ) +var ( + chapterOneFileOrder = []string{"_index", "Data_Structure", "Algorithm"} + chapterTwoFileOrder = []string{"_index", "Array", "String", "Two_Pointers", "Linked_List", "Stack", "Tree", "Dynamic_Programming", "Backtracking", "Depth_First_Search", "Breadth_First_Search", + "Binary_Search", "Math", "Hash_Table", "Sort", "Bit_Manipulation", "Union_Find", "Sliding_Window", "Segment_Tree", "Binary_Indexed_Tree"} + chapterThreeFileOrder = []string{"_index", "Segment_Tree", "UnionFind", "LRUCache", "LFUCache"} + preNextHeader = "----------------------------------------------\n
\n" + preNextFotter = "
" + delLine = "----------------------------------------------\n" + delHeader = "
" + delLabel = "<[a-zA-Z]+.*?>([\\s\\S]*?)" + delFooter = "
" + + //ErrNoFilename is thrown when the path the the file to tail was not given + ErrNoFilename = errors.New("You must provide the path to a file in the \"-file\" flag.") + + //ErrInvalidLineCount is thrown when the user provided 0 (zero) as the value for number of lines to tail + ErrInvalidLineCount = errors.New("You cannot tail zero lines.") +) + +func getChapterFourFileOrder() []string { + solutions := util.LoadChapterFourDir() + chapterFourFileOrder := []string{"_index"} + chapterFourFileOrder = append(chapterFourFileOrder, solutions...) + fmt.Printf("ChapterFour 中包括 _index 有 %v 个文件\n", len(chapterFourFileOrder)) + return chapterFourFileOrder +} + func newLabelCommand() *cobra.Command { mc := &cobra.Command{ Use: "label ", @@ -22,7 +63,7 @@ func newAddPreNext() *cobra.Command { Use: "add-pre-next", Short: "Add pre-next label", Run: func(cmd *cobra.Command, args []string) { - + addPreNext() }, } // cmd.Flags().StringVar(&alias, "alias", "", "alias") @@ -32,12 +73,215 @@ func newAddPreNext() *cobra.Command { func newDeletePreNext() *cobra.Command { cmd := &cobra.Command{ - Use: "delete-pre-next", + Use: "del-pre-next", Short: "Delete pre-next label", Run: func(cmd *cobra.Command, args []string) { + delPreNext() }, } // cmd.Flags().StringVar(&alias, "alias", "", "alias") // cmd.Flags().StringVar(&appId, "appid", "", "appid") return cmd } + +func addPreNext() { + // Chpater one add pre-next + addPreNextLabel(chapterOneFileOrder, []string{}, "", "ChapterOne", "ChapterTwo") + // Chpater two add pre-next + addPreNextLabel(chapterTwoFileOrder, chapterOneFileOrder, "ChapterOne", "ChapterTwo", "ChapterThree") + // Chpater three add pre-next + addPreNextLabel(chapterThreeFileOrder, chapterTwoFileOrder, "ChapterTwo", "ChapterThree", "ChapterFour") + // Chpater four add pre-next + //fmt.Printf("%v\n", getChapterFourFileOrder()) + addPreNextLabel(getChapterFourFileOrder(), chapterThreeFileOrder, "ChapterThree", "ChapterFour", "") +} + +func addPreNextLabel(order, preOrder []string, preChapter, chapter, nextChapter string) { + var ( + exist bool + err error + res []byte + count int + ) + for index, v := range order { + tmp := "" + if index == 0 { + if chapter == "ChapterOne" { + // 第一页不需要“上一章” + tmp = "\n\n" + delLine + fmt.Sprintf("

下一页➡️

\n", chapter, order[index+1]) + } else { + tmp = "\n\n" + preNextHeader + fmt.Sprintf("

⬅️上一章

\n", preChapter, preOrder[len(preOrder)-1]) + fmt.Sprintf("

下一页➡️

\n", chapter, order[index+1]) + preNextFotter + } + } else if index == len(order)-1 { + if chapter == "ChapterFour" { + // 最后一页不需要“下一页” + tmp = "\n\n" + delLine + fmt.Sprintf("

⬅️上一页

\n", chapter, order[index-1]) + } else { + tmp = "\n\n" + preNextHeader + fmt.Sprintf("

⬅️上一页

\n", chapter, order[index-1]) + fmt.Sprintf("

下一章➡️

\n", nextChapter) + preNextFotter + } + } else if index == 1 { + tmp = "\n\n" + preNextHeader + fmt.Sprintf("

⬅️上一页

\n", chapter) + fmt.Sprintf("

下一页➡️

\n", chapter, order[index+1]) + preNextFotter + } else { + tmp = "\n\n" + preNextHeader + fmt.Sprintf("

⬅️上一页

\n", chapter, order[index-1]) + fmt.Sprintf("

下一页➡️

\n", chapter, order[index+1]) + preNextFotter + } + exist, err = needAdd(fmt.Sprintf("../website/content/%v/%v.md", chapter, v)) + if err != nil { + fmt.Println(err) + return + } + // 当前没有上一页和下一页,才添加 + if !exist && err == nil { + res, err = eofAdd(fmt.Sprintf("../website/content/%v/%v.md", chapter, v), tmp) + if err != nil { + fmt.Println(err) + return + } + util.WriteFile(fmt.Sprintf("../website/content/%v/%v.md", chapter, v), res) + count++ + } + } + fmt.Printf("添加了 %v 个文件的 pre-next\n", count) +} + +func eofAdd(filePath string, labelString string) ([]byte, error) { + f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) + if err != nil { + return nil, err + } + defer f.Close() + reader, output := bufio.NewReader(f), []byte{} + + for { + line, _, err := reader.ReadLine() + if err != nil { + if err == io.EOF { + output = append(output, []byte(labelString)...) + output = append(output, []byte("\n")...) + return output, nil + } + return nil, err + } + output = append(output, line...) + output = append(output, []byte("\n")...) + } +} + +func delPreNext() { + // Chpater one del pre-next + delPreNextLabel(chapterOneFileOrder, "ChapterOne") + // Chpater two del pre-next + delPreNextLabel(chapterTwoFileOrder, "ChapterTwo") + // Chpater three del pre-next + delPreNextLabel(chapterThreeFileOrder, "ChapterThree") + // Chpater four del pre-next + delPreNextLabel(getChapterFourFileOrder(), "ChapterFour") +} + +func delPreNextLabel(order []string, chapter string) { + count := 0 + for index, v := range order { + lineNum := 5 + if index == 0 && chapter == "ChapterOne" || index == len(order)-1 && chapter == "ChapterFour" { + lineNum = 3 + } + exist, err := needAdd(fmt.Sprintf("../website/content/%v/%v.md", chapter, v)) + if err != nil { + fmt.Println(err) + return + } + // 存在才删除 + if exist && err == nil { + removeLine(fmt.Sprintf("../website/content/%v/%v.md", chapter, v), lineNum+1) + count++ + } + } + fmt.Printf("删除了 %v 个文件的 pre-next\n", count) + // 另外一种删除方法 + // res, err := eofDel(fmt.Sprintf("../website/content/ChapterOne/%v.md", v)) + // if err != nil { + // fmt.Println(err) + // return + // } + // util.WriteFile(fmt.Sprintf("../website/content/ChapterOne/%v.md", v), res) +} + +func needAdd(filePath string) (bool, error) { + f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) + if err != nil { + return false, err + } + defer f.Close() + reader, output := bufio.NewReader(f), []byte{} + for { + line, _, err := reader.ReadLine() + if err != nil { + if err == io.EOF { + return false, nil + } + return false, err + } + if ok, _ := regexp.Match(delHeader, line); ok { + return true, nil + } else if ok, _ := regexp.Match(delLabel, line); ok { + return true, nil + } else { + output = append(output, line...) + output = append(output, []byte("\n")...) + } + } +} + +func eofDel(filePath string) ([]byte, error) { + f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) + if err != nil { + return nil, err + } + defer f.Close() + reader, output := bufio.NewReader(f), []byte{} + for { + line, _, err := reader.ReadLine() + if err != nil { + if err == io.EOF { + return output, nil + } + return nil, err + } + if ok, _ := regexp.Match(delLine, line); ok { + reg := regexp.MustCompile(delLine) + newByte := reg.ReplaceAll(line, []byte(" ")) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else if ok, _ := regexp.Match(delHeader, line); ok { + reg := regexp.MustCompile(delHeader) + newByte := reg.ReplaceAll(line, []byte(" ")) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else if ok, _ := regexp.Match(delLabel, line); ok { + reg := regexp.MustCompile(delLabel) + newByte := reg.ReplaceAll(line, []byte(" ")) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else if ok, _ := regexp.Match(delFooter, line); ok { + reg := regexp.MustCompile(delFooter) + newByte := reg.ReplaceAll(line, []byte(" ")) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else { + output = append(output, line...) + output = append(output, []byte("\n")...) + } + } +} + +func removeLine(path string, lineNumber int) { + file, err := ioutil.ReadFile(path) + if err != nil { + panic(err) + } + info, _ := os.Stat(path) + mode := info.Mode() + array := strings.Split(string(file), "\n") + array = array[:len(array)-lineNumber-1] + ioutil.WriteFile(path, []byte(strings.Join(array, "\n")), mode) + //fmt.Println("remove line successful") +} diff --git a/ctl/render.go b/ctl/render.go index 1e474d79..879b31cb 100644 --- a/ctl/render.go +++ b/ctl/render.go @@ -34,7 +34,6 @@ func newBuildCommand() *cobra.Command { newBuildREADME(), newBuildChapterTwo(), ) - return mc } @@ -101,6 +100,7 @@ func buildREADME() { return } util.WriteFile("../README.md", res) + fmt.Println("write file successful") //makeReadmeFile(mds) } @@ -151,6 +151,7 @@ func buildChapterTwo() { var ( gr m.GraphQLResp questions []m.Question + count int ) for index, tag := range chapterTwoSlug { body := getTagProblemList(tag) @@ -177,7 +178,9 @@ func buildChapterTwo() { return } util.WriteFile(fmt.Sprintf("../website/content/ChapterTwo/%v.md", chapterTwoFileName[index]), res) + count++ } + fmt.Println("write %v files successful", count) } func loadMetaData(filePath string) (map[int]m.TagList, error) { diff --git a/ctl/util/util.go b/ctl/util/util.go index a3b6ab0e..7c0d1d25 100644 --- a/ctl/util/util.go +++ b/ctl/util/util.go @@ -29,6 +29,34 @@ func LoadSolutionsDir() ([]int, int) { return solutionIds, len(files) - len(solutionIds) } +// LoadChapterFourDir define +func LoadChapterFourDir() []string { + files, err := ioutil.ReadDir("../website/content/ChapterFour/") + if err != nil { + fmt.Println(err) + } + solutions, solutionIds, solutionsMap := []string{}, []int{}, map[int]string{} + for _, f := range files { + if f.Name()[4] == '.' { + tmp, err := strconv.Atoi(f.Name()[:4]) + if err != nil { + fmt.Println(err) + } + solutionIds = append(solutionIds, tmp) + // len(f.Name())-3 = 文件名去掉 .md 后缀 + solutionsMap[tmp] = f.Name()[:len(f.Name())-3] + } + } + sort.Ints(solutionIds) + fmt.Printf("读取了第四章的 %v 道题的题解\n", len(solutionIds)) + for _, v := range solutionIds { + if name, ok := solutionsMap[v]; ok { + solutions = append(solutions, name) + } + } + return solutions +} + // WriteFile define func WriteFile(fileName string, content []byte) { file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0777) @@ -41,7 +69,7 @@ func WriteFile(fileName string, content []byte) { if err != nil { fmt.Println(err) } - fmt.Println("write file successful") + //fmt.Println("write file successful") } // BinarySearch define diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..751917f2 --- /dev/null +++ b/go.mod @@ -0,0 +1,16 @@ +module github.com/halfrost/LeetCode-Go + +go 1.14 + +require ( + github.com/BurntSushi/toml v0.3.1 + github.com/bitly/go-simplejson v0.5.0 // indirect + github.com/graphql-go/graphql v0.7.9 + github.com/keegancsmith/rpc v1.3.0 // indirect + github.com/mozillazg/request v0.8.0 + github.com/nsf/gocode v0.0.0-20190302080247-5bee97b48836 // indirect + github.com/spf13/cobra v1.1.1 + github.com/stamblerre/gocode v1.0.0 // indirect + golang.org/x/mod v0.4.0 // indirect + golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..0d8cc757 --- /dev/null +++ b/go.sum @@ -0,0 +1,321 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= +github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/graphql-go/graphql v0.7.9 h1:5Va/Rt4l5g3YjwDnid3vFfn43faaQBq7rMcIZ0VnV34= +github.com/graphql-go/graphql v0.7.9/go.mod h1:k6yrAYQaSP59DC5UVxbgxESlmVyojThKdORUqGDGmrI= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/keegancsmith/rpc v1.1.0 h1:bXVRk3EzbtrEegTGKxNTc+St1lR7t/Z1PAO8misBnCc= +github.com/keegancsmith/rpc v1.1.0/go.mod h1:Xow74TKX34OPPiPCdz6x1o9c0SCxRqGxDuKGk7ZOo8s= +github.com/keegancsmith/rpc v1.3.0 h1:wGWOpjcNrZaY8GDYZJfvyxmlLljm3YQWF+p918DXtDk= +github.com/keegancsmith/rpc v1.3.0/go.mod h1:6O2xnOGjPyvIPbvp0MdrOe5r6cu1GZ4JoTzpzDhWeo0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mozillazg/request v0.8.0 h1:TbXeQUdBWr1J1df5Z+lQczDFzX9JD71kTCl7Zu/9rNM= +github.com/mozillazg/request v0.8.0/go.mod h1:weoQ/mVFNbWgRBtivCGF1tUT9lwneFesues+CleXMWc= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nsf/gocode v0.0.0-20190302080247-5bee97b48836 h1:oc3CL18CoGhyOQJ7HDa9gJAde33bwI8Vi28zLdIzJVc= +github.com/nsf/gocode v0.0.0-20190302080247-5bee97b48836/go.mod h1:6Q8/OMaaKAgTX7/jt2bOXVDrm1eJhoNd+iwzghR7jvs= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/stamblerre/gocode v1.0.0 h1:5aTRgkRTOS8mELHoKatkwhfX44OdEV3iwu3FCXyvLzk= +github.com/stamblerre/gocode v1.0.0/go.mod h1:ONyGamdxpnxaG2+XLyGkNuuoYISmz0QFVHScxvsXsqM= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191030062658-86caa796c7ab h1:tpc/nJ4vD66vAk/2KN0sw/DvQIz2sKmCpWvyKtPmfMQ= +golang.org/x/tools v0.0.0-20191030062658-86caa796c7ab/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58 h1:1Bs6RVeBFtLZ8Yi1Hk07DiOqzvwLD/4hln4iahvFlag= +golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md b/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md index 4d9e958d..a6a54769 100755 --- a/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md +++ b/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md @@ -45,7 +45,7 @@ Recall that: - 叶节点 是二叉树中没有子节点的节点 - 树的根节点的 深度 为 0,如果某一节点的深度为 d,那它的子节点的深度就是 d+1 -- 如果我们假定 A 是一组节点 S 的 最近公共祖先,S 中的每个节点都在以 A 为根节点的子树中,且 A 的深度达到此条件下可能的最大值。 +- 如果我们假定 A 是一组节点 S 的 最近公共祖先,S 中的每个节点都在以 A 为根节点的子树中,且 A 的深度达到此条件下可能的最大值。   提示: diff --git a/website/content/ChapterOne/Algorithm.md b/website/content/ChapterOne/Algorithm.md index bd094783..bdf96932 100644 --- a/website/content/ChapterOne/Algorithm.md +++ b/website/content/ChapterOne/Algorithm.md @@ -23,4 +23,11 @@ type: docs |几何||1. 凸包 - Gift wrapping
2. 凸包 - Graham scan
3. 线段问题
4. 多边形和多面体相关问题
|| |NP 完全|1. 计算模型
2. P 类与 NP 类问题
3. NP 完全问题
4. NP 完全问题的近似算法
|1. 随机存取机 RAM
2. 随机存取存储程序机 RASP
3. 图灵机
4. 非确定性图灵机
5. P 类与 NP 类语言
6. 多项式时间验证
7. 多项式时间变换
8. Cook定理
9. 合取范式的可满足性问题 CNF-SAT
10. 3 元合取范式的可满足性问题 3-SAT
11. 团问题 CLIQUE
12. 顶点覆盖问题 VERTEX-COVER
13. 子集和问题 SUBSET-SUM
14. 哈密顿回路问题 HAM-CYCLE
15. 旅行售货员问题 TSP
16. 顶点覆盖问题的近似算法
17. 旅行售货员问题近似算法
18. 具有三角不等式性质的旅行售货员问题
19. 一般的旅行售货员问题
20. 集合覆盖问题的近似算法
21. 子集和问题的近似算法
22. 子集和问题的指数时间算法
23. 子集和问题的多项式时间近似格式
|| |位运算| 位操作包括:
1. 取反(NOT)
2. 按位或(OR)
3. 按位异或(XOR)
4. 按位与(AND)
5. 移位: 是一个二元运算符,用来将一个二进制数中的每一位全部都向一个方向移动指定位,溢出的部分将被舍弃,而空缺的部分填入一定的值。
| 1.数字范围按位与
2.UTF-8 编码验证
3.数字转换为十六进制数
4.找出最长的超赞子字符串
5.数组异或操作
6.幂集
7.位1的个数
8.二进制表示中质数个计算置位
9.子数组异或查询
| [力扣:位运算](https://leetcode-cn.com/tag/bit-manipulation/) -|------------|------------------------------------------------------------------|-----------------------------------------------------------------|--------------------| \ No newline at end of file +|------------|------------------------------------------------------------------|-----------------------------------------------------------------|--------------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterOne/Data_Structure.md b/website/content/ChapterOne/Data_Structure.md index f1d405f7..1d9ca35f 100644 --- a/website/content/ChapterOne/Data_Structure.md +++ b/website/content/ChapterOne/Data_Structure.md @@ -21,4 +21,11 @@ type: docs |数组实现的堆
Heap|1. 极大堆和极小堆
2. 极大极小堆
3. 双端堆 Deap
4. d 叉堆||| |树实现的堆
Heap|1. 左堆
2. 扁堆
3. 二项式堆
4. 斐波那契堆 Fibonacco Heap
5. 配对堆 Pairing Heap||| |查找
Find|1. 哈希表 Hash
2. 跳跃表 Skip List
3. 排序二叉树 Binary Sort Tree
4. AVL 树
5. B 树 / B+ 树 / B* 树
6. AA 树
7. 红黑树 Red Black Tree
8. 排序二叉堆 Binary Heap
9. Splay 树
10. 双链树 Double Chained Tree
11. Trie 树
12. R 树||| -|--------------------------------------------|--------------------------------------------------------------------------------------------|---------------------------|-----------------------------------| \ No newline at end of file +|--------------------------------------------|--------------------------------------------------------------------------------------------|---------------------------|-----------------------------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterOne/_index.md b/website/content/ChapterOne/_index.md index 1016b57c..0eba551e 100644 --- a/website/content/ChapterOne/_index.md +++ b/website/content/ChapterOne/_index.md @@ -86,4 +86,9 @@ LeetCode 统计代码运行时长会有波动的,相同的代码提交 10 次 本作品采用 [知识署名-非商业性使用-禁止演绎 (BY-NC-ND) 4.0 国际许可协议](https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode.zh-Hans) 进行许可。 -题解里面的所有题目版权均归 [LeetCode](https://leetcode.com/) 和 [力扣中国](https://leetcode-cn.com/) 所有 \ No newline at end of file +题解里面的所有题目版权均归 [LeetCode](https://leetcode.com/) 和 [力扣中国](https://leetcode-cn.com/) 所有 + + +---------------------------------------------- +

下一页➡️

+ diff --git a/website/content/ChapterThree/LFUCache.md b/website/content/ChapterThree/LFUCache.md index 22212967..b176f6db 100644 --- a/website/content/ChapterThree/LFUCache.md +++ b/website/content/ChapterThree/LFUCache.md @@ -357,4 +357,11 @@ func (this *LFUCache) Put(key int, value int) { this.nodes[key] = newNode } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterThree/LRUCache.md b/website/content/ChapterThree/LRUCache.md index 3cbecaa4..e4b3816f 100644 --- a/website/content/ChapterThree/LRUCache.md +++ b/website/content/ChapterThree/LRUCache.md @@ -269,4 +269,11 @@ func (this *LRUCache) Remove(node *Node) { node.Next.Prev = node.Prev } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterThree/Segment_Tree.md b/website/content/ChapterThree/Segment_Tree.md index 96160509..da5cf4c0 100644 --- a/website/content/ChapterThree/Segment_Tree.md +++ b/website/content/ChapterThree/Segment_Tree.md @@ -272,4 +272,11 @@ func (st *SegmentCountTree) updateCountInTree(treeIndex, left, right, val int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterThree/UnionFind.md b/website/content/ChapterThree/UnionFind.md index e4910131..33cf76a2 100644 --- a/website/content/ChapterThree/UnionFind.md +++ b/website/content/ChapterThree/UnionFind.md @@ -141,4 +141,11 @@ func max(a int, b int) int { return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterThree/_index.md b/website/content/ChapterThree/_index.md index 30eec94a..02f24845 100644 --- a/website/content/ChapterThree/_index.md +++ b/website/content/ChapterThree/_index.md @@ -10,4 +10,11 @@ type: docs

-这一章会罗列一些整理好的模板。一起来看看吧。 \ No newline at end of file +这一章会罗列一些整理好的模板。一起来看看吧。 + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Array.md b/website/content/ChapterTwo/Array.md index fae2d630..394e72d8 100644 --- a/website/content/ChapterTwo/Array.md +++ b/website/content/ChapterTwo/Array.md @@ -149,3 +149,10 @@ type: docs |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Backtracking.md b/website/content/ChapterTwo/Backtracking.md index dd2cd9dc..87565235 100644 --- a/website/content/ChapterTwo/Backtracking.md +++ b/website/content/ChapterTwo/Backtracking.md @@ -134,3 +134,10 @@ func updateMatrix_BFS(matrix [][]int) [][]int { |1681|Minimum Incompatibility|[Go]({{< relref "/ChapterFour/1681.Minimum-Incompatibility.md" >}})|Hard||||35.0%| |1688|Count of Matches in Tournament|[Go]({{< relref "/ChapterFour/1688.Count-of-Matches-in-Tournament.md" >}})|Easy||||83.2%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Binary_Indexed_Tree.md b/website/content/ChapterTwo/Binary_Indexed_Tree.md index 9c722c1a..0efcc004 100644 --- a/website/content/ChapterTwo/Binary_Indexed_Tree.md +++ b/website/content/ChapterTwo/Binary_Indexed_Tree.md @@ -16,3 +16,10 @@ type: docs |0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})|Hard||||26.6%| |1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Binary_Search.md b/website/content/ChapterTwo/Binary_Search.md index 7339fdc6..30aa8513 100644 --- a/website/content/ChapterTwo/Binary_Search.md +++ b/website/content/ChapterTwo/Binary_Search.md @@ -197,4 +197,10 @@ func peakIndexInMountainArray(A []int) int { |1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.6%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| ---| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Bit_Manipulation.md b/website/content/ChapterTwo/Bit_Manipulation.md index c86d5963..e4298d6f 100644 --- a/website/content/ChapterTwo/Bit_Manipulation.md +++ b/website/content/ChapterTwo/Bit_Manipulation.md @@ -74,3 +74,10 @@ X & ~X = 0 |0898|Bitwise ORs of Subarrays|[Go]({{< relref "/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md" >}})|Medium| O(n)| O(1)||34.0%| |1290|Convert Binary Number in a Linked List to Integer|[Go]({{< relref "/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md" >}})|Easy||||81.6%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Breadth_First_Search.md b/website/content/ChapterTwo/Breadth_First_Search.md index eec61d7d..57254d40 100644 --- a/website/content/ChapterTwo/Breadth_First_Search.md +++ b/website/content/ChapterTwo/Breadth_First_Search.md @@ -33,3 +33,10 @@ type: docs |1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.4%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Depth_First_Search.md b/website/content/ChapterTwo/Depth_First_Search.md index 78a8554c..a9496644 100644 --- a/website/content/ChapterTwo/Depth_First_Search.md +++ b/website/content/ChapterTwo/Depth_First_Search.md @@ -80,3 +80,10 @@ type: docs |1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.6%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Dynamic_Programming.md b/website/content/ChapterTwo/Dynamic_Programming.md index ccfc9c9e..95aa17e6 100644 --- a/website/content/ChapterTwo/Dynamic_Programming.md +++ b/website/content/ChapterTwo/Dynamic_Programming.md @@ -59,3 +59,10 @@ type: docs |1664|Ways to Make a Fair Array|[Go]({{< relref "/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md" >}})|Medium||||60.6%| |1690|Stone Game VII|[Go]({{< relref "/ChapterFour/1690.Stone-Game-VII.md" >}})|Medium||||46.5%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Hash_Table.md b/website/content/ChapterTwo/Hash_Table.md index 6424f1b3..d2b6dbc6 100644 --- a/website/content/ChapterTwo/Hash_Table.md +++ b/website/content/ChapterTwo/Hash_Table.md @@ -76,3 +76,10 @@ type: docs |1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.3%| |1679|Max Number of K-Sum Pairs|[Go]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}})|Medium||||52.0%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Linked_List.md b/website/content/ChapterTwo/Linked_List.md index ef03c6e9..d9a5a75d 100644 --- a/website/content/ChapterTwo/Linked_List.md +++ b/website/content/ChapterTwo/Linked_List.md @@ -56,3 +56,10 @@ type: docs |1669|Merge In Between Linked Lists|[Go]({{< relref "/ChapterFour/1669.Merge-In-Between-Linked-Lists.md" >}})|Medium||||78.2%| |1670|Design Front Middle Back Queue|[Go]({{< relref "/ChapterFour/1670.Design-Front-Middle-Back-Queue.md" >}})|Medium||||54.6%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Math.md b/website/content/ChapterTwo/Math.md index afecf1c9..18831b4f 100644 --- a/website/content/ChapterTwo/Math.md +++ b/website/content/ChapterTwo/Math.md @@ -79,3 +79,10 @@ type: docs |1680|Concatenation of Consecutive Binary Numbers|[Go]({{< relref "/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md" >}})|Medium||||45.1%| |1685|Sum of Absolute Differences in a Sorted Array|[Go]({{< relref "/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md" >}})|Medium||||61.7%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Segment_Tree.md b/website/content/ChapterTwo/Segment_Tree.md index 0f053551..cd233ee8 100644 --- a/website/content/ChapterTwo/Segment_Tree.md +++ b/website/content/ChapterTwo/Segment_Tree.md @@ -48,3 +48,10 @@ type: docs |1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard| O(log n)| O(n)|❤️|39.5%| |1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Sliding_Window.md b/website/content/ChapterTwo/Sliding_Window.md index 709a3015..32c1f276 100644 --- a/website/content/ChapterTwo/Sliding_Window.md +++ b/website/content/ChapterTwo/Sliding_Window.md @@ -44,3 +44,10 @@ type: docs |1208|Get Equal Substrings Within Budget|[Go]({{< relref "/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md" >}})|Medium||||43.7%| |1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.6%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Sort.md b/website/content/ChapterTwo/Sort.md index f4dc0947..c50678f5 100644 --- a/website/content/ChapterTwo/Sort.md +++ b/website/content/ChapterTwo/Sort.md @@ -50,3 +50,10 @@ type: docs |1647|Minimum Deletions to Make Character Frequencies Unique|[Go]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}})|Medium||||53.9%| |1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Stack.md b/website/content/ChapterTwo/Stack.md index 192775aa..7a030346 100644 --- a/website/content/ChapterTwo/Stack.md +++ b/website/content/ChapterTwo/Stack.md @@ -56,3 +56,10 @@ type: docs |1047|Remove All Adjacent Duplicates In String|[Go]({{< relref "/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md" >}})|Easy| O(n)| O(1)||70.2%| |1673|Find the Most Competitive Subsequence|[Go]({{< relref "/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md" >}})|Medium||||38.3%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/String.md b/website/content/ChapterTwo/String.md index d129d222..ce72f226 100644 --- a/website/content/ChapterTwo/String.md +++ b/website/content/ChapterTwo/String.md @@ -52,3 +52,10 @@ type: docs |1684|Count the Number of Consistent Strings|[Go]({{< relref "/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md" >}})|Easy||||84.2%| |1694|Reformat Phone Number|[Go]({{< relref "/ChapterFour/1694.Reformat-Phone-Number.md" >}})|Easy||||67.1%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Tree.md b/website/content/ChapterTwo/Tree.md index 352ddefa..7ac05a12 100644 --- a/website/content/ChapterTwo/Tree.md +++ b/website/content/ChapterTwo/Tree.md @@ -67,3 +67,10 @@ type: docs |1302|Deepest Leaves Sum|[Go]({{< relref "/ChapterFour/1302.Deepest-Leaves-Sum.md" >}})|Medium||||84.1%| |1305|All Elements in Two Binary Search Trees|[Go]({{< relref "/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}})|Medium||||77.8%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Two_Pointers.md b/website/content/ChapterTwo/Two_Pointers.md index 89c959a3..bc5beed2 100644 --- a/website/content/ChapterTwo/Two_Pointers.md +++ b/website/content/ChapterTwo/Two_Pointers.md @@ -87,4 +87,11 @@ type: docs |1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.6%| |1695|Maximum Erasure Value|[Go]({{< relref "/ChapterFour/1695.Maximum-Erasure-Value.md" >}})|Medium||||49.5%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| -| + + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/Union_Find.md b/website/content/ChapterTwo/Union_Find.md index c72622df..08b8323c 100644 --- a/website/content/ChapterTwo/Union_Find.md +++ b/website/content/ChapterTwo/Union_Find.md @@ -38,3 +38,10 @@ type: docs |0990|Satisfiability of Equality Equations|[Go]({{< relref "/ChapterFour/0990.Satisfiability-of-Equality-Equations.md" >}})|Medium| O(n)| O(n)||46.4%| |1202|Smallest String With Swaps|[Go]({{< relref "/ChapterFour/1202.Smallest-String-With-Swaps.md" >}})|Medium||||48.3%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + + +---------------------------------------------- + diff --git a/website/content/ChapterTwo/_index.md b/website/content/ChapterTwo/_index.md index c28b73c5..4699e8ca 100644 --- a/website/content/ChapterTwo/_index.md +++ b/website/content/ChapterTwo/_index.md @@ -19,3 +19,10 @@ type: docs 做到目前为止,笔者认为动态规划是最灵活的类型,这类题目没有一个模板可以给你套用,它也是算法之优雅的地方。笔者认为称它为算法的艺术不为过。动态规划这类型,笔者也还没有刷完,只刷了一部分,还在学习中。 那么就分享一下笔者目前刷过的题,和有相似点的题目吧。 + + +---------------------------------------------- + From 9354e6141437bc7b62bf4a96a2618c4932f1668f Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 17 Jan 2021 02:25:36 +0800 Subject: [PATCH 77/82] chapter four add pre-next --- ctl/render.go | 2 +- website/content/ChapterFour/0001.Two-Sum.md | 9 ++++++++- website/content/ChapterFour/0002.Add-Two-Numbers.md | 9 ++++++++- ...003.Longest-Substring-Without-Repeating-Characters.md | 7 +++++++ .../ChapterFour/0004.Median-of-Two-Sorted-Arrays.md | 7 +++++++ website/content/ChapterFour/0007.Reverse-Integer.md | 7 +++++++ website/content/ChapterFour/0009.Palindrome-Number.md | 9 ++++++++- .../ChapterFour/0011.Container-With-Most-Water.md | 7 +++++++ website/content/ChapterFour/0013.Roman-to-Integer.md | 9 ++++++++- website/content/ChapterFour/0015.3Sum.md | 7 +++++++ website/content/ChapterFour/0016.3Sum-Closest.md | 7 +++++++ .../0017.Letter-Combinations-of-a-Phone-Number.md | 7 +++++++ website/content/ChapterFour/0018.4Sum.md | 7 +++++++ .../ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md | 7 +++++++ website/content/ChapterFour/0020.Valid-Parentheses.md | 7 +++++++ .../content/ChapterFour/0021.Merge-Two-Sorted-Lists.md | 7 +++++++ website/content/ChapterFour/0022.Generate-Parentheses.md | 7 +++++++ website/content/ChapterFour/0023.Merge-k-Sorted-Lists.md | 7 +++++++ website/content/ChapterFour/0024.Swap-Nodes-in-Pairs.md | 7 +++++++ .../content/ChapterFour/0025.Reverse-Nodes-in-k-Group.md | 7 +++++++ .../0026.Remove-Duplicates-from-Sorted-Array.md | 7 +++++++ website/content/ChapterFour/0027.Remove-Element.md | 7 +++++++ website/content/ChapterFour/0028.Implement-strStr.md | 7 +++++++ website/content/ChapterFour/0029.Divide-Two-Integers.md | 7 +++++++ .../0030.Substring-with-Concatenation-of-All-Words.md | 7 +++++++ .../ChapterFour/0033.Search-in-Rotated-Sorted-Array.md | 7 +++++++ ...First-and-Last-Position-of-Element-in-Sorted-Array.md | 7 +++++++ .../content/ChapterFour/0035.Search-Insert-Position.md | 7 +++++++ website/content/ChapterFour/0036.Valid-Sudoku.md | 7 +++++++ website/content/ChapterFour/0037.Sudoku-Solver.md | 7 +++++++ website/content/ChapterFour/0039.Combination-Sum.md | 7 +++++++ website/content/ChapterFour/0040.Combination-Sum-II.md | 7 +++++++ .../content/ChapterFour/0041.First-Missing-Positive.md | 7 +++++++ website/content/ChapterFour/0042.Trapping-Rain-Water.md | 7 +++++++ website/content/ChapterFour/0046.Permutations.md | 7 +++++++ website/content/ChapterFour/0047.Permutations-II.md | 7 +++++++ website/content/ChapterFour/0048.Rotate-Image.md | 7 +++++++ website/content/ChapterFour/0049.Group-Anagrams.md | 7 +++++++ website/content/ChapterFour/0050.Powx-n.md | 7 +++++++ website/content/ChapterFour/0051.N-Queens.md | 9 ++++++++- website/content/ChapterFour/0052.N-Queens-II.md | 9 ++++++++- website/content/ChapterFour/0053.Maximum-Subarray.md | 9 ++++++++- website/content/ChapterFour/0054.Spiral-Matrix.md | 9 ++++++++- website/content/ChapterFour/0055.Jump-Game.md | 9 ++++++++- website/content/ChapterFour/0056.Merge-Intervals.md | 9 ++++++++- website/content/ChapterFour/0057.Insert-Interval.md | 9 ++++++++- website/content/ChapterFour/0059.Spiral-Matrix-II.md | 9 ++++++++- website/content/ChapterFour/0060.Permutation-Sequence.md | 9 ++++++++- website/content/ChapterFour/0061.Rotate-List.md | 9 ++++++++- website/content/ChapterFour/0062.Unique-Paths.md | 9 ++++++++- website/content/ChapterFour/0063.Unique-Paths-II.md | 9 ++++++++- website/content/ChapterFour/0064.Minimum-Path-Sum.md | 9 ++++++++- website/content/ChapterFour/0066.Plus-One.md | 9 ++++++++- website/content/ChapterFour/0067.Add-Binary.md | 9 ++++++++- website/content/ChapterFour/0069.Sqrtx.md | 9 ++++++++- website/content/ChapterFour/0070.Climbing-Stairs.md | 9 ++++++++- website/content/ChapterFour/0071.Simplify-Path.md | 9 ++++++++- website/content/ChapterFour/0074.Search-a-2D-Matrix.md | 9 ++++++++- website/content/ChapterFour/0075.Sort-Colors.md | 9 ++++++++- .../content/ChapterFour/0076.Minimum-Window-Substring.md | 7 +++++++ website/content/ChapterFour/0077.Combinations.md | 9 ++++++++- website/content/ChapterFour/0078.Subsets.md | 9 ++++++++- website/content/ChapterFour/0079.Word-Search.md | 9 ++++++++- .../0080.Remove-Duplicates-from-Sorted-Array-II.md | 9 ++++++++- .../0081.Search-in-Rotated-Sorted-Array-II.md | 9 ++++++++- .../0082.Remove-Duplicates-from-Sorted-List-II.md | 9 ++++++++- .../0083.Remove-Duplicates-from-Sorted-List.md | 9 ++++++++- .../ChapterFour/0084.Largest-Rectangle-in-Histogram.md | 9 ++++++++- website/content/ChapterFour/0086.Partition-List.md | 9 ++++++++- website/content/ChapterFour/0088.Merge-Sorted-Array.md | 9 ++++++++- website/content/ChapterFour/0089.Gray-Code.md | 9 ++++++++- website/content/ChapterFour/0090.Subsets-II.md | 9 ++++++++- website/content/ChapterFour/0091.Decode-Ways.md | 9 ++++++++- .../content/ChapterFour/0092.Reverse-Linked-List-II.md | 9 ++++++++- website/content/ChapterFour/0093.Restore-IP-Addresses.md | 9 ++++++++- .../ChapterFour/0094.Binary-Tree-Inorder-Traversal.md | 9 ++++++++- .../ChapterFour/0095.Unique-Binary-Search-Trees-II.md | 9 ++++++++- .../ChapterFour/0096.Unique-Binary-Search-Trees.md | 9 ++++++++- .../ChapterFour/0098.Validate-Binary-Search-Tree.md | 9 ++++++++- .../ChapterFour/0099.Recover-Binary-Search-Tree.md | 9 ++++++++- website/content/ChapterFour/0100.Same-Tree.md | 9 ++++++++- website/content/ChapterFour/0101.Symmetric-Tree.md | 9 ++++++++- .../0102.Binary-Tree-Level-Order-Traversal.md | 9 ++++++++- .../0103.Binary-Tree-Zigzag-Level-Order-Traversal.md | 9 ++++++++- .../ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md | 9 ++++++++- ...ct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md | 9 ++++++++- ...t-Binary-Tree-from-Inorder-and-Postorder-Traversal.md | 9 ++++++++- .../0107.Binary-Tree-Level-Order-Traversal-II.md | 9 ++++++++- .../0108.Convert-Sorted-Array-to-Binary-Search-Tree.md | 9 ++++++++- .../0109.Convert-Sorted-List-to-Binary-Search-Tree.md | 9 ++++++++- website/content/ChapterFour/0110.Balanced-Binary-Tree.md | 9 ++++++++- .../ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md | 9 ++++++++- website/content/ChapterFour/0112.Path-Sum.md | 9 ++++++++- website/content/ChapterFour/0113.Path-Sum-II.md | 9 ++++++++- .../0114.Flatten-Binary-Tree-to-Linked-List.md | 9 ++++++++- website/content/ChapterFour/0118.Pascals-Triangle.md | 7 +++++++ website/content/ChapterFour/0120.Triangle.md | 9 ++++++++- .../ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md | 9 ++++++++- .../0122.Best-Time-to-Buy-and-Sell-Stock-II.md | 9 ++++++++- .../ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md | 9 ++++++++- website/content/ChapterFour/0125.Valid-Palindrome.md | 9 ++++++++- website/content/ChapterFour/0126.Word-Ladder-II.md | 9 ++++++++- website/content/ChapterFour/0127.Word-Ladder.md | 9 ++++++++- .../ChapterFour/0128.Longest-Consecutive-Sequence.md | 9 ++++++++- .../content/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md | 9 ++++++++- website/content/ChapterFour/0130.Surrounded-Regions.md | 9 ++++++++- .../content/ChapterFour/0131.Palindrome-Partitioning.md | 9 ++++++++- website/content/ChapterFour/0136.Single-Number.md | 9 ++++++++- website/content/ChapterFour/0137.Single-Number-II.md | 9 ++++++++- website/content/ChapterFour/0141.Linked-List-Cycle.md | 9 ++++++++- website/content/ChapterFour/0142.Linked-List-Cycle-II.md | 9 ++++++++- website/content/ChapterFour/0143.Reorder-List.md | 9 ++++++++- .../ChapterFour/0144.Binary-Tree-Preorder-Traversal.md | 9 ++++++++- .../ChapterFour/0145.Binary-Tree-Postorder-Traversal.md | 9 ++++++++- website/content/ChapterFour/0146.LRU-Cache.md | 9 ++++++++- website/content/ChapterFour/0147.Insertion-Sort-List.md | 9 ++++++++- website/content/ChapterFour/0148.Sort-List.md | 9 ++++++++- .../ChapterFour/0150.Evaluate-Reverse-Polish-Notation.md | 9 ++++++++- .../ChapterFour/0151.Reverse-Words-in-a-String.md | 9 ++++++++- .../content/ChapterFour/0152.Maximum-Product-Subarray.md | 9 ++++++++- .../0153.Find-Minimum-in-Rotated-Sorted-Array.md | 9 ++++++++- .../0154.Find-Minimum-in-Rotated-Sorted-Array-II.md | 9 ++++++++- website/content/ChapterFour/0155.Min-Stack.md | 9 ++++++++- .../ChapterFour/0160.Intersection-of-Two-Linked-Lists.md | 9 ++++++++- website/content/ChapterFour/0162.Find-Peak-Element.md | 9 ++++++++- website/content/ChapterFour/0164.Maximum-Gap.md | 9 ++++++++- .../0167.Two-Sum-II---Input-array-is-sorted.md | 9 ++++++++- .../content/ChapterFour/0168.Excel-Sheet-Column-Title.md | 9 ++++++++- website/content/ChapterFour/0169.Majority-Element.md | 9 ++++++++- .../ChapterFour/0171.Excel-Sheet-Column-Number.md | 9 ++++++++- .../ChapterFour/0172.Factorial-Trailing-Zeroes.md | 9 ++++++++- .../ChapterFour/0173.Binary-Search-Tree-Iterator.md | 9 ++++++++- website/content/ChapterFour/0174.Dungeon-Game.md | 9 ++++++++- website/content/ChapterFour/0179.Largest-Number.md | 9 ++++++++- .../content/ChapterFour/0187.Repeated-DNA-Sequences.md | 9 ++++++++- website/content/ChapterFour/0189.Rotate-Array.md | 9 ++++++++- website/content/ChapterFour/0190.Reverse-Bits.md | 9 ++++++++- website/content/ChapterFour/0191.Number-of-1-Bits.md | 9 ++++++++- website/content/ChapterFour/0198.House-Robber.md | 9 ++++++++- .../ChapterFour/0199.Binary-Tree-Right-Side-View.md | 9 ++++++++- website/content/ChapterFour/0200.Number-of-Islands.md | 9 ++++++++- .../ChapterFour/0201.Bitwise-AND-of-Numbers-Range.md | 9 ++++++++- website/content/ChapterFour/0202.Happy-Number.md | 9 ++++++++- .../ChapterFour/0203.Remove-Linked-List-Elements.md | 9 ++++++++- website/content/ChapterFour/0204.Count-Primes.md | 9 ++++++++- website/content/ChapterFour/0205.Isomorphic-Strings.md | 9 ++++++++- website/content/ChapterFour/0206.Reverse-Linked-List.md | 9 ++++++++- website/content/ChapterFour/0207.Course-Schedule.md | 9 ++++++++- .../ChapterFour/0208.Implement-Trie-Prefix-Tree.md | 9 ++++++++- .../ChapterFour/0209.Minimum-Size-Subarray-Sum.md | 9 ++++++++- website/content/ChapterFour/0210.Course-Schedule-II.md | 9 ++++++++- .../0211.Design-Add-and-Search-Words-Data-Structure.md | 9 ++++++++- website/content/ChapterFour/0212.Word-Search-II.md | 9 ++++++++- website/content/ChapterFour/0213.House-Robber-II.md | 9 ++++++++- .../ChapterFour/0215.Kth-Largest-Element-in-an-Array.md | 9 ++++++++- website/content/ChapterFour/0216.Combination-Sum-III.md | 9 ++++++++- website/content/ChapterFour/0217.Contains-Duplicate.md | 9 ++++++++- website/content/ChapterFour/0218.The-Skyline-Problem.md | 9 ++++++++- .../content/ChapterFour/0219.Contains-Duplicate-II.md | 9 ++++++++- .../content/ChapterFour/0220.Contains-Duplicate-III.md | 9 ++++++++- .../ChapterFour/0222.Count-Complete-Tree-Nodes.md | 9 ++++++++- website/content/ChapterFour/0223.Rectangle-Area.md | 9 ++++++++- website/content/ChapterFour/0224.Basic-Calculator.md | 9 ++++++++- .../ChapterFour/0225.Implement-Stack-using-Queues.md | 9 ++++++++- website/content/ChapterFour/0226.Invert-Binary-Tree.md | 9 ++++++++- website/content/ChapterFour/0228.Summary-Ranges.md | 9 ++++++++- website/content/ChapterFour/0229.Majority-Element-II.md | 9 ++++++++- .../ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md | 9 ++++++++- website/content/ChapterFour/0231.Power-of-Two.md | 9 ++++++++- .../ChapterFour/0232.Implement-Queue-using-Stacks.md | 9 ++++++++- .../content/ChapterFour/0234.Palindrome-Linked-List.md | 9 ++++++++- ...235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md | 9 ++++++++- .../0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md | 9 ++++++++- .../ChapterFour/0237.Delete-Node-in-a-Linked-List.md | 9 ++++++++- .../content/ChapterFour/0239.Sliding-Window-Maximum.md | 9 ++++++++- .../content/ChapterFour/0240.Search-a-2D-Matrix-II.md | 9 ++++++++- website/content/ChapterFour/0242.Valid-Anagram.md | 9 ++++++++- website/content/ChapterFour/0257.Binary-Tree-Paths.md | 9 ++++++++- website/content/ChapterFour/0258.Add-Digits.md | 9 ++++++++- website/content/ChapterFour/0260.Single-Number-III.md | 9 ++++++++- website/content/ChapterFour/0263.Ugly-Number.md | 9 ++++++++- website/content/ChapterFour/0268.Missing-Number.md | 9 ++++++++- website/content/ChapterFour/0274.H-Index.md | 9 ++++++++- website/content/ChapterFour/0275.H-Index-II.md | 9 ++++++++- website/content/ChapterFour/0283.Move-Zeroes.md | 9 ++++++++- .../ChapterFour/0287.Find-the-Duplicate-Number.md | 9 ++++++++- website/content/ChapterFour/0290.Word-Pattern.md | 9 ++++++++- .../ChapterFour/0300.Longest-Increasing-Subsequence.md | 9 ++++++++- .../ChapterFour/0303.Range-Sum-Query---Immutable.md | 9 ++++++++- website/content/ChapterFour/0306.Additive-Number.md | 9 ++++++++- .../ChapterFour/0307.Range-Sum-Query---Mutable.md | 9 ++++++++- ...0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md | 9 ++++++++- .../0315.Count-of-Smaller-Numbers-After-Self.md | 9 ++++++++- .../ChapterFour/0318.Maximum-Product-of-Word-Lengths.md | 9 ++++++++- website/content/ChapterFour/0322.Coin-Change.md | 9 ++++++++- website/content/ChapterFour/0324.Wiggle-Sort-II.md | 9 ++++++++- website/content/ChapterFour/0326.Power-of-Three.md | 9 ++++++++- website/content/ChapterFour/0327.Count-of-Range-Sum.md | 9 ++++++++- website/content/ChapterFour/0328.Odd-Even-Linked-List.md | 9 ++++++++- .../0329.Longest-Increasing-Path-in-a-Matrix.md | 9 ++++++++- ...331.Verify-Preorder-Serialization-of-a-Binary-Tree.md | 9 ++++++++- website/content/ChapterFour/0337.House-Robber-III.md | 9 ++++++++- website/content/ChapterFour/0338.Counting-Bits.md | 9 ++++++++- website/content/ChapterFour/0342.Power-of-Four.md | 9 ++++++++- website/content/ChapterFour/0343.Integer-Break.md | 9 ++++++++- website/content/ChapterFour/0344.Reverse-String.md | 9 ++++++++- .../ChapterFour/0345.Reverse-Vowels-of-a-String.md | 9 ++++++++- .../content/ChapterFour/0347.Top-K-Frequent-Elements.md | 9 ++++++++- .../ChapterFour/0349.Intersection-of-Two-Arrays.md | 9 ++++++++- .../ChapterFour/0350.Intersection-of-Two-Arrays-II.md | 9 ++++++++- .../content/ChapterFour/0354.Russian-Doll-Envelopes.md | 9 ++++++++- .../ChapterFour/0357.Count-Numbers-with-Unique-Digits.md | 9 ++++++++- website/content/ChapterFour/0367.Valid-Perfect-Square.md | 9 ++++++++- website/content/ChapterFour/0371.Sum-of-Two-Integers.md | 9 ++++++++- website/content/ChapterFour/0372.Super-Pow.md | 9 ++++++++- .../ChapterFour/0373.Find-K-Pairs-with-Smallest-Sums.md | 9 ++++++++- .../0378.Kth-Smallest-Element-in-a-Sorted-Matrix.md | 9 ++++++++- website/content/ChapterFour/0385.Mini-Parser.md | 9 ++++++++- .../content/ChapterFour/0386.Lexicographical-Numbers.md | 9 ++++++++- .../0387.First-Unique-Character-in-a-String.md | 9 ++++++++- website/content/ChapterFour/0389.Find-the-Difference.md | 9 ++++++++- website/content/ChapterFour/0392.Is-Subsequence.md | 9 ++++++++- website/content/ChapterFour/0393.UTF-8-Validation.md | 9 ++++++++- website/content/ChapterFour/0394.Decode-String.md | 9 ++++++++- website/content/ChapterFour/0397.Integer-Replacement.md | 9 ++++++++- website/content/ChapterFour/0399.Evaluate-Division.md | 9 ++++++++- website/content/ChapterFour/0401.Binary-Watch.md | 9 ++++++++- website/content/ChapterFour/0402.Remove-K-Digits.md | 9 ++++++++- website/content/ChapterFour/0404.Sum-of-Left-Leaves.md | 9 ++++++++- .../ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md | 9 ++++++++- website/content/ChapterFour/0409.Longest-Palindrome.md | 9 ++++++++- .../content/ChapterFour/0410.Split-Array-Largest-Sum.md | 9 ++++++++- website/content/ChapterFour/0412.Fizz-Buzz.md | 9 ++++++++- website/content/ChapterFour/0414.Third-Maximum-Number.md | 9 ++++++++- .../ChapterFour/0416.Partition-Equal-Subset-Sum.md | 9 ++++++++- .../0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md | 9 ++++++++- .../0424.Longest-Repeating-Character-Replacement.md | 9 ++++++++- .../content/ChapterFour/0433.Minimum-Genetic-Mutation.md | 9 ++++++++- .../ChapterFour/0435.Non-overlapping-Intervals.md | 9 ++++++++- website/content/ChapterFour/0436.Find-Right-Interval.md | 9 ++++++++- website/content/ChapterFour/0437.Path-Sum-III.md | 9 ++++++++- .../ChapterFour/0438.Find-All-Anagrams-in-a-String.md | 9 ++++++++- website/content/ChapterFour/0441.Arranging-Coins.md | 9 ++++++++- website/content/ChapterFour/0445.Add-Two-Numbers-II.md | 9 ++++++++- website/content/ChapterFour/0447.Number-of-Boomerangs.md | 9 ++++++++- .../0448.Find-All-Numbers-Disappeared-in-an-Array.md | 9 ++++++++- .../ChapterFour/0451.Sort-Characters-By-Frequency.md | 9 ++++++++- .../0453.Minimum-Moves-to-Equal-Array-Elements.md | 9 ++++++++- website/content/ChapterFour/0454.4Sum-II.md | 9 ++++++++- website/content/ChapterFour/0455.Assign-Cookies.md | 9 ++++++++- website/content/ChapterFour/0456.132-Pattern.md | 9 ++++++++- website/content/ChapterFour/0457.Circular-Array-Loop.md | 9 ++++++++- website/content/ChapterFour/0460.LFU-Cache.md | 9 ++++++++- website/content/ChapterFour/0461.Hamming-Distance.md | 9 ++++++++- website/content/ChapterFour/0463.Island-Perimeter.md | 9 ++++++++- .../ChapterFour/0470.Implement-Rand10-Using-Rand7.md | 9 ++++++++- website/content/ChapterFour/0474.Ones-and-Zeroes.md | 9 ++++++++- website/content/ChapterFour/0475.Heaters.md | 9 ++++++++- website/content/ChapterFour/0476.Number-Complement.md | 9 ++++++++- .../content/ChapterFour/0477.Total-Hamming-Distance.md | 9 ++++++++- .../content/ChapterFour/0480.Sliding-Window-Median.md | 9 ++++++++- website/content/ChapterFour/0483.Smallest-Good-Base.md | 9 ++++++++- website/content/ChapterFour/0485.Max-Consecutive-Ones.md | 9 ++++++++- .../content/ChapterFour/0491.Increasing-Subsequences.md | 9 ++++++++- website/content/ChapterFour/0493.Reverse-Pairs.md | 9 ++++++++- website/content/ChapterFour/0494.Target-Sum.md | 9 ++++++++- .../content/ChapterFour/0496.Next-Greater-Element-I.md | 9 ++++++++- .../0497.Random-Point-in-Non-overlapping-Rectangles.md | 9 ++++++++- website/content/ChapterFour/0498.Diagonal-Traverse.md | 9 ++++++++- website/content/ChapterFour/0500.Keyboard-Row.md | 9 ++++++++- .../content/ChapterFour/0503.Next-Greater-Element-II.md | 9 ++++++++- website/content/ChapterFour/0507.Perfect-Number.md | 9 ++++++++- .../ChapterFour/0508.Most-Frequent-Subtree-Sum.md | 9 ++++++++- website/content/ChapterFour/0509.Fibonacci-Number.md | 9 ++++++++- .../ChapterFour/0513.Find-Bottom-Left-Tree-Value.md | 9 ++++++++- .../0515.Find-Largest-Value-in-Each-Tree-Row.md | 9 ++++++++- .../0524.Longest-Word-in-Dictionary-through-Deleting.md | 9 ++++++++- .../content/ChapterFour/0526.Beautiful-Arrangement.md | 9 ++++++++- .../content/ChapterFour/0528.Random-Pick-with-Weight.md | 9 ++++++++- website/content/ChapterFour/0529.Minesweeper.md | 9 ++++++++- .../content/ChapterFour/0532.K-diff-Pairs-in-an-Array.md | 9 ++++++++- .../ChapterFour/0537.Complex-Number-Multiplication.md | 9 ++++++++- website/content/ChapterFour/0541.Reverse-String-II.md | 9 ++++++++- website/content/ChapterFour/0542.01-Matrix.md | 9 ++++++++- website/content/ChapterFour/0547.Number-of-Provinces.md | 9 ++++++++- .../ChapterFour/0557.Reverse-Words-in-a-String-III.md | 9 ++++++++- website/content/ChapterFour/0561.Array-Partition-I.md | 9 ++++++++- website/content/ChapterFour/0563.Binary-Tree-Tilt.md | 9 ++++++++- website/content/ChapterFour/0566.Reshape-the-Matrix.md | 9 ++++++++- .../content/ChapterFour/0567.Permutation-in-String.md | 9 ++++++++- .../content/ChapterFour/0572.Subtree-of-Another-Tree.md | 9 ++++++++- website/content/ChapterFour/0575.Distribute-Candies.md | 9 ++++++++- .../ChapterFour/0594.Longest-Harmonious-Subsequence.md | 9 ++++++++- website/content/ChapterFour/0598.Range-Addition-II.md | 9 ++++++++- .../ChapterFour/0599.Minimum-Index-Sum-of-Two-Lists.md | 9 ++++++++- website/content/ChapterFour/0605.Can-Place-Flowers.md | 9 ++++++++- .../ChapterFour/0628.Maximum-Product-of-Three-Numbers.md | 9 ++++++++- ...0632.Smallest-Range-Covering-Elements-from-K-Lists.md | 9 ++++++++- .../content/ChapterFour/0633.Sum-of-Square-Numbers.md | 9 ++++++++- .../ChapterFour/0636.Exclusive-Time-of-Functions.md | 9 ++++++++- .../ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md | 9 ++++++++- website/content/ChapterFour/0638.Shopping-Offers.md | 9 ++++++++- website/content/ChapterFour/0645.Set-Mismatch.md | 9 ++++++++- website/content/ChapterFour/0648.Replace-Words.md | 9 ++++++++- .../ChapterFour/0653.Two-Sum-IV---Input-is-a-BST.md | 9 ++++++++- .../content/ChapterFour/0658.Find-K-Closest-Elements.md | 9 ++++++++- website/content/ChapterFour/0661.Image-Smoother.md | 9 ++++++++- .../ChapterFour/0662.Maximum-Width-of-Binary-Tree.md | 9 ++++++++- .../0668.Kth-Smallest-Number-in-Multiplication-Table.md | 9 ++++++++- .../ChapterFour/0676.Implement-Magic-Dictionary.md | 9 ++++++++- website/content/ChapterFour/0682.Baseball-Game.md | 9 ++++++++- website/content/ChapterFour/0684.Redundant-Connection.md | 9 ++++++++- .../content/ChapterFour/0685.Redundant-Connection-II.md | 9 ++++++++- .../0693.Binary-Number-with-Alternating-Bits.md | 9 ++++++++- website/content/ChapterFour/0695.Max-Area-of-Island.md | 9 ++++++++- website/content/ChapterFour/0697.Degree-of-an-Array.md | 9 ++++++++- website/content/ChapterFour/0699.Falling-Squares.md | 9 ++++++++- website/content/ChapterFour/0704.Binary-Search.md | 9 ++++++++- website/content/ChapterFour/0705.Design-HashSet.md | 9 ++++++++- website/content/ChapterFour/0706.Design-HashMap.md | 9 ++++++++- website/content/ChapterFour/0707.Design-Linked-List.md | 9 ++++++++- .../ChapterFour/0710.Random-Pick-with-Blacklist.md | 9 ++++++++- .../ChapterFour/0713.Subarray-Product-Less-Than-K.md | 9 ++++++++- ...st-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md | 9 ++++++++- website/content/ChapterFour/0715.Range-Module.md | 9 ++++++++- .../ChapterFour/0717.1-bit-and-2-bit-Characters.md | 9 ++++++++- .../0718.Maximum-Length-of-Repeated-Subarray.md | 9 ++++++++- .../ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md | 9 ++++++++- .../ChapterFour/0720.Longest-Word-in-Dictionary.md | 9 ++++++++- website/content/ChapterFour/0721.Accounts-Merge.md | 9 ++++++++- website/content/ChapterFour/0724.Find-Pivot-Index.md | 7 +++++++ .../ChapterFour/0725.Split-Linked-List-in-Parts.md | 9 ++++++++- website/content/ChapterFour/0726.Number-of-Atoms.md | 9 ++++++++- website/content/ChapterFour/0729.My-Calendar-I.md | 9 ++++++++- website/content/ChapterFour/0732.My-Calendar-III.md | 9 ++++++++- website/content/ChapterFour/0733.Flood-Fill.md | 9 ++++++++- website/content/ChapterFour/0735.Asteroid-Collision.md | 9 ++++++++- website/content/ChapterFour/0739.Daily-Temperatures.md | 9 ++++++++- .../0744.Find-Smallest-Letter-Greater-Than-Target.md | 9 ++++++++- .../content/ChapterFour/0745.Prefix-and-Suffix-Search.md | 9 ++++++++- .../content/ChapterFour/0746.Min-Cost-Climbing-Stairs.md | 9 ++++++++- .../content/ChapterFour/0748.Shortest-Completing-Word.md | 9 ++++++++- website/content/ChapterFour/0753.Cracking-the-Safe.md | 9 ++++++++- .../ChapterFour/0756.Pyramid-Transition-Matrix.md | 9 ++++++++- ....Prime-Number-of-Set-Bits-in-Binary-Representation.md | 9 ++++++++- website/content/ChapterFour/0763.Partition-Labels.md | 9 ++++++++- .../content/ChapterFour/0765.Couples-Holding-Hands.md | 9 ++++++++- website/content/ChapterFour/0766.Toeplitz-Matrix.md | 9 ++++++++- website/content/ChapterFour/0767.Reorganize-String.md | 9 ++++++++- website/content/ChapterFour/0771.Jewels-and-Stones.md | 9 ++++++++- website/content/ChapterFour/0778.Swim-in-Rising-Water.md | 9 ++++++++- website/content/ChapterFour/0781.Rabbits-in-Forest.md | 9 ++++++++- .../content/ChapterFour/0784.Letter-Case-Permutation.md | 9 ++++++++- website/content/ChapterFour/0785.Is-Graph-Bipartite.md | 9 ++++++++- .../ChapterFour/0786.K-th-Smallest-Prime-Fraction.md | 9 ++++++++- .../0793.Preimage-Size-of-Factorial-Zeroes-Function.md | 9 ++++++++- .../ChapterFour/0802.Find-Eventual-Safe-States.md | 9 ++++++++- .../content/ChapterFour/0803.Bricks-Falling-When-Hit.md | 9 ++++++++- .../content/ChapterFour/0811.Subdomain-Visit-Count.md | 9 ++++++++- .../content/ChapterFour/0812.Largest-Triangle-Area.md | 9 ++++++++- website/content/ChapterFour/0815.Bus-Routes.md | 9 ++++++++- .../content/ChapterFour/0817.Linked-List-Components.md | 9 ++++++++- website/content/ChapterFour/0819.Most-Common-Word.md | 9 ++++++++- .../ChapterFour/0826.Most-Profit-Assigning-Work.md | 9 ++++++++- ...que-Characters-of-All-Substrings-of-a-Given-String.md | 9 ++++++++- .../ChapterFour/0830.Positions-of-Large-Groups.md | 9 ++++++++- website/content/ChapterFour/0832.Flipping-an-Image.md | 9 ++++++++- .../content/ChapterFour/0834.Sum-of-Distances-in-Tree.md | 9 ++++++++- website/content/ChapterFour/0836.Rectangle-Overlap.md | 9 ++++++++- website/content/ChapterFour/0838.Push-Dominoes.md | 9 ++++++++- .../content/ChapterFour/0839.Similar-String-Groups.md | 9 ++++++++- website/content/ChapterFour/0841.Keys-and-Rooms.md | 9 ++++++++- .../0842.Split-Array-into-Fibonacci-Sequence.md | 9 ++++++++- .../content/ChapterFour/0844.Backspace-String-Compare.md | 9 ++++++++- .../ChapterFour/0845.Longest-Mountain-in-Array.md | 9 ++++++++- website/content/ChapterFour/0850.Rectangle-Area-II.md | 9 ++++++++- website/content/ChapterFour/0851.Loud-and-Rich.md | 9 ++++++++- .../ChapterFour/0852.Peak-Index-in-a-Mountain-Array.md | 9 ++++++++- website/content/ChapterFour/0853.Car-Fleet.md | 9 ++++++++- website/content/ChapterFour/0856.Score-of-Parentheses.md | 9 ++++++++- .../0862.Shortest-Subarray-with-Sum-at-Least-K.md | 9 ++++++++- .../0863.All-Nodes-Distance-K-in-Binary-Tree.md | 9 ++++++++- .../ChapterFour/0864.Shortest-Path-to-Get-All-Keys.md | 9 ++++++++- website/content/ChapterFour/0867.Transpose-Matrix.md | 9 ++++++++- website/content/ChapterFour/0872.Leaf-Similar-Trees.md | 9 ++++++++- website/content/ChapterFour/0875.Koko-Eating-Bananas.md | 9 ++++++++- .../ChapterFour/0876.Middle-of-the-Linked-List.md | 9 ++++++++- website/content/ChapterFour/0878.Nth-Magical-Number.md | 9 ++++++++- .../content/ChapterFour/0880.Decoded-String-at-Index.md | 9 ++++++++- website/content/ChapterFour/0881.Boats-to-Save-People.md | 9 ++++++++- .../0884.Uncommon-Words-from-Two-Sentences.md | 9 ++++++++- website/content/ChapterFour/0885.Spiral-Matrix-III.md | 9 ++++++++- website/content/ChapterFour/0887.Super-Egg-Drop.md | 9 ++++++++- website/content/ChapterFour/0888.Fair-Candy-Swap.md | 9 ++++++++- .../ChapterFour/0891.Sum-of-Subsequence-Widths.md | 9 ++++++++- .../ChapterFour/0892.Surface-Area-of-3D-Shapes.md | 9 ++++++++- .../content/ChapterFour/0895.Maximum-Frequency-Stack.md | 9 ++++++++- website/content/ChapterFour/0896.Monotonic-Array.md | 9 ++++++++- .../ChapterFour/0897.Increasing-Order-Search-Tree.md | 9 ++++++++- .../content/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md | 9 ++++++++- website/content/ChapterFour/0901.Online-Stock-Span.md | 9 ++++++++- website/content/ChapterFour/0904.Fruit-Into-Baskets.md | 9 ++++++++- .../content/ChapterFour/0907.Sum-of-Subarray-Minimums.md | 9 ++++++++- website/content/ChapterFour/0910.Smallest-Range-II.md | 9 ++++++++- website/content/ChapterFour/0911.Online-Election.md | 9 ++++++++- .../ChapterFour/0914.X-of-a-Kind-in-a-Deck-of-Cards.md | 9 ++++++++- .../ChapterFour/0918.Maximum-Sum-Circular-Subarray.md | 9 ++++++++- .../ChapterFour/0920.Number-of-Music-Playlists.md | 9 ++++++++- .../0921.Minimum-Add-to-Make-Parentheses-Valid.md | 9 ++++++++- .../content/ChapterFour/0922.Sort-Array-By-Parity-II.md | 9 ++++++++- .../content/ChapterFour/0923.3Sum-With-Multiplicity.md | 9 ++++++++- .../content/ChapterFour/0924.Minimize-Malware-Spread.md | 9 ++++++++- website/content/ChapterFour/0925.Long-Pressed-Name.md | 9 ++++++++- website/content/ChapterFour/0927.Three-Equal-Parts.md | 9 ++++++++- .../ChapterFour/0928.Minimize-Malware-Spread-II.md | 9 ++++++++- .../ChapterFour/0930.Binary-Subarrays-With-Sum.md | 9 ++++++++- .../content/ChapterFour/0933.Number-of-Recent-Calls.md | 9 ++++++++- website/content/ChapterFour/0942.DI-String-Match.md | 9 ++++++++- .../content/ChapterFour/0946.Validate-Stack-Sequences.md | 9 ++++++++- .../0947.Most-Stones-Removed-with-Same-Row-or-Column.md | 9 ++++++++- .../ChapterFour/0949.Largest-Time-for-Given-Digits.md | 9 ++++++++- .../0952.Largest-Component-Size-by-Common-Factor.md | 9 ++++++++- .../ChapterFour/0953.Verifying-an-Alien-Dictionary.md | 9 ++++++++- .../content/ChapterFour/0959.Regions-Cut-By-Slashes.md | 9 ++++++++- .../0961.N-Repeated-Element-in-Size-2N-Array.md | 9 ++++++++- website/content/ChapterFour/0968.Binary-Tree-Cameras.md | 9 ++++++++- website/content/ChapterFour/0969.Pancake-Sorting.md | 9 ++++++++- website/content/ChapterFour/0970.Powerful-Integers.md | 9 ++++++++- .../ChapterFour/0973.K-Closest-Points-to-Origin.md | 9 ++++++++- .../ChapterFour/0976.Largest-Perimeter-Triangle.md | 9 ++++++++- .../ChapterFour/0977.Squares-of-a-Sorted-Array.md | 9 ++++++++- .../ChapterFour/0978.Longest-Turbulent-Subarray.md | 9 ++++++++- .../ChapterFour/0979.Distribute-Coins-in-Binary-Tree.md | 9 ++++++++- website/content/ChapterFour/0980.Unique-Paths-III.md | 9 ++++++++- .../ChapterFour/0981.Time-Based-Key-Value-Store.md | 9 ++++++++- .../ChapterFour/0984.String-Without-AAA-or-BBB.md | 9 ++++++++- .../0985.Sum-of-Even-Numbers-After-Queries.md | 9 ++++++++- .../ChapterFour/0986.Interval-List-Intersections.md | 9 ++++++++- .../0990.Satisfiability-of-Equality-Equations.md | 9 ++++++++- .../0992.Subarrays-with-K-Different-Integers.md | 9 ++++++++- .../content/ChapterFour/0993.Cousins-in-Binary-Tree.md | 9 ++++++++- .../0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md | 9 ++++++++- .../ChapterFour/0996.Number-of-Squareful-Arrays.md | 9 ++++++++- .../ChapterFour/0999.Available-Captures-for-Rook.md | 9 ++++++++- .../content/ChapterFour/1002.Find-Common-Characters.md | 9 ++++++++- .../1003.Check-If-Word-Is-Valid-After-Substitutions.md | 9 ++++++++- .../content/ChapterFour/1004.Max-Consecutive-Ones-III.md | 9 ++++++++- .../1005.Maximize-Sum-Of-Array-After-K-Negations.md | 9 ++++++++- .../1011.Capacity-To-Ship-Packages-Within-D-Days.md | 9 ++++++++- website/content/ChapterFour/1017.Convert-to-Base--2.md | 9 ++++++++- .../ChapterFour/1018.Binary-Prefix-Divisible-By-5.md | 9 ++++++++- .../ChapterFour/1019.Next-Greater-Node-In-Linked-List.md | 9 ++++++++- website/content/ChapterFour/1020.Number-of-Enclaves.md | 9 ++++++++- .../ChapterFour/1021.Remove-Outermost-Parentheses.md | 9 ++++++++- website/content/ChapterFour/1025.Divisor-Game.md | 9 ++++++++- .../1026.Maximum-Difference-Between-Node-and-Ancestor.md | 9 ++++++++- .../1028.Recover-a-Tree-From-Preorder-Traversal.md | 9 ++++++++- .../ChapterFour/1030.Matrix-Cells-in-Distance-Order.md | 9 ++++++++- website/content/ChapterFour/1037.Valid-Boomerang.md | 9 ++++++++- .../1040.Moving-Stones-Until-Consecutive-II.md | 9 ++++++++- .../1047.Remove-All-Adjacent-Duplicates-In-String.md | 9 ++++++++- website/content/ChapterFour/1049.Last-Stone-Weight-II.md | 9 ++++++++- website/content/ChapterFour/1051.Height-Checker.md | 9 ++++++++- .../content/ChapterFour/1052.Grumpy-Bookstore-Owner.md | 9 ++++++++- website/content/ChapterFour/1054.Distant-Barcodes.md | 9 ++++++++- .../ChapterFour/1073.Adding-Two-Negabinary-Numbers.md | 9 ++++++++- .../1074.Number-of-Submatrices-That-Sum-to-Target.md | 9 ++++++++- .../content/ChapterFour/1078.Occurrences-After-Bigram.md | 9 ++++++++- .../ChapterFour/1079.Letter-Tile-Possibilities.md | 9 ++++++++- website/content/ChapterFour/1089.Duplicate-Zeros.md | 9 ++++++++- .../ChapterFour/1093.Statistics-from-a-Large-Sample.md | 9 ++++++++- .../content/ChapterFour/1105.Filling-Bookcase-Shelves.md | 9 ++++++++- .../content/ChapterFour/1108.Defanging-an-IP-Address.md | 9 ++++++++- .../ChapterFour/1110.Delete-Nodes-And-Return-Forest.md | 9 ++++++++- ...mum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md | 9 ++++++++- website/content/ChapterFour/1122.Relative-Sort-Array.md | 9 ++++++++- .../1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md | 9 ++++++++- .../1128.Number-of-Equivalent-Domino-Pairs.md | 9 ++++++++- .../content/ChapterFour/1137.N-th-Tribonacci-Number.md | 9 ++++++++- .../ChapterFour/1145.Binary-Tree-Coloring-Game.md | 9 ++++++++- website/content/ChapterFour/1154.Day-of-the-Year.md | 9 ++++++++- .../1157.Online-Majority-Element-In-Subarray.md | 9 ++++++++- .../1160.Find-Words-That-Can-Be-Formed-by-Characters.md | 9 ++++++++- ...are-Strings-by-Frequency-of-the-Smallest-Character.md | 9 ++++++++- ...Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md | 9 ++++++++- website/content/ChapterFour/1175.Prime-Arrangements.md | 9 ++++++++- .../ChapterFour/1184.Distance-Between-Bus-Stops.md | 9 ++++++++- website/content/ChapterFour/1185.Day-of-the-Week.md | 9 ++++++++- .../ChapterFour/1189.Maximum-Number-of-Balloons.md | 9 ++++++++- .../ChapterFour/1200.Minimum-Absolute-Difference.md | 9 ++++++++- website/content/ChapterFour/1201.Ugly-Number-III.md | 9 ++++++++- .../ChapterFour/1202.Smallest-String-With-Swaps.md | 9 ++++++++- .../ChapterFour/1207.Unique-Number-of-Occurrences.md | 9 ++++++++- .../1208.Get-Equal-Substrings-Within-Budget.md | 9 ++++++++- ...17.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md | 9 ++++++++- .../1221.Split-a-String-in-Balanced-Strings.md | 9 ++++++++- .../ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md | 9 ++++++++- .../1234.Replace-the-Substring-for-Balanced-String.md | 9 ++++++++- .../ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md | 9 ++++++++- .../1252.Cells-with-Odd-Values-in-a-Matrix.md | 9 ++++++++- .../content/ChapterFour/1254.Number-of-Closed-Islands.md | 9 ++++++++- website/content/ChapterFour/1260.Shift-2D-Grid.md | 9 ++++++++- .../ChapterFour/1266.Minimum-Time-Visiting-All-Points.md | 9 ++++++++- .../1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md | 9 ++++++++- ...btract-the-Product-and-Sum-of-Digits-of-an-Integer.md | 9 ++++++++- .../1283.Find-the-Smallest-Divisor-Given-a-Threshold.md | 9 ++++++++- ...287.Element-Appearing-More-Than-25-In-Sorted-Array.md | 9 ++++++++- ....Convert-Binary-Number-in-a-Linked-List-to-Integer.md | 9 ++++++++- .../1295.Find-Numbers-with-Even-Number-of-Digits.md | 9 ++++++++- ...place-Elements-with-Greatest-Element-on-Right-Side.md | 9 ++++++++- .../1300.Sum-of-Mutated-Array-Closest-to-Target.md | 9 ++++++++- website/content/ChapterFour/1302.Deepest-Leaves-Sum.md | 9 ++++++++- .../1304.Find-N-Unique-Integers-Sum-up-to-Zero.md | 9 ++++++++- .../1305.All-Elements-in-Two-Binary-Search-Trees.md | 9 ++++++++- website/content/ChapterFour/1306.Jump-Game-III.md | 9 ++++++++- .../1313.Decompress-Run-Length-Encoded-List.md | 9 ++++++++- ...Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers.md | 9 ++++++++- .../ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md | 9 ++++++++- .../1385.Find-the-Distance-Value-Between-Two-Arrays.md | 9 ++++++++- .../1389.Create-Target-Array-in-the-Given-Order.md | 9 ++++++++- ...-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence.md | 9 ++++++++- .../1464.Maximum-Product-of-Two-Elements-in-an-Array.md | 9 ++++++++- website/content/ChapterFour/1470.Shuffle-the-Array.md | 9 ++++++++- .../content/ChapterFour/1480.Running-Sum-of-1d-Array.md | 9 ++++++++- website/content/ChapterFour/1512.Number-of-Good-Pairs.md | 9 ++++++++- .../ChapterFour/1539.Kth-Missing-Positive-Number.md | 9 ++++++++- .../ChapterFour/1573.Number-of-Ways-to-Split-a-String.md | 9 ++++++++- .../1640.Check-Array-Formation-Through-Concatenation.md | 9 ++++++++- .../ChapterFour/1646.Get-Maximum-in-Generated-Array.md | 9 ++++++++- ...mum-Deletions-to-Make-Character-Frequencies-Unique.md | 9 ++++++++- .../1648.Sell-Diminishing-Valued-Colored-Balls.md | 9 ++++++++- .../1649.Create-Sorted-Array-through-Instructions.md | 9 ++++++++- website/content/ChapterFour/1652.Defuse-the-Bomb.md | 9 ++++++++- .../1653.Minimum-Deletions-to-Make-String-Balanced.md | 9 ++++++++- .../ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md | 9 ++++++++- .../ChapterFour/1655.Distribute-Repeating-Integers.md | 9 ++++++++- .../content/ChapterFour/1656.Design-an-Ordered-Stream.md | 9 ++++++++- .../1657.Determine-if-Two-Strings-Are-Close.md | 9 ++++++++- .../1658.Minimum-Operations-to-Reduce-X-to-Zero.md | 9 ++++++++- .../content/ChapterFour/1659.Maximize-Grid-Happiness.md | 9 ++++++++- .../1662.Check-If-Two-String-Arrays-are-Equivalent.md | 9 ++++++++- .../1663.Smallest-String-With-A-Given-Numeric-Value.md | 9 ++++++++- .../ChapterFour/1664.Ways-to-Make-a-Fair-Array.md | 9 ++++++++- .../1665.Minimum-Initial-Energy-to-Finish-Tasks.md | 9 ++++++++- .../ChapterFour/1668.Maximum-Repeating-Substring.md | 9 ++++++++- .../ChapterFour/1669.Merge-In-Between-Linked-Lists.md | 9 ++++++++- .../ChapterFour/1670.Design-Front-Middle-Back-Queue.md | 9 ++++++++- .../content/ChapterFour/1672.Richest-Customer-Wealth.md | 9 ++++++++- .../1673.Find-the-Most-Competitive-Subsequence.md | 9 ++++++++- .../1674.Minimum-Moves-to-Make-Array-Complementary.md | 9 ++++++++- .../ChapterFour/1678.Goal-Parser-Interpretation.md | 9 ++++++++- .../ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md | 9 ++++++++- .../1680.Concatenation-of-Consecutive-Binary-Numbers.md | 9 ++++++++- .../content/ChapterFour/1681.Minimum-Incompatibility.md | 9 ++++++++- .../1684.Count-the-Number-of-Consistent-Strings.md | 9 ++++++++- ...1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md | 9 ++++++++- .../ChapterFour/1688.Count-of-Matches-in-Tournament.md | 9 ++++++++- ...tioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md | 9 ++++++++- website/content/ChapterFour/1690.Stone-Game-VII.md | 9 ++++++++- .../content/ChapterFour/1694.Reformat-Phone-Number.md | 9 ++++++++- .../content/ChapterFour/1695.Maximum-Erasure-Value.md | 7 ++++++- website/content/ChapterFour/_index.md | 9 ++++++++- 562 files changed, 4450 insertions(+), 525 deletions(-) diff --git a/ctl/render.go b/ctl/render.go index 879b31cb..f2984821 100644 --- a/ctl/render.go +++ b/ctl/render.go @@ -180,7 +180,7 @@ func buildChapterTwo() { util.WriteFile(fmt.Sprintf("../website/content/ChapterTwo/%v.md", chapterTwoFileName[index]), res) count++ } - fmt.Println("write %v files successful", count) + fmt.Printf("write %v files successful", count) } func loadMetaData(filePath string) (map[int]m.TagList, error) { diff --git a/website/content/ChapterFour/0001.Two-Sum.md b/website/content/ChapterFour/0001.Two-Sum.md index 469d1d19..a45c6f51 100644 --- a/website/content/ChapterFour/0001.Two-Sum.md +++ b/website/content/ChapterFour/0001.Two-Sum.md @@ -47,4 +47,11 @@ func twoSum(nums []int, target int) []int { return nil } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0002.Add-Two-Numbers.md b/website/content/ChapterFour/0002.Add-Two-Numbers.md index c30fb0ef..090c9379 100644 --- a/website/content/ChapterFour/0002.Add-Two-Numbers.md +++ b/website/content/ChapterFour/0002.Add-Two-Numbers.md @@ -75,4 +75,11 @@ func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode { return head.Next } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md b/website/content/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md index 36e027da..19d3329b 100644 --- a/website/content/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md +++ b/website/content/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md @@ -122,3 +122,10 @@ func max(a int, b int) int { + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0004.Median-of-Two-Sorted-Arrays.md b/website/content/ChapterFour/0004.Median-of-Two-Sorted-Arrays.md index 9ad0c55b..e8821397 100755 --- a/website/content/ChapterFour/0004.Median-of-Two-Sorted-Arrays.md +++ b/website/content/ChapterFour/0004.Median-of-Two-Sorted-Arrays.md @@ -96,3 +96,10 @@ func findMedianSortedArrays(nums1 []int, nums2 []int) float64 { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0007.Reverse-Integer.md b/website/content/ChapterFour/0007.Reverse-Integer.md index 801d5088..6f8273ec 100755 --- a/website/content/ChapterFour/0007.Reverse-Integer.md +++ b/website/content/ChapterFour/0007.Reverse-Integer.md @@ -53,3 +53,10 @@ func reverse7(x int) int { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0009.Palindrome-Number.md b/website/content/ChapterFour/0009.Palindrome-Number.md index d01fc716..b74c69ef 100644 --- a/website/content/ChapterFour/0009.Palindrome-Number.md +++ b/website/content/ChapterFour/0009.Palindrome-Number.md @@ -66,4 +66,11 @@ func isPalindrome(x int) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0011.Container-With-Most-Water.md b/website/content/ChapterFour/0011.Container-With-Most-Water.md index c8d25a2e..9591c9ef 100644 --- a/website/content/ChapterFour/0011.Container-With-Most-Water.md +++ b/website/content/ChapterFour/0011.Container-With-Most-Water.md @@ -57,3 +57,10 @@ func maxArea(height []int) int { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0013.Roman-to-Integer.md b/website/content/ChapterFour/0013.Roman-to-Integer.md index 44d758eb..5e5ece59 100644 --- a/website/content/ChapterFour/0013.Roman-to-Integer.md +++ b/website/content/ChapterFour/0013.Roman-to-Integer.md @@ -129,4 +129,11 @@ func romanToInt(s string) int { return total } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0015.3Sum.md b/website/content/ChapterFour/0015.3Sum.md index e2d9af95..ec6ca213 100644 --- a/website/content/ChapterFour/0015.3Sum.md +++ b/website/content/ChapterFour/0015.3Sum.md @@ -119,3 +119,10 @@ func threeSum1(nums []int) [][]int { + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0016.3Sum-Closest.md b/website/content/ChapterFour/0016.3Sum-Closest.md index 19d44e56..117a1935 100644 --- a/website/content/ChapterFour/0016.3Sum-Closest.md +++ b/website/content/ChapterFour/0016.3Sum-Closest.md @@ -87,3 +87,10 @@ func abs(a int) int { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md b/website/content/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md index 8de0f911..e6cc6cf4 100755 --- a/website/content/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md +++ b/website/content/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md @@ -142,3 +142,10 @@ func letterFunc(res string, digits string) { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0018.4Sum.md b/website/content/ChapterFour/0018.4Sum.md index e0f70941..59682039 100644 --- a/website/content/ChapterFour/0018.4Sum.md +++ b/website/content/ChapterFour/0018.4Sum.md @@ -95,3 +95,10 @@ func fourSum(nums []int, target int) [][]int { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md b/website/content/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md index 0cb4c9d0..28fe564c 100644 --- a/website/content/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md +++ b/website/content/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md @@ -98,3 +98,10 @@ func removeNthFromEnd1(head *ListNode, n int) *ListNode { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0020.Valid-Parentheses.md b/website/content/ChapterFour/0020.Valid-Parentheses.md index 1df3ba11..77b1b83b 100644 --- a/website/content/ChapterFour/0020.Valid-Parentheses.md +++ b/website/content/ChapterFour/0020.Valid-Parentheses.md @@ -94,3 +94,10 @@ func isValid(s string) bool { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0021.Merge-Two-Sorted-Lists.md b/website/content/ChapterFour/0021.Merge-Two-Sorted-Lists.md index cc559bc3..dd007fe2 100644 --- a/website/content/ChapterFour/0021.Merge-Two-Sorted-Lists.md +++ b/website/content/ChapterFour/0021.Merge-Two-Sorted-Lists.md @@ -51,3 +51,10 @@ func mergeTwoLists(l1 *ListNode, l2 *ListNode) *ListNode { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0022.Generate-Parentheses.md b/website/content/ChapterFour/0022.Generate-Parentheses.md index 0e340b39..2188ce03 100755 --- a/website/content/ChapterFour/0022.Generate-Parentheses.md +++ b/website/content/ChapterFour/0022.Generate-Parentheses.md @@ -58,3 +58,10 @@ func findGenerateParenthesis(lindex, rindex int, str string, res *[]string) { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0023.Merge-k-Sorted-Lists.md b/website/content/ChapterFour/0023.Merge-k-Sorted-Lists.md index 3166c480..78a8c5e9 100644 --- a/website/content/ChapterFour/0023.Merge-k-Sorted-Lists.md +++ b/website/content/ChapterFour/0023.Merge-k-Sorted-Lists.md @@ -72,3 +72,10 @@ func mergeTwoLists1(l1 *ListNode, l2 *ListNode) *ListNode { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0024.Swap-Nodes-in-Pairs.md b/website/content/ChapterFour/0024.Swap-Nodes-in-Pairs.md index 017a0eb4..7df959d3 100644 --- a/website/content/ChapterFour/0024.Swap-Nodes-in-Pairs.md +++ b/website/content/ChapterFour/0024.Swap-Nodes-in-Pairs.md @@ -69,3 +69,10 @@ func swapPairs(head *ListNode) *ListNode { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0025.Reverse-Nodes-in-k-Group.md b/website/content/ChapterFour/0025.Reverse-Nodes-in-k-Group.md index 8d6ba27a..cca95bdf 100644 --- a/website/content/ChapterFour/0025.Reverse-Nodes-in-k-Group.md +++ b/website/content/ChapterFour/0025.Reverse-Nodes-in-k-Group.md @@ -72,3 +72,10 @@ func reverse(first *ListNode, last *ListNode) *ListNode { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md b/website/content/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md index b7f1b479..0b32f0ad 100644 --- a/website/content/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md +++ b/website/content/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md @@ -126,3 +126,10 @@ func removeElement1(nums []int, start, val int) int { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0027.Remove-Element.md b/website/content/ChapterFour/0027.Remove-Element.md index 214d6ff4..0dc8bb08 100644 --- a/website/content/ChapterFour/0027.Remove-Element.md +++ b/website/content/ChapterFour/0027.Remove-Element.md @@ -89,3 +89,10 @@ func removeElement(nums []int, val int) int { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0028.Implement-strStr.md b/website/content/ChapterFour/0028.Implement-strStr.md index 4bcbaebb..9ab526ff 100644 --- a/website/content/ChapterFour/0028.Implement-strStr.md +++ b/website/content/ChapterFour/0028.Implement-strStr.md @@ -84,3 +84,10 @@ func strStr1(haystack string, needle string) int { + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0029.Divide-Two-Integers.md b/website/content/ChapterFour/0029.Divide-Two-Integers.md index c3f4a834..5ca4689f 100755 --- a/website/content/ChapterFour/0029.Divide-Two-Integers.md +++ b/website/content/ChapterFour/0029.Divide-Two-Integers.md @@ -146,3 +146,10 @@ func divide1(divided int, divisor int) int { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md b/website/content/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md index d4eb4ef0..6f6e762b 100644 --- a/website/content/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md +++ b/website/content/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md @@ -96,3 +96,10 @@ func copyMap(s map[string]int) map[string]int { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md b/website/content/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md index ac935c4d..c31b5ed5 100755 --- a/website/content/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md +++ b/website/content/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md @@ -76,3 +76,10 @@ func search33(nums []int, target int) int { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array.md b/website/content/ChapterFour/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array.md index 6d991286..5e5f850c 100755 --- a/website/content/ChapterFour/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array.md +++ b/website/content/ChapterFour/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array.md @@ -119,3 +119,10 @@ func searchLastLessElement(nums []int, target int) int { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0035.Search-Insert-Position.md b/website/content/ChapterFour/0035.Search-Insert-Position.md index 18339f1e..554f7c5f 100755 --- a/website/content/ChapterFour/0035.Search-Insert-Position.md +++ b/website/content/ChapterFour/0035.Search-Insert-Position.md @@ -63,3 +63,10 @@ func searchInsert(nums []int, target int) int { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0036.Valid-Sudoku.md b/website/content/ChapterFour/0036.Valid-Sudoku.md index 72e8ba47..b180ee60 100755 --- a/website/content/ChapterFour/0036.Valid-Sudoku.md +++ b/website/content/ChapterFour/0036.Valid-Sudoku.md @@ -166,3 +166,10 @@ func isValidSudoku1(board [][]byte) bool { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0037.Sudoku-Solver.md b/website/content/ChapterFour/0037.Sudoku-Solver.md index 724076d3..da7a7c32 100755 --- a/website/content/ChapterFour/0037.Sudoku-Solver.md +++ b/website/content/ChapterFour/0037.Sudoku-Solver.md @@ -116,3 +116,10 @@ func checkSudoku(board *[][]byte, pos position, val int) bool { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0039.Combination-Sum.md b/website/content/ChapterFour/0039.Combination-Sum.md index 6167df45..4f5be48c 100755 --- a/website/content/ChapterFour/0039.Combination-Sum.md +++ b/website/content/ChapterFour/0039.Combination-Sum.md @@ -85,3 +85,10 @@ func findcombinationSum(nums []int, target, index int, c []int, res *[][]int) { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0040.Combination-Sum-II.md b/website/content/ChapterFour/0040.Combination-Sum-II.md index 9d0188a3..36ecc38a 100755 --- a/website/content/ChapterFour/0040.Combination-Sum-II.md +++ b/website/content/ChapterFour/0040.Combination-Sum-II.md @@ -87,3 +87,10 @@ func findcombinationSum2(nums []int, target, index int, c []int, res *[][]int) { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0041.First-Missing-Positive.md b/website/content/ChapterFour/0041.First-Missing-Positive.md index 88564723..6e3915d0 100644 --- a/website/content/ChapterFour/0041.First-Missing-Positive.md +++ b/website/content/ChapterFour/0041.First-Missing-Positive.md @@ -64,3 +64,10 @@ func firstMissingPositive(nums []int) int { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0042.Trapping-Rain-Water.md b/website/content/ChapterFour/0042.Trapping-Rain-Water.md index 1b0dd4b7..9af370ab 100644 --- a/website/content/ChapterFour/0042.Trapping-Rain-Water.md +++ b/website/content/ChapterFour/0042.Trapping-Rain-Water.md @@ -59,3 +59,10 @@ func trap(height []int) int { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0046.Permutations.md b/website/content/ChapterFour/0046.Permutations.md index 6ddd55f4..1be0d0d2 100755 --- a/website/content/ChapterFour/0046.Permutations.md +++ b/website/content/ChapterFour/0046.Permutations.md @@ -64,3 +64,10 @@ func generatePermutation(nums []int, index int, p []int, res *[][]int, used *[]b } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0047.Permutations-II.md b/website/content/ChapterFour/0047.Permutations-II.md index ff63b687..cd0a38d8 100755 --- a/website/content/ChapterFour/0047.Permutations-II.md +++ b/website/content/ChapterFour/0047.Permutations-II.md @@ -68,3 +68,10 @@ func generatePermutation47(nums []int, index int, p []int, res *[][]int, used *[ } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0048.Rotate-Image.md b/website/content/ChapterFour/0048.Rotate-Image.md index 48d11b65..2913142a 100755 --- a/website/content/ChapterFour/0048.Rotate-Image.md +++ b/website/content/ChapterFour/0048.Rotate-Image.md @@ -125,3 +125,10 @@ func rotate(matrix [][]int) { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0049.Group-Anagrams.md b/website/content/ChapterFour/0049.Group-Anagrams.md index 8eca6bea..0fe588da 100644 --- a/website/content/ChapterFour/0049.Group-Anagrams.md +++ b/website/content/ChapterFour/0049.Group-Anagrams.md @@ -70,3 +70,10 @@ func groupAnagrams(strs []string) [][]string { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0050.Powx-n.md b/website/content/ChapterFour/0050.Powx-n.md index 86ec7451..c4a4cc04 100755 --- a/website/content/ChapterFour/0050.Powx-n.md +++ b/website/content/ChapterFour/0050.Powx-n.md @@ -67,3 +67,10 @@ func myPow(x float64, n int) float64 { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0051.N-Queens.md b/website/content/ChapterFour/0051.N-Queens.md index 9c9b2eba..a139bf0b 100755 --- a/website/content/ChapterFour/0051.N-Queens.md +++ b/website/content/ChapterFour/0051.N-Queens.md @@ -131,4 +131,11 @@ func generateBoard(n int, row *[]int) []string { // } // }; -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0052.N-Queens-II.md b/website/content/ChapterFour/0052.N-Queens-II.md index 36b5911b..16aa957d 100755 --- a/website/content/ChapterFour/0052.N-Queens-II.md +++ b/website/content/ChapterFour/0052.N-Queens-II.md @@ -104,4 +104,11 @@ func putQueen52(n, index int, col, dia1, dia2 *[]bool, row *[]int, res *int) { // } // }; -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0053.Maximum-Subarray.md b/website/content/ChapterFour/0053.Maximum-Subarray.md index a5c3a0a5..ada3aaa0 100755 --- a/website/content/ChapterFour/0053.Maximum-Subarray.md +++ b/website/content/ChapterFour/0053.Maximum-Subarray.md @@ -72,4 +72,11 @@ func maxSubArray1(nums []int) int { return maxSum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0054.Spiral-Matrix.md b/website/content/ChapterFour/0054.Spiral-Matrix.md index 4fd81dc5..f4207db7 100755 --- a/website/content/ChapterFour/0054.Spiral-Matrix.md +++ b/website/content/ChapterFour/0054.Spiral-Matrix.md @@ -162,4 +162,11 @@ func spiralOrder2(matrix [][]int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0055.Jump-Game.md b/website/content/ChapterFour/0055.Jump-Game.md index 84b7ddaf..f7728173 100644 --- a/website/content/ChapterFour/0055.Jump-Game.md +++ b/website/content/ChapterFour/0055.Jump-Game.md @@ -55,4 +55,11 @@ func canJump(nums []int) bool { } return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0056.Merge-Intervals.md b/website/content/ChapterFour/0056.Merge-Intervals.md index cfe7aecd..bf424015 100644 --- a/website/content/ChapterFour/0056.Merge-Intervals.md +++ b/website/content/ChapterFour/0056.Merge-Intervals.md @@ -106,4 +106,11 @@ func quickSort(a []Interval, lo, hi int) { quickSort(a, p+1, hi) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0057.Insert-Interval.md b/website/content/ChapterFour/0057.Insert-Interval.md index 63b6df7c..77957dd9 100644 --- a/website/content/ChapterFour/0057.Insert-Interval.md +++ b/website/content/ChapterFour/0057.Insert-Interval.md @@ -72,4 +72,11 @@ func insert(intervals []Interval, newInterval Interval) []Interval { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0059.Spiral-Matrix-II.md b/website/content/ChapterFour/0059.Spiral-Matrix-II.md index 201b80f3..763affe6 100755 --- a/website/content/ChapterFour/0059.Spiral-Matrix-II.md +++ b/website/content/ChapterFour/0059.Spiral-Matrix-II.md @@ -91,4 +91,11 @@ func generateMatrix(n int) [][]int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0060.Permutation-Sequence.md b/website/content/ChapterFour/0060.Permutation-Sequence.md index e762d748..67889293 100755 --- a/website/content/ChapterFour/0060.Permutation-Sequence.md +++ b/website/content/ChapterFour/0060.Permutation-Sequence.md @@ -93,4 +93,11 @@ func findPermutation(n, index int, k *int, p []int, res *string, used *[]bool) { return } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0061.Rotate-List.md b/website/content/ChapterFour/0061.Rotate-List.md index 6bef2616..f4adedb5 100644 --- a/website/content/ChapterFour/0061.Rotate-List.md +++ b/website/content/ChapterFour/0061.Rotate-List.md @@ -78,4 +78,11 @@ func rotateRight(head *ListNode, k int) *ListNode { return res.Next } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0062.Unique-Paths.md b/website/content/ChapterFour/0062.Unique-Paths.md index 9a67bbb9..a0dce700 100755 --- a/website/content/ChapterFour/0062.Unique-Paths.md +++ b/website/content/ChapterFour/0062.Unique-Paths.md @@ -66,4 +66,11 @@ func uniquePaths(m int, n int) int { return dp[n-1][m-1] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0063.Unique-Paths-II.md b/website/content/ChapterFour/0063.Unique-Paths-II.md index 7ab37659..6038f50c 100755 --- a/website/content/ChapterFour/0063.Unique-Paths-II.md +++ b/website/content/ChapterFour/0063.Unique-Paths-II.md @@ -77,4 +77,11 @@ func uniquePathsWithObstacles(obstacleGrid [][]int) int { return dp[m-1][n-1] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0064.Minimum-Path-Sum.md b/website/content/ChapterFour/0064.Minimum-Path-Sum.md index 8ae24ab1..c39e60cf 100755 --- a/website/content/ChapterFour/0064.Minimum-Path-Sum.md +++ b/website/content/ChapterFour/0064.Minimum-Path-Sum.md @@ -90,4 +90,11 @@ func minPathSum1(grid [][]int) int { return dp[m-1][n-1] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0066.Plus-One.md b/website/content/ChapterFour/0066.Plus-One.md index 441789f9..6cc9b1e3 100755 --- a/website/content/ChapterFour/0066.Plus-One.md +++ b/website/content/ChapterFour/0066.Plus-One.md @@ -60,4 +60,11 @@ func plusOne(digits []int) []int { return digits } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0067.Add-Binary.md b/website/content/ChapterFour/0067.Add-Binary.md index 91d977e5..74af33b2 100644 --- a/website/content/ChapterFour/0067.Add-Binary.md +++ b/website/content/ChapterFour/0067.Add-Binary.md @@ -73,4 +73,11 @@ func addBinary(a string, b string) string { return strings.Join(res, "") } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0069.Sqrtx.md b/website/content/ChapterFour/0069.Sqrtx.md index 3b4397de..ff8d8742 100755 --- a/website/content/ChapterFour/0069.Sqrtx.md +++ b/website/content/ChapterFour/0069.Sqrtx.md @@ -88,4 +88,11 @@ func mySqrt1(x int) int { // return y; // } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0070.Climbing-Stairs.md b/website/content/ChapterFour/0070.Climbing-Stairs.md index 5eda8e5c..8f8ed262 100755 --- a/website/content/ChapterFour/0070.Climbing-Stairs.md +++ b/website/content/ChapterFour/0070.Climbing-Stairs.md @@ -52,4 +52,11 @@ func climbStairs(n int) int { return dp[n] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0071.Simplify-Path.md b/website/content/ChapterFour/0071.Simplify-Path.md index b4a7c4cf..e716cd11 100644 --- a/website/content/ChapterFour/0071.Simplify-Path.md +++ b/website/content/ChapterFour/0071.Simplify-Path.md @@ -114,4 +114,11 @@ func simplifyPath1(path string) string { return filepath.Clean(path) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0074.Search-a-2D-Matrix.md b/website/content/ChapterFour/0074.Search-a-2D-Matrix.md index 07290862..d84a1b1e 100755 --- a/website/content/ChapterFour/0074.Search-a-2D-Matrix.md +++ b/website/content/ChapterFour/0074.Search-a-2D-Matrix.md @@ -69,4 +69,11 @@ func searchMatrix(matrix [][]int, target int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0075.Sort-Colors.md b/website/content/ChapterFour/0075.Sort-Colors.md index 127d74c0..d9653fc9 100644 --- a/website/content/ChapterFour/0075.Sort-Colors.md +++ b/website/content/ChapterFour/0075.Sort-Colors.md @@ -69,4 +69,11 @@ func sortColors(nums []int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0076.Minimum-Window-Substring.md b/website/content/ChapterFour/0076.Minimum-Window-Substring.md index a13affa3..5ac08bf8 100644 --- a/website/content/ChapterFour/0076.Minimum-Window-Substring.md +++ b/website/content/ChapterFour/0076.Minimum-Window-Substring.md @@ -74,3 +74,10 @@ func minWindow(s string, t string) string { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0077.Combinations.md b/website/content/ChapterFour/0077.Combinations.md index be995c07..c9c88ed6 100755 --- a/website/content/ChapterFour/0077.Combinations.md +++ b/website/content/ChapterFour/0077.Combinations.md @@ -57,4 +57,11 @@ func generateCombinations(n, k, start int, c []int, res *[][]int) { return } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0078.Subsets.md b/website/content/ChapterFour/0078.Subsets.md index 3173014e..32aa9d48 100755 --- a/website/content/ChapterFour/0078.Subsets.md +++ b/website/content/ChapterFour/0078.Subsets.md @@ -102,4 +102,11 @@ func subsets2(nums []int) [][]int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0079.Word-Search.md b/website/content/ChapterFour/0079.Word-Search.md index b38e63ba..62c03768 100755 --- a/website/content/ChapterFour/0079.Word-Search.md +++ b/website/content/ChapterFour/0079.Word-Search.md @@ -80,4 +80,11 @@ func searchWord(board [][]byte, visited [][]bool, word string, index, x, y int) return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md b/website/content/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md index e0811e92..36438895 100644 --- a/website/content/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md +++ b/website/content/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md @@ -102,4 +102,11 @@ func removeDuplicates80(nums []int) int { } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0081.Search-in-Rotated-Sorted-Array-II.md b/website/content/ChapterFour/0081.Search-in-Rotated-Sorted-Array-II.md index e9b9a880..e7dad91f 100755 --- a/website/content/ChapterFour/0081.Search-in-Rotated-Sorted-Array-II.md +++ b/website/content/ChapterFour/0081.Search-in-Rotated-Sorted-Array-II.md @@ -82,4 +82,11 @@ func search(nums []int, target int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md b/website/content/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md index 1a4f119e..d0dc28f7 100644 --- a/website/content/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md +++ b/website/content/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md @@ -188,4 +188,11 @@ func deleteDuplicates4(head *ListNode) *ListNode { } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0083.Remove-Duplicates-from-Sorted-List.md b/website/content/ChapterFour/0083.Remove-Duplicates-from-Sorted-List.md index 07d1654e..fd662034 100644 --- a/website/content/ChapterFour/0083.Remove-Duplicates-from-Sorted-List.md +++ b/website/content/ChapterFour/0083.Remove-Duplicates-from-Sorted-List.md @@ -63,4 +63,11 @@ func deleteDuplicates(head *ListNode) *ListNode { return head } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0084.Largest-Rectangle-in-Histogram.md b/website/content/ChapterFour/0084.Largest-Rectangle-in-Histogram.md index 7b22b220..f50d91ad 100644 --- a/website/content/ChapterFour/0084.Largest-Rectangle-in-Histogram.md +++ b/website/content/ChapterFour/0084.Largest-Rectangle-in-Histogram.md @@ -72,4 +72,11 @@ func largestRectangleArea(heights []int) int { return maxArea } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0086.Partition-List.md b/website/content/ChapterFour/0086.Partition-List.md index d261700d..540430a3 100644 --- a/website/content/ChapterFour/0086.Partition-List.md +++ b/website/content/ChapterFour/0086.Partition-List.md @@ -145,4 +145,11 @@ func genListNode(head *DoublyListNode) *ListNode { return LNHead } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0088.Merge-Sorted-Array.md b/website/content/ChapterFour/0088.Merge-Sorted-Array.md index 42d50a53..500295f6 100644 --- a/website/content/ChapterFour/0088.Merge-Sorted-Array.md +++ b/website/content/ChapterFour/0088.Merge-Sorted-Array.md @@ -66,4 +66,11 @@ func merge(nums1 []int, m int, nums2 []int, n int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0089.Gray-Code.md b/website/content/ChapterFour/0089.Gray-Code.md index cb3d5df9..df616ebc 100755 --- a/website/content/ChapterFour/0089.Gray-Code.md +++ b/website/content/ChapterFour/0089.Gray-Code.md @@ -114,4 +114,11 @@ func grayCode1(n int) []int { return out } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0090.Subsets-II.md b/website/content/ChapterFour/0090.Subsets-II.md index 53e15611..77b974db 100755 --- a/website/content/ChapterFour/0090.Subsets-II.md +++ b/website/content/ChapterFour/0090.Subsets-II.md @@ -73,4 +73,11 @@ func generateSubsetsWithDup(nums []int, k, start int, c []int, res *[][]int) { return } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0091.Decode-Ways.md b/website/content/ChapterFour/0091.Decode-Ways.md index 11dc5416..ccf85684 100755 --- a/website/content/ChapterFour/0091.Decode-Ways.md +++ b/website/content/ChapterFour/0091.Decode-Ways.md @@ -79,4 +79,11 @@ func numDecodings(s string) int { return dp[len(s)] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0092.Reverse-Linked-List-II.md b/website/content/ChapterFour/0092.Reverse-Linked-List-II.md index 59cd5d57..ea62d1f1 100644 --- a/website/content/ChapterFour/0092.Reverse-Linked-List-II.md +++ b/website/content/ChapterFour/0092.Reverse-Linked-List-II.md @@ -62,4 +62,11 @@ func reverseBetween(head *ListNode, m int, n int) *ListNode { return newHead.Next } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0093.Restore-IP-Addresses.md b/website/content/ChapterFour/0093.Restore-IP-Addresses.md index 1ef2120d..f4c862d9 100755 --- a/website/content/ChapterFour/0093.Restore-IP-Addresses.md +++ b/website/content/ChapterFour/0093.Restore-IP-Addresses.md @@ -75,4 +75,11 @@ func getString(ip []int) string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md b/website/content/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md index 1161f158..68f2997d 100644 --- a/website/content/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md +++ b/website/content/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md @@ -70,4 +70,11 @@ func inorder(root *TreeNode, output *[]int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0095.Unique-Binary-Search-Trees-II.md b/website/content/ChapterFour/0095.Unique-Binary-Search-Trees-II.md index 790470c1..8bb74436 100755 --- a/website/content/ChapterFour/0095.Unique-Binary-Search-Trees-II.md +++ b/website/content/ChapterFour/0095.Unique-Binary-Search-Trees-II.md @@ -75,4 +75,11 @@ func generateBSTree(start, end int) []*TreeNode { return tree } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0096.Unique-Binary-Search-Trees.md b/website/content/ChapterFour/0096.Unique-Binary-Search-Trees.md index a3fca5ef..216f7084 100755 --- a/website/content/ChapterFour/0096.Unique-Binary-Search-Trees.md +++ b/website/content/ChapterFour/0096.Unique-Binary-Search-Trees.md @@ -50,4 +50,11 @@ func numTrees(n int) int { return dp[n] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0098.Validate-Binary-Search-Tree.md b/website/content/ChapterFour/0098.Validate-Binary-Search-Tree.md index 0787fd0d..d95b7e82 100755 --- a/website/content/ChapterFour/0098.Validate-Binary-Search-Tree.md +++ b/website/content/ChapterFour/0098.Validate-Binary-Search-Tree.md @@ -96,4 +96,11 @@ func inOrder(root *TreeNode, arr *[]int) { inOrder(root.Right, arr) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0099.Recover-Binary-Search-Tree.md b/website/content/ChapterFour/0099.Recover-Binary-Search-Tree.md index 0a0e86e9..4ec788c7 100755 --- a/website/content/ChapterFour/0099.Recover-Binary-Search-Tree.md +++ b/website/content/ChapterFour/0099.Recover-Binary-Search-Tree.md @@ -98,4 +98,11 @@ func inOrderTraverse(root, prev, target1, target2 *TreeNode) (*TreeNode, *TreeNo return prev, target1, target2 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0100.Same-Tree.md b/website/content/ChapterFour/0100.Same-Tree.md index 6c12131b..e714cda2 100644 --- a/website/content/ChapterFour/0100.Same-Tree.md +++ b/website/content/ChapterFour/0100.Same-Tree.md @@ -89,4 +89,11 @@ func isSameTree(p *TreeNode, q *TreeNode) bool { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0101.Symmetric-Tree.md b/website/content/ChapterFour/0101.Symmetric-Tree.md index b3f2ea18..21b4dc1a 100644 --- a/website/content/ChapterFour/0101.Symmetric-Tree.md +++ b/website/content/ChapterFour/0101.Symmetric-Tree.md @@ -68,4 +68,11 @@ func isSymmetric(root *TreeNode) bool { return isSameTree(invertTree(root.Left), root.Right) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md b/website/content/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md index 6848f2ca..e00a4646 100644 --- a/website/content/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md +++ b/website/content/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md @@ -112,4 +112,11 @@ func dfsLevel(node *TreeNode, level int, res *[][]int) { dfsLevel(node.Right, currLevel, res) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md b/website/content/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md index 1f2db14f..110306c8 100644 --- a/website/content/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md +++ b/website/content/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md @@ -123,4 +123,11 @@ func search(root *TreeNode, depth int, res *[][]int) { search(root.Right, depth+1, res) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md b/website/content/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md index 3502cb85..8529be03 100644 --- a/website/content/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md +++ b/website/content/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md @@ -57,4 +57,11 @@ func maxDepth(root *TreeNode) int { return max(maxDepth(root.Left), maxDepth(root.Right)) + 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md b/website/content/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md index 0d6259c0..4a77e74b 100755 --- a/website/content/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md +++ b/website/content/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md @@ -70,4 +70,11 @@ func buildPreIn2TreeDFS(pre []int, preStart int, preEnd int, inStart int, inPos return root } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md b/website/content/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md index 62ea1c8a..fefec6b0 100755 --- a/website/content/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md +++ b/website/content/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md @@ -68,4 +68,11 @@ func buildInPos2TreeDFS(post []int, postStart int, postEnd int, inStart int, inP return root } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md b/website/content/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md index 5054e26f..1003bee3 100644 --- a/website/content/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md +++ b/website/content/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md @@ -67,4 +67,11 @@ func levelOrderBottom(root *TreeNode) [][]int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md b/website/content/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md index b888c624..6b440de7 100755 --- a/website/content/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md +++ b/website/content/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md @@ -49,4 +49,11 @@ func sortedArrayToBST(nums []int) *TreeNode { return &TreeNode{Val: nums[len(nums)/2], Left: sortedArrayToBST(nums[:len(nums)/2]), Right: sortedArrayToBST(nums[len(nums)/2+1:])} } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md b/website/content/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md index 5ddfce29..9ae35afd 100644 --- a/website/content/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md +++ b/website/content/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md @@ -94,4 +94,11 @@ func middleNodeAndPreNode(head *ListNode) (middle *ListNode, pre *ListNode) { return p1, pre } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0110.Balanced-Binary-Tree.md b/website/content/ChapterFour/0110.Balanced-Binary-Tree.md index 9417fd71..779fae8f 100644 --- a/website/content/ChapterFour/0110.Balanced-Binary-Tree.md +++ b/website/content/ChapterFour/0110.Balanced-Binary-Tree.md @@ -87,4 +87,11 @@ func depth(root *TreeNode) int { return max(depth(root.Left), depth(root.Right)) + 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md b/website/content/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md index 12019aed..d3bd4f1b 100755 --- a/website/content/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md +++ b/website/content/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md @@ -59,4 +59,11 @@ func minDepth(root *TreeNode) int { return min(minDepth(root.Left), minDepth(root.Right)) + 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0112.Path-Sum.md b/website/content/ChapterFour/0112.Path-Sum.md index 19a22631..f3fcce0f 100755 --- a/website/content/ChapterFour/0112.Path-Sum.md +++ b/website/content/ChapterFour/0112.Path-Sum.md @@ -56,4 +56,11 @@ func hasPathSum(root *TreeNode, sum int) bool { return hasPathSum(root.Left, sum-root.Val) || hasPathSum(root.Right, sum-root.Val) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0113.Path-Sum-II.md b/website/content/ChapterFour/0113.Path-Sum-II.md index ac592ca8..e975e8a1 100755 --- a/website/content/ChapterFour/0113.Path-Sum-II.md +++ b/website/content/ChapterFour/0113.Path-Sum-II.md @@ -105,4 +105,11 @@ func pathSum1(root *TreeNode, sum int) [][]int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md b/website/content/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md index 4cfc5452..e80d351b 100755 --- a/website/content/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md +++ b/website/content/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md @@ -188,4 +188,11 @@ func flatten2(root *TreeNode) { root.Left = nil } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0118.Pascals-Triangle.md b/website/content/ChapterFour/0118.Pascals-Triangle.md index b74f58fa..36a16f50 100644 --- a/website/content/ChapterFour/0118.Pascals-Triangle.md +++ b/website/content/ChapterFour/0118.Pascals-Triangle.md @@ -58,3 +58,10 @@ func generate(numRows int) [][]int { ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0120.Triangle.md b/website/content/ChapterFour/0120.Triangle.md index d3ec1112..473cfa62 100755 --- a/website/content/ChapterFour/0120.Triangle.md +++ b/website/content/ChapterFour/0120.Triangle.md @@ -86,4 +86,11 @@ func minimumTotal1(triangle [][]int) int { return minNum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md b/website/content/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md index 5a39f8cc..0ec5db6b 100755 --- a/website/content/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md +++ b/website/content/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md @@ -79,4 +79,11 @@ func maxProfit1(prices []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0122.Best-Time-to-Buy-and-Sell-Stock-II.md b/website/content/ChapterFour/0122.Best-Time-to-Buy-and-Sell-Stock-II.md index 5029cbf8..241e31bc 100755 --- a/website/content/ChapterFour/0122.Best-Time-to-Buy-and-Sell-Stock-II.md +++ b/website/content/ChapterFour/0122.Best-Time-to-Buy-and-Sell-Stock-II.md @@ -57,4 +57,11 @@ func maxProfit122(prices []int) int { return profit } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md b/website/content/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md index b8fdab71..665d167c 100755 --- a/website/content/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md +++ b/website/content/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md @@ -77,4 +77,11 @@ func getPathSum(root *TreeNode, maxSum *int) int { return currMax } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0125.Valid-Palindrome.md b/website/content/ChapterFour/0125.Valid-Palindrome.md index 552c02c9..ec7f4908 100644 --- a/website/content/ChapterFour/0125.Valid-Palindrome.md +++ b/website/content/ChapterFour/0125.Valid-Palindrome.md @@ -67,4 +67,11 @@ func isChar(c byte) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0126.Word-Ladder-II.md b/website/content/ChapterFour/0126.Word-Ladder-II.md index 687124c7..a296cf23 100755 --- a/website/content/ChapterFour/0126.Word-Ladder-II.md +++ b/website/content/ChapterFour/0126.Word-Ladder-II.md @@ -127,4 +127,11 @@ func findLadders(beginWord string, endWord string, wordList []string) [][]string return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0127.Word-Ladder.md b/website/content/ChapterFour/0127.Word-Ladder.md index cf67f6d1..dbeebb29 100755 --- a/website/content/ChapterFour/0127.Word-Ladder.md +++ b/website/content/ChapterFour/0127.Word-Ladder.md @@ -118,4 +118,11 @@ func getCandidates(word string) []string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0128.Longest-Consecutive-Sequence.md b/website/content/ChapterFour/0128.Longest-Consecutive-Sequence.md index 80d7a5f4..e8d9307c 100755 --- a/website/content/ChapterFour/0128.Longest-Consecutive-Sequence.md +++ b/website/content/ChapterFour/0128.Longest-Consecutive-Sequence.md @@ -136,4 +136,11 @@ func longestConsecutive2(nums []int) int { return max(lcs, length) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md b/website/content/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md index 261b8ebd..2e52457e 100755 --- a/website/content/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md +++ b/website/content/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md @@ -94,4 +94,11 @@ func binaryTreeNums(root *TreeNode) []string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0130.Surrounded-Regions.md b/website/content/ChapterFour/0130.Surrounded-Regions.md index a5709860..228ce63e 100755 --- a/website/content/ChapterFour/0130.Surrounded-Regions.md +++ b/website/content/ChapterFour/0130.Surrounded-Regions.md @@ -123,4 +123,11 @@ func dfs130(i, j int, board [][]byte) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0131.Palindrome-Partitioning.md b/website/content/ChapterFour/0131.Palindrome-Partitioning.md index 29b17bff..41c4f013 100755 --- a/website/content/ChapterFour/0131.Palindrome-Partitioning.md +++ b/website/content/ChapterFour/0131.Palindrome-Partitioning.md @@ -118,4 +118,11 @@ func isPal(str string, s, e int) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0136.Single-Number.md b/website/content/ChapterFour/0136.Single-Number.md index e3d24d83..73561826 100755 --- a/website/content/ChapterFour/0136.Single-Number.md +++ b/website/content/ChapterFour/0136.Single-Number.md @@ -43,4 +43,11 @@ func singleNumber(nums []int) int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0137.Single-Number-II.md b/website/content/ChapterFour/0137.Single-Number-II.md index 5e82a6b7..44ac1c0a 100755 --- a/website/content/ChapterFour/0137.Single-Number-II.md +++ b/website/content/ChapterFour/0137.Single-Number-II.md @@ -106,4 +106,11 @@ func singleNumberIIIII1(nums []int) int { return ones } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0141.Linked-List-Cycle.md b/website/content/ChapterFour/0141.Linked-List-Cycle.md index ac0553c6..cdb276f6 100644 --- a/website/content/ChapterFour/0141.Linked-List-Cycle.md +++ b/website/content/ChapterFour/0141.Linked-List-Cycle.md @@ -45,4 +45,11 @@ func hasCycle(head *ListNode) bool { return false } -```w \ No newline at end of file +```w + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0142.Linked-List-Cycle-II.md b/website/content/ChapterFour/0142.Linked-List-Cycle-II.md index f598045a..07f10488 100644 --- a/website/content/ChapterFour/0142.Linked-List-Cycle-II.md +++ b/website/content/ChapterFour/0142.Linked-List-Cycle-II.md @@ -106,4 +106,11 @@ func hasCycle142(head *ListNode) (bool, *ListNode) { return false, nil } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0143.Reorder-List.md b/website/content/ChapterFour/0143.Reorder-List.md index 9383f56e..87060cc9 100644 --- a/website/content/ChapterFour/0143.Reorder-List.md +++ b/website/content/ChapterFour/0143.Reorder-List.md @@ -124,4 +124,11 @@ func listToArray(head *ListNode) []int { return array } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md b/website/content/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md index 408ccb75..d4b09831 100644 --- a/website/content/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md +++ b/website/content/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md @@ -109,4 +109,11 @@ func preorderTraversal2(root *TreeNode) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md b/website/content/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md index a78a7465..e73320d0 100644 --- a/website/content/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md +++ b/website/content/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md @@ -68,4 +68,11 @@ func postorder(root *TreeNode, output *[]int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0146.LRU-Cache.md b/website/content/ChapterFour/0146.LRU-Cache.md index 917b2684..abf03290 100644 --- a/website/content/ChapterFour/0146.LRU-Cache.md +++ b/website/content/ChapterFour/0146.LRU-Cache.md @@ -131,4 +131,11 @@ func (this *LRUCache) Remove(node *Node) { node.Prev.Next = node.Next node.Next.Prev = node.Prev } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0147.Insertion-Sort-List.md b/website/content/ChapterFour/0147.Insertion-Sort-List.md index 80bedc45..bbdca940 100644 --- a/website/content/ChapterFour/0147.Insertion-Sort-List.md +++ b/website/content/ChapterFour/0147.Insertion-Sort-List.md @@ -74,4 +74,11 @@ func insertionSortList(head *ListNode) *ListNode { return newHead.Next } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0148.Sort-List.md b/website/content/ChapterFour/0148.Sort-List.md index 1f429a8b..6d435555 100644 --- a/website/content/ChapterFour/0148.Sort-List.md +++ b/website/content/ChapterFour/0148.Sort-List.md @@ -93,4 +93,11 @@ func mergeTwoLists(l1 *ListNode, l2 *ListNode) *ListNode { } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0150.Evaluate-Reverse-Polish-Notation.md b/website/content/ChapterFour/0150.Evaluate-Reverse-Polish-Notation.md index 0cb6b472..b8cfa59b 100644 --- a/website/content/ChapterFour/0150.Evaluate-Reverse-Polish-Notation.md +++ b/website/content/ChapterFour/0150.Evaluate-Reverse-Polish-Notation.md @@ -112,4 +112,11 @@ func evalRPN(tokens []string) int { return stack[0] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0151.Reverse-Words-in-a-String.md b/website/content/ChapterFour/0151.Reverse-Words-in-a-String.md index e7d47d72..9d3a8fa4 100755 --- a/website/content/ChapterFour/0151.Reverse-Words-in-a-String.md +++ b/website/content/ChapterFour/0151.Reverse-Words-in-a-String.md @@ -79,4 +79,11 @@ func reverse151(m *[]string, i int, j int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0152.Maximum-Product-Subarray.md b/website/content/ChapterFour/0152.Maximum-Product-Subarray.md index a09a1296..937780c5 100755 --- a/website/content/ChapterFour/0152.Maximum-Product-Subarray.md +++ b/website/content/ChapterFour/0152.Maximum-Product-Subarray.md @@ -49,4 +49,11 @@ func maxProduct(nums []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0153.Find-Minimum-in-Rotated-Sorted-Array.md b/website/content/ChapterFour/0153.Find-Minimum-in-Rotated-Sorted-Array.md index b2a6d6e6..2462d5f4 100755 --- a/website/content/ChapterFour/0153.Find-Minimum-in-Rotated-Sorted-Array.md +++ b/website/content/ChapterFour/0153.Find-Minimum-in-Rotated-Sorted-Array.md @@ -105,4 +105,11 @@ func findMin2(nums []int) int { return min } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0154.Find-Minimum-in-Rotated-Sorted-Array-II.md b/website/content/ChapterFour/0154.Find-Minimum-in-Rotated-Sorted-Array-II.md index 4ddfaa71..ed0c89af 100755 --- a/website/content/ChapterFour/0154.Find-Minimum-in-Rotated-Sorted-Array-II.md +++ b/website/content/ChapterFour/0154.Find-Minimum-in-Rotated-Sorted-Array-II.md @@ -64,4 +64,11 @@ func findMin154(nums []int) int { return nums[low] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0155.Min-Stack.md b/website/content/ChapterFour/0155.Min-Stack.md index 5d811c4e..4259b85a 100644 --- a/website/content/ChapterFour/0155.Min-Stack.md +++ b/website/content/ChapterFour/0155.Min-Stack.md @@ -84,4 +84,11 @@ func (this *MinStack) GetMin() int { return this.min[this.l-1] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0160.Intersection-of-Two-Linked-Lists.md b/website/content/ChapterFour/0160.Intersection-of-Two-Linked-Lists.md index 6a450eba..0fe6c24d 100644 --- a/website/content/ChapterFour/0160.Intersection-of-Two-Linked-Lists.md +++ b/website/content/ChapterFour/0160.Intersection-of-Two-Linked-Lists.md @@ -113,4 +113,11 @@ func getIntersectionNode(headA, headB *ListNode) *ListNode { return a } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0162.Find-Peak-Element.md b/website/content/ChapterFour/0162.Find-Peak-Element.md index 2b69dbdb..74e7b14e 100755 --- a/website/content/ChapterFour/0162.Find-Peak-Element.md +++ b/website/content/ChapterFour/0162.Find-Peak-Element.md @@ -91,4 +91,11 @@ func findPeakElement1(nums []int) int { return low } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0164.Maximum-Gap.md b/website/content/ChapterFour/0164.Maximum-Gap.md index b830a74c..ea05421f 100644 --- a/website/content/ChapterFour/0164.Maximum-Gap.md +++ b/website/content/ChapterFour/0164.Maximum-Gap.md @@ -134,4 +134,11 @@ func max(a int, b int) int { } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md b/website/content/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md index b4a1dd22..1e55e786 100644 --- a/website/content/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md +++ b/website/content/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md @@ -65,4 +65,11 @@ func twoSum167_1(numbers []int, target int) []int { return nil } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0168.Excel-Sheet-Column-Title.md b/website/content/ChapterFour/0168.Excel-Sheet-Column-Title.md index c1ecdd58..3a78b80d 100644 --- a/website/content/ChapterFour/0168.Excel-Sheet-Column-Title.md +++ b/website/content/ChapterFour/0168.Excel-Sheet-Column-Title.md @@ -77,4 +77,11 @@ func convertToTitle(n int) string { return string(result) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0169.Majority-Element.md b/website/content/ChapterFour/0169.Majority-Element.md index 548fb3ed..f05a4392 100755 --- a/website/content/ChapterFour/0169.Majority-Element.md +++ b/website/content/ChapterFour/0169.Majority-Element.md @@ -63,4 +63,11 @@ func majorityElement1(nums []int) int { return 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0171.Excel-Sheet-Column-Number.md b/website/content/ChapterFour/0171.Excel-Sheet-Column-Number.md index 8c9f6651..6294074d 100644 --- a/website/content/ChapterFour/0171.Excel-Sheet-Column-Number.md +++ b/website/content/ChapterFour/0171.Excel-Sheet-Column-Number.md @@ -64,4 +64,11 @@ func titleToNumber(s string) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0172.Factorial-Trailing-Zeroes.md b/website/content/ChapterFour/0172.Factorial-Trailing-Zeroes.md index 4c6db632..c6a99740 100755 --- a/website/content/ChapterFour/0172.Factorial-Trailing-Zeroes.md +++ b/website/content/ChapterFour/0172.Factorial-Trailing-Zeroes.md @@ -48,4 +48,11 @@ func trailingZeroes(n int) int { return n/5 + trailingZeroes(n/5) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0173.Binary-Search-Tree-Iterator.md b/website/content/ChapterFour/0173.Binary-Search-Tree-Iterator.md index 8521ef5b..b81575ce 100755 --- a/website/content/ChapterFour/0173.Binary-Search-Tree-Iterator.md +++ b/website/content/ChapterFour/0173.Binary-Search-Tree-Iterator.md @@ -115,4 +115,11 @@ func (pq *PriorityQueueOfInt) Pop() interface{} { return item } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0174.Dungeon-Game.md b/website/content/ChapterFour/0174.Dungeon-Game.md index d95cc1ac..a3260aeb 100755 --- a/website/content/ChapterFour/0174.Dungeon-Game.md +++ b/website/content/ChapterFour/0174.Dungeon-Game.md @@ -121,4 +121,11 @@ func canCross(dungeon [][]int, start int) bool { return dp[m-1][n-1] > 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0179.Largest-Number.md b/website/content/ChapterFour/0179.Largest-Number.md index de167785..aeb366ce 100644 --- a/website/content/ChapterFour/0179.Largest-Number.md +++ b/website/content/ChapterFour/0179.Largest-Number.md @@ -119,4 +119,11 @@ func quickSortString(a []string, lo, hi int) { quickSortString(a, p+1, hi) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0187.Repeated-DNA-Sequences.md b/website/content/ChapterFour/0187.Repeated-DNA-Sequences.md index 5f917e03..fe746802 100755 --- a/website/content/ChapterFour/0187.Repeated-DNA-Sequences.md +++ b/website/content/ChapterFour/0187.Repeated-DNA-Sequences.md @@ -68,4 +68,11 @@ func findRepeatedDnaSequences1(s string) []string { return ans } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0189.Rotate-Array.md b/website/content/ChapterFour/0189.Rotate-Array.md index e5560337..3be1e0de 100644 --- a/website/content/ChapterFour/0189.Rotate-Array.md +++ b/website/content/ChapterFour/0189.Rotate-Array.md @@ -72,4 +72,11 @@ func rotate1(nums []int, k int) { } copy(nums, newNums) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0190.Reverse-Bits.md b/website/content/ChapterFour/0190.Reverse-Bits.md index 47b9b939..dfbb2863 100755 --- a/website/content/ChapterFour/0190.Reverse-Bits.md +++ b/website/content/ChapterFour/0190.Reverse-Bits.md @@ -50,4 +50,11 @@ func reverseBits(num uint32) uint32 { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0191.Number-of-1-Bits.md b/website/content/ChapterFour/0191.Number-of-1-Bits.md index 2723d2a0..379892d3 100755 --- a/website/content/ChapterFour/0191.Number-of-1-Bits.md +++ b/website/content/ChapterFour/0191.Number-of-1-Bits.md @@ -62,4 +62,11 @@ func hammingWeight1(num uint32) int { return count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0198.House-Robber.md b/website/content/ChapterFour/0198.House-Robber.md index 4ad33a62..cbe1d110 100755 --- a/website/content/ChapterFour/0198.House-Robber.md +++ b/website/content/ChapterFour/0198.House-Robber.md @@ -91,4 +91,11 @@ func rob(nums []int) int { return max(a, b) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0199.Binary-Tree-Right-Side-View.md b/website/content/ChapterFour/0199.Binary-Tree-Right-Side-View.md index 621d2333..5c15e36b 100644 --- a/website/content/ChapterFour/0199.Binary-Tree-Right-Side-View.md +++ b/website/content/ChapterFour/0199.Binary-Tree-Right-Side-View.md @@ -81,4 +81,11 @@ func rightSideView(root *TreeNode) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0200.Number-of-Islands.md b/website/content/ChapterFour/0200.Number-of-Islands.md index 3fe5a2f2..703125e3 100755 --- a/website/content/ChapterFour/0200.Number-of-Islands.md +++ b/website/content/ChapterFour/0200.Number-of-Islands.md @@ -78,4 +78,11 @@ func searchIslands(grid [][]byte, visited *[][]bool, x, y int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0201.Bitwise-AND-of-Numbers-Range.md b/website/content/ChapterFour/0201.Bitwise-AND-of-Numbers-Range.md index cccdb75b..c0c11f3d 100755 --- a/website/content/ChapterFour/0201.Bitwise-AND-of-Numbers-Range.md +++ b/website/content/ChapterFour/0201.Bitwise-AND-of-Numbers-Range.md @@ -63,4 +63,11 @@ func rangeBitwiseAnd(m int, n int) int { return n } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0202.Happy-Number.md b/website/content/ChapterFour/0202.Happy-Number.md index 673c90cb..453b3275 100644 --- a/website/content/ChapterFour/0202.Happy-Number.md +++ b/website/content/ChapterFour/0202.Happy-Number.md @@ -62,4 +62,11 @@ func isHappy(n int) bool { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0203.Remove-Linked-List-Elements.md b/website/content/ChapterFour/0203.Remove-Linked-List-Elements.md index 049e2561..0ab51f2a 100644 --- a/website/content/ChapterFour/0203.Remove-Linked-List-Elements.md +++ b/website/content/ChapterFour/0203.Remove-Linked-List-Elements.md @@ -53,4 +53,11 @@ func removeElements(head *ListNode, val int) *ListNode { return newHead.Next } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0204.Count-Primes.md b/website/content/ChapterFour/0204.Count-Primes.md index 81f49cdc..f835f5a8 100755 --- a/website/content/ChapterFour/0204.Count-Primes.md +++ b/website/content/ChapterFour/0204.Count-Primes.md @@ -47,4 +47,11 @@ func countPrimes(n int) int { return count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0205.Isomorphic-Strings.md b/website/content/ChapterFour/0205.Isomorphic-Strings.md index 31a2b620..43074115 100644 --- a/website/content/ChapterFour/0205.Isomorphic-Strings.md +++ b/website/content/ChapterFour/0205.Isomorphic-Strings.md @@ -87,4 +87,11 @@ func isIsomorphic(s string, t string) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0206.Reverse-Linked-List.md b/website/content/ChapterFour/0206.Reverse-Linked-List.md index 28f4d7e6..af6949ca 100644 --- a/website/content/ChapterFour/0206.Reverse-Linked-List.md +++ b/website/content/ChapterFour/0206.Reverse-Linked-List.md @@ -44,4 +44,11 @@ func reverseList(head *ListNode) *ListNode { return behind } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0207.Course-Schedule.md b/website/content/ChapterFour/0207.Course-Schedule.md index 7d2e8401..c3f60925 100755 --- a/website/content/ChapterFour/0207.Course-Schedule.md +++ b/website/content/ChapterFour/0207.Course-Schedule.md @@ -79,4 +79,11 @@ func canFinish(n int, pre [][]int) bool { return len(next) == n } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0208.Implement-Trie-Prefix-Tree.md b/website/content/ChapterFour/0208.Implement-Trie-Prefix-Tree.md index 42d6500b..fec04d06 100755 --- a/website/content/ChapterFour/0208.Implement-Trie-Prefix-Tree.md +++ b/website/content/ChapterFour/0208.Implement-Trie-Prefix-Tree.md @@ -96,4 +96,11 @@ func (this *Trie) StartsWith(prefix string) bool { * param_3 := obj.StartsWith(prefix); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0209.Minimum-Size-Subarray-Sum.md b/website/content/ChapterFour/0209.Minimum-Size-Subarray-Sum.md index c2fd8a75..0d6d6f1e 100644 --- a/website/content/ChapterFour/0209.Minimum-Size-Subarray-Sum.md +++ b/website/content/ChapterFour/0209.Minimum-Size-Subarray-Sum.md @@ -58,4 +58,11 @@ func minSubArrayLen(s int, nums []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0210.Course-Schedule-II.md b/website/content/ChapterFour/0210.Course-Schedule-II.md index 735d260e..d2662b22 100755 --- a/website/content/ChapterFour/0210.Course-Schedule-II.md +++ b/website/content/ChapterFour/0210.Course-Schedule-II.md @@ -77,4 +77,11 @@ func findOrder(numCourses int, prerequisites [][]int) []int { return []int{} } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md b/website/content/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md index 208903d5..171e82cc 100755 --- a/website/content/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md +++ b/website/content/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md @@ -92,4 +92,11 @@ func (this *WordDictionary) Search(word string) bool { * param_2 := obj.Search(word); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0212.Word-Search-II.md b/website/content/ChapterFour/0212.Word-Search-II.md index b277984b..f83123dc 100755 --- a/website/content/ChapterFour/0212.Word-Search-II.md +++ b/website/content/ChapterFour/0212.Word-Search-II.md @@ -54,4 +54,11 @@ func findWords(board [][]byte, words []string) []string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0213.House-Robber-II.md b/website/content/ChapterFour/0213.House-Robber-II.md index b53c02f6..4860b757 100755 --- a/website/content/ChapterFour/0213.House-Robber-II.md +++ b/website/content/ChapterFour/0213.House-Robber-II.md @@ -67,4 +67,11 @@ func rob213_1(nums []int, start, end int) int { return curMax } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0215.Kth-Largest-Element-in-an-Array.md b/website/content/ChapterFour/0215.Kth-Largest-Element-in-an-Array.md index babad9e9..ed9137fd 100644 --- a/website/content/ChapterFour/0215.Kth-Largest-Element-in-an-Array.md +++ b/website/content/ChapterFour/0215.Kth-Largest-Element-in-an-Array.md @@ -73,4 +73,11 @@ func selection(arr []int, l, r, k int) int { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0216.Combination-Sum-III.md b/website/content/ChapterFour/0216.Combination-Sum-III.md index 8aadea35..97e953dc 100755 --- a/website/content/ChapterFour/0216.Combination-Sum-III.md +++ b/website/content/ChapterFour/0216.Combination-Sum-III.md @@ -70,4 +70,11 @@ func findcombinationSum3(k, target, index int, c []int, res *[][]int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0217.Contains-Duplicate.md b/website/content/ChapterFour/0217.Contains-Duplicate.md index c9ce8b43..2a078acd 100644 --- a/website/content/ChapterFour/0217.Contains-Duplicate.md +++ b/website/content/ChapterFour/0217.Contains-Duplicate.md @@ -59,4 +59,11 @@ func containsDuplicate(nums []int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0218.The-Skyline-Problem.md b/website/content/ChapterFour/0218.The-Skyline-Problem.md index 0a4f2bc6..71fa6d02 100755 --- a/website/content/ChapterFour/0218.The-Skyline-Problem.md +++ b/website/content/ChapterFour/0218.The-Skyline-Problem.md @@ -284,4 +284,11 @@ func (q *IndexMaxPQ) less(i, j int) bool { return q.items[q.pq[i]] < q.items[q.pq[j]] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0219.Contains-Duplicate-II.md b/website/content/ChapterFour/0219.Contains-Duplicate-II.md index 8cf856a3..37772d36 100644 --- a/website/content/ChapterFour/0219.Contains-Duplicate-II.md +++ b/website/content/ChapterFour/0219.Contains-Duplicate-II.md @@ -66,4 +66,11 @@ func containsNearbyDuplicate(nums []int, k int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0220.Contains-Duplicate-III.md b/website/content/ChapterFour/0220.Contains-Duplicate-III.md index 9dcd3f1b..a9df8c3f 100644 --- a/website/content/ChapterFour/0220.Contains-Duplicate-III.md +++ b/website/content/ChapterFour/0220.Contains-Duplicate-III.md @@ -100,4 +100,11 @@ func containsNearbyAlmostDuplicate1(nums []int, k int, t int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0222.Count-Complete-Tree-Nodes.md b/website/content/ChapterFour/0222.Count-Complete-Tree-Nodes.md index b2a21ebe..88f00d48 100644 --- a/website/content/ChapterFour/0222.Count-Complete-Tree-Nodes.md +++ b/website/content/ChapterFour/0222.Count-Complete-Tree-Nodes.md @@ -79,4 +79,11 @@ func countNodes(root *TreeNode) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0223.Rectangle-Area.md b/website/content/ChapterFour/0223.Rectangle-Area.md index 08d9c64d..c129f609 100755 --- a/website/content/ChapterFour/0223.Rectangle-Area.md +++ b/website/content/ChapterFour/0223.Rectangle-Area.md @@ -50,4 +50,11 @@ func area(x0, y0, x1, y1 int) int { return l * h } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0224.Basic-Calculator.md b/website/content/ChapterFour/0224.Basic-Calculator.md index 5861726a..dae86172 100755 --- a/website/content/ChapterFour/0224.Basic-Calculator.md +++ b/website/content/ChapterFour/0224.Basic-Calculator.md @@ -162,4 +162,11 @@ func isDigital(v byte) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0225.Implement-Stack-using-Queues.md b/website/content/ChapterFour/0225.Implement-Stack-using-Queues.md index 11ef4866..9a1be896 100644 --- a/website/content/ChapterFour/0225.Implement-Stack-using-Queues.md +++ b/website/content/ChapterFour/0225.Implement-Stack-using-Queues.md @@ -92,4 +92,11 @@ func (this *MyStack) Empty() bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0226.Invert-Binary-Tree.md b/website/content/ChapterFour/0226.Invert-Binary-Tree.md index 8fae9dff..844f3e90 100644 --- a/website/content/ChapterFour/0226.Invert-Binary-Tree.md +++ b/website/content/ChapterFour/0226.Invert-Binary-Tree.md @@ -73,4 +73,11 @@ func invertTree(root *TreeNode) *TreeNode { return root } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0228.Summary-Ranges.md b/website/content/ChapterFour/0228.Summary-Ranges.md index 7512736a..3a2a53ec 100644 --- a/website/content/ChapterFour/0228.Summary-Ranges.md +++ b/website/content/ChapterFour/0228.Summary-Ranges.md @@ -105,4 +105,11 @@ func summaryRanges(nums []int) (ans []string) { } return } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0229.Majority-Element-II.md b/website/content/ChapterFour/0229.Majority-Element-II.md index ce926058..45cbf0db 100755 --- a/website/content/ChapterFour/0229.Majority-Element-II.md +++ b/website/content/ChapterFour/0229.Majority-Element-II.md @@ -97,4 +97,11 @@ func majorityElement229_1(nums []int) []int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md b/website/content/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md index b874e616..45fcea55 100755 --- a/website/content/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md +++ b/website/content/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md @@ -75,4 +75,11 @@ func inorder230(node *TreeNode, k int, count *int, ans *int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0231.Power-of-Two.md b/website/content/ChapterFour/0231.Power-of-Two.md index d2b3d492..157f91e5 100755 --- a/website/content/ChapterFour/0231.Power-of-Two.md +++ b/website/content/ChapterFour/0231.Power-of-Two.md @@ -67,4 +67,11 @@ func isPowerOfTwo3(num int) bool { return num == 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0232.Implement-Queue-using-Stacks.md b/website/content/ChapterFour/0232.Implement-Queue-using-Stacks.md index fded5d37..6ceaa1b0 100644 --- a/website/content/ChapterFour/0232.Implement-Queue-using-Stacks.md +++ b/website/content/ChapterFour/0232.Implement-Queue-using-Stacks.md @@ -96,4 +96,11 @@ func (this *MyQueue) fromStackToQueue(s, q *[]int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0234.Palindrome-Linked-List.md b/website/content/ChapterFour/0234.Palindrome-Linked-List.md index f883bea3..56eca338 100644 --- a/website/content/ChapterFour/0234.Palindrome-Linked-List.md +++ b/website/content/ChapterFour/0234.Palindrome-Linked-List.md @@ -108,4 +108,11 @@ func L2ss(head *ListNode) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md b/website/content/ChapterFour/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md index 6cadb8e9..73a9a443 100755 --- a/website/content/ChapterFour/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md +++ b/website/content/ChapterFour/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md @@ -69,4 +69,11 @@ func lowestCommonAncestor(root, p, q *TreeNode) *TreeNode { return root } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md b/website/content/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md index ccd47234..96342c14 100755 --- a/website/content/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md +++ b/website/content/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md @@ -69,4 +69,11 @@ func lowestCommonAncestor236(root, p, q *TreeNode) *TreeNode { return right } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0237.Delete-Node-in-a-Linked-List.md b/website/content/ChapterFour/0237.Delete-Node-in-a-Linked-List.md index c431655d..981fe415 100644 --- a/website/content/ChapterFour/0237.Delete-Node-in-a-Linked-List.md +++ b/website/content/ChapterFour/0237.Delete-Node-in-a-Linked-List.md @@ -69,4 +69,11 @@ func deleteNode(node *ListNode) { cur.Next = nil } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0239.Sliding-Window-Maximum.md b/website/content/ChapterFour/0239.Sliding-Window-Maximum.md index dd1cd697..ea5a4493 100755 --- a/website/content/ChapterFour/0239.Sliding-Window-Maximum.md +++ b/website/content/ChapterFour/0239.Sliding-Window-Maximum.md @@ -92,4 +92,11 @@ func maxSlidingWindow(nums []int, k int) []int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0240.Search-a-2D-Matrix-II.md b/website/content/ChapterFour/0240.Search-a-2D-Matrix-II.md index d8d92a10..736d4ba4 100755 --- a/website/content/ChapterFour/0240.Search-a-2D-Matrix-II.md +++ b/website/content/ChapterFour/0240.Search-a-2D-Matrix-II.md @@ -86,4 +86,11 @@ func searchMatrix2401(matrix [][]int, target int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0242.Valid-Anagram.md b/website/content/ChapterFour/0242.Valid-Anagram.md index cc243f3e..7f643f68 100644 --- a/website/content/ChapterFour/0242.Valid-Anagram.md +++ b/website/content/ChapterFour/0242.Valid-Anagram.md @@ -114,4 +114,11 @@ func quickSortByte(a []byte, lo, hi int) { quickSortByte(a, p+1, hi) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0257.Binary-Tree-Paths.md b/website/content/ChapterFour/0257.Binary-Tree-Paths.md index 5ee5f35f..eaef55f8 100755 --- a/website/content/ChapterFour/0257.Binary-Tree-Paths.md +++ b/website/content/ChapterFour/0257.Binary-Tree-Paths.md @@ -68,4 +68,11 @@ func binaryTreePaths(root *TreeNode) []string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0258.Add-Digits.md b/website/content/ChapterFour/0258.Add-Digits.md index 8c811904..57abdabc 100644 --- a/website/content/ChapterFour/0258.Add-Digits.md +++ b/website/content/ChapterFour/0258.Add-Digits.md @@ -44,4 +44,11 @@ func addDigits(num int) int { return num } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0260.Single-Number-III.md b/website/content/ChapterFour/0260.Single-Number-III.md index fa8e45b5..a5c74bf0 100755 --- a/website/content/ChapterFour/0260.Single-Number-III.md +++ b/website/content/ChapterFour/0260.Single-Number-III.md @@ -58,4 +58,11 @@ func singleNumberIII(nums []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0263.Ugly-Number.md b/website/content/ChapterFour/0263.Ugly-Number.md index e677f673..4e04b40e 100644 --- a/website/content/ChapterFour/0263.Ugly-Number.md +++ b/website/content/ChapterFour/0263.Ugly-Number.md @@ -66,4 +66,11 @@ func isUgly(num int) bool { return num == 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0268.Missing-Number.md b/website/content/ChapterFour/0268.Missing-Number.md index cf72f8c0..f5bafc72 100755 --- a/website/content/ChapterFour/0268.Missing-Number.md +++ b/website/content/ChapterFour/0268.Missing-Number.md @@ -44,4 +44,11 @@ func missingNumber(nums []int) int { return xor ^ i } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0274.H-Index.md b/website/content/ChapterFour/0274.H-Index.md index 4306deed..fd961ebc 100644 --- a/website/content/ChapterFour/0274.H-Index.md +++ b/website/content/ChapterFour/0274.H-Index.md @@ -75,4 +75,11 @@ func hIndex1(citations []int) int { return hIndex } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0275.H-Index-II.md b/website/content/ChapterFour/0275.H-Index-II.md index 21310f01..880d39d3 100755 --- a/website/content/ChapterFour/0275.H-Index-II.md +++ b/website/content/ChapterFour/0275.H-Index-II.md @@ -68,4 +68,11 @@ func hIndex275(citations []int) int { return len(citations) - low } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0283.Move-Zeroes.md b/website/content/ChapterFour/0283.Move-Zeroes.md index f7c334ea..48c52dd7 100644 --- a/website/content/ChapterFour/0283.Move-Zeroes.md +++ b/website/content/ChapterFour/0283.Move-Zeroes.md @@ -52,4 +52,11 @@ func moveZeroes(nums []int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0287.Find-the-Duplicate-Number.md b/website/content/ChapterFour/0287.Find-the-Duplicate-Number.md index a8146fe3..11dc7ccf 100644 --- a/website/content/ChapterFour/0287.Find-the-Duplicate-Number.md +++ b/website/content/ChapterFour/0287.Find-the-Duplicate-Number.md @@ -104,4 +104,11 @@ func findDuplicate2(nums []int) int { return 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0290.Word-Pattern.md b/website/content/ChapterFour/0290.Word-Pattern.md index d7764d4e..d22b9623 100644 --- a/website/content/ChapterFour/0290.Word-Pattern.md +++ b/website/content/ChapterFour/0290.Word-Pattern.md @@ -95,4 +95,11 @@ func wordPattern(pattern string, str string) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0300.Longest-Increasing-Subsequence.md b/website/content/ChapterFour/0300.Longest-Increasing-Subsequence.md index eb6436a6..3d678515 100755 --- a/website/content/ChapterFour/0300.Longest-Increasing-Subsequence.md +++ b/website/content/ChapterFour/0300.Longest-Increasing-Subsequence.md @@ -76,4 +76,11 @@ func lengthOfLIS1(nums []int) int { return len(dp) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0303.Range-Sum-Query---Immutable.md b/website/content/ChapterFour/0303.Range-Sum-Query---Immutable.md index 12ebbe67..9f24536e 100755 --- a/website/content/ChapterFour/0303.Range-Sum-Query---Immutable.md +++ b/website/content/ChapterFour/0303.Range-Sum-Query---Immutable.md @@ -107,4 +107,11 @@ func (ma *NumArray) SumRange(i int, j int) int { * param_1 := obj.SumRange(i,j); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0306.Additive-Number.md b/website/content/ChapterFour/0306.Additive-Number.md index 4d188472..b3ed5be6 100755 --- a/website/content/ChapterFour/0306.Additive-Number.md +++ b/website/content/ChapterFour/0306.Additive-Number.md @@ -86,4 +86,11 @@ func recursiveCheck(num string, x1 int, x2 int, left int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0307.Range-Sum-Query---Mutable.md b/website/content/ChapterFour/0307.Range-Sum-Query---Mutable.md index 1d17bbec..c8618b62 100755 --- a/website/content/ChapterFour/0307.Range-Sum-Query---Mutable.md +++ b/website/content/ChapterFour/0307.Range-Sum-Query---Mutable.md @@ -118,4 +118,11 @@ func (this *NumArray) Update(i int, val int) { * param_2 := obj.SumRange(i,j); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md b/website/content/ChapterFour/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md index f9d6d14a..efd0363d 100755 --- a/website/content/ChapterFour/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md +++ b/website/content/ChapterFour/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md @@ -81,4 +81,11 @@ func maxProfit309_1(prices []int) int { return sell[(len(prices)-1)%3] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md b/website/content/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md index e82ba661..77b9e627 100755 --- a/website/content/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md +++ b/website/content/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md @@ -85,4 +85,11 @@ func countSmaller(nums []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0318.Maximum-Product-of-Word-Lengths.md b/website/content/ChapterFour/0318.Maximum-Product-of-Word-Lengths.md index 7020a8bd..de8f712c 100755 --- a/website/content/ChapterFour/0318.Maximum-Product-of-Word-Lengths.md +++ b/website/content/ChapterFour/0318.Maximum-Product-of-Word-Lengths.md @@ -74,4 +74,11 @@ func maxProduct318(words []string) int { return maxProduct } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0322.Coin-Change.md b/website/content/ChapterFour/0322.Coin-Change.md index ee3adf0b..4e15b87c 100755 --- a/website/content/ChapterFour/0322.Coin-Change.md +++ b/website/content/ChapterFour/0322.Coin-Change.md @@ -58,4 +58,11 @@ func coinChange(coins []int, amount int) int { return dp[amount] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0324.Wiggle-Sort-II.md b/website/content/ChapterFour/0324.Wiggle-Sort-II.md index d8baed57..5047b8f0 100644 --- a/website/content/ChapterFour/0324.Wiggle-Sort-II.md +++ b/website/content/ChapterFour/0324.Wiggle-Sort-II.md @@ -260,4 +260,11 @@ func wiggleSort1(nums []int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0326.Power-of-Three.md b/website/content/ChapterFour/0326.Power-of-Three.md index 7455f864..38328b88 100755 --- a/website/content/ChapterFour/0326.Power-of-Three.md +++ b/website/content/ChapterFour/0326.Power-of-Three.md @@ -74,4 +74,11 @@ func isPowerOfThree2(num int) bool { return num == 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0327.Count-of-Range-Sum.md b/website/content/ChapterFour/0327.Count-of-Range-Sum.md index 87a5d324..30779996 100755 --- a/website/content/ChapterFour/0327.Count-of-Range-Sum.md +++ b/website/content/ChapterFour/0327.Count-of-Range-Sum.md @@ -142,4 +142,11 @@ func countRangeSum1(nums []int, lower int, upper int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0328.Odd-Even-Linked-List.md b/website/content/ChapterFour/0328.Odd-Even-Linked-List.md index b7201e5d..3e76e37c 100644 --- a/website/content/ChapterFour/0328.Odd-Even-Linked-List.md +++ b/website/content/ChapterFour/0328.Odd-Even-Linked-List.md @@ -74,4 +74,11 @@ func oddEvenList(head *ListNode) *ListNode { return oddHead.Next } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0329.Longest-Increasing-Path-in-a-Matrix.md b/website/content/ChapterFour/0329.Longest-Increasing-Path-in-a-Matrix.md index 4ae43112..f26eb117 100755 --- a/website/content/ChapterFour/0329.Longest-Increasing-Path-in-a-Matrix.md +++ b/website/content/ChapterFour/0329.Longest-Increasing-Path-in-a-Matrix.md @@ -89,4 +89,11 @@ func searchPath(board, cache [][]int, lastNum, x, y int) int { return count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md b/website/content/ChapterFour/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md index 8df741a1..83ba9b8d 100644 --- a/website/content/ChapterFour/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md +++ b/website/content/ChapterFour/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md @@ -82,4 +82,11 @@ func isValidSerialization(preorder string) bool { return diff == 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0337.House-Robber-III.md b/website/content/ChapterFour/0337.House-Robber-III.md index e8451881..d524b3d3 100644 --- a/website/content/ChapterFour/0337.House-Robber-III.md +++ b/website/content/ChapterFour/0337.House-Robber-III.md @@ -70,4 +70,11 @@ func dfsTreeRob(root *TreeNode) (a, b int) { return tmp0, tmp1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0338.Counting-Bits.md b/website/content/ChapterFour/0338.Counting-Bits.md index ea8e0de2..a543d869 100755 --- a/website/content/ChapterFour/0338.Counting-Bits.md +++ b/website/content/ChapterFour/0338.Counting-Bits.md @@ -51,4 +51,11 @@ func countBits(num int) []int { return bits } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0342.Power-of-Four.md b/website/content/ChapterFour/0342.Power-of-Four.md index 64782049..221989d8 100755 --- a/website/content/ChapterFour/0342.Power-of-Four.md +++ b/website/content/ChapterFour/0342.Power-of-Four.md @@ -52,4 +52,11 @@ func isPowerOfFour1(num int) bool { return num == 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0343.Integer-Break.md b/website/content/ChapterFour/0343.Integer-Break.md index cfa558d7..3ca9c6af 100755 --- a/website/content/ChapterFour/0343.Integer-Break.md +++ b/website/content/ChapterFour/0343.Integer-Break.md @@ -50,4 +50,11 @@ func integerBreak(n int) int { return dp[n] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0344.Reverse-String.md b/website/content/ChapterFour/0344.Reverse-String.md index f3568648..493fbe3b 100644 --- a/website/content/ChapterFour/0344.Reverse-String.md +++ b/website/content/ChapterFour/0344.Reverse-String.md @@ -50,4 +50,11 @@ func reverseString(s []byte) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0345.Reverse-Vowels-of-a-String.md b/website/content/ChapterFour/0345.Reverse-Vowels-of-a-String.md index 2cbb07fb..bd7679af 100644 --- a/website/content/ChapterFour/0345.Reverse-Vowels-of-a-String.md +++ b/website/content/ChapterFour/0345.Reverse-Vowels-of-a-String.md @@ -66,4 +66,11 @@ func isVowels(s byte) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0347.Top-K-Frequent-Elements.md b/website/content/ChapterFour/0347.Top-K-Frequent-Elements.md index c2a98fcd..ea1d85b1 100644 --- a/website/content/ChapterFour/0347.Top-K-Frequent-Elements.md +++ b/website/content/ChapterFour/0347.Top-K-Frequent-Elements.md @@ -100,4 +100,11 @@ func (pq *PriorityQueue) Pop() interface{} { return item } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0349.Intersection-of-Two-Arrays.md b/website/content/ChapterFour/0349.Intersection-of-Two-Arrays.md index 8f8ad399..ade24e62 100644 --- a/website/content/ChapterFour/0349.Intersection-of-Two-Arrays.md +++ b/website/content/ChapterFour/0349.Intersection-of-Two-Arrays.md @@ -57,4 +57,11 @@ func intersection(nums1 []int, nums2 []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0350.Intersection-of-Two-Arrays-II.md b/website/content/ChapterFour/0350.Intersection-of-Two-Arrays-II.md index dc92b38c..eb94c11d 100644 --- a/website/content/ChapterFour/0350.Intersection-of-Two-Arrays-II.md +++ b/website/content/ChapterFour/0350.Intersection-of-Two-Arrays-II.md @@ -69,4 +69,11 @@ func intersect(nums1 []int, nums2 []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0354.Russian-Doll-Envelopes.md b/website/content/ChapterFour/0354.Russian-Doll-Envelopes.md index 810345d3..8100d0f6 100755 --- a/website/content/ChapterFour/0354.Russian-Doll-Envelopes.md +++ b/website/content/ChapterFour/0354.Russian-Doll-Envelopes.md @@ -78,4 +78,11 @@ func maxEnvelopes(envelopes [][]int) int { return len(dp) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md b/website/content/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md index 021b4187..6c7583a6 100755 --- a/website/content/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md +++ b/website/content/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md @@ -58,4 +58,11 @@ func countNumbersWithUniqueDigits(n int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0367.Valid-Perfect-Square.md b/website/content/ChapterFour/0367.Valid-Perfect-Square.md index 50584b0d..0edd6fc0 100755 --- a/website/content/ChapterFour/0367.Valid-Perfect-Square.md +++ b/website/content/ChapterFour/0367.Valid-Perfect-Square.md @@ -54,4 +54,11 @@ func isPerfectSquare(num int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0371.Sum-of-Two-Integers.md b/website/content/ChapterFour/0371.Sum-of-Two-Integers.md index 31318dd7..423f35b1 100755 --- a/website/content/ChapterFour/0371.Sum-of-Two-Integers.md +++ b/website/content/ChapterFour/0371.Sum-of-Two-Integers.md @@ -44,4 +44,11 @@ func getSum(a int, b int) int { return getSum((a&b)<<1, a^b) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0372.Super-Pow.md b/website/content/ChapterFour/0372.Super-Pow.md index 79b2830c..1bb73d92 100755 --- a/website/content/ChapterFour/0372.Super-Pow.md +++ b/website/content/ChapterFour/0372.Super-Pow.md @@ -105,4 +105,11 @@ func superPow1(a int, b []int) int { return f * l % 1337 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0373.Find-K-Pairs-with-Smallest-Sums.md b/website/content/ChapterFour/0373.Find-K-Pairs-with-Smallest-Sums.md index 237c063d..85bb5352 100755 --- a/website/content/ChapterFour/0373.Find-K-Pairs-with-Smallest-Sums.md +++ b/website/content/ChapterFour/0373.Find-K-Pairs-with-Smallest-Sums.md @@ -123,4 +123,11 @@ func kSmallestPairs1(nums1 []int, nums2 []int, k int) [][]int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0378.Kth-Smallest-Element-in-a-Sorted-Matrix.md b/website/content/ChapterFour/0378.Kth-Smallest-Element-in-a-Sorted-Matrix.md index 922adeeb..9f675463 100755 --- a/website/content/ChapterFour/0378.Kth-Smallest-Element-in-a-Sorted-Matrix.md +++ b/website/content/ChapterFour/0378.Kth-Smallest-Element-in-a-Sorted-Matrix.md @@ -132,4 +132,11 @@ func (p *pq) Pop() interface{} { return p.data[p.len] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0385.Mini-Parser.md b/website/content/ChapterFour/0385.Mini-Parser.md index 57a00d32..93706631 100755 --- a/website/content/ChapterFour/0385.Mini-Parser.md +++ b/website/content/ChapterFour/0385.Mini-Parser.md @@ -172,4 +172,11 @@ func deserialize(s string) *NestedInteger { return cur } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0386.Lexicographical-Numbers.md b/website/content/ChapterFour/0386.Lexicographical-Numbers.md index 7bb82d4b..2b448727 100755 --- a/website/content/ChapterFour/0386.Lexicographical-Numbers.md +++ b/website/content/ChapterFour/0386.Lexicographical-Numbers.md @@ -48,4 +48,11 @@ func dfs386(x, n int, res *[]int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0387.First-Unique-Character-in-a-String.md b/website/content/ChapterFour/0387.First-Unique-Character-in-a-String.md index 35f72fe4..211fab68 100755 --- a/website/content/ChapterFour/0387.First-Unique-Character-in-a-String.md +++ b/website/content/ChapterFour/0387.First-Unique-Character-in-a-String.md @@ -78,4 +78,11 @@ func firstUniqChar1(s string) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0389.Find-the-Difference.md b/website/content/ChapterFour/0389.Find-the-Difference.md index 57b53354..026b6f99 100755 --- a/website/content/ChapterFour/0389.Find-the-Difference.md +++ b/website/content/ChapterFour/0389.Find-the-Difference.md @@ -45,4 +45,11 @@ func findTheDifference(s string, t string) byte { return ch } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0392.Is-Subsequence.md b/website/content/ChapterFour/0392.Is-Subsequence.md index 09ff2c75..7b11b78e 100755 --- a/website/content/ChapterFour/0392.Is-Subsequence.md +++ b/website/content/ChapterFour/0392.Is-Subsequence.md @@ -77,4 +77,11 @@ func isSubsequence1(s string, t string) bool { } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0393.UTF-8-Validation.md b/website/content/ChapterFour/0393.UTF-8-Validation.md index 1d8b50fb..b1efbce0 100755 --- a/website/content/ChapterFour/0393.UTF-8-Validation.md +++ b/website/content/ChapterFour/0393.UTF-8-Validation.md @@ -102,4 +102,11 @@ func validUtf8(data []int) bool { return count == 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0394.Decode-String.md b/website/content/ChapterFour/0394.Decode-String.md index 93a71bce..902049c3 100644 --- a/website/content/ChapterFour/0394.Decode-String.md +++ b/website/content/ChapterFour/0394.Decode-String.md @@ -78,4 +78,11 @@ func decodeString(s string) string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0397.Integer-Replacement.md b/website/content/ChapterFour/0397.Integer-Replacement.md index 1dea6f59..67691292 100755 --- a/website/content/ChapterFour/0397.Integer-Replacement.md +++ b/website/content/ChapterFour/0397.Integer-Replacement.md @@ -83,4 +83,11 @@ func integerReplacement(n int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0399.Evaluate-Division.md b/website/content/ChapterFour/0399.Evaluate-Division.md index d4cf4524..cdefaf23 100755 --- a/website/content/ChapterFour/0399.Evaluate-Division.md +++ b/website/content/ChapterFour/0399.Evaluate-Division.md @@ -114,4 +114,11 @@ func calcEquation(equations [][]string, values []float64, queries [][]string) [] return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0401.Binary-Watch.md b/website/content/ChapterFour/0401.Binary-Watch.md index 0d40d6f2..ae9162a2 100755 --- a/website/content/ChapterFour/0401.Binary-Watch.md +++ b/website/content/ChapterFour/0401.Binary-Watch.md @@ -135,4 +135,11 @@ func findReadBinaryWatchHour(target, index int, c []int, res *[]string) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0402.Remove-K-Digits.md b/website/content/ChapterFour/0402.Remove-K-Digits.md index 52c3ce27..e8f6c0e4 100644 --- a/website/content/ChapterFour/0402.Remove-K-Digits.md +++ b/website/content/ChapterFour/0402.Remove-K-Digits.md @@ -85,4 +85,11 @@ func removeKdigits(num string, k int) string { return string(res) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0404.Sum-of-Left-Leaves.md b/website/content/ChapterFour/0404.Sum-of-Left-Leaves.md index c2103dbe..18c83472 100755 --- a/website/content/ChapterFour/0404.Sum-of-Left-Leaves.md +++ b/website/content/ChapterFour/0404.Sum-of-Left-Leaves.md @@ -52,4 +52,11 @@ func sumOfLeftLeaves(root *TreeNode) int { return sumOfLeftLeaves(root.Left) + sumOfLeftLeaves(root.Right) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md b/website/content/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md index c77a0258..52d661c8 100755 --- a/website/content/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md +++ b/website/content/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md @@ -77,4 +77,11 @@ func toHex(num int) string { return str } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0409.Longest-Palindrome.md b/website/content/ChapterFour/0409.Longest-Palindrome.md index a0e18ad1..f0d3f136 100755 --- a/website/content/ChapterFour/0409.Longest-Palindrome.md +++ b/website/content/ChapterFour/0409.Longest-Palindrome.md @@ -54,4 +54,11 @@ func longestPalindrome(s string) int { return answer } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0410.Split-Array-Largest-Sum.md b/website/content/ChapterFour/0410.Split-Array-Largest-Sum.md index f4ce4e9b..5620d814 100755 --- a/website/content/ChapterFour/0410.Split-Array-Largest-Sum.md +++ b/website/content/ChapterFour/0410.Split-Array-Largest-Sum.md @@ -89,4 +89,11 @@ func calSum(mid, m int, nums []int) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0412.Fizz-Buzz.md b/website/content/ChapterFour/0412.Fizz-Buzz.md index cf9fdd90..2dd24805 100644 --- a/website/content/ChapterFour/0412.Fizz-Buzz.md +++ b/website/content/ChapterFour/0412.Fizz-Buzz.md @@ -68,4 +68,11 @@ func fizzBuzz(n int) []string { return solution } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0414.Third-Maximum-Number.md b/website/content/ChapterFour/0414.Third-Maximum-Number.md index 7c8ef633..cd2224b0 100644 --- a/website/content/ChapterFour/0414.Third-Maximum-Number.md +++ b/website/content/ChapterFour/0414.Third-Maximum-Number.md @@ -69,4 +69,11 @@ func thirdMax(nums []int) int { return c } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0416.Partition-Equal-Subset-Sum.md b/website/content/ChapterFour/0416.Partition-Equal-Subset-Sum.md index ce3a79cc..94fe2e3c 100755 --- a/website/content/ChapterFour/0416.Partition-Equal-Subset-Sum.md +++ b/website/content/ChapterFour/0416.Partition-Equal-Subset-Sum.md @@ -73,4 +73,11 @@ func canPartition(nums []int) bool { return dp[C] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md b/website/content/ChapterFour/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md index e4c527b3..688e41e3 100755 --- a/website/content/ChapterFour/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md +++ b/website/content/ChapterFour/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md @@ -96,4 +96,11 @@ func findMaximumXOR1(nums []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0424.Longest-Repeating-Character-Replacement.md b/website/content/ChapterFour/0424.Longest-Repeating-Character-Replacement.md index 8e54fbcc..1762c02c 100644 --- a/website/content/ChapterFour/0424.Longest-Repeating-Character-Replacement.md +++ b/website/content/ChapterFour/0424.Longest-Repeating-Character-Replacement.md @@ -82,4 +82,11 @@ func max(a int, b int) int { return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0433.Minimum-Genetic-Mutation.md b/website/content/ChapterFour/0433.Minimum-Genetic-Mutation.md index 8fea5ecf..309dece2 100755 --- a/website/content/ChapterFour/0433.Minimum-Genetic-Mutation.md +++ b/website/content/ChapterFour/0433.Minimum-Genetic-Mutation.md @@ -180,4 +180,11 @@ func convert(gene string) uint32 { return v } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0435.Non-overlapping-Intervals.md b/website/content/ChapterFour/0435.Non-overlapping-Intervals.md index ff8c9074..de0366f7 100755 --- a/website/content/ChapterFour/0435.Non-overlapping-Intervals.md +++ b/website/content/ChapterFour/0435.Non-overlapping-Intervals.md @@ -132,4 +132,11 @@ func eraseOverlapIntervals1(intervals [][]int) int { return len(intervals) - res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0436.Find-Right-Interval.md b/website/content/ChapterFour/0436.Find-Right-Interval.md index 2bb73c8d..5aef3a4a 100755 --- a/website/content/ChapterFour/0436.Find-Right-Interval.md +++ b/website/content/ChapterFour/0436.Find-Right-Interval.md @@ -139,4 +139,11 @@ func searchFirstGreaterInterval(nums []Interval, target int) int { return -1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0437.Path-Sum-III.md b/website/content/ChapterFour/0437.Path-Sum-III.md index 8b9811d5..51b357f6 100755 --- a/website/content/ChapterFour/0437.Path-Sum-III.md +++ b/website/content/ChapterFour/0437.Path-Sum-III.md @@ -82,4 +82,11 @@ func findPath437(root *TreeNode, sum int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0438.Find-All-Anagrams-in-a-String.md b/website/content/ChapterFour/0438.Find-All-Anagrams-in-a-String.md index c422dbb1..207f321b 100644 --- a/website/content/ChapterFour/0438.Find-All-Anagrams-in-a-String.md +++ b/website/content/ChapterFour/0438.Find-All-Anagrams-in-a-String.md @@ -103,4 +103,11 @@ func findAnagrams(s string, p string) []int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0441.Arranging-Coins.md b/website/content/ChapterFour/0441.Arranging-Coins.md index d76eb626..fb7ba3f7 100755 --- a/website/content/ChapterFour/0441.Arranging-Coins.md +++ b/website/content/ChapterFour/0441.Arranging-Coins.md @@ -72,4 +72,11 @@ func arrangeCoins1(n int) int { return k - 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0445.Add-Two-Numbers-II.md b/website/content/ChapterFour/0445.Add-Two-Numbers-II.md index 19c3a576..f0b62889 100644 --- a/website/content/ChapterFour/0445.Add-Two-Numbers-II.md +++ b/website/content/ChapterFour/0445.Add-Two-Numbers-II.md @@ -93,4 +93,11 @@ func getLength(l *ListNode) int { return count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0447.Number-of-Boomerangs.md b/website/content/ChapterFour/0447.Number-of-Boomerangs.md index 332a6a3e..44289f4d 100644 --- a/website/content/ChapterFour/0447.Number-of-Boomerangs.md +++ b/website/content/ChapterFour/0447.Number-of-Boomerangs.md @@ -63,4 +63,11 @@ func dis(pa, pb []int) int { return (pa[0]-pb[0])*(pa[0]-pb[0]) + (pa[1]-pb[1])*(pa[1]-pb[1]) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0448.Find-All-Numbers-Disappeared-in-an-Array.md b/website/content/ChapterFour/0448.Find-All-Numbers-Disappeared-in-an-Array.md index ec98b0b4..02019d10 100644 --- a/website/content/ChapterFour/0448.Find-All-Numbers-Disappeared-in-an-Array.md +++ b/website/content/ChapterFour/0448.Find-All-Numbers-Disappeared-in-an-Array.md @@ -54,4 +54,11 @@ func findDisappearedNumbers(nums []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0451.Sort-Characters-By-Frequency.md b/website/content/ChapterFour/0451.Sort-Characters-By-Frequency.md index 58558d7f..84d262a5 100644 --- a/website/content/ChapterFour/0451.Sort-Characters-By-Frequency.md +++ b/website/content/ChapterFour/0451.Sort-Characters-By-Frequency.md @@ -110,4 +110,11 @@ func frequencySort(s string) string { return string(res) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0453.Minimum-Moves-to-Equal-Array-Elements.md b/website/content/ChapterFour/0453.Minimum-Moves-to-Equal-Array-Elements.md index 280f22a2..7417b7ad 100644 --- a/website/content/ChapterFour/0453.Minimum-Moves-to-Equal-Array-Elements.md +++ b/website/content/ChapterFour/0453.Minimum-Moves-to-Equal-Array-Elements.md @@ -48,4 +48,11 @@ func minMoves(nums []int) int { return sum - min*l } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0454.4Sum-II.md b/website/content/ChapterFour/0454.4Sum-II.md index 6a60ecf1..048a3452 100644 --- a/website/content/ChapterFour/0454.4Sum-II.md +++ b/website/content/ChapterFour/0454.4Sum-II.md @@ -62,4 +62,11 @@ func fourSumCount(A []int, B []int, C []int, D []int) int { return ret } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0455.Assign-Cookies.md b/website/content/ChapterFour/0455.Assign-Cookies.md index 4efda7a8..bfdff43a 100755 --- a/website/content/ChapterFour/0455.Assign-Cookies.md +++ b/website/content/ChapterFour/0455.Assign-Cookies.md @@ -66,4 +66,11 @@ func findContentChildren(g []int, s []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0456.132-Pattern.md b/website/content/ChapterFour/0456.132-Pattern.md index 382c2720..425aef1a 100755 --- a/website/content/ChapterFour/0456.132-Pattern.md +++ b/website/content/ChapterFour/0456.132-Pattern.md @@ -100,4 +100,11 @@ func find132pattern1(nums []int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0457.Circular-Array-Loop.md b/website/content/ChapterFour/0457.Circular-Array-Loop.md index 89756b22..3038fe2b 100755 --- a/website/content/ChapterFour/0457.Circular-Array-Loop.md +++ b/website/content/ChapterFour/0457.Circular-Array-Loop.md @@ -101,4 +101,11 @@ func getNextIndex(nums []int, index int) int { return ((nums[index]+index)%len(nums) + len(nums)) % len(nums) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0460.LFU-Cache.md b/website/content/ChapterFour/0460.LFU-Cache.md index 4bc0f1be..cc384229 100644 --- a/website/content/ChapterFour/0460.LFU-Cache.md +++ b/website/content/ChapterFour/0460.LFU-Cache.md @@ -139,4 +139,11 @@ func (this *LFUCache) Put(key int, value int) { newNode := newList.PushBack(currentNode) this.nodes[key] = newNode } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0461.Hamming-Distance.md b/website/content/ChapterFour/0461.Hamming-Distance.md index 9d0d75c0..0d85bdcb 100755 --- a/website/content/ChapterFour/0461.Hamming-Distance.md +++ b/website/content/ChapterFour/0461.Hamming-Distance.md @@ -50,4 +50,11 @@ func hammingDistance(x int, y int) int { return distance } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0463.Island-Perimeter.md b/website/content/ChapterFour/0463.Island-Perimeter.md index 7a319887..b847d231 100755 --- a/website/content/ChapterFour/0463.Island-Perimeter.md +++ b/website/content/ChapterFour/0463.Island-Perimeter.md @@ -68,4 +68,11 @@ func islandPerimeter(grid [][]int) int { return counter } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0470.Implement-Rand10-Using-Rand7.md b/website/content/ChapterFour/0470.Implement-Rand10-Using-Rand7.md index 1c650ca3..06fca2cd 100755 --- a/website/content/ChapterFour/0470.Implement-Rand10-Using-Rand7.md +++ b/website/content/ChapterFour/0470.Implement-Rand10-Using-Rand7.md @@ -97,4 +97,11 @@ func rand101() int { return rand40%10 + 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0474.Ones-and-Zeroes.md b/website/content/ChapterFour/0474.Ones-and-Zeroes.md index 65e29392..dddce982 100755 --- a/website/content/ChapterFour/0474.Ones-and-Zeroes.md +++ b/website/content/ChapterFour/0474.Ones-and-Zeroes.md @@ -75,4 +75,11 @@ func findMaxForm(strs []string, m int, n int) int { return dp[m][n] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0475.Heaters.md b/website/content/ChapterFour/0475.Heaters.md index bbe46ca7..8beba569 100755 --- a/website/content/ChapterFour/0475.Heaters.md +++ b/website/content/ChapterFour/0475.Heaters.md @@ -119,4 +119,11 @@ func findRadius1(houses []int, heaters []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0476.Number-Complement.md b/website/content/ChapterFour/0476.Number-Complement.md index 1bc61a9e..cd3ca3b0 100755 --- a/website/content/ChapterFour/0476.Number-Complement.md +++ b/website/content/ChapterFour/0476.Number-Complement.md @@ -65,4 +65,11 @@ func findComplement1(num int) int { return (temp - 1) ^ num // temp - 1 即是前面都是 0,num 长度的末尾都是 1 的数,再异或 num 即是最终结果 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0477.Total-Hamming-Distance.md b/website/content/ChapterFour/0477.Total-Hamming-Distance.md index f3e64a05..12970083 100755 --- a/website/content/ChapterFour/0477.Total-Hamming-Distance.md +++ b/website/content/ChapterFour/0477.Total-Hamming-Distance.md @@ -63,4 +63,11 @@ func totalHammingDistance1(nums []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0480.Sliding-Window-Median.md b/website/content/ChapterFour/0480.Sliding-Window-Median.md index 23499f93..105da2eb 100755 --- a/website/content/ChapterFour/0480.Sliding-Window-Median.md +++ b/website/content/ChapterFour/0480.Sliding-Window-Median.md @@ -273,4 +273,11 @@ func (h *MaxHeapR) Push(x int) { heap.Push(&h.hp, x) } // Remove define func (h *MaxHeapR) Remove(x int) { heap.Push(&h.hpDel, x) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0483.Smallest-Good-Base.md b/website/content/ChapterFour/0483.Smallest-Good-Base.md index 117d95c4..bcfe0613 100755 --- a/website/content/ChapterFour/0483.Smallest-Good-Base.md +++ b/website/content/ChapterFour/0483.Smallest-Good-Base.md @@ -135,4 +135,11 @@ func findBase(mid, bit uint64) uint64 { return sum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0485.Max-Consecutive-Ones.md b/website/content/ChapterFour/0485.Max-Consecutive-Ones.md index 6bd2c40e..02f757ef 100644 --- a/website/content/ChapterFour/0485.Max-Consecutive-Ones.md +++ b/website/content/ChapterFour/0485.Max-Consecutive-Ones.md @@ -56,4 +56,11 @@ func findMaxConsecutiveOnes(nums []int) int { return maxCount } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0491.Increasing-Subsequences.md b/website/content/ChapterFour/0491.Increasing-Subsequences.md index 9a262bb7..b7a1b4a7 100755 --- a/website/content/ChapterFour/0491.Increasing-Subsequences.md +++ b/website/content/ChapterFour/0491.Increasing-Subsequences.md @@ -81,4 +81,11 @@ func generateIncSubsets(nums []int, current int, c []int, res *[][]int) { return } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0493.Reverse-Pairs.md b/website/content/ChapterFour/0493.Reverse-Pairs.md index b6e2e840..82bcc36b 100755 --- a/website/content/ChapterFour/0493.Reverse-Pairs.md +++ b/website/content/ChapterFour/0493.Reverse-Pairs.md @@ -123,4 +123,11 @@ func mergesortCount(nums, buf []int) int { return cnt } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0494.Target-Sum.md b/website/content/ChapterFour/0494.Target-Sum.md index dd3c2b10..16b49336 100644 --- a/website/content/ChapterFour/0494.Target-Sum.md +++ b/website/content/ChapterFour/0494.Target-Sum.md @@ -105,4 +105,11 @@ func dfsFindTargetSumWays(nums []int, index int, curSum int, S int, res *int, su dfsFindTargetSumWays(nums, index+1, curSum-nums[index], S, res, sums) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0496.Next-Greater-Element-I.md b/website/content/ChapterFour/0496.Next-Greater-Element-I.md index 2a62ef32..8d60eb23 100644 --- a/website/content/ChapterFour/0496.Next-Greater-Element-I.md +++ b/website/content/ChapterFour/0496.Next-Greater-Element-I.md @@ -77,4 +77,11 @@ func nextGreaterElement(nums1 []int, nums2 []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md b/website/content/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md index 97029b4b..6819448c 100755 --- a/website/content/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md +++ b/website/content/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md @@ -131,4 +131,11 @@ func (so *Solution497) Pick() []int { * param_1 := obj.Pick(); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0498.Diagonal-Traverse.md b/website/content/ChapterFour/0498.Diagonal-Traverse.md index f28348a6..b6d0739c 100755 --- a/website/content/ChapterFour/0498.Diagonal-Traverse.md +++ b/website/content/ChapterFour/0498.Diagonal-Traverse.md @@ -181,4 +181,11 @@ func addTraverse(matrix [][]int, i, j int, res *[]int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0500.Keyboard-Row.md b/website/content/ChapterFour/0500.Keyboard-Row.md index 6d6eda08..168b9370 100755 --- a/website/content/ChapterFour/0500.Keyboard-Row.md +++ b/website/content/ChapterFour/0500.Keyboard-Row.md @@ -59,4 +59,11 @@ func findWords500(words []string) []string { return output } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0503.Next-Greater-Element-II.md b/website/content/ChapterFour/0503.Next-Greater-Element-II.md index a8d5f46c..e9ff3ace 100644 --- a/website/content/ChapterFour/0503.Next-Greater-Element-II.md +++ b/website/content/ChapterFour/0503.Next-Greater-Element-II.md @@ -75,4 +75,11 @@ func nextGreaterElements1(nums []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0507.Perfect-Number.md b/website/content/ChapterFour/0507.Perfect-Number.md index 12d0c764..3092928a 100644 --- a/website/content/ChapterFour/0507.Perfect-Number.md +++ b/website/content/ChapterFour/0507.Perfect-Number.md @@ -61,4 +61,11 @@ func checkPerfectNumber_(num int) bool { return num == 6 || num == 28 || num == 496 || num == 8128 || num == 33550336 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0508.Most-Frequent-Subtree-Sum.md b/website/content/ChapterFour/0508.Most-Frequent-Subtree-Sum.md index 91c2a9a6..0b78939a 100755 --- a/website/content/ChapterFour/0508.Most-Frequent-Subtree-Sum.md +++ b/website/content/ChapterFour/0508.Most-Frequent-Subtree-Sum.md @@ -120,4 +120,11 @@ func findTreeSum(root *TreeNode, fre map[int]int) int { return val } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0509.Fibonacci-Number.md b/website/content/ChapterFour/0509.Fibonacci-Number.md index ee304607..baf08390 100755 --- a/website/content/ChapterFour/0509.Fibonacci-Number.md +++ b/website/content/ChapterFour/0509.Fibonacci-Number.md @@ -168,4 +168,11 @@ func fib5(N int) int { return int(math.Round(math.Pow(goldenRatio, float64(N)) / math.Sqrt(5))) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md b/website/content/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md index c4f7f083..4c6683c4 100755 --- a/website/content/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md +++ b/website/content/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md @@ -109,4 +109,11 @@ func findBottomLeftValue1(root *TreeNode) int { return 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md b/website/content/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md index 7cf9f303..cb60a179 100755 --- a/website/content/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md +++ b/website/content/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md @@ -90,4 +90,11 @@ func largestValues1(root *TreeNode) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0524.Longest-Word-in-Dictionary-through-Deleting.md b/website/content/ChapterFour/0524.Longest-Word-in-Dictionary-through-Deleting.md index d139890a..f9e5044a 100644 --- a/website/content/ChapterFour/0524.Longest-Word-in-Dictionary-through-Deleting.md +++ b/website/content/ChapterFour/0524.Longest-Word-in-Dictionary-through-Deleting.md @@ -73,4 +73,11 @@ func findLongestWord(s string, d []string) string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0526.Beautiful-Arrangement.md b/website/content/ChapterFour/0526.Beautiful-Arrangement.md index f9f005cd..5dee55d6 100755 --- a/website/content/ChapterFour/0526.Beautiful-Arrangement.md +++ b/website/content/ChapterFour/0526.Beautiful-Arrangement.md @@ -107,4 +107,11 @@ func checkDivisible(num, d int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0528.Random-Pick-with-Weight.md b/website/content/ChapterFour/0528.Random-Pick-with-Weight.md index 53733f3b..ce18b24e 100755 --- a/website/content/ChapterFour/0528.Random-Pick-with-Weight.md +++ b/website/content/ChapterFour/0528.Random-Pick-with-Weight.md @@ -105,4 +105,11 @@ func (so *Solution528) PickIndex() int { * param_1 := obj.PickIndex(); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0529.Minesweeper.md b/website/content/ChapterFour/0529.Minesweeper.md index f2166a69..d1b7ed79 100644 --- a/website/content/ChapterFour/0529.Minesweeper.md +++ b/website/content/ChapterFour/0529.Minesweeper.md @@ -142,4 +142,11 @@ func mineSweeper(x, y int, board [][]byte, mineMap [][]int, dir8 [][]int) { } } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0532.K-diff-Pairs-in-an-Array.md b/website/content/ChapterFour/0532.K-diff-Pairs-in-an-Array.md index 20aa2889..ff546c26 100644 --- a/website/content/ChapterFour/0532.K-diff-Pairs-in-an-Array.md +++ b/website/content/ChapterFour/0532.K-diff-Pairs-in-an-Array.md @@ -92,4 +92,11 @@ func findPairs(nums []int, k int) int { return count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0537.Complex-Number-Multiplication.md b/website/content/ChapterFour/0537.Complex-Number-Multiplication.md index 568404ba..6f0c11bb 100644 --- a/website/content/ChapterFour/0537.Complex-Number-Multiplication.md +++ b/website/content/ChapterFour/0537.Complex-Number-Multiplication.md @@ -70,4 +70,11 @@ func parse(s string) (int, int) { return r, i } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0541.Reverse-String-II.md b/website/content/ChapterFour/0541.Reverse-String-II.md index e95c1d9c..6c2c50c9 100755 --- a/website/content/ChapterFour/0541.Reverse-String-II.md +++ b/website/content/ChapterFour/0541.Reverse-String-II.md @@ -53,4 +53,11 @@ func reverseStr(s string, k int) string { return s } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0542.01-Matrix.md b/website/content/ChapterFour/0542.01-Matrix.md index deb16e4c..5dc0b0b3 100755 --- a/website/content/ChapterFour/0542.01-Matrix.md +++ b/website/content/ChapterFour/0542.01-Matrix.md @@ -199,4 +199,11 @@ func updateMatrixDP(matrix [][]int) [][]int { return matrix } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0547.Number-of-Provinces.md b/website/content/ChapterFour/0547.Number-of-Provinces.md index 2cc6c178..727eaa16 100755 --- a/website/content/ChapterFour/0547.Number-of-Provinces.md +++ b/website/content/ChapterFour/0547.Number-of-Provinces.md @@ -108,4 +108,11 @@ func dfs547(M [][]int, cur int, visited []bool) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0557.Reverse-Words-in-a-String-III.md b/website/content/ChapterFour/0557.Reverse-Words-in-a-String-III.md index 68363ed8..91251032 100755 --- a/website/content/ChapterFour/0557.Reverse-Words-in-a-String-III.md +++ b/website/content/ChapterFour/0557.Reverse-Words-in-a-String-III.md @@ -54,4 +54,11 @@ func revers(s string) string { return string(bytes) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0561.Array-Partition-I.md b/website/content/ChapterFour/0561.Array-Partition-I.md index d72ea633..0b146a5a 100644 --- a/website/content/ChapterFour/0561.Array-Partition-I.md +++ b/website/content/ChapterFour/0561.Array-Partition-I.md @@ -55,4 +55,11 @@ func arrayPairSum(nums []int) int { return sum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0563.Binary-Tree-Tilt.md b/website/content/ChapterFour/0563.Binary-Tree-Tilt.md index b5a8ce5c..23bdf2ab 100755 --- a/website/content/ChapterFour/0563.Binary-Tree-Tilt.md +++ b/website/content/ChapterFour/0563.Binary-Tree-Tilt.md @@ -80,4 +80,11 @@ func findTiltDFS(root *TreeNode, sum *int) int { return root.Val + left + right } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0566.Reshape-the-Matrix.md b/website/content/ChapterFour/0566.Reshape-the-Matrix.md index a55a7028..694ab4b7 100755 --- a/website/content/ChapterFour/0566.Reshape-the-Matrix.md +++ b/website/content/ChapterFour/0566.Reshape-the-Matrix.md @@ -99,4 +99,11 @@ func reshape(nums [][]int, r, c int) [][]int { return newShape } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0567.Permutation-in-String.md b/website/content/ChapterFour/0567.Permutation-in-String.md index e2e9d17a..a17623c4 100644 --- a/website/content/ChapterFour/0567.Permutation-in-String.md +++ b/website/content/ChapterFour/0567.Permutation-in-String.md @@ -84,4 +84,11 @@ func checkInclusion(s1 string, s2 string) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0572.Subtree-of-Another-Tree.md b/website/content/ChapterFour/0572.Subtree-of-Another-Tree.md index 21611c12..38df9747 100755 --- a/website/content/ChapterFour/0572.Subtree-of-Another-Tree.md +++ b/website/content/ChapterFour/0572.Subtree-of-Another-Tree.md @@ -84,4 +84,11 @@ func isSubtree(s *TreeNode, t *TreeNode) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0575.Distribute-Candies.md b/website/content/ChapterFour/0575.Distribute-Candies.md index 4e329936..98421846 100755 --- a/website/content/ChapterFour/0575.Distribute-Candies.md +++ b/website/content/ChapterFour/0575.Distribute-Candies.md @@ -56,4 +56,11 @@ func distributeCandies(candies []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0594.Longest-Harmonious-Subsequence.md b/website/content/ChapterFour/0594.Longest-Harmonious-Subsequence.md index 380ad65a..e580f1b8 100755 --- a/website/content/ChapterFour/0594.Longest-Harmonious-Subsequence.md +++ b/website/content/ChapterFour/0594.Longest-Harmonious-Subsequence.md @@ -54,4 +54,11 @@ func findLHS(nums []int) int { return longest } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0598.Range-Addition-II.md b/website/content/ChapterFour/0598.Range-Addition-II.md index a4606f95..2629104d 100644 --- a/website/content/ChapterFour/0598.Range-Addition-II.md +++ b/website/content/ChapterFour/0598.Range-Addition-II.md @@ -79,4 +79,11 @@ func min(a, b int) int { return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0599.Minimum-Index-Sum-of-Two-Lists.md b/website/content/ChapterFour/0599.Minimum-Index-Sum-of-Two-Lists.md index 01cc155e..98bedc57 100755 --- a/website/content/ChapterFour/0599.Minimum-Index-Sum-of-Two-Lists.md +++ b/website/content/ChapterFour/0599.Minimum-Index-Sum-of-Two-Lists.md @@ -74,4 +74,11 @@ func findRestaurant(list1 []string, list2 []string) []string { return ans } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0605.Can-Place-Flowers.md b/website/content/ChapterFour/0605.Can-Place-Flowers.md index 1c8b09ba..c873052e 100644 --- a/website/content/ChapterFour/0605.Can-Place-Flowers.md +++ b/website/content/ChapterFour/0605.Can-Place-Flowers.md @@ -57,4 +57,11 @@ func canPlaceFlowers(flowerbed []int, n int) bool { } return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md b/website/content/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md index c51411ad..890a736d 100755 --- a/website/content/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md +++ b/website/content/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md @@ -93,4 +93,11 @@ func maximumProduct1(nums []int) int { return n1 * n4 * n5 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md b/website/content/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md index b1187be9..9b77ea7e 100755 --- a/website/content/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md +++ b/website/content/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md @@ -110,4 +110,11 @@ func (p SortByVal) Less(i, j int) bool { return p.elements[i].val < p.elements[j].val } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0633.Sum-of-Square-Numbers.md b/website/content/ChapterFour/0633.Sum-of-Square-Numbers.md index 545036a1..5db9b22e 100755 --- a/website/content/ChapterFour/0633.Sum-of-Square-Numbers.md +++ b/website/content/ChapterFour/0633.Sum-of-Square-Numbers.md @@ -50,4 +50,11 @@ func judgeSquareSum(c int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0636.Exclusive-Time-of-Functions.md b/website/content/ChapterFour/0636.Exclusive-Time-of-Functions.md index 71458a89..49ebc64a 100755 --- a/website/content/ChapterFour/0636.Exclusive-Time-of-Functions.md +++ b/website/content/ChapterFour/0636.Exclusive-Time-of-Functions.md @@ -97,4 +97,11 @@ func exclusiveTime(n int, logs []string) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md b/website/content/ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md index 34b0c41a..494e17b3 100644 --- a/website/content/ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md +++ b/website/content/ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md @@ -82,4 +82,11 @@ func averageOfLevels(root *TreeNode) []float64 { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0638.Shopping-Offers.md b/website/content/ChapterFour/0638.Shopping-Offers.md index cf389acb..e139c7b8 100644 --- a/website/content/ChapterFour/0638.Shopping-Offers.md +++ b/website/content/ChapterFour/0638.Shopping-Offers.md @@ -126,4 +126,11 @@ func dfsShoppingOffers(price []int, special [][]int, needs []int, pay int, res * dfsShoppingOffers(price, special[1:], newNeeds, pay+special[0][len(price)], res) dfsShoppingOffers(price, special[1:], needs, pay, res) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0645.Set-Mismatch.md b/website/content/ChapterFour/0645.Set-Mismatch.md index 9236fd4c..389004d7 100755 --- a/website/content/ChapterFour/0645.Set-Mismatch.md +++ b/website/content/ChapterFour/0645.Set-Mismatch.md @@ -59,4 +59,11 @@ func findErrorNums(nums []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0648.Replace-Words.md b/website/content/ChapterFour/0648.Replace-Words.md index 17614c9c..d47adb84 100755 --- a/website/content/ChapterFour/0648.Replace-Words.md +++ b/website/content/ChapterFour/0648.Replace-Words.md @@ -108,4 +108,11 @@ func replaceWords1(dict []string, sentence string) string { return strings.Join(result, " ") } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0653.Two-Sum-IV---Input-is-a-BST.md b/website/content/ChapterFour/0653.Two-Sum-IV---Input-is-a-BST.md index e203db03..bf1681f0 100755 --- a/website/content/ChapterFour/0653.Two-Sum-IV---Input-is-a-BST.md +++ b/website/content/ChapterFour/0653.Two-Sum-IV---Input-is-a-BST.md @@ -72,4 +72,11 @@ func findTargetDFS(root *TreeNode, k int, m map[int]int) bool { return findTargetDFS(root.Left, k, m) || findTargetDFS(root.Right, k, m) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0658.Find-K-Closest-Elements.md b/website/content/ChapterFour/0658.Find-K-Closest-Elements.md index b55ced18..cc6ea000 100755 --- a/website/content/ChapterFour/0658.Find-K-Closest-Elements.md +++ b/website/content/ChapterFour/0658.Find-K-Closest-Elements.md @@ -79,4 +79,11 @@ func findClosestElements1(arr []int, k int, x int) []int { return arr[low : low+k] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0661.Image-Smoother.md b/website/content/ChapterFour/0661.Image-Smoother.md index 03fde6bf..898ac924 100644 --- a/website/content/ChapterFour/0661.Image-Smoother.md +++ b/website/content/ChapterFour/0661.Image-Smoother.md @@ -108,4 +108,11 @@ func smooth(x, y int, M [][]int) int { return sum / count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0662.Maximum-Width-of-Binary-Tree.md b/website/content/ChapterFour/0662.Maximum-Width-of-Binary-Tree.md index d60af025..00a6fb10 100755 --- a/website/content/ChapterFour/0662.Maximum-Width-of-Binary-Tree.md +++ b/website/content/ChapterFour/0662.Maximum-Width-of-Binary-Tree.md @@ -149,4 +149,11 @@ func widthOfBinaryTree(root *TreeNode) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0668.Kth-Smallest-Number-in-Multiplication-Table.md b/website/content/ChapterFour/0668.Kth-Smallest-Number-in-Multiplication-Table.md index 491973cb..6c2d2620 100755 --- a/website/content/ChapterFour/0668.Kth-Smallest-Number-in-Multiplication-Table.md +++ b/website/content/ChapterFour/0668.Kth-Smallest-Number-in-Multiplication-Table.md @@ -81,4 +81,11 @@ func counterKthNum(m, n, mid int) int { return count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0676.Implement-Magic-Dictionary.md b/website/content/ChapterFour/0676.Implement-Magic-Dictionary.md index 4ce7d05c..8633d427 100755 --- a/website/content/ChapterFour/0676.Implement-Magic-Dictionary.md +++ b/website/content/ChapterFour/0676.Implement-Magic-Dictionary.md @@ -84,4 +84,11 @@ func (this *MagicDictionary) Search(word string) bool { * param_2 := obj.Search(word); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0682.Baseball-Game.md b/website/content/ChapterFour/0682.Baseball-Game.md index 6f76fd35..447934fb 100644 --- a/website/content/ChapterFour/0682.Baseball-Game.md +++ b/website/content/ChapterFour/0682.Baseball-Game.md @@ -103,4 +103,11 @@ func calPoints(ops []string) int { return points } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0684.Redundant-Connection.md b/website/content/ChapterFour/0684.Redundant-Connection.md index 527d61be..5348b2b9 100755 --- a/website/content/ChapterFour/0684.Redundant-Connection.md +++ b/website/content/ChapterFour/0684.Redundant-Connection.md @@ -82,4 +82,11 @@ func findRedundantConnection(edges [][]int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0685.Redundant-Connection-II.md b/website/content/ChapterFour/0685.Redundant-Connection-II.md index d6436f4b..f96a97c7 100755 --- a/website/content/ChapterFour/0685.Redundant-Connection-II.md +++ b/website/content/ChapterFour/0685.Redundant-Connection-II.md @@ -107,4 +107,11 @@ func findRoot(parent *[]int, k int) int { return (*parent)[k] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0693.Binary-Number-with-Alternating-Bits.md b/website/content/ChapterFour/0693.Binary-Number-with-Alternating-Bits.md index 290e2cda..0a75d45c 100755 --- a/website/content/ChapterFour/0693.Binary-Number-with-Alternating-Bits.md +++ b/website/content/ChapterFour/0693.Binary-Number-with-Alternating-Bits.md @@ -77,4 +77,11 @@ func hasAlternatingBits1(n int) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0695.Max-Area-of-Island.md b/website/content/ChapterFour/0695.Max-Area-of-Island.md index 2419d561..6d5ee78a 100644 --- a/website/content/ChapterFour/0695.Max-Area-of-Island.md +++ b/website/content/ChapterFour/0695.Max-Area-of-Island.md @@ -74,4 +74,11 @@ func areaOfIsland(grid [][]int, x, y int) int { } return total } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0697.Degree-of-an-Array.md b/website/content/ChapterFour/0697.Degree-of-an-Array.md index ab032f5c..25cf311a 100644 --- a/website/content/ChapterFour/0697.Degree-of-an-Array.md +++ b/website/content/ChapterFour/0697.Degree-of-an-Array.md @@ -77,4 +77,11 @@ func findShortestSubArray(nums []int) int { return smallest } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0699.Falling-Squares.md b/website/content/ChapterFour/0699.Falling-Squares.md index a3228a87..7986f80e 100755 --- a/website/content/ChapterFour/0699.Falling-Squares.md +++ b/website/content/ChapterFour/0699.Falling-Squares.md @@ -142,4 +142,11 @@ func discretization(positions [][]int) map[int]int { return posMap } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0704.Binary-Search.md b/website/content/ChapterFour/0704.Binary-Search.md index b10293d9..ea9b82b3 100755 --- a/website/content/ChapterFour/0704.Binary-Search.md +++ b/website/content/ChapterFour/0704.Binary-Search.md @@ -64,4 +64,11 @@ func search704(nums []int, target int) int { return -1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0705.Design-HashSet.md b/website/content/ChapterFour/0705.Design-HashSet.md index d4d241f7..da4d3578 100755 --- a/website/content/ChapterFour/0705.Design-HashSet.md +++ b/website/content/ChapterFour/0705.Design-HashSet.md @@ -91,4 +91,11 @@ func (this *MyHashSet) Contains(key int) bool { * param_3 := obj.Contains(key); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0706.Design-HashMap.md b/website/content/ChapterFour/0706.Design-HashMap.md index 80146098..786c2cab 100755 --- a/website/content/ChapterFour/0706.Design-HashMap.md +++ b/website/content/ChapterFour/0706.Design-HashMap.md @@ -148,4 +148,11 @@ func (this *MyHashMap) Hash(value int) int { * obj.Remove(key); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0707.Design-Linked-List.md b/website/content/ChapterFour/0707.Design-Linked-List.md index c014e9e6..6930dd2f 100644 --- a/website/content/ChapterFour/0707.Design-Linked-List.md +++ b/website/content/ChapterFour/0707.Design-Linked-List.md @@ -137,4 +137,11 @@ func (this *MyLinkedList) DeleteAtIndex(index int) { * obj.DeleteAtIndex(index); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0710.Random-Pick-with-Blacklist.md b/website/content/ChapterFour/0710.Random-Pick-with-Blacklist.md index d796e1e7..8622e8ed 100644 --- a/website/content/ChapterFour/0710.Random-Pick-with-Blacklist.md +++ b/website/content/ChapterFour/0710.Random-Pick-with-Blacklist.md @@ -142,4 +142,11 @@ func (this *Solution) Pick() int { * param_1 := obj.Pick(); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0713.Subarray-Product-Less-Than-K.md b/website/content/ChapterFour/0713.Subarray-Product-Less-Than-K.md index f5afc7d1..47182853 100644 --- a/website/content/ChapterFour/0713.Subarray-Product-Less-Than-K.md +++ b/website/content/ChapterFour/0713.Subarray-Product-Less-Than-K.md @@ -62,4 +62,11 @@ func numSubarrayProductLessThanK(nums []int, k int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md b/website/content/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md index 7bf23833..9a4f62fb 100755 --- a/website/content/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md +++ b/website/content/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md @@ -77,4 +77,11 @@ func maxProfit714_1(prices []int, fee int) int { return sell } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0715.Range-Module.md b/website/content/ChapterFour/0715.Range-Module.md index acd40364..80b3a39b 100755 --- a/website/content/ChapterFour/0715.Range-Module.md +++ b/website/content/ChapterFour/0715.Range-Module.md @@ -267,4 +267,11 @@ func query(node *SegmentTreeNode, start, end int) bool { * obj.RemoveRange(left,right); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0717.1-bit-and-2-bit-Characters.md b/website/content/ChapterFour/0717.1-bit-and-2-bit-Characters.md index 49988924..82de8dfc 100755 --- a/website/content/ChapterFour/0717.1-bit-and-2-bit-Characters.md +++ b/website/content/ChapterFour/0717.1-bit-and-2-bit-Characters.md @@ -62,4 +62,11 @@ func isOneBitCharacter(bits []int) bool { return i == len(bits)-1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md b/website/content/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md index eec248fe..211ef777 100755 --- a/website/content/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md +++ b/website/content/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md @@ -120,4 +120,11 @@ func findLength1(A []int, B []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md b/website/content/ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md index 836b8922..d529b244 100755 --- a/website/content/ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md +++ b/website/content/ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md @@ -94,4 +94,11 @@ func findDistanceCount1(nums []int, num int) int { return count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0720.Longest-Word-in-Dictionary.md b/website/content/ChapterFour/0720.Longest-Word-in-Dictionary.md index 8a70177f..27b9c7a1 100755 --- a/website/content/ChapterFour/0720.Longest-Word-in-Dictionary.md +++ b/website/content/ChapterFour/0720.Longest-Word-in-Dictionary.md @@ -69,4 +69,11 @@ func longestWord(words []string) string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0721.Accounts-Merge.md b/website/content/ChapterFour/0721.Accounts-Merge.md index 352343d9..42c63ba1 100755 --- a/website/content/ChapterFour/0721.Accounts-Merge.md +++ b/website/content/ChapterFour/0721.Accounts-Merge.md @@ -146,4 +146,11 @@ func accountsMerge1(accounts [][]string) [][]string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0724.Find-Pivot-Index.md b/website/content/ChapterFour/0724.Find-Pivot-Index.md index 1e93cf47..5360bf54 100644 --- a/website/content/ChapterFour/0724.Find-Pivot-Index.md +++ b/website/content/ChapterFour/0724.Find-Pivot-Index.md @@ -72,3 +72,10 @@ func pivotIndex(nums []int) int { } ``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0725.Split-Linked-List-in-Parts.md b/website/content/ChapterFour/0725.Split-Linked-List-in-Parts.md index 6c7fdf87..7bc0e10e 100644 --- a/website/content/ChapterFour/0725.Split-Linked-List-in-Parts.md +++ b/website/content/ChapterFour/0725.Split-Linked-List-in-Parts.md @@ -139,4 +139,11 @@ func getLength(l *ListNode) int { return count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0726.Number-of-Atoms.md b/website/content/ChapterFour/0726.Number-of-Atoms.md index a9d3cf4a..a885505c 100755 --- a/website/content/ChapterFour/0726.Number-of-Atoms.md +++ b/website/content/ChapterFour/0726.Number-of-Atoms.md @@ -183,4 +183,11 @@ func isLowerLetter(v byte) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0729.My-Calendar-I.md b/website/content/ChapterFour/0729.My-Calendar-I.md index bc957aba..15bb691d 100755 --- a/website/content/ChapterFour/0729.My-Calendar-I.md +++ b/website/content/ChapterFour/0729.My-Calendar-I.md @@ -177,4 +177,11 @@ func (this *MyCalendar) Book(start int, end int) bool { * param_1 := obj.Book(start,end); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0732.My-Calendar-III.md b/website/content/ChapterFour/0732.My-Calendar-III.md index 5b953911..16114138 100755 --- a/website/content/ChapterFour/0732.My-Calendar-III.md +++ b/website/content/ChapterFour/0732.My-Calendar-III.md @@ -139,4 +139,11 @@ func (st *SegmentTree732) book(start, end int, maxHeight *int) { * param_1 := obj.Book(start,end); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0733.Flood-Fill.md b/website/content/ChapterFour/0733.Flood-Fill.md index 8fd2bba3..b66a77a7 100755 --- a/website/content/ChapterFour/0733.Flood-Fill.md +++ b/website/content/ChapterFour/0733.Flood-Fill.md @@ -78,4 +78,11 @@ func dfs733(image [][]int, x, y int, newColor int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0735.Asteroid-Collision.md b/website/content/ChapterFour/0735.Asteroid-Collision.md index 2db71447..a9933fdb 100644 --- a/website/content/ChapterFour/0735.Asteroid-Collision.md +++ b/website/content/ChapterFour/0735.Asteroid-Collision.md @@ -102,4 +102,11 @@ func asteroidCollision(asteroids []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0739.Daily-Temperatures.md b/website/content/ChapterFour/0739.Daily-Temperatures.md index 9fef4be8..514474e8 100644 --- a/website/content/ChapterFour/0739.Daily-Temperatures.md +++ b/website/content/ChapterFour/0739.Daily-Temperatures.md @@ -56,4 +56,11 @@ func dailyTemperatures1(T []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0744.Find-Smallest-Letter-Greater-Than-Target.md b/website/content/ChapterFour/0744.Find-Smallest-Letter-Greater-Than-Target.md index fc6e6208..da03eb56 100755 --- a/website/content/ChapterFour/0744.Find-Smallest-Letter-Greater-Than-Target.md +++ b/website/content/ChapterFour/0744.Find-Smallest-Letter-Greater-Than-Target.md @@ -89,4 +89,11 @@ func nextGreatestLetter(letters []byte, target byte) byte { return find } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0745.Prefix-and-Suffix-Search.md b/website/content/ChapterFour/0745.Prefix-and-Suffix-Search.md index 705aa217..fef5fe50 100755 --- a/website/content/ChapterFour/0745.Prefix-and-Suffix-Search.md +++ b/website/content/ChapterFour/0745.Prefix-and-Suffix-Search.md @@ -95,4 +95,11 @@ func (this *WordFilter_) F_(prefix string, suffix string) int { * param_1 := obj.F(prefix,suffix); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0746.Min-Cost-Climbing-Stairs.md b/website/content/ChapterFour/0746.Min-Cost-Climbing-Stairs.md index 2abd334b..b7616f0b 100755 --- a/website/content/ChapterFour/0746.Min-Cost-Climbing-Stairs.md +++ b/website/content/ChapterFour/0746.Min-Cost-Climbing-Stairs.md @@ -68,4 +68,11 @@ func minCostClimbingStairs1(cost []int) int { return last } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0748.Shortest-Completing-Word.md b/website/content/ChapterFour/0748.Shortest-Completing-Word.md index ec0267e3..8f2cb3a5 100755 --- a/website/content/ChapterFour/0748.Shortest-Completing-Word.md +++ b/website/content/ChapterFour/0748.Shortest-Completing-Word.md @@ -99,4 +99,11 @@ func match(lp [26]int, w string) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0753.Cracking-the-Safe.md b/website/content/ChapterFour/0753.Cracking-the-Safe.md index 39c79a48..63567a9f 100644 --- a/website/content/ChapterFour/0753.Cracking-the-Safe.md +++ b/website/content/ChapterFour/0753.Cracking-the-Safe.md @@ -89,4 +89,11 @@ func dfsCrackSafe(depth, n, k int, str *[]byte, visit *map[string]bool) bool { } return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0756.Pyramid-Transition-Matrix.md b/website/content/ChapterFour/0756.Pyramid-Transition-Matrix.md index 1b158131..b3042ed5 100755 --- a/website/content/ChapterFour/0756.Pyramid-Transition-Matrix.md +++ b/website/content/ChapterFour/0756.Pyramid-Transition-Matrix.md @@ -89,4 +89,11 @@ func dfsT(bottom, above string, pyramid map[string][]string) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md b/website/content/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md index 8c01e90f..fcfb1d5c 100755 --- a/website/content/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md +++ b/website/content/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md @@ -75,4 +75,11 @@ func isPrime(x int) bool { return x == 2 || x == 3 || x == 5 || x == 7 || x == 11 || x == 13 || x == 17 || x == 19 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0763.Partition-Labels.md b/website/content/ChapterFour/0763.Partition-Labels.md index 76bf1b3f..e5273f5e 100644 --- a/website/content/ChapterFour/0763.Partition-Labels.md +++ b/website/content/ChapterFour/0763.Partition-Labels.md @@ -89,4 +89,11 @@ func partitionLabels1(S string) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0765.Couples-Holding-Hands.md b/website/content/ChapterFour/0765.Couples-Holding-Hands.md index 035512fe..65a08a69 100755 --- a/website/content/ChapterFour/0765.Couples-Holding-Hands.md +++ b/website/content/ChapterFour/0765.Couples-Holding-Hands.md @@ -90,4 +90,11 @@ func minSwapsCouples(row []int) int { return len(row)/2 - uf.TotalCount() } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0766.Toeplitz-Matrix.md b/website/content/ChapterFour/0766.Toeplitz-Matrix.md index a595e632..e4f7e305 100755 --- a/website/content/ChapterFour/0766.Toeplitz-Matrix.md +++ b/website/content/ChapterFour/0766.Toeplitz-Matrix.md @@ -76,4 +76,11 @@ func isToeplitzMatrix(matrix [][]int) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0767.Reorganize-String.md b/website/content/ChapterFour/0767.Reorganize-String.md index 45388be3..60eb52c3 100644 --- a/website/content/ChapterFour/0767.Reorganize-String.md +++ b/website/content/ChapterFour/0767.Reorganize-String.md @@ -146,4 +146,11 @@ func frequencySort767(s string) string { return string(res) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0771.Jewels-and-Stones.md b/website/content/ChapterFour/0771.Jewels-and-Stones.md index e5490bed..e5322860 100755 --- a/website/content/ChapterFour/0771.Jewels-and-Stones.md +++ b/website/content/ChapterFour/0771.Jewels-and-Stones.md @@ -71,4 +71,11 @@ func numJewelsInStones1(J string, S string) int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0778.Swim-in-Rising-Water.md b/website/content/ChapterFour/0778.Swim-in-Rising-Water.md index 7153069f..dbb2414b 100755 --- a/website/content/ChapterFour/0778.Swim-in-Rising-Water.md +++ b/website/content/ChapterFour/0778.Swim-in-Rising-Water.md @@ -129,4 +129,11 @@ func swimInWater1(grid [][]int) int { return res - 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0781.Rabbits-in-Forest.md b/website/content/ChapterFour/0781.Rabbits-in-Forest.md index 61aa4555..5ec3870d 100755 --- a/website/content/ChapterFour/0781.Rabbits-in-Forest.md +++ b/website/content/ChapterFour/0781.Rabbits-in-Forest.md @@ -66,4 +66,11 @@ func numRabbits(ans []int) int { return total } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0784.Letter-Case-Permutation.md b/website/content/ChapterFour/0784.Letter-Case-Permutation.md index 323b4e63..18f870a0 100755 --- a/website/content/ChapterFour/0784.Letter-Case-Permutation.md +++ b/website/content/ChapterFour/0784.Letter-Case-Permutation.md @@ -117,4 +117,11 @@ func toUpper(s string, i int) string { return string(b) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0785.Is-Graph-Bipartite.md b/website/content/ChapterFour/0785.Is-Graph-Bipartite.md index 2eb2e5d1..f595b55e 100644 --- a/website/content/ChapterFour/0785.Is-Graph-Bipartite.md +++ b/website/content/ChapterFour/0785.Is-Graph-Bipartite.md @@ -95,4 +95,11 @@ func dfs(n int, graph [][]int, colors []int, parentCol int) bool { } return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0786.K-th-Smallest-Prime-Fraction.md b/website/content/ChapterFour/0786.K-th-Smallest-Prime-Fraction.md index 9646d5af..17203613 100755 --- a/website/content/ChapterFour/0786.K-th-Smallest-Prime-Fraction.md +++ b/website/content/ChapterFour/0786.K-th-Smallest-Prime-Fraction.md @@ -116,4 +116,11 @@ func (a SortByFraction) Less(i, j int) bool { return a[i].molecule*a[j].denominator < a[j].molecule*a[i].denominator } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md b/website/content/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md index b784e046..28bfeba4 100755 --- a/website/content/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md +++ b/website/content/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md @@ -103,4 +103,11 @@ func preimageSizeFZF1(K int) int { return 5 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0802.Find-Eventual-Safe-States.md b/website/content/ChapterFour/0802.Find-Eventual-Safe-States.md index f6879f30..af127111 100644 --- a/website/content/ChapterFour/0802.Find-Eventual-Safe-States.md +++ b/website/content/ChapterFour/0802.Find-Eventual-Safe-States.md @@ -70,4 +70,11 @@ func dfsEventualSafeNodes(graph [][]int, idx int, color []int) bool { color[idx] = 2 return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0803.Bricks-Falling-When-Hit.md b/website/content/ChapterFour/0803.Bricks-Falling-When-Hit.md index 6f5335ed..c08b8ab8 100755 --- a/website/content/ChapterFour/0803.Bricks-Falling-When-Hit.md +++ b/website/content/ChapterFour/0803.Bricks-Falling-When-Hit.md @@ -122,4 +122,11 @@ func getUnionFindFromGrid(grid [][]int, x, y int, uf template.UnionFindCount) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0811.Subdomain-Visit-Count.md b/website/content/ChapterFour/0811.Subdomain-Visit-Count.md index 69840bd9..d2eda349 100755 --- a/website/content/ChapterFour/0811.Subdomain-Visit-Count.md +++ b/website/content/ChapterFour/0811.Subdomain-Visit-Count.md @@ -140,4 +140,11 @@ func splitDomain(domain string, domains map[string]int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0812.Largest-Triangle-Area.md b/website/content/ChapterFour/0812.Largest-Triangle-Area.md index 426826f1..81ea3077 100644 --- a/website/content/ChapterFour/0812.Largest-Triangle-Area.md +++ b/website/content/ChapterFour/0812.Largest-Triangle-Area.md @@ -67,4 +67,11 @@ func max(a, b float64) float64 { return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0815.Bus-Routes.md b/website/content/ChapterFour/0815.Bus-Routes.md index bddbd3b0..18b747b2 100755 --- a/website/content/ChapterFour/0815.Bus-Routes.md +++ b/website/content/ChapterFour/0815.Bus-Routes.md @@ -85,4 +85,11 @@ func numBusesToDestination(routes [][]int, S int, T int) int { return -1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0817.Linked-List-Components.md b/website/content/ChapterFour/0817.Linked-List-Components.md index a0415371..4b49383b 100644 --- a/website/content/ChapterFour/0817.Linked-List-Components.md +++ b/website/content/ChapterFour/0817.Linked-List-Components.md @@ -106,4 +106,11 @@ func toMap(G []int) map[int]int { return GMap } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0819.Most-Common-Word.md b/website/content/ChapterFour/0819.Most-Common-Word.md index e37b45ee..307a2044 100755 --- a/website/content/ChapterFour/0819.Most-Common-Word.md +++ b/website/content/ChapterFour/0819.Most-Common-Word.md @@ -86,4 +86,11 @@ func mostCommonWord(paragraph string, banned []string) string { return mostFreqWord } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0826.Most-Profit-Assigning-Work.md b/website/content/ChapterFour/0826.Most-Profit-Assigning-Work.md index 33059b95..4e49558d 100644 --- a/website/content/ChapterFour/0826.Most-Profit-Assigning-Work.md +++ b/website/content/ChapterFour/0826.Most-Profit-Assigning-Work.md @@ -104,4 +104,11 @@ func maxProfitAssignment(difficulty []int, profit []int, worker []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md b/website/content/ChapterFour/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md index 23224a84..c60e35a1 100644 --- a/website/content/ChapterFour/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md +++ b/website/content/ChapterFour/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md @@ -98,4 +98,11 @@ func uniqueLetterString1(S string) int { } return res % mod } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0830.Positions-of-Large-Groups.md b/website/content/ChapterFour/0830.Positions-of-Large-Groups.md index 02736a18..3fdced6d 100644 --- a/website/content/ChapterFour/0830.Positions-of-Large-Groups.md +++ b/website/content/ChapterFour/0830.Positions-of-Large-Groups.md @@ -77,4 +77,11 @@ func largeGroupPositions(S string) [][]int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0832.Flipping-an-Image.md b/website/content/ChapterFour/0832.Flipping-an-Image.md index 81b8ccc9..50bf028f 100644 --- a/website/content/ChapterFour/0832.Flipping-an-Image.md +++ b/website/content/ChapterFour/0832.Flipping-an-Image.md @@ -60,4 +60,11 @@ func flipAndInvertImage(A [][]int) [][]int { return A } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0834.Sum-of-Distances-in-Tree.md b/website/content/ChapterFour/0834.Sum-of-Distances-in-Tree.md index b0390a4a..d6a010e8 100755 --- a/website/content/ChapterFour/0834.Sum-of-Distances-in-Tree.md +++ b/website/content/ChapterFour/0834.Sum-of-Distances-in-Tree.md @@ -98,4 +98,11 @@ func deepSecondSearch(root int, visited []bool, count, res []int, tree [][]int) } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0836.Rectangle-Overlap.md b/website/content/ChapterFour/0836.Rectangle-Overlap.md index 2cce0169..986dda6e 100755 --- a/website/content/ChapterFour/0836.Rectangle-Overlap.md +++ b/website/content/ChapterFour/0836.Rectangle-Overlap.md @@ -51,4 +51,11 @@ func isRectangleOverlap(rec1 []int, rec2 []int) bool { return rec1[0] < rec2[2] && rec2[0] < rec1[2] && rec1[1] < rec2[3] && rec2[1] < rec1[3] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0838.Push-Dominoes.md b/website/content/ChapterFour/0838.Push-Dominoes.md index 7acc9ce5..548a2bac 100644 --- a/website/content/ChapterFour/0838.Push-Dominoes.md +++ b/website/content/ChapterFour/0838.Push-Dominoes.md @@ -141,4 +141,11 @@ func pushDominoes1(dominoes string) string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0839.Similar-String-Groups.md b/website/content/ChapterFour/0839.Similar-String-Groups.md index 217ee2da..e1ad098b 100755 --- a/website/content/ChapterFour/0839.Similar-String-Groups.md +++ b/website/content/ChapterFour/0839.Similar-String-Groups.md @@ -95,4 +95,11 @@ func isSimilar(a, b string) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0841.Keys-and-Rooms.md b/website/content/ChapterFour/0841.Keys-and-Rooms.md index 69d1da3a..b7f3e74a 100644 --- a/website/content/ChapterFour/0841.Keys-and-Rooms.md +++ b/website/content/ChapterFour/0841.Keys-and-Rooms.md @@ -77,4 +77,11 @@ func dfsVisitAllRooms(es [][]int, visited map[int]bool, from int) { dfsVisitAllRooms(es, visited, to) } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md b/website/content/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md index 9bb286ec..6326d234 100755 --- a/website/content/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md +++ b/website/content/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md @@ -132,4 +132,11 @@ func findRecursiveCheck(S string, x1 int, x2 int, left int, res *[]int, isComple return } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0844.Backspace-String-Compare.md b/website/content/ChapterFour/0844.Backspace-String-Compare.md index fb758f3b..2ecbe11f 100644 --- a/website/content/ChapterFour/0844.Backspace-String-Compare.md +++ b/website/content/ChapterFour/0844.Backspace-String-Compare.md @@ -108,4 +108,11 @@ func backspaceCompare(S string, T string) bool { return string(s) == string(s2) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0845.Longest-Mountain-in-Array.md b/website/content/ChapterFour/0845.Longest-Mountain-in-Array.md index 0f44f673..9379ea68 100644 --- a/website/content/ChapterFour/0845.Longest-Mountain-in-Array.md +++ b/website/content/ChapterFour/0845.Longest-Mountain-in-Array.md @@ -88,4 +88,11 @@ func longestMountain(A []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0850.Rectangle-Area-II.md b/website/content/ChapterFour/0850.Rectangle-Area-II.md index 29dbe94e..149bcf13 100755 --- a/website/content/ChapterFour/0850.Rectangle-Area-II.md +++ b/website/content/ChapterFour/0850.Rectangle-Area-II.md @@ -290,4 +290,11 @@ func (sat *SegmentAreaTree) updateInTree(treeIndex, left, right, updateLeft, upd sat.pushUp(treeIndex, leftTreeIndex, rightTreeIndex) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0851.Loud-and-Rich.md b/website/content/ChapterFour/0851.Loud-and-Rich.md index 26351328..fbe44627 100644 --- a/website/content/ChapterFour/0851.Loud-and-Rich.md +++ b/website/content/ChapterFour/0851.Loud-and-Rich.md @@ -105,4 +105,11 @@ func loudAndRich(richer [][]int, quiet []int) []int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0852.Peak-Index-in-a-Mountain-Array.md b/website/content/ChapterFour/0852.Peak-Index-in-a-Mountain-Array.md index ea6ae942..0948ede4 100755 --- a/website/content/ChapterFour/0852.Peak-Index-in-a-Mountain-Array.md +++ b/website/content/ChapterFour/0852.Peak-Index-in-a-Mountain-Array.md @@ -88,4 +88,11 @@ func peakIndexInMountainArray1(A []int) int { return low } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0853.Car-Fleet.md b/website/content/ChapterFour/0853.Car-Fleet.md index b28efdbd..bb13b0d5 100755 --- a/website/content/ChapterFour/0853.Car-Fleet.md +++ b/website/content/ChapterFour/0853.Car-Fleet.md @@ -95,4 +95,11 @@ func carFleet(target int, position []int, speed []int) int { return fleet } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0856.Score-of-Parentheses.md b/website/content/ChapterFour/0856.Score-of-Parentheses.md index 9d5c8758..7c810458 100644 --- a/website/content/ChapterFour/0856.Score-of-Parentheses.md +++ b/website/content/ChapterFour/0856.Score-of-Parentheses.md @@ -99,4 +99,11 @@ func scoreOfParentheses(S string) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0862.Shortest-Subarray-with-Sum-at-Least-K.md b/website/content/ChapterFour/0862.Shortest-Subarray-with-Sum-at-Least-K.md index 469ca3bd..0bd92651 100644 --- a/website/content/ChapterFour/0862.Shortest-Subarray-with-Sum-at-Least-K.md +++ b/website/content/ChapterFour/0862.Shortest-Subarray-with-Sum-at-Least-K.md @@ -87,4 +87,11 @@ func shortestSubarray(A []int, K int) int { } return -1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md b/website/content/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md index 4ea32b20..c212698a 100644 --- a/website/content/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md +++ b/website/content/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md @@ -93,4 +93,11 @@ func findChild(root *TreeNode, K int, visit *[]int) { findChild(root.Right, K-1, visit) } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0864.Shortest-Path-to-Get-All-Keys.md b/website/content/ChapterFour/0864.Shortest-Path-to-Get-All-Keys.md index d6d65b49..b9dcafd7 100755 --- a/website/content/ChapterFour/0864.Shortest-Path-to-Get-All-Keys.md +++ b/website/content/ChapterFour/0864.Shortest-Path-to-Get-All-Keys.md @@ -228,4 +228,11 @@ func isKey(board [][]byte, x, y int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0867.Transpose-Matrix.md b/website/content/ChapterFour/0867.Transpose-Matrix.md index 379b9b25..b9a42775 100755 --- a/website/content/ChapterFour/0867.Transpose-Matrix.md +++ b/website/content/ChapterFour/0867.Transpose-Matrix.md @@ -54,4 +54,11 @@ func transpose(A [][]int) [][]int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0872.Leaf-Similar-Trees.md b/website/content/ChapterFour/0872.Leaf-Similar-Trees.md index 900b7e74..bce16f6b 100644 --- a/website/content/ChapterFour/0872.Leaf-Similar-Trees.md +++ b/website/content/ChapterFour/0872.Leaf-Similar-Trees.md @@ -59,4 +59,11 @@ func dfsLeaf(root *TreeNode, leaf *[]int) { dfsLeaf(root.Right, leaf) } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0875.Koko-Eating-Bananas.md b/website/content/ChapterFour/0875.Koko-Eating-Bananas.md index f2c7c411..7da578f7 100755 --- a/website/content/ChapterFour/0875.Koko-Eating-Bananas.md +++ b/website/content/ChapterFour/0875.Koko-Eating-Bananas.md @@ -98,4 +98,11 @@ func maxInArr(xs []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0876.Middle-of-the-Linked-List.md b/website/content/ChapterFour/0876.Middle-of-the-Linked-List.md index b9f801fd..e4532487 100644 --- a/website/content/ChapterFour/0876.Middle-of-the-Linked-List.md +++ b/website/content/ChapterFour/0876.Middle-of-the-Linked-List.md @@ -79,4 +79,11 @@ func middleNode(head *ListNode) *ListNode { return p1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0878.Nth-Magical-Number.md b/website/content/ChapterFour/0878.Nth-Magical-Number.md index d78c5ed9..7dc186cc 100755 --- a/website/content/ChapterFour/0878.Nth-Magical-Number.md +++ b/website/content/ChapterFour/0878.Nth-Magical-Number.md @@ -78,4 +78,11 @@ func calNthMagicalCount(num, a, b int64) int64 { return num/a + num/b - num/ab } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0880.Decoded-String-at-Index.md b/website/content/ChapterFour/0880.Decoded-String-at-Index.md index 96056438..e1f0e0b1 100644 --- a/website/content/ChapterFour/0880.Decoded-String-at-Index.md +++ b/website/content/ChapterFour/0880.Decoded-String-at-Index.md @@ -101,4 +101,11 @@ func decodeAtIndex(S string, K int) string { return "" } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0881.Boats-to-Save-People.md b/website/content/ChapterFour/0881.Boats-to-Save-People.md index 2af2b88d..a42fd693 100644 --- a/website/content/ChapterFour/0881.Boats-to-Save-People.md +++ b/website/content/ChapterFour/0881.Boats-to-Save-People.md @@ -87,4 +87,11 @@ func numRescueBoats(people []int, limit int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0884.Uncommon-Words-from-Two-Sentences.md b/website/content/ChapterFour/0884.Uncommon-Words-from-Two-Sentences.md index 66fc23b0..cf2505db 100755 --- a/website/content/ChapterFour/0884.Uncommon-Words-from-Two-Sentences.md +++ b/website/content/ChapterFour/0884.Uncommon-Words-from-Two-Sentences.md @@ -63,4 +63,11 @@ func uncommonFromSentences(A string, B string) []string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0885.Spiral-Matrix-III.md b/website/content/ChapterFour/0885.Spiral-Matrix-III.md index 0a80d2e0..9e57b2b0 100755 --- a/website/content/ChapterFour/0885.Spiral-Matrix-III.md +++ b/website/content/ChapterFour/0885.Spiral-Matrix-III.md @@ -81,4 +81,11 @@ func spiralMatrixIII(R int, C int, r0 int, c0 int) [][]int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0887.Super-Egg-Drop.md b/website/content/ChapterFour/0887.Super-Egg-Drop.md index a79b6085..486df343 100755 --- a/website/content/ChapterFour/0887.Super-Egg-Drop.md +++ b/website/content/ChapterFour/0887.Super-Egg-Drop.md @@ -152,4 +152,11 @@ func superEggDrop1(K int, N int) int { return step } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0888.Fair-Candy-Swap.md b/website/content/ChapterFour/0888.Fair-Candy-Swap.md index 79a2c2bc..5e805037 100644 --- a/website/content/ChapterFour/0888.Fair-Candy-Swap.md +++ b/website/content/ChapterFour/0888.Fair-Candy-Swap.md @@ -107,4 +107,11 @@ func max(a, b int) int { return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0891.Sum-of-Subsequence-Widths.md b/website/content/ChapterFour/0891.Sum-of-Subsequence-Widths.md index 9e5f0479..b8cf2e13 100644 --- a/website/content/ChapterFour/0891.Sum-of-Subsequence-Widths.md +++ b/website/content/ChapterFour/0891.Sum-of-Subsequence-Widths.md @@ -65,4 +65,11 @@ func sumSubseqWidths(A []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0892.Surface-Area-of-3D-Shapes.md b/website/content/ChapterFour/0892.Surface-Area-of-3D-Shapes.md index bcb6ad51..0ffd62dc 100644 --- a/website/content/ChapterFour/0892.Surface-Area-of-3D-Shapes.md +++ b/website/content/ChapterFour/0892.Surface-Area-of-3D-Shapes.md @@ -105,4 +105,11 @@ func min(a, b int) int { return a } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0895.Maximum-Frequency-Stack.md b/website/content/ChapterFour/0895.Maximum-Frequency-Stack.md index bd1c2060..776d3184 100644 --- a/website/content/ChapterFour/0895.Maximum-Frequency-Stack.md +++ b/website/content/ChapterFour/0895.Maximum-Frequency-Stack.md @@ -110,4 +110,11 @@ func (this *FreqStack) Pop() int { * param_2 := obj.Pop(); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0896.Monotonic-Array.md b/website/content/ChapterFour/0896.Monotonic-Array.md index afd6b08d..56eddaa0 100644 --- a/website/content/ChapterFour/0896.Monotonic-Array.md +++ b/website/content/ChapterFour/0896.Monotonic-Array.md @@ -96,4 +96,11 @@ func dec(A []int) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0897.Increasing-Order-Search-Tree.md b/website/content/ChapterFour/0897.Increasing-Order-Search-Tree.md index 44076d30..f0639a17 100755 --- a/website/content/ChapterFour/0897.Increasing-Order-Search-Tree.md +++ b/website/content/ChapterFour/0897.Increasing-Order-Search-Tree.md @@ -120,4 +120,11 @@ func inorder(root *TreeNode, output *[]int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md b/website/content/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md index 259871f1..c17418d4 100755 --- a/website/content/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md +++ b/website/content/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md @@ -140,4 +140,11 @@ func subarrayBitwiseORs1(A []int) int { return len(res) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0901.Online-Stock-Span.md b/website/content/ChapterFour/0901.Online-Stock-Span.md index 582fa43f..b85244d1 100644 --- a/website/content/ChapterFour/0901.Online-Stock-Span.md +++ b/website/content/ChapterFour/0901.Online-Stock-Span.md @@ -108,4 +108,11 @@ func (this *StockSpanner) Next(price int) int { * param_1 := obj.Next(price); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0904.Fruit-Into-Baskets.md b/website/content/ChapterFour/0904.Fruit-Into-Baskets.md index c3786ae7..95079e7f 100644 --- a/website/content/ChapterFour/0904.Fruit-Into-Baskets.md +++ b/website/content/ChapterFour/0904.Fruit-Into-Baskets.md @@ -112,4 +112,11 @@ func totalFruit(tree []int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0907.Sum-of-Subarray-Minimums.md b/website/content/ChapterFour/0907.Sum-of-Subarray-Minimums.md index 7c5374d4..21544292 100644 --- a/website/content/ChapterFour/0907.Sum-of-Subarray-Minimums.md +++ b/website/content/ChapterFour/0907.Sum-of-Subarray-Minimums.md @@ -121,4 +121,11 @@ func sumSubarrayMins2(A []int) int { return res % mod } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0910.Smallest-Range-II.md b/website/content/ChapterFour/0910.Smallest-Range-II.md index f7183454..82794f39 100644 --- a/website/content/ChapterFour/0910.Smallest-Range-II.md +++ b/website/content/ChapterFour/0910.Smallest-Range-II.md @@ -79,4 +79,11 @@ func min(a, b int) int { } return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0911.Online-Election.md b/website/content/ChapterFour/0911.Online-Election.md index 63a73bb6..eedcb5c8 100755 --- a/website/content/ChapterFour/0911.Online-Election.md +++ b/website/content/ChapterFour/0911.Online-Election.md @@ -96,4 +96,11 @@ func (tvc *TopVotedCandidate) Q(t int) int { * param_1 := obj.Q(t); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0914.X-of-a-Kind-in-a-Deck-of-Cards.md b/website/content/ChapterFour/0914.X-of-a-Kind-in-a-Deck-of-Cards.md index 02c8ebdd..8c1ad0f3 100644 --- a/website/content/ChapterFour/0914.X-of-a-Kind-in-a-Deck-of-Cards.md +++ b/website/content/ChapterFour/0914.X-of-a-Kind-in-a-Deck-of-Cards.md @@ -102,4 +102,11 @@ func gcd(a, b int) int { return gcd(b%a, a) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0918.Maximum-Sum-Circular-Subarray.md b/website/content/ChapterFour/0918.Maximum-Sum-Circular-Subarray.md index 1b60e16e..6f2526d7 100755 --- a/website/content/ChapterFour/0918.Maximum-Sum-Circular-Subarray.md +++ b/website/content/ChapterFour/0918.Maximum-Sum-Circular-Subarray.md @@ -98,4 +98,11 @@ func kadane(a []int) int { return maxSoFar } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0920.Number-of-Music-Playlists.md b/website/content/ChapterFour/0920.Number-of-Music-Playlists.md index b0efa478..e339361e 100755 --- a/website/content/ChapterFour/0920.Number-of-Music-Playlists.md +++ b/website/content/ChapterFour/0920.Number-of-Music-Playlists.md @@ -82,4 +82,11 @@ func numMusicPlaylists(N int, L int, K int) int { return dp[L][N] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0921.Minimum-Add-to-Make-Parentheses-Valid.md b/website/content/ChapterFour/0921.Minimum-Add-to-Make-Parentheses-Valid.md index 8952fe95..d634ca3d 100644 --- a/website/content/ChapterFour/0921.Minimum-Add-to-Make-Parentheses-Valid.md +++ b/website/content/ChapterFour/0921.Minimum-Add-to-Make-Parentheses-Valid.md @@ -85,4 +85,11 @@ func minAddToMakeValid(S string) int { return len(stack) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0922.Sort-Array-By-Parity-II.md b/website/content/ChapterFour/0922.Sort-Array-By-Parity-II.md index ca915fd9..1b315cbb 100644 --- a/website/content/ChapterFour/0922.Sort-Array-By-Parity-II.md +++ b/website/content/ChapterFour/0922.Sort-Array-By-Parity-II.md @@ -58,4 +58,11 @@ func sortArrayByParityII(A []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0923.3Sum-With-Multiplicity.md b/website/content/ChapterFour/0923.3Sum-With-Multiplicity.md index 0673f0de..b10b767f 100644 --- a/website/content/ChapterFour/0923.3Sum-With-Multiplicity.md +++ b/website/content/ChapterFour/0923.3Sum-With-Multiplicity.md @@ -99,4 +99,11 @@ func threeSumMulti(A []int, target int) int { return res % mod } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0924.Minimize-Malware-Spread.md b/website/content/ChapterFour/0924.Minimize-Malware-Spread.md index ce5c8970..3b4fb596 100755 --- a/website/content/ChapterFour/0924.Minimize-Malware-Spread.md +++ b/website/content/ChapterFour/0924.Minimize-Malware-Spread.md @@ -102,4 +102,11 @@ func minMalwareSpread(graph [][]int, initial []int) int { return minIndex } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0925.Long-Pressed-Name.md b/website/content/ChapterFour/0925.Long-Pressed-Name.md index fb33cbd9..4025899b 100644 --- a/website/content/ChapterFour/0925.Long-Pressed-Name.md +++ b/website/content/ChapterFour/0925.Long-Pressed-Name.md @@ -104,4 +104,11 @@ func isLongPressedName(name string, typed string) bool { return i == len(name) && j == len(typed) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0927.Three-Equal-Parts.md b/website/content/ChapterFour/0927.Three-Equal-Parts.md index 311b8c49..d0f0979e 100755 --- a/website/content/ChapterFour/0927.Three-Equal-Parts.md +++ b/website/content/ChapterFour/0927.Three-Equal-Parts.md @@ -110,4 +110,11 @@ func threeEqualParts(A []int) []int { return []int{-1, -1} } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0928.Minimize-Malware-Spread-II.md b/website/content/ChapterFour/0928.Minimize-Malware-Spread-II.md index 4d83986b..22e9f45e 100755 --- a/website/content/ChapterFour/0928.Minimize-Malware-Spread-II.md +++ b/website/content/ChapterFour/0928.Minimize-Malware-Spread-II.md @@ -134,4 +134,11 @@ func minMalwareSpread2(graph [][]int, initial []int) int { return minIndex } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0930.Binary-Subarrays-With-Sum.md b/website/content/ChapterFour/0930.Binary-Subarrays-With-Sum.md index 161579ce..265f9b31 100644 --- a/website/content/ChapterFour/0930.Binary-Subarrays-With-Sum.md +++ b/website/content/ChapterFour/0930.Binary-Subarrays-With-Sum.md @@ -62,4 +62,11 @@ func numSubarraysWithSum(A []int, S int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0933.Number-of-Recent-Calls.md b/website/content/ChapterFour/0933.Number-of-Recent-Calls.md index 02b2340c..44cf1056 100644 --- a/website/content/ChapterFour/0933.Number-of-Recent-Calls.md +++ b/website/content/ChapterFour/0933.Number-of-Recent-Calls.md @@ -71,4 +71,11 @@ func (this *RecentCounter) Ping(t int) int { * obj := Constructor(); * param_1 := obj.Ping(t); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0942.DI-String-Match.md b/website/content/ChapterFour/0942.DI-String-Match.md index 485dee18..7254de73 100755 --- a/website/content/ChapterFour/0942.DI-String-Match.md +++ b/website/content/ChapterFour/0942.DI-String-Match.md @@ -70,4 +70,11 @@ func diStringMatch(S string) []int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0946.Validate-Stack-Sequences.md b/website/content/ChapterFour/0946.Validate-Stack-Sequences.md index f69621d2..7794c71b 100644 --- a/website/content/ChapterFour/0946.Validate-Stack-Sequences.md +++ b/website/content/ChapterFour/0946.Validate-Stack-Sequences.md @@ -65,4 +65,11 @@ func validateStackSequences(pushed []int, popped []int) bool { return j == N } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0947.Most-Stones-Removed-with-Same-Row-or-Column.md b/website/content/ChapterFour/0947.Most-Stones-Removed-with-Same-Row-or-Column.md index 886bb036..b976171e 100755 --- a/website/content/ChapterFour/0947.Most-Stones-Removed-with-Same-Row-or-Column.md +++ b/website/content/ChapterFour/0947.Most-Stones-Removed-with-Same-Row-or-Column.md @@ -79,4 +79,11 @@ func removeStones(stones [][]int) int { return len(stones) - uf.TotalCount() } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0949.Largest-Time-for-Given-Digits.md b/website/content/ChapterFour/0949.Largest-Time-for-Given-Digits.md index 02f0bf43..6ec4fffa 100644 --- a/website/content/ChapterFour/0949.Largest-Time-for-Given-Digits.md +++ b/website/content/ChapterFour/0949.Largest-Time-for-Given-Digits.md @@ -75,4 +75,11 @@ func largestTimeFromDigits(A []int) string { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0952.Largest-Component-Size-by-Common-Factor.md b/website/content/ChapterFour/0952.Largest-Component-Size-by-Common-Factor.md index d37262bc..85c83482 100755 --- a/website/content/ChapterFour/0952.Largest-Component-Size-by-Common-Factor.md +++ b/website/content/ChapterFour/0952.Largest-Component-Size-by-Common-Factor.md @@ -116,4 +116,11 @@ func largestComponentSize1(A []int) int { return uf.MaxUnionCount() } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0953.Verifying-an-Alien-Dictionary.md b/website/content/ChapterFour/0953.Verifying-an-Alien-Dictionary.md index ff648c14..dfdde219 100755 --- a/website/content/ChapterFour/0953.Verifying-an-Alien-Dictionary.md +++ b/website/content/ChapterFour/0953.Verifying-an-Alien-Dictionary.md @@ -78,4 +78,11 @@ func isAlienSorted(words []string, order string) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0959.Regions-Cut-By-Slashes.md b/website/content/ChapterFour/0959.Regions-Cut-By-Slashes.md index c560cc59..d9f8eed2 100755 --- a/website/content/ChapterFour/0959.Regions-Cut-By-Slashes.md +++ b/website/content/ChapterFour/0959.Regions-Cut-By-Slashes.md @@ -147,4 +147,11 @@ func getFaceIdx(size, i, j, k int) int { return 4*(i*size+j) + k } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0961.N-Repeated-Element-in-Size-2N-Array.md b/website/content/ChapterFour/0961.N-Repeated-Element-in-Size-2N-Array.md index a9e53e77..5fe35e97 100755 --- a/website/content/ChapterFour/0961.N-Repeated-Element-in-Size-2N-Array.md +++ b/website/content/ChapterFour/0961.N-Repeated-Element-in-Size-2N-Array.md @@ -57,4 +57,11 @@ func repeatedNTimes(A []int) int { return 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0968.Binary-Tree-Cameras.md b/website/content/ChapterFour/0968.Binary-Tree-Cameras.md index d9873a5b..d11dbab5 100755 --- a/website/content/ChapterFour/0968.Binary-Tree-Cameras.md +++ b/website/content/ChapterFour/0968.Binary-Tree-Cameras.md @@ -100,4 +100,11 @@ func minCameraCoverDFS(root *TreeNode, res *int) status { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0969.Pancake-Sorting.md b/website/content/ChapterFour/0969.Pancake-Sorting.md index 68288d5c..6755f805 100644 --- a/website/content/ChapterFour/0969.Pancake-Sorting.md +++ b/website/content/ChapterFour/0969.Pancake-Sorting.md @@ -93,4 +93,11 @@ func find(nums []int, t int) int { return -1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0970.Powerful-Integers.md b/website/content/ChapterFour/0970.Powerful-Integers.md index 9de40954..95a7db75 100755 --- a/website/content/ChapterFour/0970.Powerful-Integers.md +++ b/website/content/ChapterFour/0970.Powerful-Integers.md @@ -85,4 +85,11 @@ func pow(x, i int) int { return int(math.Pow(float64(x), float64(i))) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0973.K-Closest-Points-to-Origin.md b/website/content/ChapterFour/0973.K-Closest-Points-to-Origin.md index a0b3a760..77984f7e 100644 --- a/website/content/ChapterFour/0973.K-Closest-Points-to-Origin.md +++ b/website/content/ChapterFour/0973.K-Closest-Points-to-Origin.md @@ -68,4 +68,11 @@ func KClosest(points [][]int, K int) [][]int { return ans } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0976.Largest-Perimeter-Triangle.md b/website/content/ChapterFour/0976.Largest-Perimeter-Triangle.md index 52b5b24c..078db7d9 100644 --- a/website/content/ChapterFour/0976.Largest-Perimeter-Triangle.md +++ b/website/content/ChapterFour/0976.Largest-Perimeter-Triangle.md @@ -75,4 +75,11 @@ func largestPerimeter(A []int) int { return 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0977.Squares-of-a-Sorted-Array.md b/website/content/ChapterFour/0977.Squares-of-a-Sorted-Array.md index 06fbd1a7..d02cfd81 100644 --- a/website/content/ChapterFour/0977.Squares-of-a-Sorted-Array.md +++ b/website/content/ChapterFour/0977.Squares-of-a-Sorted-Array.md @@ -83,4 +83,11 @@ func sortedSquares1(A []int) []int { return A } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md b/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md index 43dcd7f9..62ece5f2 100755 --- a/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md +++ b/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md @@ -106,4 +106,11 @@ func maxTurbulenceSize1(A []int) int { return max(res, 1) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0979.Distribute-Coins-in-Binary-Tree.md b/website/content/ChapterFour/0979.Distribute-Coins-in-Binary-Tree.md index ac98a452..93872dbb 100755 --- a/website/content/ChapterFour/0979.Distribute-Coins-in-Binary-Tree.md +++ b/website/content/ChapterFour/0979.Distribute-Coins-in-Binary-Tree.md @@ -93,4 +93,11 @@ func distributeCoinsDFS(root *TreeNode, res *int) int { return left + right + root.Val - 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0980.Unique-Paths-III.md b/website/content/ChapterFour/0980.Unique-Paths-III.md index 94f53c18..908e25c8 100755 --- a/website/content/ChapterFour/0980.Unique-Paths-III.md +++ b/website/content/ChapterFour/0980.Unique-Paths-III.md @@ -128,4 +128,11 @@ func findUniquePathIII(board [][]int, visited [][]bool, path []int, empty, start return } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0981.Time-Based-Key-Value-Store.md b/website/content/ChapterFour/0981.Time-Based-Key-Value-Store.md index a598ed75..4b5c51ff 100755 --- a/website/content/ChapterFour/0981.Time-Based-Key-Value-Store.md +++ b/website/content/ChapterFour/0981.Time-Based-Key-Value-Store.md @@ -121,4 +121,11 @@ func (t TimeMap) Get(key string, timestamp int) string { * param_2 := obj.Get(key,timestamp); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0984.String-Without-AAA-or-BBB.md b/website/content/ChapterFour/0984.String-Without-AAA-or-BBB.md index cccb67b2..f8f8a7fb 100755 --- a/website/content/ChapterFour/0984.String-Without-AAA-or-BBB.md +++ b/website/content/ChapterFour/0984.String-Without-AAA-or-BBB.md @@ -90,4 +90,11 @@ func strWithout3a3b(A int, B int) string { return ans } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0985.Sum-of-Even-Numbers-After-Queries.md b/website/content/ChapterFour/0985.Sum-of-Even-Numbers-After-Queries.md index 8811079b..53918c0e 100644 --- a/website/content/ChapterFour/0985.Sum-of-Even-Numbers-After-Queries.md +++ b/website/content/ChapterFour/0985.Sum-of-Even-Numbers-After-Queries.md @@ -69,4 +69,11 @@ func sumEvenAfterQueries(A []int, queries [][]int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0986.Interval-List-Intersections.md b/website/content/ChapterFour/0986.Interval-List-Intersections.md index d1a46341..cd2ef563 100644 --- a/website/content/ChapterFour/0986.Interval-List-Intersections.md +++ b/website/content/ChapterFour/0986.Interval-List-Intersections.md @@ -70,4 +70,11 @@ func intervalIntersection(A []Interval, B []Interval) []Interval { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0990.Satisfiability-of-Equality-Equations.md b/website/content/ChapterFour/0990.Satisfiability-of-Equality-Equations.md index 75f33db2..efe57ddf 100755 --- a/website/content/ChapterFour/0990.Satisfiability-of-Equality-Equations.md +++ b/website/content/ChapterFour/0990.Satisfiability-of-Equality-Equations.md @@ -96,4 +96,11 @@ func equationsPossible(equations []string) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0992.Subarrays-with-K-Different-Integers.md b/website/content/ChapterFour/0992.Subarrays-with-K-Different-Integers.md index 33155fa2..642f19c2 100644 --- a/website/content/ChapterFour/0992.Subarrays-with-K-Different-Integers.md +++ b/website/content/ChapterFour/0992.Subarrays-with-K-Different-Integers.md @@ -110,4 +110,11 @@ func subarraysWithKDistinctSlideWindow(A []int, K int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0993.Cousins-in-Binary-Tree.md b/website/content/ChapterFour/0993.Cousins-in-Binary-Tree.md index 1fd4a366..4579f7bd 100755 --- a/website/content/ChapterFour/0993.Cousins-in-Binary-Tree.md +++ b/website/content/ChapterFour/0993.Cousins-in-Binary-Tree.md @@ -160,4 +160,11 @@ func dfsCousins(root *TreeNode, val, depth, last int, parent, res *int) { dfsCousins(root.Right, val, depth, root.Val, parent, res) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md b/website/content/ChapterFour/0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md index 768d37be..3227e1d8 100755 --- a/website/content/ChapterFour/0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md +++ b/website/content/ChapterFour/0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md @@ -94,4 +94,11 @@ func minKBitFlips(A []int, K int) int { return count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0996.Number-of-Squareful-Arrays.md b/website/content/ChapterFour/0996.Number-of-Squareful-Arrays.md index 5a420a2c..270b4cb0 100755 --- a/website/content/ChapterFour/0996.Number-of-Squareful-Arrays.md +++ b/website/content/ChapterFour/0996.Number-of-Squareful-Arrays.md @@ -104,4 +104,11 @@ func checkSquare(num int) bool { return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/0999.Available-Captures-for-Rook.md b/website/content/ChapterFour/0999.Available-Captures-for-Rook.md index 47e6d127..7253b6c1 100644 --- a/website/content/ChapterFour/0999.Available-Captures-for-Rook.md +++ b/website/content/ChapterFour/0999.Available-Captures-for-Rook.md @@ -96,4 +96,11 @@ func caputure(board [][]byte, x, y int, bx, by int) int { return 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1002.Find-Common-Characters.md b/website/content/ChapterFour/1002.Find-Common-Characters.md index 9b61e205..93b72aa6 100755 --- a/website/content/ChapterFour/1002.Find-Common-Characters.md +++ b/website/content/ChapterFour/1002.Find-Common-Characters.md @@ -71,4 +71,11 @@ func commonChars(A []string) []string { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md b/website/content/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md index b423f1dc..2c4ec6b3 100644 --- a/website/content/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md +++ b/website/content/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md @@ -104,4 +104,11 @@ func isValid1003(S string) bool { return len(stack) == 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1004.Max-Consecutive-Ones-III.md b/website/content/ChapterFour/1004.Max-Consecutive-Ones-III.md index ba6eb873..54a10366 100644 --- a/website/content/ChapterFour/1004.Max-Consecutive-Ones-III.md +++ b/website/content/ChapterFour/1004.Max-Consecutive-Ones-III.md @@ -77,4 +77,11 @@ func longestOnes(A []int, K int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1005.Maximize-Sum-Of-Array-After-K-Negations.md b/website/content/ChapterFour/1005.Maximize-Sum-Of-Array-After-K-Negations.md index 1293b74f..cfa94c28 100644 --- a/website/content/ChapterFour/1005.Maximize-Sum-Of-Array-After-K-Negations.md +++ b/website/content/ChapterFour/1005.Maximize-Sum-Of-Array-After-K-Negations.md @@ -80,4 +80,11 @@ func largestSumAfterKNegations(A []int, K int) int { return sum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md b/website/content/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md index 774c53d1..5db2dec8 100755 --- a/website/content/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md +++ b/website/content/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md @@ -98,4 +98,11 @@ func shipWithinDays(weights []int, D int) int { return low } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1017.Convert-to-Base--2.md b/website/content/ChapterFour/1017.Convert-to-Base--2.md index 77eec60f..26516464 100755 --- a/website/content/ChapterFour/1017.Convert-to-Base--2.md +++ b/website/content/ChapterFour/1017.Convert-to-Base--2.md @@ -72,4 +72,11 @@ func baseNeg2(N int) string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md b/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md index 76d165f6..98109b82 100644 --- a/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md +++ b/website/content/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md @@ -67,4 +67,11 @@ func prefixesDivBy5(a []int) []bool { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md b/website/content/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md index 944ca8e3..82843023 100644 --- a/website/content/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md +++ b/website/content/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md @@ -93,4 +93,11 @@ func nextLargerNodes(head *ListNode) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1020.Number-of-Enclaves.md b/website/content/ChapterFour/1020.Number-of-Enclaves.md index 34b72b3d..b125cd5d 100644 --- a/website/content/ChapterFour/1020.Number-of-Enclaves.md +++ b/website/content/ChapterFour/1020.Number-of-Enclaves.md @@ -90,4 +90,11 @@ func dfsNumEnclaves(A [][]int, x, y int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1021.Remove-Outermost-Parentheses.md b/website/content/ChapterFour/1021.Remove-Outermost-Parentheses.md index d43d1b22..3bc01ab3 100644 --- a/website/content/ChapterFour/1021.Remove-Outermost-Parentheses.md +++ b/website/content/ChapterFour/1021.Remove-Outermost-Parentheses.md @@ -120,4 +120,11 @@ func removeOuterParentheses1(S string) string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1025.Divisor-Game.md b/website/content/ChapterFour/1025.Divisor-Game.md index e6a45211..34dcdfe2 100755 --- a/website/content/ChapterFour/1025.Divisor-Game.md +++ b/website/content/ChapterFour/1025.Divisor-Game.md @@ -59,4 +59,11 @@ func divisorGame(N int) bool { return N%2 == 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md b/website/content/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md index b2c94617..6d75cc21 100644 --- a/website/content/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md +++ b/website/content/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md @@ -71,4 +71,11 @@ func dfsAncestorDiff(root *TreeNode, res *int) (int, int) { *res = max(*res, max(abs(root.Val-min(leftMin, rightMin)), abs(root.Val-max(leftMax, rightMax)))) return max(leftMax, max(rightMax, root.Val)), min(leftMin, min(rightMin, root.Val)) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md b/website/content/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md index f9c25238..01210afb 100755 --- a/website/content/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md +++ b/website/content/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md @@ -132,4 +132,11 @@ func dfsBuildPreorderTree(S string, index, level *int, cur *TreeNode) (newIndex return index } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1030.Matrix-Cells-in-Distance-Order.md b/website/content/ChapterFour/1030.Matrix-Cells-in-Distance-Order.md index ba60ec4d..62a940fb 100755 --- a/website/content/ChapterFour/1030.Matrix-Cells-in-Distance-Order.md +++ b/website/content/ChapterFour/1030.Matrix-Cells-in-Distance-Order.md @@ -81,4 +81,11 @@ func allCellsDistOrder(R int, C int, r0 int, c0 int) [][]int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1037.Valid-Boomerang.md b/website/content/ChapterFour/1037.Valid-Boomerang.md index 89a4000d..3dc1b94c 100644 --- a/website/content/ChapterFour/1037.Valid-Boomerang.md +++ b/website/content/ChapterFour/1037.Valid-Boomerang.md @@ -46,4 +46,11 @@ func isBoomerang(points [][]int) bool { return (points[0][0]-points[1][0])*(points[0][1]-points[2][1]) != (points[0][0]-points[2][0])*(points[0][1]-points[1][1]) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md b/website/content/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md index 9c41121e..d611c135 100755 --- a/website/content/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md +++ b/website/content/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md @@ -118,4 +118,11 @@ func numMovesStonesII(stones []int) []int { return []int{minStep, maxStep} } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md b/website/content/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md index 1166355f..1fd0cb3a 100644 --- a/website/content/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md +++ b/website/content/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md @@ -54,4 +54,11 @@ func removeDuplicates1047(S string) string { return string(stack) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1049.Last-Stone-Weight-II.md b/website/content/ChapterFour/1049.Last-Stone-Weight-II.md index 4159bb50..035a6afc 100755 --- a/website/content/ChapterFour/1049.Last-Stone-Weight-II.md +++ b/website/content/ChapterFour/1049.Last-Stone-Weight-II.md @@ -76,4 +76,11 @@ func lastStoneWeightII(stones []int) int { return sum - 2*dp[C] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1051.Height-Checker.md b/website/content/ChapterFour/1051.Height-Checker.md index 10653f21..6fecbda0 100644 --- a/website/content/ChapterFour/1051.Height-Checker.md +++ b/website/content/ChapterFour/1051.Height-Checker.md @@ -69,4 +69,11 @@ func heightChecker(heights []int) int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1052.Grumpy-Bookstore-Owner.md b/website/content/ChapterFour/1052.Grumpy-Bookstore-Owner.md index b63f9479..40805ff8 100755 --- a/website/content/ChapterFour/1052.Grumpy-Bookstore-Owner.md +++ b/website/content/ChapterFour/1052.Grumpy-Bookstore-Owner.md @@ -103,4 +103,11 @@ func sumSatisfied(customers []int, grumpy []int, start, end int) int { return sum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1054.Distant-Barcodes.md b/website/content/ChapterFour/1054.Distant-Barcodes.md index 522c4e83..e9322c19 100755 --- a/website/content/ChapterFour/1054.Distant-Barcodes.md +++ b/website/content/ChapterFour/1054.Distant-Barcodes.md @@ -89,4 +89,11 @@ func barcodesFrequencySort(s []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1073.Adding-Two-Negabinary-Numbers.md b/website/content/ChapterFour/1073.Adding-Two-Negabinary-Numbers.md index b8380b33..dbbdc84a 100755 --- a/website/content/ChapterFour/1073.Adding-Two-Negabinary-Numbers.md +++ b/website/content/ChapterFour/1073.Adding-Two-Negabinary-Numbers.md @@ -143,4 +143,11 @@ func intToNegabinary(num int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md b/website/content/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md index a9a66a85..04875e8a 100755 --- a/website/content/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md +++ b/website/content/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md @@ -140,4 +140,11 @@ func sumSubmatrix(matrix [][]int, startx, starty, endx, endy int) int { return sum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1078.Occurrences-After-Bigram.md b/website/content/ChapterFour/1078.Occurrences-After-Bigram.md index 6d1806e0..37333250 100755 --- a/website/content/ChapterFour/1078.Occurrences-After-Bigram.md +++ b/website/content/ChapterFour/1078.Occurrences-After-Bigram.md @@ -61,4 +61,11 @@ func findOcurrences(text string, first string, second string) []string { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1079.Letter-Tile-Possibilities.md b/website/content/ChapterFour/1079.Letter-Tile-Possibilities.md index 6f035a14..2dc6dd6a 100755 --- a/website/content/ChapterFour/1079.Letter-Tile-Possibilities.md +++ b/website/content/ChapterFour/1079.Letter-Tile-Possibilities.md @@ -104,4 +104,11 @@ func findTile(tiles, tmp []byte, used *[]bool, index int, res *int, tMap map[str } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1089.Duplicate-Zeros.md b/website/content/ChapterFour/1089.Duplicate-Zeros.md index 3c822474..a124e966 100644 --- a/website/content/ChapterFour/1089.Duplicate-Zeros.md +++ b/website/content/ChapterFour/1089.Duplicate-Zeros.md @@ -55,4 +55,11 @@ func duplicateZeros(arr []int) { } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1093.Statistics-from-a-Large-Sample.md b/website/content/ChapterFour/1093.Statistics-from-a-Large-Sample.md index ab5f59be..863f1f81 100755 --- a/website/content/ChapterFour/1093.Statistics-from-a-Large-Sample.md +++ b/website/content/ChapterFour/1093.Statistics-from-a-Large-Sample.md @@ -92,4 +92,11 @@ func sampleStats(count []int) []float64 { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1105.Filling-Bookcase-Shelves.md b/website/content/ChapterFour/1105.Filling-Bookcase-Shelves.md index a09fe67b..e2c256c7 100755 --- a/website/content/ChapterFour/1105.Filling-Bookcase-Shelves.md +++ b/website/content/ChapterFour/1105.Filling-Bookcase-Shelves.md @@ -65,4 +65,11 @@ func minHeightShelves(books [][]int, shelfWidth int) int { return dp[len(books)] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1108.Defanging-an-IP-Address.md b/website/content/ChapterFour/1108.Defanging-an-IP-Address.md index 870f909d..f745e3bd 100755 --- a/website/content/ChapterFour/1108.Defanging-an-IP-Address.md +++ b/website/content/ChapterFour/1108.Defanging-an-IP-Address.md @@ -51,4 +51,11 @@ func defangIPaddr(address string) string { return strings.Replace(address, ".", "[.]", -1) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md b/website/content/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md index 9d3c214c..971b3e1b 100644 --- a/website/content/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md +++ b/website/content/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md @@ -79,4 +79,11 @@ func dfsDelNodes(root *TreeNode, toDel map[int]bool, isRoot bool, res *[]*TreeNo } return isRoot } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md b/website/content/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md index aebabe96..bc6d761b 100755 --- a/website/content/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md +++ b/website/content/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md @@ -129,4 +129,11 @@ func maxDepthAfterSplit1(seq string) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1122.Relative-Sort-Array.md b/website/content/ChapterFour/1122.Relative-Sort-Array.md index 1a560cee..3ce06048 100755 --- a/website/content/ChapterFour/1122.Relative-Sort-Array.md +++ b/website/content/ChapterFour/1122.Relative-Sort-Array.md @@ -98,4 +98,11 @@ func relativeSortArray1(arr1 []int, arr2 []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md b/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md index a6a54769..f3fb3dee 100755 --- a/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md +++ b/website/content/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md @@ -98,4 +98,11 @@ func lcaDeepestLeavesDFS(lca **TreeNode, maxLevel *int, depth int, root *TreeNod return max(depthLeft, depthRight) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1128.Number-of-Equivalent-Domino-Pairs.md b/website/content/ChapterFour/1128.Number-of-Equivalent-Domino-Pairs.md index f30cc814..b9f94100 100755 --- a/website/content/ChapterFour/1128.Number-of-Equivalent-Domino-Pairs.md +++ b/website/content/ChapterFour/1128.Number-of-Equivalent-Domino-Pairs.md @@ -65,4 +65,11 @@ func numEquivDominoPairs(dominoes [][]int) int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1137.N-th-Tribonacci-Number.md b/website/content/ChapterFour/1137.N-th-Tribonacci-Number.md index 0e6e6d17..211d5ba6 100755 --- a/website/content/ChapterFour/1137.N-th-Tribonacci-Number.md +++ b/website/content/ChapterFour/1137.N-th-Tribonacci-Number.md @@ -68,4 +68,11 @@ func tribonacci(n int) int { return trib } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1145.Binary-Tree-Coloring-Game.md b/website/content/ChapterFour/1145.Binary-Tree-Coloring-Game.md index 02fbc682..c1395df1 100644 --- a/website/content/ChapterFour/1145.Binary-Tree-Coloring-Game.md +++ b/website/content/ChapterFour/1145.Binary-Tree-Coloring-Game.md @@ -79,4 +79,11 @@ func dfsBtreeGameWinningMove(node *TreeNode, left, right *int, x int) int { } return l + r + 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1154.Day-of-the-Year.md b/website/content/ChapterFour/1154.Day-of-the-Year.md index 8fcd6833..b4c4bcb2 100755 --- a/website/content/ChapterFour/1154.Day-of-the-Year.md +++ b/website/content/ChapterFour/1154.Day-of-the-Year.md @@ -78,4 +78,11 @@ func dayOfYear(date string) int { return int(duration.Hours())/24 + 1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1157.Online-Majority-Element-In-Subarray.md b/website/content/ChapterFour/1157.Online-Majority-Element-In-Subarray.md index 10f4d06a..abfafc03 100755 --- a/website/content/ChapterFour/1157.Online-Majority-Element-In-Subarray.md +++ b/website/content/ChapterFour/1157.Online-Majority-Element-In-Subarray.md @@ -193,4 +193,11 @@ func (mc *MajorityChecker) Query(left int, right int, threshold int) int { * param_1 := obj.Query(left,right,threshold); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1160.Find-Words-That-Can-Be-Formed-by-Characters.md b/website/content/ChapterFour/1160.Find-Words-That-Can-Be-Formed-by-Characters.md index 5a73172d..2df6a209 100755 --- a/website/content/ChapterFour/1160.Find-Words-That-Can-Be-Formed-by-Characters.md +++ b/website/content/ChapterFour/1160.Find-Words-That-Can-Be-Formed-by-Characters.md @@ -78,4 +78,11 @@ func canBeFormed(w string, c []int) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md b/website/content/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md index f9605d63..854c1e78 100755 --- a/website/content/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md +++ b/website/content/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md @@ -83,4 +83,11 @@ func countFunc(s string) int { return count[i] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md b/website/content/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md index 6b55a1a8..bee3e8a8 100755 --- a/website/content/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md +++ b/website/content/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md @@ -137,4 +137,11 @@ func removeZeroSumSublists1(head *ListNode) *ListNode { return head } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1175.Prime-Arrangements.md b/website/content/ChapterFour/1175.Prime-Arrangements.md index ceae2ed5..063a2619 100755 --- a/website/content/ChapterFour/1175.Prime-Arrangements.md +++ b/website/content/ChapterFour/1175.Prime-Arrangements.md @@ -62,4 +62,11 @@ func factorial(n int) int { return n * factorial(n-1) % 1000000007 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1184.Distance-Between-Bus-Stops.md b/website/content/ChapterFour/1184.Distance-Between-Bus-Stops.md index 7455432d..5d23749e 100755 --- a/website/content/ChapterFour/1184.Distance-Between-Bus-Stops.md +++ b/website/content/ChapterFour/1184.Distance-Between-Bus-Stops.md @@ -79,4 +79,11 @@ func distanceBetweenBusStops(distance []int, start int, destination int) int { return counterclockwiseDis } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1185.Day-of-the-Week.md b/website/content/ChapterFour/1185.Day-of-the-Week.md index 1d970543..5b34b8de 100755 --- a/website/content/ChapterFour/1185.Day-of-the-Week.md +++ b/website/content/ChapterFour/1185.Day-of-the-Week.md @@ -58,4 +58,11 @@ func dayOfTheWeek(day int, month int, year int) string { return time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.Local).Weekday().String() } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1189.Maximum-Number-of-Balloons.md b/website/content/ChapterFour/1189.Maximum-Number-of-Balloons.md index 9bfd7219..ac27e5eb 100755 --- a/website/content/ChapterFour/1189.Maximum-Number-of-Balloons.md +++ b/website/content/ChapterFour/1189.Maximum-Number-of-Balloons.md @@ -67,4 +67,11 @@ func maxNumberOfBalloons(text string) int { return min(fre[1], min(fre[0], min(fre[11]/2, min(fre[14]/2, fre[13])))) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1200.Minimum-Absolute-Difference.md b/website/content/ChapterFour/1200.Minimum-Absolute-Difference.md index ad1b5e88..2cbf856b 100755 --- a/website/content/ChapterFour/1200.Minimum-Absolute-Difference.md +++ b/website/content/ChapterFour/1200.Minimum-Absolute-Difference.md @@ -74,4 +74,11 @@ func minimumAbsDifference(arr []int) [][]int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1201.Ugly-Number-III.md b/website/content/ChapterFour/1201.Ugly-Number-III.md index 74d25b81..9382712f 100755 --- a/website/content/ChapterFour/1201.Ugly-Number-III.md +++ b/website/content/ChapterFour/1201.Ugly-Number-III.md @@ -89,4 +89,11 @@ func gcd(a, b int64) int64 { return a } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md b/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md index 9a46cee4..f82a83f8 100755 --- a/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md +++ b/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md @@ -99,4 +99,11 @@ func smallestStringWithSwaps(s string, pairs [][]int) string { return string(res) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md b/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md index bba34134..a4d435fe 100755 --- a/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md +++ b/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md @@ -65,4 +65,11 @@ func uniqueOccurrences(arr []int) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md b/website/content/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md index 3569ea9e..92c91739 100755 --- a/website/content/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md +++ b/website/content/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md @@ -74,4 +74,11 @@ func equalSubstring(s string, t string, maxCost int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md b/website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md index 7740a7ac..d1b1cda2 100755 --- a/website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md +++ b/website/content/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md @@ -73,4 +73,11 @@ func minCostToMoveChips(chips []int) int { return min(odd, even) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md b/website/content/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md index 9cfeaedf..4111287f 100755 --- a/website/content/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md +++ b/website/content/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md @@ -70,4 +70,11 @@ func balancedStringSplit(s string) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md b/website/content/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md index 831b229f..3d4fc4cb 100755 --- a/website/content/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md +++ b/website/content/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md @@ -68,4 +68,11 @@ func checkStraightLine(coordinates [][]int) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md b/website/content/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md index a9d35b14..8404def8 100755 --- a/website/content/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md +++ b/website/content/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md @@ -90,4 +90,11 @@ func balancedString(s string) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md b/website/content/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md index 9f08f7a4..831aceef 100755 --- a/website/content/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md +++ b/website/content/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md @@ -115,4 +115,11 @@ func (s sortJobs) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md b/website/content/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md index 9d46af45..6f869e52 100755 --- a/website/content/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md +++ b/website/content/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md @@ -100,4 +100,11 @@ func oddCells1(n int, m int, indices [][]int) int { return count } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1254.Number-of-Closed-Islands.md b/website/content/ChapterFour/1254.Number-of-Closed-Islands.md index 3ff8da1a..bdcdec52 100755 --- a/website/content/ChapterFour/1254.Number-of-Closed-Islands.md +++ b/website/content/ChapterFour/1254.Number-of-Closed-Islands.md @@ -107,4 +107,11 @@ func isIntInBoard(board [][]int, x, y int) bool { return x >= 0 && x < len(board) && y >= 0 && y < len(board[0]) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1260.Shift-2D-Grid.md b/website/content/ChapterFour/1260.Shift-2D-Grid.md index a63d3e77..8a10aef5 100644 --- a/website/content/ChapterFour/1260.Shift-2D-Grid.md +++ b/website/content/ChapterFour/1260.Shift-2D-Grid.md @@ -87,4 +87,11 @@ func shiftGrid(grid [][]int, k int) [][]int { return newGrid } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md b/website/content/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md index 5e5268af..3e9ad63d 100755 --- a/website/content/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md +++ b/website/content/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md @@ -72,4 +72,11 @@ func minTimeToVisitAllPoints(points [][]int) int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md b/website/content/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md index 750d3c7b..92f05952 100644 --- a/website/content/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md +++ b/website/content/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md @@ -151,4 +151,11 @@ func tictactoe(moves [][]int) string { return "Draw" } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer.md b/website/content/ChapterFour/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer.md index 96cc347d..2c964c08 100644 --- a/website/content/ChapterFour/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer.md +++ b/website/content/ChapterFour/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer.md @@ -56,4 +56,11 @@ func subtractProductAndSum(n int) int { } return product - sum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1283.Find-the-Smallest-Divisor-Given-a-Threshold.md b/website/content/ChapterFour/1283.Find-the-Smallest-Divisor-Given-a-Threshold.md index f0359723..e25c1209 100644 --- a/website/content/ChapterFour/1283.Find-the-Smallest-Divisor-Given-a-Threshold.md +++ b/website/content/ChapterFour/1283.Find-the-Smallest-Divisor-Given-a-Threshold.md @@ -84,4 +84,11 @@ func calDivisor(nums []int, mid, threshold int) bool { } return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1287.Element-Appearing-More-Than-25-In-Sorted-Array.md b/website/content/ChapterFour/1287.Element-Appearing-More-Than-25-In-Sorted-Array.md index f9714a4d..c1c9d669 100644 --- a/website/content/ChapterFour/1287.Element-Appearing-More-Than-25-In-Sorted-Array.md +++ b/website/content/ChapterFour/1287.Element-Appearing-More-Than-25-In-Sorted-Array.md @@ -46,4 +46,11 @@ func findSpecialInteger(arr []int) int { } return -1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md b/website/content/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md index 1c0f9be1..28ab0065 100644 --- a/website/content/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md +++ b/website/content/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md @@ -78,4 +78,11 @@ func getDecimalValue(head *ListNode) int { } return sum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1295.Find-Numbers-with-Even-Number-of-Digits.md b/website/content/ChapterFour/1295.Find-Numbers-with-Even-Number-of-Digits.md index ccaa6c49..32096cd1 100644 --- a/website/content/ChapterFour/1295.Find-Numbers-with-Even-Number-of-Digits.md +++ b/website/content/ChapterFour/1295.Find-Numbers-with-Even-Number-of-Digits.md @@ -60,4 +60,11 @@ func findNumbers(nums []int) int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1299.Replace-Elements-with-Greatest-Element-on-Right-Side.md b/website/content/ChapterFour/1299.Replace-Elements-with-Greatest-Element-on-Right-Side.md index 633c6576..fb242b8f 100644 --- a/website/content/ChapterFour/1299.Replace-Elements-with-Greatest-Element-on-Right-Side.md +++ b/website/content/ChapterFour/1299.Replace-Elements-with-Greatest-Element-on-Right-Side.md @@ -48,4 +48,11 @@ func replaceElements(arr []int) []int { } return arr } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md b/website/content/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md index 15c7d5d7..113f3d86 100644 --- a/website/content/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md +++ b/website/content/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md @@ -100,4 +100,11 @@ func min(a int, b int) int { return a } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1302.Deepest-Leaves-Sum.md b/website/content/ChapterFour/1302.Deepest-Leaves-Sum.md index 70482634..a79aef4d 100644 --- a/website/content/ChapterFour/1302.Deepest-Leaves-Sum.md +++ b/website/content/ChapterFour/1302.Deepest-Leaves-Sum.md @@ -55,4 +55,11 @@ func dfsDeepestLeavesSum(root *TreeNode, level int, maxLevel, sum *int) { dfsDeepestLeavesSum(root.Left, level+1, maxLevel, sum) dfsDeepestLeavesSum(root.Right, level+1, maxLevel, sum) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1304.Find-N-Unique-Integers-Sum-up-to-Zero.md b/website/content/ChapterFour/1304.Find-N-Unique-Integers-Sum-up-to-Zero.md index 1e15836e..0fadb33f 100644 --- a/website/content/ChapterFour/1304.Find-N-Unique-Integers-Sum-up-to-Zero.md +++ b/website/content/ChapterFour/1304.Find-N-Unique-Integers-Sum-up-to-Zero.md @@ -59,4 +59,11 @@ func sumZero(n int) []int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md b/website/content/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md index 247bbfbb..4de15219 100644 --- a/website/content/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md +++ b/website/content/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md @@ -87,4 +87,11 @@ func getAllElements1(root1 *TreeNode, root2 *TreeNode) []int { sort.Ints(arr) return arr } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1306.Jump-Game-III.md b/website/content/ChapterFour/1306.Jump-Game-III.md index 63f26345..82a9fe22 100644 --- a/website/content/ChapterFour/1306.Jump-Game-III.md +++ b/website/content/ChapterFour/1306.Jump-Game-III.md @@ -77,4 +77,11 @@ func canReach(arr []int, start int) bool { } return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1313.Decompress-Run-Length-Encoded-List.md b/website/content/ChapterFour/1313.Decompress-Run-Length-Encoded-List.md index 645d9057..a99baec6 100644 --- a/website/content/ChapterFour/1313.Decompress-Run-Length-Encoded-List.md +++ b/website/content/ChapterFour/1313.Decompress-Run-Length-Encoded-List.md @@ -57,4 +57,11 @@ func decompressRLElist(nums []int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers.md b/website/content/ChapterFour/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers.md index b7871908..b8453ec3 100644 --- a/website/content/ChapterFour/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers.md +++ b/website/content/ChapterFour/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers.md @@ -93,4 +93,11 @@ func isNoZero(n int) bool { return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md b/website/content/ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md index 01d97eb8..264dc72f 100644 --- a/website/content/ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md +++ b/website/content/ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md @@ -84,4 +84,11 @@ func luckyNumbers(matrix [][]int) []int { return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1385.Find-the-Distance-Value-Between-Two-Arrays.md b/website/content/ChapterFour/1385.Find-the-Distance-Value-Between-Two-Arrays.md index 9d604246..3e99081b 100644 --- a/website/content/ChapterFour/1385.Find-the-Distance-Value-Between-Two-Arrays.md +++ b/website/content/ChapterFour/1385.Find-the-Distance-Value-Between-Two-Arrays.md @@ -95,4 +95,11 @@ func abs(a int) int { return a } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1389.Create-Target-Array-in-the-Given-Order.md b/website/content/ChapterFour/1389.Create-Target-Array-in-the-Given-Order.md index 45f4acf6..005cd089 100644 --- a/website/content/ChapterFour/1389.Create-Target-Array-in-the-Given-Order.md +++ b/website/content/ChapterFour/1389.Create-Target-Array-in-the-Given-Order.md @@ -87,4 +87,11 @@ func createTargetArray(nums []int, index []int) []int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence.md b/website/content/ChapterFour/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence.md index c8081e82..5dc63968 100644 --- a/website/content/ChapterFour/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence.md +++ b/website/content/ChapterFour/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence.md @@ -95,4 +95,11 @@ func isPrefixOfWord(sentence string, searchWord string) int { return -1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1464.Maximum-Product-of-Two-Elements-in-an-Array.md b/website/content/ChapterFour/1464.Maximum-Product-of-Two-Elements-in-an-Array.md index 04dbf134..eeef6901 100644 --- a/website/content/ChapterFour/1464.Maximum-Product-of-Two-Elements-in-an-Array.md +++ b/website/content/ChapterFour/1464.Maximum-Product-of-Two-Elements-in-an-Array.md @@ -63,4 +63,11 @@ func maxProduct(nums []int) int { return (max1 - 1) * (max2 - 1) } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1470.Shuffle-the-Array.md b/website/content/ChapterFour/1470.Shuffle-the-Array.md index 961d200c..571c6c2e 100644 --- a/website/content/ChapterFour/1470.Shuffle-the-Array.md +++ b/website/content/ChapterFour/1470.Shuffle-the-Array.md @@ -61,4 +61,11 @@ func shuffle(nums []int, n int) []int { return result } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1480.Running-Sum-of-1d-Array.md b/website/content/ChapterFour/1480.Running-Sum-of-1d-Array.md index d0e48335..12573981 100644 --- a/website/content/ChapterFour/1480.Running-Sum-of-1d-Array.md +++ b/website/content/ChapterFour/1480.Running-Sum-of-1d-Array.md @@ -61,4 +61,11 @@ func runningSum(nums []int) []int { return dp[1:] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1512.Number-of-Good-Pairs.md b/website/content/ChapterFour/1512.Number-of-Good-Pairs.md index a6954aa0..5d5db6bf 100644 --- a/website/content/ChapterFour/1512.Number-of-Good-Pairs.md +++ b/website/content/ChapterFour/1512.Number-of-Good-Pairs.md @@ -64,4 +64,11 @@ func numIdenticalPairs(nums []int) int { return total } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md b/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md index 9350e713..9ec04f9e 100644 --- a/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md +++ b/website/content/ChapterFour/1539.Kth-Missing-Positive-Number.md @@ -60,4 +60,11 @@ func findKthPositive(arr []int, k int) int { } return positive } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md b/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md index 8954680f..9060eded 100644 --- a/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md +++ b/website/content/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md @@ -105,4 +105,11 @@ func numWays(s string) int { } return (b - a) * (d - c) % 1000000007 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md b/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md index dbbce406..45aa66a1 100644 --- a/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md +++ b/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md @@ -92,4 +92,11 @@ func canFormArray(arr []int, pieces [][]int) bool { } return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md b/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md index ce833f68..9a6f0290 100644 --- a/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md +++ b/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md @@ -93,4 +93,11 @@ func getMaximumGenerated(n int) int { } return max } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md b/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md index 40aacead..dddd6ba1 100644 --- a/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md +++ b/website/content/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md @@ -86,4 +86,11 @@ func minDeletions(s string) int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md b/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md index e030a9f5..1ee5fd26 100644 --- a/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md +++ b/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md @@ -128,4 +128,11 @@ func maxProfit(inventory []int, orders int) int { } return res % mod } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md b/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md index 08435245..69450ff8 100644 --- a/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md +++ b/website/content/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md @@ -186,4 +186,11 @@ func (b *BIT) get(i int) int { } return sum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1652.Defuse-the-Bomb.md b/website/content/ChapterFour/1652.Defuse-the-Bomb.md index df2c48b3..3ae46fce 100644 --- a/website/content/ChapterFour/1652.Defuse-the-Bomb.md +++ b/website/content/ChapterFour/1652.Defuse-the-Bomb.md @@ -122,4 +122,11 @@ func decrypt(code []int, k int) []int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md b/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md index fe8836e1..bd2ee314 100644 --- a/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md +++ b/website/content/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md @@ -87,4 +87,11 @@ func minimumDeletions1(s string) int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md b/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md index fdb7ef53..793f382c 100644 --- a/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md +++ b/website/content/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md @@ -98,4 +98,11 @@ func minimumJumps(forbidden []int, a int, b int, x int) int { } return -1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md b/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md index 7960563c..41977eef 100644 --- a/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md +++ b/website/content/ChapterFour/1655.Distribute-Repeating-Integers.md @@ -109,4 +109,11 @@ func dfs(freq map[int]int, quantity []int) bool { } return false } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md b/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md index db625aea..39c33d70 100644 --- a/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md +++ b/website/content/ChapterFour/1656.Design-an-Ordered-Stream.md @@ -103,4 +103,11 @@ func (this *OrderedStream) Insert(id int, value string) []string { * obj := Constructor(n); * param_1 := obj.Insert(id,value); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md b/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md index cd8b3455..82d429e8 100644 --- a/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md +++ b/website/content/ChapterFour/1657.Determine-if-Two-Strings-Are-Close.md @@ -111,4 +111,11 @@ func closeStrings(word1 string, word2 string) bool { } return true } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md b/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md index 5f40e213..955f6f2b 100644 --- a/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md +++ b/website/content/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md @@ -93,4 +93,11 @@ func max(a, b int) int { } return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md b/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md index fe9bab4d..73f3ed57 100644 --- a/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md +++ b/website/content/ChapterFour/1659.Maximize-Grid-Happiness.md @@ -182,4 +182,11 @@ func max(a int, b int) int { } return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md b/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md index fecd0ed0..84931259 100644 --- a/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md +++ b/website/content/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md @@ -62,4 +62,11 @@ func arrayStringsAreEqual(word1 []string, word2 []string) bool { } return str1 == str2 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md b/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md index 5e932b8d..9eb095dc 100644 --- a/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md +++ b/website/content/ChapterFour/1663.Smallest-String-With-A-Given-Numeric-Value.md @@ -101,4 +101,11 @@ func findSmallestString(value int, length, k, index int, str []byte, res *string } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md b/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md index 77af00a1..45d86fc9 100644 --- a/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md +++ b/website/content/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md @@ -113,4 +113,11 @@ func waysToMakeFair1(nums []int) int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md b/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md index b8226454..6518e98a 100644 --- a/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md +++ b/website/content/ChapterFour/1665.Minimum-Initial-Energy-to-Finish-Tasks.md @@ -125,4 +125,11 @@ func (task Task) Swap(i, j int) { task[i] = task[j] task[j] = t } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md b/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md index 61ea3c70..91c3fd9d 100644 --- a/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md +++ b/website/content/ChapterFour/1668.Maximum-Repeating-Substring.md @@ -66,4 +66,11 @@ func maxRepeating(sequence string, word string) int { } return 0 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md b/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md index 919ff5ce..fdd831d1 100644 --- a/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md +++ b/website/content/ChapterFour/1669.Merge-In-Between-Linked-Lists.md @@ -72,4 +72,11 @@ func mergeInBetween(list1 *ListNode, a int, b int, list2 *ListNode) *ListNode { n.Next = endRef.Next return list1 } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md b/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md index 30067232..533fa366 100644 --- a/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md +++ b/website/content/ChapterFour/1670.Design-Front-Middle-Back-Queue.md @@ -169,4 +169,11 @@ func (this *FrontMiddleBackQueue) PopBack() int { * param_5 := obj.PopMiddle(); * param_6 := obj.PopBack(); */ -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1672.Richest-Customer-Wealth.md b/website/content/ChapterFour/1672.Richest-Customer-Wealth.md index 0f95c881..13a3b114 100644 --- a/website/content/ChapterFour/1672.Richest-Customer-Wealth.md +++ b/website/content/ChapterFour/1672.Richest-Customer-Wealth.md @@ -69,4 +69,11 @@ func maximumWealth(accounts [][]int) int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md b/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md index 0fb52b6f..b0b30764 100644 --- a/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md +++ b/website/content/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md @@ -59,4 +59,11 @@ func mostCompetitive(nums []int, k int) []int { } return stack[:k] } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md b/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md index 54fb1254..31ade1f0 100644 --- a/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md +++ b/website/content/ChapterFour/1674.Minimum-Moves-to-Make-Array-Complementary.md @@ -94,4 +94,11 @@ func max(a, b int) int { } return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1678.Goal-Parser-Interpretation.md b/website/content/ChapterFour/1678.Goal-Parser-Interpretation.md index 0accbbe7..0027dd5b 100644 --- a/website/content/ChapterFour/1678.Goal-Parser-Interpretation.md +++ b/website/content/ChapterFour/1678.Goal-Parser-Interpretation.md @@ -70,4 +70,11 @@ func interpret(command string) string { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md b/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md index 19b30fd4..a573fadc 100644 --- a/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md +++ b/website/content/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md @@ -95,4 +95,11 @@ func maxOperations_(nums []int, k int) int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md b/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md index 5be2e74d..5fc06173 100644 --- a/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md +++ b/website/content/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md @@ -92,4 +92,11 @@ func concatenatedBinary1(n int) int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1681.Minimum-Incompatibility.md b/website/content/ChapterFour/1681.Minimum-Incompatibility.md index 03773a04..ebc5c06a 100644 --- a/website/content/ChapterFour/1681.Minimum-Incompatibility.md +++ b/website/content/ChapterFour/1681.Minimum-Incompatibility.md @@ -119,4 +119,11 @@ func generatePermutation1681(nums, counts, order []int, index, sum, eachSize int } } } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md b/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md index fdfe2ab1..9cce9fd7 100644 --- a/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md +++ b/website/content/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md @@ -76,4 +76,11 @@ func countConsistentStrings(allowed string, words []string) int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md b/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md index d7c2465c..690f9b1d 100644 --- a/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md +++ b/website/content/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md @@ -85,4 +85,11 @@ func getSumAbsoluteDifferences1(nums []int) []int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md b/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md index 61c9f7ab..fc73c685 100644 --- a/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md +++ b/website/content/ChapterFour/1688.Count-of-Matches-in-Tournament.md @@ -77,4 +77,11 @@ func numberOfMatches1(n int) int { } return sum } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md b/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md index a6d53116..bb6b7c53 100644 --- a/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md +++ b/website/content/ChapterFour/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md @@ -57,4 +57,11 @@ func minPartitions(n string) int { } return res } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1690.Stone-Game-VII.md b/website/content/ChapterFour/1690.Stone-Game-VII.md index 0a33e2dc..cdb41310 100644 --- a/website/content/ChapterFour/1690.Stone-Game-VII.md +++ b/website/content/ChapterFour/1690.Stone-Game-VII.md @@ -127,4 +127,11 @@ func max(a, b int) int { } return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1694.Reformat-Phone-Number.md b/website/content/ChapterFour/1694.Reformat-Phone-Number.md index 474c1209..b878af68 100644 --- a/website/content/ChapterFour/1694.Reformat-Phone-Number.md +++ b/website/content/ChapterFour/1694.Reformat-Phone-Number.md @@ -132,4 +132,11 @@ func reformatNumber(number string) string { } return strings.Join(parts, "-") } -``` \ No newline at end of file +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1695.Maximum-Erasure-Value.md b/website/content/ChapterFour/1695.Maximum-Erasure-Value.md index 948220c1..e31251fa 100644 --- a/website/content/ChapterFour/1695.Maximum-Erasure-Value.md +++ b/website/content/ChapterFour/1695.Maximum-Erasure-Value.md @@ -71,4 +71,9 @@ func max(a int, b int) int { } return b } -``` \ No newline at end of file +``` + + +---------------------------------------------- +

⬅️上一页

+ diff --git a/website/content/ChapterFour/_index.md b/website/content/ChapterFour/_index.md index 3daf13a7..bcc5b320 100644 --- a/website/content/ChapterFour/_index.md +++ b/website/content/ChapterFour/_index.md @@ -14,4 +14,11 @@ type: docs 题解慢慢更新中,欢迎大家提出更好的解法。点击页面下方的 edit,会跳转到 github 对应的页面 markdown 中,可以提交你的最优解 PR。 -让我们在题解的太空遨游吧~ \ No newline at end of file +让我们在题解的太空遨游吧~ + + +---------------------------------------------- + From 05f56189f1f8b76639e184a2911a636644c694a7 Mon Sep 17 00:00:00 2001 From: YDZ Date: Sun, 17 Jan 2021 04:21:35 +0800 Subject: [PATCH 78/82] Ctl add generate PDF --- ctl/README.md | 6 +- ctl/label.go | 17 ++-- ctl/meta/PDFPreface | 12 +++ ctl/models/tagproblem.go | 8 +- ctl/pdf.go | 201 ++++++++++++++++++++++++++++++++++++++- ctl/render.go | 15 ++- ctl/util/util.go | 61 ++++++++++++ go.mod | 2 +- 8 files changed, 300 insertions(+), 22 deletions(-) create mode 100644 ctl/meta/PDFPreface diff --git a/ctl/README.md b/ctl/README.md index 4ed13ce1..cbbc8327 100644 --- a/ctl/README.md +++ b/ctl/README.md @@ -13,4 +13,8 @@ Username="test" Password="test" Cookie="csrftoken=XXXXXXXXX; LEETCODE_SESSION=YYYYYYYY;" CSRFtoken="ZZZZZZZZ" -``` \ No newline at end of file +``` + +## PDF 生成 + +用 `leetcode-go pdf` 命令先生成书籍内容的合并版本 pdf.md,再用 vscode 或者其他支持 toc 目录生成的工具,生成 toc。最后用 Typora 把 md 文件转换成 pdf。就可以发布 release 新版本了。 \ No newline at end of file diff --git a/ctl/label.go b/ctl/label.go index 89f31ceb..0ecccd80 100644 --- a/ctl/label.go +++ b/ctl/label.go @@ -2,19 +2,14 @@ package main import ( "bufio" - // "encoding/json" + "errors" "fmt" - // m "github.com/halfrost/LeetCode-Go/ctl/models" - // "github.com/halfrost/LeetCode-Go/ctl/util" "github.com/halfrost/LeetCode-Go/ctl/util" "github.com/spf13/cobra" "io" + "io/ioutil" "os" "regexp" - // "sort" - // "strconv" - "errors" - "io/ioutil" "strings" ) @@ -248,22 +243,22 @@ func eofDel(filePath string) ([]byte, error) { } if ok, _ := regexp.Match(delLine, line); ok { reg := regexp.MustCompile(delLine) - newByte := reg.ReplaceAll(line, []byte(" ")) + newByte := reg.ReplaceAll(line, []byte("")) output = append(output, newByte...) output = append(output, []byte("\n")...) } else if ok, _ := regexp.Match(delHeader, line); ok { reg := regexp.MustCompile(delHeader) - newByte := reg.ReplaceAll(line, []byte(" ")) + newByte := reg.ReplaceAll(line, []byte("")) output = append(output, newByte...) output = append(output, []byte("\n")...) } else if ok, _ := regexp.Match(delLabel, line); ok { reg := regexp.MustCompile(delLabel) - newByte := reg.ReplaceAll(line, []byte(" ")) + newByte := reg.ReplaceAll(line, []byte("")) output = append(output, newByte...) output = append(output, []byte("\n")...) } else if ok, _ := regexp.Match(delFooter, line); ok { reg := regexp.MustCompile(delFooter) - newByte := reg.ReplaceAll(line, []byte(" ")) + newByte := reg.ReplaceAll(line, []byte("")) output = append(output, newByte...) output = append(output, []byte("\n")...) } else { diff --git a/ctl/meta/PDFPreface b/ctl/meta/PDFPreface new file mode 100644 index 00000000..24bc7a3b --- /dev/null +++ b/ctl/meta/PDFPreface @@ -0,0 +1,12 @@ +logo + + +# 说明 + +此版本是 https://books.halfrost.com/leetcode 网页的离线版,由于网页版实时会更新,所以此 PDF 版难免会有一些排版或者错别字。如果读者遇到了,可以到网页版相应页面,点击页面 edit 按钮,提交 pr 进行更改。此 PDF 版本号是 V1.5.20。PDF 永久更新地址是 https://github.com/halfrost/LeetCode-Go/releases/,以版本号区分不同版本。笔者还是强烈推荐看在线版,有任何错误都会立即更新。如果觉得此书对刷题有一点点帮助,可以给此书点一个 star,鼓励一下笔者早点更新更多题解。 + +> 版本号说明,V1.5.20,1 是大版本号,5 代表当前题解中有几百题,目前是 520 题,所以第二个版本号是 5,20 代表当前题解中有几十题,目前是 520 题,所以第三个版本号是 20 。 + +# 目录 + +[toc] \ No newline at end of file diff --git a/ctl/models/tagproblem.go b/ctl/models/tagproblem.go index 838bbd23..f5cfbd5b 100644 --- a/ctl/models/tagproblem.go +++ b/ctl/models/tagproblem.go @@ -115,7 +115,7 @@ func (t TagList) tableLine() string { } // GenerateTagMdRows define -func GenerateTagMdRows(solutionIds []int, metaMap map[int]TagList, mdrows []Mdrow) []TagList { +func GenerateTagMdRows(solutionIds []int, metaMap map[int]TagList, mdrows []Mdrow, internal bool) []TagList { tl := []TagList{} for _, row := range mdrows { if util.BinarySearch(solutionIds, int(row.FrontendQuestionID)) != -1 { @@ -129,7 +129,11 @@ func GenerateTagMdRows(solutionIds []int, metaMap map[int]TagList, mdrows []Mdro s5 := strings.Replace(s4, ")", "", -1) s6 := strings.Replace(s5, ",", "", -1) s7 := strings.Replace(s6, "?", "", -1) - tmp.SolutionPath = fmt.Sprintf("[Go]({{< relref \"/ChapterFour/%v.md\" >}})", fmt.Sprintf("%04d.%v", int(row.FrontendQuestionID), s7)) + if internal { + tmp.SolutionPath = fmt.Sprintf("[Go]({{< relref \"/ChapterFour/%v.md\" >}})", fmt.Sprintf("%04d.%v", int(row.FrontendQuestionID), s7)) + } else { + tmp.SolutionPath = fmt.Sprintf("[Go](https://books.halfrost.com/leetcode/ChapterFour/%v)", fmt.Sprintf("%04d.%v", int(row.FrontendQuestionID), s7)) + } tmp.Acceptance = row.Acceptance tmp.Difficulty = row.Difficulty tmp.TimeComplexity = metaMap[int(row.FrontendQuestionID)].TimeComplexity diff --git a/ctl/pdf.go b/ctl/pdf.go index 03e18ee1..9c2b432b 100644 --- a/ctl/pdf.go +++ b/ctl/pdf.go @@ -1,17 +1,212 @@ package main import ( + "bufio" + "fmt" + "github.com/halfrost/LeetCode-Go/ctl/util" "github.com/spf13/cobra" + "io" + "io/ioutil" + "os" + "regexp" + "strings" +) + +var ( + cleanString1 = "{{< columns >}}" + cleanString2 = "<--->" + cleanString3 = "{{< /columns >}}" + cleanString4 = "\"logo\"" + pdfPreface = `logo + + +# 说明 + +此版本是 https://books.halfrost.com/leetcode 网页的离线版,由于网页版实时会更新,所以此 PDF 版难免会有一些排版或者错别字。如果读者遇到了,可以到网页版相应页面,点击页面 edit 按钮,提交 pr 进行更改。此 PDF 版本号是 V%v.%v.%v。PDF 永久更新地址是 https://github.com/halfrost/LeetCode-Go/releases/,以版本号区分不同版本。笔者还是强烈推荐看在线版,有任何错误都会立即更新。如果觉得此书对刷题有一点点帮助,可以给此书点一个 star,鼓励一下笔者早点更新更多题解。 + +> 版本号说明,V%v.%v.%v,%v 是大版本号,%v 代表当前题解中有几百题,目前是 %v 题,所以第二个版本号是 %v,%v 代表当前题解中有几十题,目前是 %v 题,所以第三个版本号是 %v 。 + +# 目录 + +[toc] + +` + + majorVersion = 1 + midVersion = 0 + lastVersion = 0 + totalSolutions = 0 ) func newPDFCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "pdf ", + Use: "pdf", Short: "PDF related commands", Run: func(cmd *cobra.Command, args []string) { - + generatePDF() }, } - //mc.PersistentFlags().StringVar(&logicEndpoint, "endpoint", "localhost:5880", "endpoint of logic service") + // cmd.Flags().StringVar(&alias, "alias", "", "alias") + // cmd.Flags().StringVar(&appId, "appid", "", "appid") return cmd } + +func generatePDF() { + var ( + pdf, tmp []byte + err error + ) + // 先删除 pre-next + delPreNext() + + chapterFourFileOrder := util.LoadChapterFourDir() + totalSolutions = len(chapterFourFileOrder) + midVersion = totalSolutions / 100 + lastVersion = totalSolutions % 100 + fmt.Printf("[当前的版本号是 V%v.%v.%v]\n", majorVersion, midVersion, lastVersion) + // 删除原始文档中的头部,并创建临时文件夹 + prepare(fmt.Sprintf("../PDF v%v.%v.%v.md", majorVersion, midVersion, lastVersion)) + // PDF 前言 + pdf = append(pdf, []byte(fmt.Sprintf(pdfPreface, majorVersion, midVersion, lastVersion, majorVersion, midVersion, lastVersion, majorVersion, midVersion, totalSolutions, midVersion, lastVersion, totalSolutions, lastVersion))...) + // PDF 第一章 + tmp, err = loadChapter(chapterOneFileOrder, "./pdftemp", "ChapterOne") + pdf = append(pdf, tmp...) + // PDF 第二章 + tmp, err = loadChapter(chapterTwoFileOrder, "./pdftemp", "ChapterTwo") + pdf = append(pdf, tmp...) + // PDF 第三章 + tmp, err = loadChapter(chapterThreeFileOrder, "./pdftemp", "ChapterThree") + pdf = append(pdf, tmp...) + // PDF 第四章 + tmp, err = util.LoadFile("./pdftemp/ChapterFour/_index.md") + pdf = append(pdf, tmp...) + tmp, err = loadChapter(chapterFourFileOrder, "../website/content", "ChapterFour") + pdf = append(pdf, tmp...) + if err != nil { + fmt.Println(err) + } + // 生成 PDF + util.WriteFile(fmt.Sprintf("../PDF v%v.%v.%v.md", majorVersion, midVersion, lastVersion), pdf) + // 还原现场 + addPreNext() + util.DestoryDir("./pdftemp") +} + +func loadChapter(order []string, path, chapter string) ([]byte, error) { + var ( + res, tmp []byte + err error + ) + for index, v := range order { + if chapter == "ChapterOne" && index == 0 { + // 清理不支持的特殊 MarkDown 语法 + tmp, err = clean(fmt.Sprintf("%v/%v/%v.md", path, chapter, v)) + } else { + tmp, err = util.LoadFile(fmt.Sprintf("%v/%v/%v.md", path, chapter, v)) + } + if err != nil { + fmt.Println(err) + return []byte{}, err + } + res = append(res, tmp...) + } + return res, err +} + +func prepare(path string) { + err := os.Remove(path) + if err != nil { + fmt.Println("pdf 还没有创建") + fmt.Println(err) + } + fmt.Println("pdf 删除成功,开始构建全新版本") + + err = os.MkdirAll("./pdftemp/ChapterOne", os.ModePerm) + if err != nil { + fmt.Println(err) + } + for _, v := range chapterOneFileOrder { + removeHeader(fmt.Sprintf("../website/content/ChapterOne/%v.md", v), fmt.Sprintf("./pdftemp/ChapterOne/%v.md", v), 4) + } + + err = os.MkdirAll("./pdftemp/ChapterTwo", os.ModePerm) + if err != nil { + fmt.Println(err) + } + // 生成外部链接的 ChapterTwo + buildChapterTwo(false) + util.CopyFile("./pdftemp/ChapterTwo/_index.md", "../website/content/ChapterTwo/_index.md") + + for _, v := range chapterTwoFileOrder { + removeHeader(fmt.Sprintf("./pdftemp/ChapterTwo/%v.md", v), fmt.Sprintf("./pdftemp/ChapterTwo/%v.md", v), 4) + } + + err = os.MkdirAll("./pdftemp/ChapterThree", os.ModePerm) + if err != nil { + fmt.Println(err) + } + for _, v := range chapterThreeFileOrder { + removeHeader(fmt.Sprintf("../website/content/ChapterThree/%v.md", v), fmt.Sprintf("./pdftemp/ChapterThree/%v.md", v), 4) + } + + err = os.MkdirAll("./pdftemp/ChapterFour", os.ModePerm) + if err != nil { + fmt.Println(err) + } + removeHeader(fmt.Sprintf("../website/content/ChapterFour/_index.md"), fmt.Sprintf("./pdftemp/ChapterFour/_index.md"), 4) +} + +func clean(filePath string) ([]byte, error) { + f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) + if err != nil { + return nil, err + } + defer f.Close() + reader, output := bufio.NewReader(f), []byte{} + for { + line, _, err := reader.ReadLine() + if err != nil { + if err == io.EOF { + return output, nil + } + return nil, err + } + if ok, _ := regexp.Match(cleanString1, line); ok { + reg := regexp.MustCompile(cleanString1) + newByte := reg.ReplaceAll(line, []byte("")) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else if ok, _ := regexp.Match(cleanString2, line); ok { + reg := regexp.MustCompile(cleanString2) + newByte := reg.ReplaceAll(line, []byte("")) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else if ok, _ := regexp.Match(cleanString3, line); ok { + reg := regexp.MustCompile(cleanString3) + newByte := reg.ReplaceAll(line, []byte("")) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else if ok, _ := regexp.Match(cleanString4, line); ok { + reg := regexp.MustCompile(cleanString4) + newByte := reg.ReplaceAll(line, []byte("")) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else { + output = append(output, line...) + output = append(output, []byte("\n")...) + } + } +} + +func removeHeader(path, newPath string, lineNumber int) { + file, err := ioutil.ReadFile(path) + if err != nil { + panic(err) + } + info, _ := os.Stat(path) + mode := info.Mode() + array := strings.Split(string(file), "\n") + array = array[lineNumber:] + ioutil.WriteFile(newPath, []byte(strings.Join(array, "\n")), mode) + //fmt.Println("remove line successful") +} diff --git a/ctl/render.go b/ctl/render.go index f2984821..6745a54c 100644 --- a/ctl/render.go +++ b/ctl/render.go @@ -55,7 +55,7 @@ func newBuildChapterTwo() *cobra.Command { Use: "chapter-two", Short: "Build Chapter Two commands", Run: func(cmd *cobra.Command, args []string) { - buildChapterTwo() + buildChapterTwo(true) }, } // cmd.Flags().StringVar(&alias, "alias", "", "alias") @@ -147,7 +147,9 @@ func renderReadme(filePath string, total, try int, mdrows, omdrows m.Mdrows, use } } -func buildChapterTwo() { +// internal: true 渲染的链接都是 hugo 内部链接,用户生成 hugo web +// false 渲染的链接是外部 HTTPS 链接,用于生成 PDF +func buildChapterTwo(internal bool) { var ( gr m.GraphQLResp questions []m.Question @@ -169,7 +171,7 @@ func buildChapterTwo() { if err != nil { fmt.Printf("err = %v\n", err) } - tls := m.GenerateTagMdRows(solutionIds, tl, mdrows) + tls := m.GenerateTagMdRows(solutionIds, tl, mdrows, internal) //fmt.Printf("tls = %v\n", tls) // 按照模板渲染 README res, err := renderChapterTwo(fmt.Sprintf("./template/%v.md", chapterTwoFileName[index]), m.TagLists{TagLists: tls}) @@ -177,7 +179,12 @@ func buildChapterTwo() { fmt.Println(err) return } - util.WriteFile(fmt.Sprintf("../website/content/ChapterTwo/%v.md", chapterTwoFileName[index]), res) + if internal { + util.WriteFile(fmt.Sprintf("../website/content/ChapterTwo/%v.md", chapterTwoFileName[index]), res) + } else { + util.WriteFile(fmt.Sprintf("./pdftemp/ChapterTwo/%v.md", chapterTwoFileName[index]), res) + } + count++ } fmt.Printf("write %v files successful", count) diff --git a/ctl/util/util.go b/ctl/util/util.go index 7c0d1d25..63e34b29 100644 --- a/ctl/util/util.go +++ b/ctl/util/util.go @@ -1,11 +1,15 @@ package util import ( + "bufio" "fmt" + "io" "io/ioutil" "os" + "path/filepath" "sort" "strconv" + "strings" ) // LoadSolutionsDir define @@ -72,6 +76,63 @@ func WriteFile(fileName string, content []byte) { //fmt.Println("write file successful") } +// LoadFile define +func LoadFile(filePath string) ([]byte, error) { + f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) + if err != nil { + return nil, err + } + defer f.Close() + reader, output := bufio.NewReader(f), []byte{} + for { + line, _, err := reader.ReadLine() + if err != nil { + if err == io.EOF { + return output, nil + } + return nil, err + } + output = append(output, line...) + output = append(output, []byte("\n")...) + } +} + +// DestoryDir define +func DestoryDir(path string) { + filepath.Walk(path, func(path string, fi os.FileInfo, err error) error { + if nil == fi { + return err + } + if !fi.IsDir() { + return nil + } + name := fi.Name() + if strings.Contains(name, "temp") { + fmt.Println("temp file name:", path) + err := os.RemoveAll(path) + if err != nil { + fmt.Println("delet dir error:", err) + } + } + return nil + }) +} + +// CopyFile define +func CopyFile(dstName, srcName string) (written int64, err error) { + src, err := os.Open(srcName) + if err != nil { + return + } + defer src.Close() + dst, err := os.OpenFile(dstName, os.O_WRONLY|os.O_CREATE, 0644) + if err != nil { + return + } + defer dst.Close() + return io.Copy(dst, src) +} + // BinarySearch define func BinarySearch(nums []int, target int) int { low, high := 0, len(nums)-1 diff --git a/go.mod b/go.mod index 751917f2..ef681142 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/halfrost/LeetCode-Go -go 1.14 +go 1.15 require ( github.com/BurntSushi/toml v0.3.1 From c90926c89967e381d83f50e058a1ec0ce5b295b0 Mon Sep 17 00:00:00 2001 From: YDZ Date: Mon, 18 Jan 2021 11:06:37 +0800 Subject: [PATCH 79/82] Add solution 1641 --- README.md | 1206 +++++++++-------- ctl/command.go | 1 + ctl/refresh.go | 25 + .../1641. Count Sorted Vowel Strings.go | 35 + .../1641. Count Sorted Vowel Strings_test.go | 52 + .../1641.Count-Sorted-Vowel-Strings/README.md | 90 ++ ...k-Array-Formation-Through-Concatenation.md | 2 +- .../1641.Count-Sorted-Vowel-Strings.md | 97 ++ .../1646.Get-Maximum-in-Generated-Array.md | 2 +- website/content/ChapterTwo/Array.md | 68 +- website/content/ChapterTwo/Backtracking.md | 25 +- website/content/ChapterTwo/Binary_Search.md | 22 +- .../content/ChapterTwo/Bit_Manipulation.md | 8 +- .../ChapterTwo/Breadth_First_Search.md | 8 +- .../content/ChapterTwo/Depth_First_Search.md | 38 +- .../content/ChapterTwo/Dynamic_Programming.md | 33 +- website/content/ChapterTwo/Hash_Table.md | 25 +- website/content/ChapterTwo/Linked_List.md | 12 +- website/content/ChapterTwo/Math.md | 21 +- website/content/ChapterTwo/Segment_Tree.md | 2 +- website/content/ChapterTwo/Sliding_Window.md | 12 +- website/content/ChapterTwo/Sort.md | 8 +- website/content/ChapterTwo/Stack.md | 10 +- website/content/ChapterTwo/String.md | 14 +- website/content/ChapterTwo/Tree.md | 24 +- website/content/ChapterTwo/Two_Pointers.md | 12 +- website/content/ChapterTwo/Union_Find.md | 14 +- website/content/menu/index.md | 1 + 28 files changed, 1089 insertions(+), 778 deletions(-) create mode 100644 ctl/refresh.go create mode 100644 leetcode/1641.Count-Sorted-Vowel-Strings/1641. Count Sorted Vowel Strings.go create mode 100644 leetcode/1641.Count-Sorted-Vowel-Strings/1641. Count Sorted Vowel Strings_test.go create mode 100644 leetcode/1641.Count-Sorted-Vowel-Strings/README.md create mode 100644 website/content/ChapterFour/1641.Count-Sorted-Vowel-Strings.md diff --git a/README.md b/README.md index 5c10d2de..748aac45 100755 --- a/README.md +++ b/README.md @@ -125,47 +125,47 @@ | | Easy | Medium | Hard | Total | |:--------:|:--------:|:--------:|:--------:|:--------:| -|Optimizing|39|44|15|98| -|Accepted|**250**|**314**|**95**|**659**| -|Total|457|901|365|1723| -|Perfection Rate|84.4%|86.0%|84.2%|85.1%| -|Completion Rate|54.7%|34.9%|26.0%|38.2%| +|Optimizing|39|44|16|99| +|Accepted|**250**|**315**|**95**|**660**| +|Total|459|903|367|1729| +|Perfection Rate|84.4%|86.0%|83.2%|85.0%| +|Completion Rate|54.5%|34.9%|25.9%|38.2%| |------------|----------------------------|----------------------------|----------------------------|----------------------------| ## 二. 目录 -以下已经收录了 561 道题的题解,还有 11 道题在尝试优化到 beats 100% +以下已经收录了 561 道题的题解,还有 12 道题在尝试优化到 beats 100% | No. | Title | Solution | Acceptance | Difficulty | Frequency | |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| |0001|Two Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum)|46.2%|Easy|| -|0002|Add Two Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0002.Add-Two-Numbers)|35.1%|Medium|| -|0003|Longest Substring Without Repeating Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0003.Longest-Substring-Without-Repeating-Characters)|31.2%|Medium|| +|0002|Add Two Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0002.Add-Two-Numbers)|35.2%|Medium|| +|0003|Longest Substring Without Repeating Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0003.Longest-Substring-Without-Repeating-Characters)|31.3%|Medium|| |0004|Median of Two Sorted Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0004.Median-of-Two-Sorted-Arrays)|30.8%|Hard|| |0005|Longest Palindromic Substring||30.1%|Medium|| |0006|ZigZag Conversion||37.6%|Medium|| -|0007|Reverse Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0007.Reverse-Integer)|25.8%|Easy|| +|0007|Reverse Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0007.Reverse-Integer)|25.9%|Easy|| |0008|String to Integer (atoi)||15.6%|Medium|| -|0009|Palindrome Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0009.Palindrome-Number)|49.4%|Easy|| +|0009|Palindrome Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0009.Palindrome-Number)|49.5%|Easy|| |0010|Regular Expression Matching||27.2%|Hard|| |0011|Container With Most Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0011.Container-With-Most-Water)|52.2%|Medium|| |0012|Integer to Roman||55.9%|Medium|| |0013|Roman to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0013.Roman-to-Integer)|56.4%|Easy|| |0014|Longest Common Prefix||36.0%|Easy|| -|0015|3Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0015.3Sum)|27.7%|Medium|| +|0015|3Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0015.3Sum)|27.8%|Medium|| |0016|3Sum Closest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0016.3Sum-Closest)|46.2%|Medium|| -|0017|Letter Combinations of a Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0017.Letter-Combinations-of-a-Phone-Number)|48.6%|Medium|| +|0017|Letter Combinations of a Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0017.Letter-Combinations-of-a-Phone-Number)|48.7%|Medium|| |0018|4Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0018.4Sum)|34.6%|Medium|| |0019|Remove Nth Node From End of List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0019.Remove-Nth-Node-From-End-of-List)|35.6%|Medium|| |0020|Valid Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0020.Valid-Parentheses)|39.5%|Easy|| -|0021|Merge Two Sorted Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0021.Merge-Two-Sorted-Lists)|55.6%|Easy|| +|0021|Merge Two Sorted Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0021.Merge-Two-Sorted-Lists)|55.7%|Easy|| |0022|Generate Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0022.Generate-Parentheses)|64.8%|Medium|| -|0023|Merge k Sorted Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0023.Merge-k-Sorted-Lists)|41.9%|Hard|| -|0024|Swap Nodes in Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0024.Swap-Nodes-in-Pairs)|52.6%|Medium|| -|0025|Reverse Nodes in k-Group|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0025.Reverse-Nodes-in-k-Group)|44.2%|Hard|| +|0023|Merge k Sorted Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0023.Merge-k-Sorted-Lists)|42.0%|Hard|| +|0024|Swap Nodes in Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0024.Swap-Nodes-in-Pairs)|52.7%|Medium|| +|0025|Reverse Nodes in k-Group|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0025.Reverse-Nodes-in-k-Group)|44.3%|Hard|| |0026|Remove Duplicates from Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0026.Remove-Duplicates-from-Sorted-Array)|46.3%|Easy|| |0027|Remove Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0027.Remove-Element)|49.0%|Easy|| -|0028|Implement strStr()|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0028.Implement-strStr())|35.0%|Easy|| +|0028|Implement strStr()|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0028.Implement-strStr())|35.1%|Easy|| |0029|Divide Two Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0029.Divide-Two-Integers)|16.6%|Medium|| |0030|Substring with Concatenation of All Words|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0030.Substring-with-Concatenation-of-All-Words)|26.0%|Hard|| |0031|Next Permutation||33.2%|Medium|| @@ -174,116 +174,116 @@ |0034|Find First and Last Position of Element in Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array)|37.1%|Medium|| |0035|Search Insert Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0035.Search-Insert-Position)|42.8%|Easy|| |0036|Valid Sudoku|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0036.Valid-Sudoku)|50.2%|Medium|| -|0037|Sudoku Solver|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0037.Sudoku-Solver)|45.9%|Hard|| +|0037|Sudoku Solver|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0037.Sudoku-Solver)|46.0%|Hard|| |0038|Count and Say||45.8%|Easy|| -|0039|Combination Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0039.Combination-Sum)|58.7%|Medium|| +|0039|Combination Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0039.Combination-Sum)|58.8%|Medium|| |0040|Combination Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0040.Combination-Sum-II)|49.8%|Medium|| |0041|First Missing Positive|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0041.First-Missing-Positive)|33.4%|Hard|| -|0042|Trapping Rain Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0042.Trapping-Rain-Water)|50.7%|Hard|| +|0042|Trapping Rain Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0042.Trapping-Rain-Water)|50.8%|Hard|| |0043|Multiply Strings||34.7%|Medium|| |0044|Wildcard Matching||25.3%|Hard|| |0045|Jump Game II||31.3%|Hard|| -|0046|Permutations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0046.Permutations)|66.0%|Medium|| +|0046|Permutations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0046.Permutations)|66.1%|Medium|| |0047|Permutations II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0047.Permutations-II)|49.0%|Medium|| -|0048|Rotate Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0048.Rotate-Image)|59.3%|Medium|| +|0048|Rotate Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0048.Rotate-Image)|59.4%|Medium|| |0049|Group Anagrams|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams)|58.8%|Medium|| |0050|Pow(x, n)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0050.Pow(x,-n))|30.8%|Medium|| -|0051|N-Queens|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0051.N-Queens)|49.0%|Hard|| +|0051|N-Queens|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0051.N-Queens)|49.1%|Hard|| |0052|N-Queens II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0052.N-Queens-II)|59.7%|Hard|| |0053|Maximum Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0053.Maximum-Subarray)|47.5%|Easy|| |0054|Spiral Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0054.Spiral-Matrix)|35.5%|Medium|| |0055|Jump Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0055.Jump-Game)|35.1%|Medium|| -|0056|Merge Intervals|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0056.Merge-Intervals)|40.6%|Medium|| -|0057|Insert Interval|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0057.Insert-Interval)|34.8%|Medium|| +|0056|Merge Intervals|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0056.Merge-Intervals)|40.7%|Medium|| +|0057|Insert Interval|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0057.Insert-Interval)|34.9%|Medium|| |0058|Length of Last Word||33.4%|Easy|| |0059|Spiral Matrix II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0059.Spiral-Matrix-II)|57.4%|Medium|| |0060|Permutation Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0060.Permutation-Sequence)|39.2%|Hard|| -|0061|Rotate List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0061.Rotate-List)|31.5%|Medium|| +|0061|Rotate List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0061.Rotate-List)|31.6%|Medium|| |0062|Unique Paths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0062.Unique-Paths)|55.6%|Medium|| |0063|Unique Paths II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0063.Unique-Paths-II)|35.1%|Medium|| |0064|Minimum Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0064.Minimum-Path-Sum)|55.9%|Medium|| |0065|Valid Number||15.7%|Hard|| |0066|Plus One|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0066.Plus-One)|42.5%|Easy|| |0067|Add Binary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0067.Add-Binary)|46.6%|Easy|| -|0068|Text Justification||29.2%|Hard|| +|0068|Text Justification||29.3%|Hard|| |0069|Sqrt(x)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0069.Sqrt(x))|34.8%|Easy|| |0070|Climbing Stairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0070.Climbing-Stairs)|48.5%|Easy|| |0071|Simplify Path|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0071.Simplify-Path)|33.6%|Medium|| |0072|Edit Distance||46.4%|Hard|| |0073|Set Matrix Zeroes||44.1%|Medium|| -|0074|Search a 2D Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0074.Search-a-2D-Matrix)|37.3%|Medium|| +|0074|Search a 2D Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0074.Search-a-2D-Matrix)|37.4%|Medium|| |0075|Sort Colors|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0075.Sort-Colors)|48.9%|Medium|| |0076|Minimum Window Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0076.Minimum-Window-Substring)|35.7%|Hard|| |0077|Combinations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0077.Combinations)|56.9%|Medium|| -|0078|Subsets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0078.Subsets)|64.4%|Medium|| -|0079|Word Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0079.Word-Search)|36.5%|Medium|| -|0080|Remove Duplicates from Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II)|45.8%|Medium|| +|0078|Subsets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0078.Subsets)|64.5%|Medium|| +|0079|Word Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0079.Word-Search)|36.6%|Medium|| +|0080|Remove Duplicates from Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II)|45.9%|Medium|| |0081|Search in Rotated Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0081.Search-in-Rotated-Sorted-Array-II)|33.5%|Medium|| -|0082|Remove Duplicates from Sorted List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II)|38.9%|Medium|| +|0082|Remove Duplicates from Sorted List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II)|39.0%|Medium|| |0083|Remove Duplicates from Sorted List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0083.Remove-Duplicates-from-Sorted-List)|46.3%|Easy|| |0084|Largest Rectangle in Histogram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0084.Largest-Rectangle-in-Histogram)|36.8%|Hard|| -|0085|Maximal Rectangle||39.1%|Hard|| +|0085|Maximal Rectangle||39.2%|Hard|| |0086|Partition List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0086.Partition-List)|43.0%|Medium|| |0087|Scramble String||34.5%|Hard|| -|0088|Merge Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0088.Merge-Sorted-Array)|40.5%|Easy|| -|0089|Gray Code|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0089.Gray-Code)|50.0%|Medium|| +|0088|Merge Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0088.Merge-Sorted-Array)|40.6%|Easy|| +|0089|Gray Code|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0089.Gray-Code)|50.1%|Medium|| |0090|Subsets II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0090.Subsets-II)|48.5%|Medium|| |0091|Decode Ways|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0091.Decode-Ways)|26.2%|Medium|| -|0092|Reverse Linked List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0092.Reverse-Linked-List-II)|40.2%|Medium|| +|0092|Reverse Linked List II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0092.Reverse-Linked-List-II)|40.3%|Medium|| |0093|Restore IP Addresses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0093.Restore-IP-Addresses)|37.2%|Medium|| |0094|Binary Tree Inorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0094.Binary-Tree-Inorder-Traversal)|65.4%|Medium|| -|0095|Unique Binary Search Trees II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0095.Unique-Binary-Search-Trees-II)|42.0%|Medium|| -|0096|Unique Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0096.Unique-Binary-Search-Trees)|54.1%|Medium|| +|0095|Unique Binary Search Trees II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0095.Unique-Binary-Search-Trees-II)|42.1%|Medium|| +|0096|Unique Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0096.Unique-Binary-Search-Trees)|54.2%|Medium|| |0097|Interleaving String||32.4%|Hard|| |0098|Validate Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0098.Validate-Binary-Search-Tree)|28.6%|Medium|| -|0099|Recover Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0099.Recover-Binary-Search-Tree)|42.1%|Hard|| +|0099|Recover Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0099.Recover-Binary-Search-Tree)|42.2%|Hard|| |0100|Same Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0100.Same-Tree)|54.0%|Easy|| -|0101|Symmetric Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0101.Symmetric-Tree)|47.8%|Easy|| +|0101|Symmetric Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0101.Symmetric-Tree)|47.9%|Easy|| |0102|Binary Tree Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0102.Binary-Tree-Level-Order-Traversal)|56.2%|Medium|| -|0103|Binary Tree Zigzag Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal)|49.7%|Medium|| +|0103|Binary Tree Zigzag Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal)|49.8%|Medium|| |0104|Maximum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0104.Maximum-Depth-of-Binary-Tree)|67.7%|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)|51.2%|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)|49.1%|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)|54.8%|Easy|| -|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)|59.9%|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)|49.7%|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)|49.2%|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)|54.9%|Easy|| +|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)|60.0%|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)|49.8%|Medium|| |0110|Balanced Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0110.Balanced-Binary-Tree)|44.6%|Easy|| |0111|Minimum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0111.Minimum-Depth-of-Binary-Tree)|39.2%|Easy|| |0112|Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0112.Path-Sum)|42.1%|Easy|| -|0113|Path Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0113.Path-Sum-II)|48.6%|Medium|| -|0114|Flatten Binary Tree to Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0114.Flatten-Binary-Tree-to-Linked-List)|51.4%|Medium|| +|0113|Path Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0113.Path-Sum-II)|48.7%|Medium|| +|0114|Flatten Binary Tree to Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0114.Flatten-Binary-Tree-to-Linked-List)|51.5%|Medium|| |0115|Distinct Subsequences||39.4%|Hard|| -|0116|Populating Next Right Pointers in Each Node||48.4%|Medium|| +|0116|Populating Next Right Pointers in Each Node||48.5%|Medium|| |0117|Populating Next Right Pointers in Each Node II||41.7%|Medium|| -|0118|Pascal's Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0118.Pascal's-Triangle)|54.3%|Easy|| -|0119|Pascal's Triangle II||51.8%|Easy|| -|0120|Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0120.Triangle)|45.4%|Medium|| -|0121|Best Time to Buy and Sell Stock|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock)|51.2%|Easy|| -|0122|Best Time to Buy and Sell Stock II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II)|58.2%|Easy|| +|0118|Pascal's Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0118.Pascal's-Triangle)|54.4%|Easy|| +|0119|Pascal's Triangle II||51.9%|Easy|| +|0120|Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0120.Triangle)|45.5%|Medium|| +|0121|Best Time to Buy and Sell Stock|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock)|51.3%|Easy|| +|0122|Best Time to Buy and Sell Stock II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II)|58.3%|Easy|| |0123|Best Time to Buy and Sell Stock III||39.7%|Hard|| -|0124|Binary Tree Maximum Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0124.Binary-Tree-Maximum-Path-Sum)|35.2%|Hard|| +|0124|Binary Tree Maximum Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0124.Binary-Tree-Maximum-Path-Sum)|35.3%|Hard|| |0125|Valid Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0125.Valid-Palindrome)|37.9%|Easy|| |0126|Word Ladder II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0126.Word-Ladder-II)|23.4%|Hard|| -|0127|Word Ladder|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0127.Word-Ladder)|31.4%|Hard|| -|0128|Longest Consecutive Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0128.Longest-Consecutive-Sequence)|46.0%|Hard|| -|0129|Sum Root to Leaf Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0129.Sum-Root-to-Leaf-Numbers)|50.5%|Medium|| -|0130|Surrounded Regions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0130.Surrounded-Regions)|29.1%|Medium|| -|0131|Palindrome Partitioning|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0131.Palindrome-Partitioning)|51.3%|Medium|| +|0127|Word Ladder|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0127.Word-Ladder)|31.5%|Hard|| +|0128|Longest Consecutive Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0128.Longest-Consecutive-Sequence)|46.1%|Hard|| +|0129|Sum Root to Leaf Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0129.Sum-Root-to-Leaf-Numbers)|50.6%|Medium|| +|0130|Surrounded Regions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0130.Surrounded-Regions)|29.2%|Medium|| +|0131|Palindrome Partitioning|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0131.Palindrome-Partitioning)|51.4%|Medium|| |0132|Palindrome Partitioning II||31.0%|Hard|| -|0133|Clone Graph||38.4%|Medium|| -|0134|Gas Station||40.9%|Medium|| -|0135|Candy||32.7%|Hard|| -|0136|Single Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0136.Single-Number)|66.3%|Easy|| +|0133|Clone Graph||38.5%|Medium|| +|0134|Gas Station||41.0%|Medium|| +|0135|Candy||32.8%|Hard|| +|0136|Single Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0136.Single-Number)|66.4%|Easy|| |0137|Single Number II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0137.Single-Number-II)|53.5%|Medium|| -|0138|Copy List with Random Pointer||39.4%|Medium|| +|0138|Copy List with Random Pointer||39.5%|Medium|| |0139|Word Break||41.4%|Medium|| -|0140|Word Break II||34.2%|Hard|| +|0140|Word Break II||34.3%|Hard|| |0141|Linked List Cycle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0141.Linked-List-Cycle)|42.2%|Easy|| |0142|Linked List Cycle II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0142.Linked-List-Cycle-II)|39.3%|Medium|| |0143|Reorder List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0143.Reorder-List)|40.2%|Medium|| |0144|Binary Tree Preorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0144.Binary-Tree-Preorder-Traversal)|57.1%|Medium|| -|0145|Binary Tree Postorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0145.Binary-Tree-Postorder-Traversal)|57.0%|Medium|| -|0146|LRU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0146.LRU-Cache)|35.2%|Medium|| +|0145|Binary Tree Postorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0145.Binary-Tree-Postorder-Traversal)|57.1%|Medium|| +|0146|LRU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0146.LRU-Cache)|35.3%|Medium|| |0147|Insertion Sort List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0147.Insertion-Sort-List)|44.1%|Medium|| |0148|Sort List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0148.Sort-List)|45.8%|Medium|| |0149|Max Points on a Line||17.3%|Hard|| @@ -293,12 +293,12 @@ |0153|Find Minimum in Rotated Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0153.Find-Minimum-in-Rotated-Sorted-Array)|45.9%|Medium|| |0154|Find Minimum in Rotated Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0154.Find-Minimum-in-Rotated-Sorted-Array-II)|41.9%|Hard|| |0155|Min Stack|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0155.Min-Stack)|46.0%|Easy|| -|0156|Binary Tree Upside Down||56.0%|Medium|| +|0156|Binary Tree Upside Down||56.1%|Medium|| |0157|Read N Characters Given Read4||36.9%|Easy|| |0158|Read N Characters Given Read4 II - Call multiple times||36.3%|Hard|| |0159|Longest Substring with At Most Two Distinct Characters||50.3%|Medium|| -|0160|Intersection of Two Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0160.Intersection-of-Two-Linked-Lists)|42.6%|Easy|| -|0161|One Edit Distance||32.7%|Medium|| +|0160|Intersection of Two Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0160.Intersection-of-Two-Linked-Lists)|42.7%|Easy|| +|0161|One Edit Distance||32.8%|Medium|| |0162|Find Peak Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0162.Find-Peak-Element)|43.8%|Medium|| |0163|Missing Ranges||26.4%|Easy|| |0164|Maximum Gap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0164.Maximum-Gap)|36.6%|Hard|| @@ -306,34 +306,34 @@ |0166|Fraction to Recurring Decimal||22.2%|Medium|| |0167|Two Sum II - Input array is sorted|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0167.Two-Sum-II---Input-array-is-sorted)|55.4%|Easy|| |0168|Excel Sheet Column Title|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0168.Excel-Sheet-Column-Title)|31.6%|Easy|| -|0169|Majority Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0169.Majority-Element)|59.8%|Easy|| +|0169|Majority Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0169.Majority-Element)|59.9%|Easy|| |0170|Two Sum III - Data structure design||34.7%|Easy|| -|0171|Excel Sheet Column Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0171.Excel-Sheet-Column-Number)|56.7%|Easy|| -|0172|Factorial Trailing Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0172.Factorial-Trailing-Zeroes)|38.3%|Easy|| +|0171|Excel Sheet Column Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0171.Excel-Sheet-Column-Number)|56.8%|Easy|| +|0172|Factorial Trailing Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0172.Factorial-Trailing-Zeroes)|38.4%|Easy|| |0173|Binary Search Tree Iterator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0173.Binary-Search-Tree-Iterator)|59.6%|Medium|| -|0174|Dungeon Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0174.Dungeon-Game)|33.1%|Hard|| -|0175|Combine Two Tables||63.4%|Easy|| +|0174|Dungeon Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0174.Dungeon-Game)|33.2%|Hard|| +|0175|Combine Two Tables||63.5%|Easy|| |0176|Second Highest Salary||33.0%|Easy|| |0177|Nth Highest Salary||32.9%|Medium|| -|0178|Rank Scores||49.2%|Medium|| +|0178|Rank Scores||49.3%|Medium|| |0179|Largest Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0179.Largest-Number)|30.4%|Medium|| |0180|Consecutive Numbers||41.7%|Medium|| -|0181|Employees Earning More Than Their Managers||59.6%|Easy|| +|0181|Employees Earning More Than Their Managers||59.7%|Easy|| |0182|Duplicate Emails||64.1%|Easy|| -|0183|Customers Who Never Order||56.1%|Easy|| -|0184|Department Highest Salary||39.3%|Medium|| -|0185|Department Top Three Salaries||38.0%|Hard|| -|0186|Reverse Words in a String II||45.0%|Medium|| +|0183|Customers Who Never Order||56.2%|Easy|| +|0184|Department Highest Salary||39.4%|Medium|| +|0185|Department Top Three Salaries||38.1%|Hard|| +|0186|Reverse Words in a String II||45.1%|Medium|| |0187|Repeated DNA Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0187.Repeated-DNA-Sequences)|41.2%|Medium|| |0188|Best Time to Buy and Sell Stock IV||29.3%|Hard|| |0189|Rotate Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0189.Rotate-Array)|36.4%|Medium|| -|0190|Reverse Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0190.Reverse-Bits)|41.6%|Easy|| +|0190|Reverse Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0190.Reverse-Bits)|41.7%|Easy|| |0191|Number of 1 Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0191.Number-of-1-Bits)|51.9%|Easy|| |0192|Word Frequency||25.8%|Medium|| |0193|Valid Phone Numbers||25.3%|Easy|| |0194|Transpose File||24.5%|Medium|| |0195|Tenth Line||32.9%|Easy|| -|0196|Delete Duplicate Emails||44.3%|Easy|| +|0196|Delete Duplicate Emails||44.4%|Easy|| |0197|Rising Temperature||39.6%|Easy|| |0198|House Robber|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0198.House-Robber)|42.7%|Medium|| |0199|Binary Tree Right Side View|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0199.Binary-Tree-Right-Side-View)|55.7%|Medium|| @@ -342,23 +342,23 @@ |0202|Happy Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0202.Happy-Number)|51.1%|Easy|| |0203|Remove Linked List Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0203.Remove-Linked-List-Elements)|39.0%|Easy|| |0204|Count Primes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0204.Count-Primes)|32.1%|Easy|| -|0205|Isomorphic Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0205.Isomorphic-Strings)|40.3%|Easy|| -|0206|Reverse Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0206.Reverse-Linked-List)|64.7%|Easy|| +|0205|Isomorphic Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0205.Isomorphic-Strings)|40.4%|Easy|| +|0206|Reverse Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0206.Reverse-Linked-List)|64.8%|Easy|| |0207|Course Schedule|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0207.Course-Schedule)|44.2%|Medium|| -|0208|Implement Trie (Prefix Tree)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0208.Implement-Trie-(Prefix-Tree))|51.5%|Medium|| +|0208|Implement Trie (Prefix Tree)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0208.Implement-Trie-(Prefix-Tree))|51.6%|Medium|| |0209|Minimum Size Subarray Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0209.Minimum-Size-Subarray-Sum)|39.2%|Medium|| -|0210|Course Schedule II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0210.Course-Schedule-II)|42.2%|Medium|| +|0210|Course Schedule II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0210.Course-Schedule-II)|42.3%|Medium|| |0211|Design Add and Search Words Data Structure|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0211.Design-Add-and-Search-Words-Data-Structure)|39.8%|Medium|| -|0212|Word Search II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0212.Word-Search-II)|36.5%|Hard|| +|0212|Word Search II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0212.Word-Search-II)|36.6%|Hard|| |0213|House Robber II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0213.House-Robber-II)|37.4%|Medium|| |0214|Shortest Palindrome||30.5%|Hard|| -|0215|Kth Largest Element in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0215.Kth-Largest-Element-in-an-Array)|57.5%|Medium|| +|0215|Kth Largest Element in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0215.Kth-Largest-Element-in-an-Array)|58.0%|Medium|| |0216|Combination Sum III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0216.Combination-Sum-III)|59.9%|Medium|| |0217|Contains Duplicate|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0217.Contains-Duplicate)|56.5%|Easy|| |0218|The Skyline Problem|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0218.The-Skyline-Problem)|36.1%|Hard|| |0219|Contains Duplicate II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0219.Contains-Duplicate-II)|38.5%|Easy|| |0220|Contains Duplicate III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0220.Contains-Duplicate-III)|21.3%|Medium|| -|0221|Maximal Square||38.7%|Medium|| +|0221|Maximal Square||38.8%|Medium|| |0222|Count Complete Tree Nodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0222.Count-Complete-Tree-Nodes)|48.8%|Medium|| |0223|Rectangle Area|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0223.Rectangle-Area)|38.1%|Medium|| |0224|Basic Calculator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0224.Basic-Calculator)|38.0%|Hard|| @@ -367,21 +367,21 @@ |0227|Basic Calculator II||38.3%|Medium|| |0228|Summary Ranges|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0228.Summary-Ranges)|42.1%|Easy|| |0229|Majority Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0229.Majority-Element-II)|38.5%|Medium|| -|0230|Kth Smallest Element in a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0230.Kth-Smallest-Element-in-a-BST)|62.1%|Medium|| +|0230|Kth Smallest Element in a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0230.Kth-Smallest-Element-in-a-BST)|62.2%|Medium|| |0231|Power of Two|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0231.Power-of-Two)|43.8%|Easy|| |0232|Implement Queue using Stacks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0232.Implement-Queue-using-Stacks)|51.6%|Easy|| -|0233|Number of Digit One||31.6%|Hard|| +|0233|Number of Digit One||31.7%|Hard|| |0234|Palindrome Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0234.Palindrome-Linked-List)|40.2%|Easy|| |0235|Lowest Common Ancestor of a Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree)|51.4%|Easy|| |0236|Lowest Common Ancestor of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree)|48.1%|Medium|| -|0237|Delete Node in a Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0237.Delete-Node-in-a-Linked-List)|66.2%|Easy|| +|0237|Delete Node in a Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0237.Delete-Node-in-a-Linked-List)|66.3%|Easy|| |0238|Product of Array Except Self||61.2%|Medium|| |0239|Sliding Window Maximum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0239.Sliding-Window-Maximum)|44.5%|Hard|| -|0240|Search a 2D Matrix II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0240.Search-a-2D-Matrix-II)|44.1%|Medium|| -|0241|Different Ways to Add Parentheses||56.9%|Medium|| +|0240|Search a 2D Matrix II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0240.Search-a-2D-Matrix-II)|44.2%|Medium|| +|0241|Different Ways to Add Parentheses||57.0%|Medium|| |0242|Valid Anagram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0242.Valid-Anagram)|57.9%|Easy|| |0243|Shortest Word Distance||61.8%|Easy|| -|0244|Shortest Word Distance II||53.5%|Medium|| +|0244|Shortest Word Distance II||53.6%|Medium|| |0245|Shortest Word Distance III||55.8%|Medium|| |0246|Strobogrammatic Number||45.7%|Easy|| |0247|Strobogrammatic Number II||48.3%|Medium|| @@ -392,22 +392,22 @@ |0252|Meeting Rooms||55.3%|Easy|| |0253|Meeting Rooms II||46.6%|Medium|| |0254|Factor Combinations||47.2%|Medium|| -|0255|Verify Preorder Sequence in Binary Search Tree||46.0%|Medium|| -|0256|Paint House||53.2%|Medium|| -|0257|Binary Tree Paths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0257.Binary-Tree-Paths)|53.1%|Easy|| -|0258|Add Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0258.Add-Digits)|58.3%|Easy|| +|0255|Verify Preorder Sequence in Binary Search Tree||46.1%|Medium|| +|0256|Paint House||53.3%|Medium|| +|0257|Binary Tree Paths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0257.Binary-Tree-Paths)|53.2%|Easy|| +|0258|Add Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0258.Add-Digits)|58.4%|Easy|| |0259|3Sum Smaller||48.7%|Medium|| |0260|Single Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0260.Single-Number-III)|65.2%|Medium|| -|0261|Graph Valid Tree||42.9%|Medium|| -|0262|Trips and Users||35.4%|Hard|| +|0261|Graph Valid Tree||43.0%|Medium|| +|0262|Trips and Users||35.5%|Hard|| |0263|Ugly Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0263.Ugly-Number)|41.7%|Easy|| |0264|Ugly Number II||42.7%|Medium|| |0265|Paint House II||45.4%|Hard|| |0266|Palindrome Permutation||62.5%|Easy|| -|0267|Palindrome Permutation II||37.2%|Medium|| -|0268|Missing Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0268.Missing-Number)|53.3%|Easy|| +|0267|Palindrome Permutation II||37.3%|Medium|| +|0268|Missing Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0268.Missing-Number)|53.4%|Easy|| |0269|Alien Dictionary||33.6%|Hard|| -|0270|Closest Binary Search Tree Value||49.6%|Easy|| +|0270|Closest Binary Search Tree Value||49.7%|Easy|| |0271|Encode and Decode Strings||32.5%|Medium|| |0272|Closest Binary Search Tree Value II||51.9%|Hard|| |0273|Integer to English Words||27.9%|Hard|| @@ -415,7 +415,7 @@ |0275|H-Index II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0275.H-Index-II)|36.2%|Medium|| |0276|Paint Fence||38.9%|Easy|| |0277|Find the Celebrity||43.1%|Medium|| -|0278|First Bad Version||37.1%|Easy|| +|0278|First Bad Version||37.2%|Easy|| |0279|Perfect Squares||48.6%|Medium|| |0280|Wiggle Sort||64.5%|Medium|| |0281|Zigzag Iterator||59.2%|Medium|| @@ -424,23 +424,23 @@ |0284|Peeking Iterator||47.4%|Medium|| |0285|Inorder Successor in BST||42.4%|Medium|| |0286|Walls and Gates||56.0%|Medium|| -|0287|Find the Duplicate Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0287.Find-the-Duplicate-Number)|57.1%|Medium|| +|0287|Find the Duplicate Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0287.Find-the-Duplicate-Number)|57.2%|Medium|| |0288|Unique Word Abbreviation||22.8%|Medium|| -|0289|Game of Life||57.7%|Medium|| -|0290|Word Pattern|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0290.Word-Pattern)|38.2%|Easy|| +|0289|Game of Life||57.8%|Medium|| +|0290|Word Pattern|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0290.Word-Pattern)|38.3%|Easy|| |0291|Word Pattern II||44.0%|Hard|| |0292|Nim Game||55.0%|Easy|| |0293|Flip Game||61.2%|Easy|| |0294|Flip Game II||50.5%|Medium|| |0295|Find Median from Data Stream||46.4%|Hard|| -|0296|Best Meeting Point||58.0%|Hard|| -|0297|Serialize and Deserialize Binary Tree||49.3%|Hard|| +|0296|Best Meeting Point||58.1%|Hard|| +|0297|Serialize and Deserialize Binary Tree||49.4%|Hard|| |0298|Binary Tree Longest Consecutive Sequence||47.8%|Medium|| |0299|Bulls and Cows||44.3%|Medium|| |0300|Longest Increasing Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0300.Longest-Increasing-Subsequence)|43.6%|Medium|| |0301|Remove Invalid Parentheses||44.4%|Hard|| |0302|Smallest Rectangle Enclosing Black Pixels||52.3%|Hard|| -|0303|Range Sum Query - Immutable|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0303.Range-Sum-Query---Immutable)|47.0%|Easy|| +|0303|Range Sum Query - Immutable|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0303.Range-Sum-Query---Immutable)|47.1%|Easy|| |0304|Range Sum Query 2D - Immutable||40.2%|Medium|| |0305|Number of Islands II||39.8%|Hard|| |0306|Additive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0306.Additive-Number)|29.6%|Medium|| @@ -451,18 +451,18 @@ |0311|Sparse Matrix Multiplication||63.6%|Medium|| |0312|Burst Balloons||53.6%|Hard|| |0313|Super Ugly Number||45.9%|Medium|| -|0314|Binary Tree Vertical Order Traversal||46.6%|Medium|| +|0314|Binary Tree Vertical Order Traversal||46.7%|Medium|| |0315|Count of Smaller Numbers After Self|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0315.Count-of-Smaller-Numbers-After-Self)|42.6%|Hard|| -|0316|Remove Duplicate Letters||38.8%|Medium|| +|0316|Remove Duplicate Letters||38.9%|Medium|| |0317|Shortest Distance from All Buildings||42.5%|Hard|| -|0318|Maximum Product of Word Lengths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0318.Maximum-Product-of-Word-Lengths)|52.0%|Medium|| +|0318|Maximum Product of Word Lengths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0318.Maximum-Product-of-Word-Lengths)|52.1%|Medium|| |0319|Bulb Switcher||45.3%|Medium|| |0320|Generalized Abbreviation||53.4%|Medium|| |0321|Create Maximum Number||27.4%|Hard|| |0322|Coin Change|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0322.Coin-Change)|36.9%|Medium|| |0323|Number of Connected Components in an Undirected Graph||57.4%|Medium|| -|0324|Wiggle Sort II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0324.Wiggle-Sort-II)|30.5%|Medium|| -|0325|Maximum Size Subarray Sum Equals k||47.2%|Medium|| +|0324|Wiggle Sort II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0324.Wiggle-Sort-II)|30.6%|Medium|| +|0325|Maximum Size Subarray Sum Equals k||47.3%|Medium|| |0326|Power of Three|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0326.Power-of-Three)|42.1%|Easy|| |0327|Count of Range Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0327.Count-of-Range-Sum)|35.9%|Hard|| |0328|Odd Even Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0328.Odd-Even-Linked-List)|56.9%|Medium|| @@ -472,15 +472,15 @@ |0332|Reconstruct Itinerary||37.7%|Medium|| |0333|Largest BST Subtree||37.4%|Medium|| |0334|Increasing Triplet Subsequence||40.6%|Medium|| -|0335|Self Crossing||28.5%|Hard|| +|0335|Self Crossing||28.6%|Hard|| |0336|Palindrome Pairs||34.4%|Hard|| |0337|House Robber III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0337.House-Robber-III)|51.7%|Medium|| |0338|Counting Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0338.Counting-Bits)|70.2%|Medium|| -|0339|Nested List Weight Sum||75.5%|Easy|| +|0339|Nested List Weight Sum||76.0%|Easy|| |0340|Longest Substring with At Most K Distinct Characters||45.2%|Medium|| |0341|Flatten Nested List Iterator||54.2%|Medium|| |0342|Power of Four|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0342.Power-of-Four)|41.6%|Easy|| -|0343|Integer Break|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0343.Integer-Break)|51.0%|Medium|| +|0343|Integer Break|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0343.Integer-Break)|51.1%|Medium|| |0344|Reverse String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0344.Reverse-String)|70.0%|Easy|| |0345|Reverse Vowels of a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0345.Reverse-Vowels-of-a-String)|44.9%|Easy|| |0346|Moving Average from Data Stream||72.8%|Easy|| @@ -493,13 +493,13 @@ |0353|Design Snake Game||35.2%|Medium|| |0354|Russian Doll Envelopes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0354.Russian-Doll-Envelopes)|36.1%|Hard|| |0355|Design Twitter||31.1%|Medium|| -|0356|Line Reflection||32.6%|Medium|| -|0357|Count Numbers with Unique Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0357.Count-Numbers-with-Unique-Digits)|48.7%|Medium|| +|0356|Line Reflection||32.7%|Medium|| +|0357|Count Numbers with Unique Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0357.Count-Numbers-with-Unique-Digits)|48.8%|Medium|| |0358|Rearrange String k Distance Apart||35.5%|Hard|| -|0359|Logger Rate Limiter||71.9%|Easy|| +|0359|Logger Rate Limiter||72.0%|Easy|| |0360|Sort Transformed Array||49.5%|Medium|| |0361|Bomb Enemy||46.5%|Medium|| -|0362|Design Hit Counter||64.9%|Medium|| +|0362|Design Hit Counter||65.0%|Medium|| |0363|Max Sum of Rectangle No Larger Than K||38.3%|Hard|| |0364|Nested List Weight Sum II||63.4%|Medium|| |0365|Water and Jug Problem||31.0%|Medium|| @@ -510,12 +510,12 @@ |0370|Range Addition||63.4%|Medium|| |0371|Sum of Two Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0371.Sum-of-Two-Integers)|50.6%|Medium|| |0372|Super Pow|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0372.Super-Pow)|36.6%|Medium|| -|0373|Find K Pairs with Smallest Sums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0373.Find-K-Pairs-with-Smallest-Sums)|37.4%|Medium|| +|0373|Find K Pairs with Smallest Sums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0373.Find-K-Pairs-with-Smallest-Sums)|37.5%|Medium|| |0374|Guess Number Higher or Lower||44.4%|Easy|| |0375|Guess Number Higher or Lower II||41.9%|Medium|| |0376|Wiggle Subsequence||40.1%|Medium|| |0377|Combination Sum IV||45.9%|Medium|| -|0378|Kth Smallest Element in a Sorted Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0378.Kth-Smallest-Element-in-a-Sorted-Matrix)|55.8%|Medium|| +|0378|Kth Smallest Element in a Sorted Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0378.Kth-Smallest-Element-in-a-Sorted-Matrix)|55.9%|Medium|| |0379|Design Phone Directory||47.7%|Medium|| |0380|Insert Delete GetRandom O(1)||48.6%|Medium|| |0381|Insert Delete GetRandom O(1) - Duplicates allowed||34.7%|Hard|| @@ -531,11 +531,11 @@ |0391|Perfect Rectangle||31.0%|Hard|| |0392|Is Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0392.Is-Subsequence)|49.5%|Easy|| |0393|UTF-8 Validation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0393.UTF-8-Validation)|37.9%|Medium|| -|0394|Decode String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0394.Decode-String)|52.3%|Medium|| +|0394|Decode String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0394.Decode-String)|52.4%|Medium|| |0395|Longest Substring with At Least K Repeating Characters||43.4%|Medium|| |0396|Rotate Function||36.6%|Medium|| |0397|Integer Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0397.Integer-Replacement)|33.4%|Medium|| -|0398|Random Pick Index||57.5%|Medium|| +|0398|Random Pick Index||57.6%|Medium|| |0399|Evaluate Division|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0399.Evaluate-Division)|54.0%|Medium|| |0400|Nth Digit||32.3%|Medium|| |0401|Binary Watch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0401.Binary-Watch)|48.3%|Easy|| @@ -570,20 +570,20 @@ |0430|Flatten a Multilevel Doubly Linked List||56.6%|Medium|| |0431|Encode N-ary Tree to Binary Tree||74.4%|Hard|| |0432|All O`one Data Structure||33.0%|Hard|| -|0433|Minimum Genetic Mutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0433.Minimum-Genetic-Mutation)|43.0%|Medium|| +|0433|Minimum Genetic Mutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0433.Minimum-Genetic-Mutation)|43.1%|Medium|| |0434|Number of Segments in a String||37.8%|Easy|| |0435|Non-overlapping Intervals|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0435.Non-overlapping-Intervals)|43.8%|Medium|| |0436|Find Right Interval|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0436.Find-Right-Interval)|48.4%|Medium|| -|0437|Path Sum III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0437.Path-Sum-III)|47.9%|Medium|| -|0438|Find All Anagrams in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0438.Find-All-Anagrams-in-a-String)|44.6%|Medium|| +|0437|Path Sum III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0437.Path-Sum-III)|48.0%|Medium|| +|0438|Find All Anagrams in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0438.Find-All-Anagrams-in-a-String)|44.7%|Medium|| |0439|Ternary Expression Parser||56.6%|Medium|| |0440|K-th Smallest in Lexicographical Order||29.7%|Hard|| |0441|Arranging Coins|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0441.Arranging-Coins)|42.3%|Easy|| |0442|Find All Duplicates in an Array||68.7%|Medium|| -|0443|String Compression||43.0%|Medium|| +|0443|String Compression||43.1%|Medium|| |0444|Sequence Reconstruction||23.4%|Medium|| |0445|Add Two Numbers II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0445.Add-Two-Numbers-II)|56.0%|Medium|| -|0446|Arithmetic Slices II - Subsequence||33.2%|Hard|| +|0446|Arithmetic Slices II - Subsequence||33.3%|Hard|| |0447|Number of Boomerangs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0447.Number-of-Boomerangs)|52.3%|Medium|| |0448|Find All Numbers Disappeared in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array)|56.1%|Easy|| |0449|Serialize and Deserialize BST||53.8%|Medium|| @@ -624,30 +624,30 @@ |0484|Find Permutation||64.1%|Medium|| |0485|Max Consecutive Ones|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0485.Max-Consecutive-Ones)|53.2%|Easy|| |0486|Predict the Winner||48.4%|Medium|| -|0487|Max Consecutive Ones II||47.8%|Medium|| +|0487|Max Consecutive Ones II||47.9%|Medium|| |0488|Zuma Game||38.6%|Hard|| |0489|Robot Room Cleaner||72.1%|Hard|| -|0490|The Maze||52.5%|Medium|| +|0490|The Maze||52.6%|Medium|| |0491|Increasing Subsequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0491.Increasing-Subsequences)|47.3%|Medium|| |0492|Construct the Rectangle||50.2%|Easy|| |0493|Reverse Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0493.Reverse-Pairs)|26.6%|Hard|| -|0494|Target Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0494.Target-Sum)|45.9%|Medium|| +|0494|Target Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0494.Target-Sum)|45.8%|Medium|| |0495|Teemo Attacking||56.1%|Medium|| -|0496|Next Greater Element I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0496.Next-Greater-Element-I)|65.1%|Easy|| +|0496|Next Greater Element I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0496.Next-Greater-Element-I)|65.2%|Easy|| |0497|Random Point in Non-overlapping Rectangles|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles)|39.1%|Medium|| |0498|Diagonal Traverse|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0498.Diagonal-Traverse)|50.1%|Medium|| -|0499|The Maze III||42.1%|Hard|| +|0499|The Maze III||42.2%|Hard|| |0500|Keyboard Row|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0500.Keyboard-Row)|65.5%|Easy|| |0501|Find Mode in Binary Search Tree||43.2%|Easy|| |0502|IPO||41.3%|Hard|| |0503|Next Greater Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0503.Next-Greater-Element-II)|58.1%|Medium|| |0504|Base 7||46.4%|Easy|| |0505|The Maze II||48.3%|Medium|| -|0506|Relative Ranks||51.0%|Easy|| +|0506|Relative Ranks||51.1%|Easy|| |0507|Perfect Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0507.Perfect-Number)|36.0%|Easy|| |0508|Most Frequent Subtree Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0508.Most-Frequent-Subtree-Sum)|58.9%|Medium|| |0509|Fibonacci Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0509.Fibonacci-Number)|67.3%|Easy|| -|0510|Inorder Successor in BST II||59.8%|Medium|| +|0510|Inorder Successor in BST II||59.9%|Medium|| |0511|Game Play Analysis I||81.3%|Easy|| |0512|Game Play Analysis II||55.8%|Easy|| |0513|Find Bottom Left Tree Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0513.Find-Bottom-Left-Tree-Value)|62.3%|Medium|| @@ -664,23 +664,23 @@ |0524|Longest Word in Dictionary through Deleting|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0524.Longest-Word-in-Dictionary-through-Deleting)|48.9%|Medium|| |0525|Contiguous Array||43.4%|Medium|| |0526|Beautiful Arrangement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0526.Beautiful-Arrangement)|61.7%|Medium|| -|0527|Word Abbreviation||55.9%|Hard|| +|0527|Word Abbreviation||56.0%|Hard|| |0528|Random Pick with Weight|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0528.Random-Pick-with-Weight)|44.5%|Medium|| -|0529|Minesweeper|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0529.Minesweeper)|60.6%|Medium|| +|0529|Minesweeper|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0529.Minesweeper)|60.7%|Medium|| |0530|Minimum Absolute Difference in BST||54.6%|Easy|| |0531|Lonely Pixel I||59.4%|Medium|| |0532|K-diff Pairs in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0532.K-diff-Pairs-in-an-Array)|34.9%|Medium|| |0533|Lonely Pixel II||48.0%|Medium|| |0534|Game Play Analysis III||78.6%|Medium|| |0535|Encode and Decode TinyURL||80.7%|Medium|| -|0536|Construct Binary Tree from String||50.3%|Medium|| +|0536|Construct Binary Tree from String||50.4%|Medium|| |0537|Complex Number Multiplication|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0537.Complex-Number-Multiplication)|68.3%|Medium|| -|0538|Convert BST to Greater Tree||56.5%|Medium|| +|0538|Convert BST to Greater Tree||56.6%|Medium|| |0539|Minimum Time Difference||52.2%|Medium|| |0540|Single Element in a Sorted Array||57.9%|Medium|| |0541|Reverse String II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0541.Reverse-String-II)|49.0%|Easy|| |0542|01 Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0542.01-Matrix)|40.6%|Medium|| -|0543|Diameter of Binary Tree||49.0%|Easy|| +|0543|Diameter of Binary Tree||49.1%|Easy|| |0544|Output Contest Matches||75.7%|Medium|| |0545|Boundary of Binary Tree||39.4%|Medium|| |0546|Remove Boxes||44.2%|Hard|| @@ -692,13 +692,13 @@ |0552|Student Attendance Record II||37.2%|Hard|| |0553|Optimal Division||57.3%|Medium|| |0554|Brick Wall||50.6%|Medium|| -|0555|Split Concatenated Strings||42.8%|Medium|| +|0555|Split Concatenated Strings||42.7%|Medium|| |0556|Next Greater Element III||33.5%|Medium|| -|0557|Reverse Words in a String III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0557.Reverse-Words-in-a-String-III)|71.5%|Easy|| +|0557|Reverse Words in a String III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0557.Reverse-Words-in-a-String-III)|71.6%|Easy|| |0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.5%|Medium|| |0559|Maximum Depth of N-ary Tree||69.4%|Easy|| -|0560|Subarray Sum Equals K||43.9%|Medium|| -|0561|Array Partition I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0561.Array-Partition-I)|72.8%|Easy|| +|0560|Subarray Sum Equals K||43.8%|Medium|| +|0561|Array Partition I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0561.Array-Partition-I)|72.9%|Easy|| |0562|Longest Line of Consecutive One in Matrix||46.2%|Medium|| |0563|Binary Tree Tilt|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0563.Binary-Tree-Tilt)|52.6%|Easy|| |0564|Find the Closest Palindrome||20.2%|Hard|| @@ -706,21 +706,21 @@ |0566|Reshape the Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0566.Reshape-the-Matrix)|61.0%|Easy|| |0567|Permutation in String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0567.Permutation-in-String)|44.6%|Medium|| |0568|Maximum Vacation Days||41.4%|Hard|| -|0569|Median Employee Salary||60.9%|Hard|| -|0570|Managers with at Least 5 Direct Reports||66.6%|Medium|| +|0569|Median Employee Salary||61.0%|Hard|| +|0570|Managers with at Least 5 Direct Reports||66.7%|Medium|| |0571|Find Median Given Frequency of Numbers||45.5%|Hard|| |0572|Subtree of Another Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0572.Subtree-of-Another-Tree)|44.4%|Easy|| |0573|Squirrel Simulation||56.0%|Medium|| -|0574|Winning Candidate||51.2%|Medium|| +|0574|Winning Candidate||51.3%|Medium|| |0575|Distribute Candies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0575.Distribute-Candies)|61.9%|Easy|| |0576|Out of Boundary Paths||35.8%|Medium|| |0577|Employee Bonus||70.8%|Easy|| |0578|Get Highest Answer Rate Question||41.3%|Medium|| -|0579|Find Cumulative Salary of an Employee||38.0%|Hard|| -|0580|Count Student Number in Departments||51.0%|Medium|| +|0579|Find Cumulative Salary of an Employee||38.1%|Hard|| +|0580|Count Student Number in Departments||51.1%|Medium|| |0581|Shortest Unsorted Continuous Subarray||31.6%|Medium|| |0582|Kill Process||62.4%|Medium|| -|0583|Delete Operation for Two Strings||49.7%|Medium|| +|0583|Delete Operation for Two Strings||49.8%|Medium|| |0584|Find Customer Referee||73.7%|Easy|| |0585|Investments in 2016||56.5%|Medium|| |0586|Customer Placing the Largest Number of Orders||75.0%|Easy|| @@ -732,38 +732,38 @@ |0592|Fraction Addition and Subtraction||50.1%|Medium|| |0593|Valid Square||43.3%|Medium|| |0594|Longest Harmonious Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0594.Longest-Harmonious-Subsequence)|47.7%|Easy|| -|0595|Big Countries||78.2%|Easy|| +|0595|Big Countries||78.3%|Easy|| |0596|Classes More Than 5 Students||38.7%|Easy|| |0597|Friend Requests I: Overall Acceptance Rate||41.7%|Easy|| |0598|Range Addition II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0598.Range-Addition-II)|50.0%|Easy|| |0599|Minimum Index Sum of Two Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0599.Minimum-Index-Sum-of-Two-Lists)|51.5%|Easy|| -|0600|Non-negative Integers without Consecutive Ones||34.5%|Hard|| -|0601|Human Traffic of Stadium||44.3%|Hard|| -|0602|Friend Requests II: Who Has the Most Friends||56.6%|Medium|| +|0600|Non-negative Integers without Consecutive Ones||34.6%|Hard|| +|0601|Human Traffic of Stadium||44.4%|Hard|| +|0602|Friend Requests II: Who Has the Most Friends||56.7%|Medium|| |0603|Consecutive Available Seats||65.7%|Easy|| -|0604|Design Compressed String Iterator||38.1%|Easy|| +|0604|Design Compressed String Iterator||38.0%|Easy|| |0605|Can Place Flowers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0605.Can-Place-Flowers)|31.9%|Easy|| |0606|Construct String from Binary Tree||55.0%|Easy|| |0607|Sales Person||64.6%|Easy|| -|0608|Tree Node||69.0%|Medium|| -|0609|Find Duplicate File in System||60.8%|Medium|| -|0610|Triangle Judgement||67.9%|Easy|| +|0608|Tree Node||69.1%|Medium|| +|0609|Find Duplicate File in System||60.9%|Medium|| +|0610|Triangle Judgement||68.0%|Easy|| |0611|Valid Triangle Number||49.1%|Medium|| -|0612|Shortest Distance in a Plane||60.9%|Medium|| -|0613|Shortest Distance in a Line||79.1%|Easy|| -|0614|Second Degree Follower||32.1%|Medium|| -|0615|Average Salary: Departments VS Company||51.4%|Hard|| +|0612|Shortest Distance in a Plane||61.0%|Medium|| +|0613|Shortest Distance in a Line||79.2%|Easy|| +|0614|Second Degree Follower||32.2%|Medium|| +|0615|Average Salary: Departments VS Company||51.5%|Hard|| |0616|Add Bold Tag in String||44.4%|Medium|| |0617|Merge Two Binary Trees||75.1%|Easy|| -|0618|Students Report By Geography||58.7%|Hard|| +|0618|Students Report By Geography||58.8%|Hard|| |0619|Biggest Single Number||44.6%|Easy|| -|0620|Not Boring Movies||69.3%|Easy|| +|0620|Not Boring Movies||69.4%|Easy|| |0621|Task Scheduler||51.5%|Medium|| |0622|Design Circular Queue||45.1%|Medium|| |0623|Add One Row to Tree||50.3%|Medium|| |0624|Maximum Distance in Arrays||39.4%|Medium|| |0625|Minimum Factorization||32.9%|Medium|| -|0626|Exchange Seats||64.9%|Medium|| +|0626|Exchange Seats||65.0%|Medium|| |0627|Swap Salary||77.2%|Easy|| |0628|Maximum Product of Three Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0628.Maximum-Product-of-Three-Numbers)|47.0%|Easy|| |0629|K Inverse Pairs Array||31.6%|Hard|| @@ -772,17 +772,17 @@ |0632|Smallest Range Covering Elements from K Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists)|53.9%|Hard|| |0633|Sum of Square Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0633.Sum-of-Square-Numbers)|32.4%|Medium|| |0634|Find the Derangement of An Array||40.4%|Medium|| -|0635|Design Log Storage System||59.4%|Medium|| +|0635|Design Log Storage System||59.5%|Medium|| |0636|Exclusive Time of Functions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0636.Exclusive-Time-of-Functions)|53.9%|Medium|| |0637|Average of Levels in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0637.Average-of-Levels-in-Binary-Tree)|64.5%|Easy|| -|0638|Shopping Offers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0638.Shopping-Offers)|52.5%|Medium|| -|0639|Decode Ways II||27.4%|Hard|| +|0638|Shopping Offers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0638.Shopping-Offers)|52.6%|Medium|| +|0639|Decode Ways II||27.5%|Hard|| |0640|Solve the Equation||42.6%|Medium|| -|0641|Design Circular Deque||54.5%|Medium|| +|0641|Design Circular Deque||54.6%|Medium|| |0642|Design Search Autocomplete System||45.9%|Hard|| |0643|Maximum Average Subarray I||42.0%|Easy|| |0644|Maximum Average Subarray II||33.9%|Hard|| -|0645|Set Mismatch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0645.Set-Mismatch)|42.5%|Easy|| +|0645|Set Mismatch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0645.Set-Mismatch)|42.4%|Easy|| |0646|Maximum Length of Pair Chain||52.7%|Medium|| |0647|Palindromic Substrings||61.7%|Medium|| |0648|Replace Words|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0648.Replace-Words)|58.2%|Medium|| @@ -795,17 +795,17 @@ |0655|Print Binary Tree||55.8%|Medium|| |0656|Coin Path||29.5%|Hard|| |0657|Robot Return to Origin||73.6%|Easy|| -|0658|Find K Closest Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0658.Find-K-Closest-Elements)|41.7%|Medium|| +|0658|Find K Closest Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0658.Find-K-Closest-Elements)|41.8%|Medium|| |0659|Split Array into Consecutive Subsequences||44.2%|Medium|| |0660|Remove 9||54.1%|Hard|| -|0661|Image Smoother|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0661.Image-Smoother)|52.1%|Easy|| +|0661|Image Smoother|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0661.Image-Smoother)|52.2%|Easy|| |0662|Maximum Width of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0662.Maximum-Width-of-Binary-Tree)|40.0%|Medium|| |0663|Equal Tree Partition||39.7%|Medium|| -|0664|Strange Printer||41.2%|Hard|| +|0664|Strange Printer||41.3%|Hard|| |0665|Non-decreasing Array||19.6%|Easy|| |0666|Path Sum IV||55.6%|Medium|| |0667|Beautiful Arrangement II||55.0%|Medium|| -|0668|Kth Smallest Number in Multiplication Table|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0668.Kth-Smallest-Number-in-Multiplication-Table)|47.6%|Hard|| +|0668|Kth Smallest Number in Multiplication Table|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0668.Kth-Smallest-Number-in-Multiplication-Table)|47.7%|Hard|| |0669|Trim a Binary Search Tree||63.3%|Easy|| |0670|Maximum Swap||44.9%|Medium|| |0671|Second Minimum Node In a Binary Tree||42.8%|Easy|| @@ -818,47 +818,47 @@ |0678|Valid Parenthesis String||31.5%|Medium|| |0679|24 Game||47.1%|Hard|| |0680|Valid Palindrome II||37.0%|Easy|| -|0681|Next Closest Time||45.7%|Medium|| -|0682|Baseball Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0682.Baseball-Game)|66.0%|Easy|| +|0681|Next Closest Time||45.8%|Medium|| +|0682|Baseball Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0682.Baseball-Game)|66.1%|Easy|| |0683|K Empty Slots||35.9%|Hard|| -|0684|Redundant Connection|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0684.Redundant-Connection)|58.7%|Medium|| +|0684|Redundant Connection|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0684.Redundant-Connection)|58.8%|Medium|| |0685|Redundant Connection II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0685.Redundant-Connection-II)|32.9%|Hard|| |0686|Repeated String Match||32.8%|Medium|| |0687|Longest Univalue Path||37.1%|Medium|| |0688|Knight Probability in Chessboard||49.9%|Medium|| |0689|Maximum Sum of 3 Non-Overlapping Subarrays||47.1%|Hard|| -|0690|Employee Importance||58.3%|Easy|| -|0691|Stickers to Spell Word||44.2%|Hard|| +|0690|Employee Importance||58.4%|Easy|| +|0691|Stickers to Spell Word||44.3%|Hard|| |0692|Top K Frequent Words||52.9%|Medium|| |0693|Binary Number with Alternating Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0693.Binary-Number-with-Alternating-Bits)|59.7%|Easy|| -|0694|Number of Distinct Islands||57.3%|Medium|| +|0694|Number of Distinct Islands||57.4%|Medium|| |0695|Max Area of Island|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0695.Max-Area-of-Island)|64.3%|Medium|| -|0696|Count Binary Substrings||57.2%|Easy|| +|0696|Count Binary Substrings||57.3%|Easy|| |0697|Degree of an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0697.Degree-of-an-Array)|54.3%|Easy|| |0698|Partition to K Equal Sum Subsets||45.5%|Medium|| |0699|Falling Squares|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0699.Falling-Squares)|42.4%|Hard|| |0700|Search in a Binary Search Tree||73.4%|Easy|| -|0701|Insert into a Binary Search Tree||75.8%|Medium|| +|0701|Insert into a Binary Search Tree||75.9%|Medium|| |0702|Search in a Sorted Array of Unknown Size||68.5%|Medium|| |0703|Kth Largest Element in a Stream||50.5%|Easy|| |0704|Binary Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0704.Binary-Search)|54.0%|Easy|| -|0705|Design HashSet|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0705.Design-HashSet)|64.5%|Easy|| -|0706|Design HashMap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0706.Design-HashMap)|62.5%|Easy|| +|0705|Design HashSet|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0705.Design-HashSet)|64.6%|Easy|| +|0706|Design HashMap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0706.Design-HashMap)|62.6%|Easy|| |0707|Design Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0707.Design-Linked-List)|25.7%|Medium|| |0708|Insert into a Sorted Circular Linked List||32.4%|Medium|| -|0709|To Lower Case||79.9%|Easy|| +|0709|To Lower Case||80.0%|Easy|| |0710|Random Pick with Blacklist|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0710.Random-Pick-with-Blacklist)|32.7%|Hard|| -|0711|Number of Distinct Islands II||49.0%|Hard|| +|0711|Number of Distinct Islands II||49.1%|Hard|| |0712|Minimum ASCII Delete Sum for Two Strings||59.3%|Medium|| |0713|Subarray Product Less Than K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0713.Subarray-Product-Less-Than-K)|40.4%|Medium|| -|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee)|55.8%|Medium|| +|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee)|55.9%|Medium|| |0715|Range Module|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0715.Range-Module)|40.0%|Hard|| |0716|Max Stack||42.9%|Easy|| |0717|1-bit and 2-bit Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0717.1-bit-and-2-bit-Characters)|47.6%|Easy|| |0718|Maximum Length of Repeated Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0718.Maximum-Length-of-Repeated-Subarray)|50.1%|Medium|| |0719|Find K-th Smallest Pair Distance|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0719.Find-K-th-Smallest-Pair-Distance)|32.4%|Hard|| -|0720|Longest Word in Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0720.Longest-Word-in-Dictionary)|49.0%|Easy|| -|0721|Accounts Merge|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0721.Accounts-Merge)|51.1%|Medium|| +|0720|Longest Word in Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0720.Longest-Word-in-Dictionary)|49.1%|Easy|| +|0721|Accounts Merge|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0721.Accounts-Merge)|51.2%|Medium|| |0722|Remove Comments||35.8%|Medium|| |0723|Candy Crush||72.3%|Medium|| |0724|Find Pivot Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0724.Find-Pivot-Index)|45.0%|Easy|| @@ -873,13 +873,13 @@ |0733|Flood Fill|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0733.Flood-Fill)|55.8%|Easy|| |0734|Sentence Similarity||42.3%|Easy|| |0735|Asteroid Collision|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0735.Asteroid-Collision)|43.2%|Medium|| -|0736|Parse Lisp Expression||49.8%|Hard|| +|0736|Parse Lisp Expression||49.9%|Hard|| |0737|Sentence Similarity II||46.4%|Medium|| |0738|Monotone Increasing Digits||45.5%|Medium|| |0739|Daily Temperatures|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0739.Daily-Temperatures)|64.3%|Medium|| |0740|Delete and Earn||49.2%|Medium|| |0741|Cherry Pickup||35.0%|Hard|| -|0742|Closest Leaf in a Binary Tree||44.1%|Medium|| +|0742|Closest Leaf in a Binary Tree||44.2%|Medium|| |0743|Network Delay Time||45.3%|Medium|| |0744|Find Smallest Letter Greater Than Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0744.Find-Smallest-Letter-Greater-Than-Target)|45.6%|Easy|| |0745|Prefix and Suffix Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0745.Prefix-and-Suffix-Search)|35.1%|Hard|| @@ -891,13 +891,13 @@ |0751|IP to CIDR||60.1%|Medium|| |0752|Open the Lock||52.5%|Medium|| |0753|Cracking the Safe|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0753.Cracking-the-Safe)|52.0%|Hard|| -|0754|Reach a Number||40.4%|Medium|| +|0754|Reach a Number||40.5%|Medium|| |0755|Pour Water||44.0%|Medium|| |0756|Pyramid Transition Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0756.Pyramid-Transition-Matrix)|55.5%|Medium|| |0757|Set Intersection Size At Least Two||42.1%|Hard|| |0758|Bold Words in String||47.1%|Easy|| |0759|Employee Free Time||67.9%|Hard|| -|0760|Find Anagram Mappings||81.6%|Easy|| +|0760|Find Anagram Mappings||81.7%|Easy|| |0761|Special Binary String||58.5%|Hard|| |0762|Prime Number of Set Bits in Binary Representation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation)|64.1%|Easy|| |0763|Partition Labels|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0763.Partition-Labels)|77.9%|Medium|| @@ -909,23 +909,23 @@ |0769|Max Chunks To Make Sorted||55.5%|Medium|| |0770|Basic Calculator IV||54.5%|Hard|| |0771|Jewels and Stones|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0771.Jewels-and-Stones)|86.8%|Easy|| -|0772|Basic Calculator III||43.1%|Hard|| -|0773|Sliding Puzzle||60.4%|Hard|| -|0774|Minimize Max Distance to Gas Station||48.0%|Hard|| +|0772|Basic Calculator III||43.2%|Hard|| +|0773|Sliding Puzzle||60.5%|Hard|| +|0774|Minimize Max Distance to Gas Station||48.1%|Hard|| |0775|Global and Local Inversions||42.5%|Medium|| |0776|Split BST||56.5%|Medium|| |0777|Swap Adjacent in LR String||35.5%|Medium|| -|0778|Swim in Rising Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0778.Swim-in-Rising-Water)|54.3%|Hard|| -|0779|K-th Symbol in Grammar||38.5%|Medium|| +|0778|Swim in Rising Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0778.Swim-in-Rising-Water)|54.4%|Hard|| +|0779|K-th Symbol in Grammar||38.4%|Medium|| |0780|Reaching Points||30.2%|Hard|| -|0781|Rabbits in Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0781.Rabbits-in-Forest)|55.3%|Medium|| +|0781|Rabbits in Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0781.Rabbits-in-Forest)|55.4%|Medium|| |0782|Transform to Chessboard||46.8%|Hard|| |0783|Minimum Distance Between BST Nodes||53.7%|Easy|| |0784|Letter Case Permutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0784.Letter-Case-Permutation)|66.2%|Medium|| |0785|Is Graph Bipartite?|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0785.Is-Graph-Bipartite?)|48.2%|Medium|| -|0786|K-th Smallest Prime Fraction|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0786.K-th-Smallest-Prime-Fraction)|41.7%|Hard|| +|0786|K-th Smallest Prime Fraction|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0786.K-th-Smallest-Prime-Fraction)|41.8%|Hard|| |0787|Cheapest Flights Within K Stops||39.5%|Medium|| -|0788|Rotated Digits||57.3%|Easy|| +|0788|Rotated Digits||57.2%|Easy|| |0789|Escape The Ghosts||58.1%|Medium|| |0790|Domino and Tromino Tiling||39.9%|Medium|| |0791|Custom Sort String||65.9%|Medium|| @@ -939,8 +939,8 @@ |0799|Champagne Tower||44.0%|Medium|| |0800|Similar RGB Color||62.2%|Easy|| |0801|Minimum Swaps To Make Sequences Increasing||39.0%|Medium|| -|0802|Find Eventual Safe States|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0802.Find-Eventual-Safe-States)|49.6%|Medium|| -|0803|Bricks Falling When Hit|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0803.Bricks-Falling-When-Hit)|31.2%|Hard|| +|0802|Find Eventual Safe States|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0802.Find-Eventual-Safe-States)|49.7%|Medium|| +|0803|Bricks Falling When Hit|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0803.Bricks-Falling-When-Hit)|31.3%|Hard|| |0804|Unique Morse Code Words||78.8%|Easy|| |0805|Split Array With Same Average||26.7%|Hard|| |0806|Number of Lines To Write String||65.4%|Easy|| @@ -953,41 +953,41 @@ |0813|Largest Sum of Averages||50.9%|Medium|| |0814|Binary Tree Pruning||72.9%|Medium|| |0815|Bus Routes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0815.Bus-Routes)|43.2%|Hard|| -|0816|Ambiguous Coordinates||47.8%|Medium|| +|0816|Ambiguous Coordinates||47.9%|Medium|| |0817|Linked List Components|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0817.Linked-List-Components)|57.6%|Medium|| |0818|Race Car||39.6%|Hard|| |0819|Most Common Word|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0819.Most-Common-Word)|45.4%|Easy|| |0820|Short Encoding of Words||51.4%|Medium|| -|0821|Shortest Distance to a Character||67.7%|Easy|| +|0821|Shortest Distance to a Character||67.8%|Easy|| |0822|Card Flipping Game||43.5%|Medium|| -|0823|Binary Trees With Factors||36.3%|Medium|| +|0823|Binary Trees With Factors||36.4%|Medium|| |0824|Goat Latin||66.3%|Easy|| |0825|Friends Of Appropriate Ages||43.8%|Medium|| |0826|Most Profit Assigning Work|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0826.Most-Profit-Assigning-Work)|38.9%|Medium|| |0827|Making A Large Island||47.1%|Hard|| -|0828|Count Unique Characters of All Substrings of a Given String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String)|46.7%|Hard|| -|0829|Consecutive Numbers Sum||39.3%|Hard|| +|0828|Count Unique Characters of All Substrings of a Given String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String)|46.8%|Hard|| +|0829|Consecutive Numbers Sum||39.4%|Hard|| |0830|Positions of Large Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0830.Positions-of-Large-Groups)|50.2%|Easy|| |0831|Masking Personal Information||44.7%|Medium|| |0832|Flipping an Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0832.Flipping-an-Image)|77.9%|Easy|| |0833|Find And Replace in String||51.3%|Medium|| |0834|Sum of Distances in Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0834.Sum-of-Distances-in-Tree)|45.5%|Hard|| -|0835|Image Overlap||61.9%|Medium|| -|0836|Rectangle Overlap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0836.Rectangle-Overlap)|45.2%|Easy|| +|0835|Image Overlap||61.8%|Medium|| +|0836|Rectangle Overlap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0836.Rectangle-Overlap)|45.1%|Easy|| |0837|New 21 Game||35.3%|Medium|| -|0838|Push Dominoes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0838.Push-Dominoes)|49.6%|Medium|| -|0839|Similar String Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0839.Similar-String-Groups)|40.0%|Hard|| +|0838|Push Dominoes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0838.Push-Dominoes)|49.7%|Medium|| +|0839|Similar String Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0839.Similar-String-Groups)|40.1%|Hard|| |0840|Magic Squares In Grid||37.8%|Medium|| |0841|Keys and Rooms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0841.Keys-and-Rooms)|65.2%|Medium|| -|0842|Split Array into Fibonacci Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0842.Split-Array-into-Fibonacci-Sequence)|36.6%|Medium|| +|0842|Split Array into Fibonacci Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0842.Split-Array-into-Fibonacci-Sequence)|36.7%|Medium|| |0843|Guess the Word||46.4%|Hard|| |0844|Backspace String Compare|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0844.Backspace-String-Compare)|46.8%|Easy|| -|0845|Longest Mountain in Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0845.Longest-Mountain-in-Array)|38.4%|Medium|| -|0846|Hand of Straights||55.2%|Medium|| +|0845|Longest Mountain in Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0845.Longest-Mountain-in-Array)|38.5%|Medium|| +|0846|Hand of Straights||55.3%|Medium|| |0847|Shortest Path Visiting All Nodes||53.3%|Hard|| |0848|Shifting Letters||45.1%|Medium|| -|0849|Maximize Distance to Closest Person||44.4%|Medium|| -|0850|Rectangle Area II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0850.Rectangle-Area-II)|48.4%|Hard|| +|0849|Maximize Distance to Closest Person||44.5%|Medium|| +|0850|Rectangle Area II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0850.Rectangle-Area-II)|48.3%|Hard|| |0851|Loud and Rich|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0851.Loud-and-Rich)|52.4%|Medium|| |0852|Peak Index in a Mountain Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0852.Peak-Index-in-a-Mountain-Array)|71.8%|Easy|| |0853|Car Fleet|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0853.Car-Fleet)|43.6%|Medium|| @@ -997,17 +997,17 @@ |0857|Minimum Cost to Hire K Workers||50.3%|Hard|| |0858|Mirror Reflection||59.5%|Medium|| |0859|Buddy Strings||29.7%|Easy|| -|0860|Lemonade Change||51.9%|Easy|| +|0860|Lemonade Change||51.8%|Easy|| |0861|Score After Flipping Matrix||73.4%|Medium|| |0862|Shortest Subarray with Sum at Least K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K)|25.1%|Hard|| -|0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|57.4%|Medium|| +|0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|57.5%|Medium|| |0864|Shortest Path to Get All Keys|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0864.Shortest-Path-to-Get-All-Keys)|41.5%|Hard|| |0865|Smallest Subtree with all the Deepest Nodes||64.6%|Medium|| -|0866|Prime Palindrome||25.1%|Medium|| +|0866|Prime Palindrome||25.0%|Medium|| |0867|Transpose Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0867.Transpose-Matrix)|62.2%|Easy|| |0868|Binary Gap||60.8%|Easy|| |0869|Reordered Power of 2||54.1%|Medium|| -|0870|Advantage Shuffle||46.6%|Medium|| +|0870|Advantage Shuffle||46.7%|Medium|| |0871|Minimum Number of Refueling Stops||32.1%|Hard|| |0872|Leaf-Similar Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0872.Leaf-Similar-Trees)|64.5%|Easy|| |0873|Length of Longest Fibonacci Subsequence||48.1%|Medium|| @@ -1018,18 +1018,18 @@ |0878|Nth Magical Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0878.Nth-Magical-Number)|28.9%|Hard|| |0879|Profitable Schemes||40.1%|Hard|| |0880|Decoded String at Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0880.Decoded-String-at-Index)|28.3%|Medium|| -|0881|Boats to Save People|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0881.Boats-to-Save-People)|48.5%|Medium|| +|0881|Boats to Save People|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0881.Boats-to-Save-People)|48.7%|Medium|| |0882|Reachable Nodes In Subdivided Graph||42.3%|Hard|| |0883|Projection Area of 3D Shapes||68.1%|Easy|| -|0884|Uncommon Words from Two Sentences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0884.Uncommon-Words-from-Two-Sentences)|63.9%|Easy|| +|0884|Uncommon Words from Two Sentences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0884.Uncommon-Words-from-Two-Sentences)|64.0%|Easy|| |0885|Spiral Matrix III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0885.Spiral-Matrix-III)|70.5%|Medium|| |0886|Possible Bipartition||44.9%|Medium|| -|0887|Super Egg Drop|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0887.Super-Egg-Drop)|27.1%|Hard|| -|0888|Fair Candy Swap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0888.Fair-Candy-Swap)|58.7%|Easy|| +|0887|Super Egg Drop|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0887.Super-Egg-Drop)|27.0%|Hard|| +|0888|Fair Candy Swap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0888.Fair-Candy-Swap)|58.8%|Easy|| |0889|Construct Binary Tree from Preorder and Postorder Traversal||67.3%|Medium|| |0890|Find and Replace Pattern||74.1%|Medium|| |0891|Sum of Subsequence Widths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0891.Sum-of-Subsequence-Widths)|32.8%|Hard|| -|0892|Surface Area of 3D Shapes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0892.Surface-Area-of-3D-Shapes)|59.5%|Easy|| +|0892|Surface Area of 3D Shapes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0892.Surface-Area-of-3D-Shapes)|59.6%|Easy|| |0893|Groups of Special-Equivalent Strings||68.2%|Easy|| |0894|All Possible Full Binary Trees||76.9%|Medium|| |0895|Maximum Frequency Stack|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0895.Maximum-Frequency-Stack)|62.1%|Hard|| @@ -1037,11 +1037,11 @@ |0897|Increasing Order Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0897.Increasing-Order-Search-Tree)|74.3%|Easy|| |0898|Bitwise ORs of Subarrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0898.Bitwise-ORs-of-Subarrays)|34.0%|Medium|| |0899|Orderly Queue||52.9%|Hard|| -|0900|RLE Iterator||55.1%|Medium|| -|0901|Online Stock Span|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0901.Online-Stock-Span)|61.1%|Medium|| +|0900|RLE Iterator||55.2%|Medium|| +|0901|Online Stock Span|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0901.Online-Stock-Span)|61.2%|Medium|| |0902|Numbers At Most N Given Digit Set||36.1%|Hard|| -|0903|Valid Permutations for DI Sequence||54.2%|Hard|| -|0904|Fruit Into Baskets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets)|42.8%|Medium|| +|0903|Valid Permutations for DI Sequence||54.1%|Hard|| +|0904|Fruit Into Baskets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets)|42.9%|Medium|| |0905|Sort Array By Parity||74.9%|Easy|| |0906|Super Palindromes||32.9%|Hard|| |0907|Sum of Subarray Minimums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0907.Sum-of-Subarray-Minimums)|33.2%|Medium|| @@ -1050,12 +1050,12 @@ |0910|Smallest Range II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0910.Smallest-Range-II)|31.2%|Medium|| |0911|Online Election|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0911.Online-Election)|51.2%|Medium|| |0912|Sort an Array||64.5%|Medium|| -|0913|Cat and Mouse||33.9%|Hard|| +|0913|Cat and Mouse||34.1%|Hard|| |0914|X of a Kind in a Deck of Cards|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0914.X-of-a-Kind-in-a-Deck-of-Cards)|34.4%|Easy|| |0915|Partition Array into Disjoint Intervals||46.0%|Medium|| |0916|Word Subsets||48.1%|Medium|| |0917|Reverse Only Letters||58.6%|Easy|| -|0918|Maximum Sum Circular Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0918.Maximum-Sum-Circular-Subarray)|34.0%|Medium|| +|0918|Maximum Sum Circular Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0918.Maximum-Sum-Circular-Subarray)|34.1%|Medium|| |0919|Complete Binary Tree Inserter||58.6%|Medium|| |0920|Number of Music Playlists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0920.Number-of-Music-Playlists)|47.6%|Hard|| |0921|Minimum Add to Make Parentheses Valid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid)|74.6%|Medium|| @@ -1064,14 +1064,14 @@ |0924|Minimize Malware Spread|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0924.Minimize-Malware-Spread)|41.8%|Hard|| |0925|Long Pressed Name|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0925.Long-Pressed-Name)|38.4%|Easy|| |0926|Flip String to Monotone Increasing||53.0%|Medium|| -|0927|Three Equal Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0927.Three-Equal-Parts)|34.4%|Hard|| -|0928|Minimize Malware Spread II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0928.Minimize-Malware-Spread-II)|41.1%|Hard|| +|0927|Three Equal Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0927.Three-Equal-Parts)|34.5%|Hard|| +|0928|Minimize Malware Spread II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0928.Minimize-Malware-Spread-II)|41.2%|Hard|| |0929|Unique Email Addresses||67.2%|Easy|| -|0930|Binary Subarrays With Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0930.Binary-Subarrays-With-Sum)|44.2%|Medium|| +|0930|Binary Subarrays With Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0930.Binary-Subarrays-With-Sum)|44.3%|Medium|| |0931|Minimum Falling Path Sum||63.2%|Medium|| |0932|Beautiful Array||61.0%|Medium|| |0933|Number of Recent Calls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0933.Number-of-Recent-Calls)|72.0%|Easy|| -|0934|Shortest Bridge||49.4%|Medium|| +|0934|Shortest Bridge||49.3%|Medium|| |0935|Knight Dialer||46.2%|Medium|| |0936|Stamping The Sequence||47.2%|Hard|| |0937|Reorder Data in Log Files||54.3%|Easy|| @@ -1081,7 +1081,7 @@ |0941|Valid Mountain Array||33.5%|Easy|| |0942|DI String Match|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0942.DI-String-Match)|73.4%|Easy|| |0943|Find the Shortest Superstring||43.5%|Hard|| -|0944|Delete Columns to Make Sorted||71.0%|Easy|| +|0944|Delete Columns to Make Sorted||71.1%|Easy|| |0945|Minimum Increment to Make Array Unique||46.6%|Medium|| |0946|Validate Stack Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0946.Validate-Stack-Sequences)|63.4%|Medium|| |0947|Most Stones Removed with Same Row or Column|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0947.Most-Stones-Removed-with-Same-Row-or-Column)|55.4%|Medium|| @@ -1090,18 +1090,18 @@ |0950|Reveal Cards In Increasing Order||75.2%|Medium|| |0951|Flip Equivalent Binary Trees||65.6%|Medium|| |0952|Largest Component Size by Common Factor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0952.Largest-Component-Size-by-Common-Factor)|36.1%|Hard|| -|0953|Verifying an Alien Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0953.Verifying-an-Alien-Dictionary)|52.6%|Easy|| +|0953|Verifying an Alien Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0953.Verifying-an-Alien-Dictionary)|52.5%|Easy|| |0954|Array of Doubled Pairs||35.3%|Medium|| -|0955|Delete Columns to Make Sorted II||33.8%|Medium|| -|0956|Tallest Billboard||39.8%|Hard|| +|0955|Delete Columns to Make Sorted II||33.7%|Medium|| +|0956|Tallest Billboard||39.7%|Hard|| |0957|Prison Cells After N Days||40.2%|Medium|| |0958|Check Completeness of a Binary Tree||52.4%|Medium|| -|0959|Regions Cut By Slashes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0959.Regions-Cut-By-Slashes)|66.8%|Medium|| -|0960|Delete Columns to Make Sorted III||54.6%|Hard|| +|0959|Regions Cut By Slashes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0959.Regions-Cut-By-Slashes)|66.9%|Medium|| +|0960|Delete Columns to Make Sorted III||54.7%|Hard|| |0961|N-Repeated Element in Size 2N Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0961.N-Repeated-Element-in-Size-2N-Array)|74.4%|Easy|| |0962|Maximum Width Ramp||46.3%|Medium|| -|0963|Minimum Area Rectangle II||51.6%|Medium|| -|0964|Least Operators to Express Number||44.8%|Hard|| +|0963|Minimum Area Rectangle II||51.7%|Medium|| +|0964|Least Operators to Express Number||44.9%|Hard|| |0965|Univalued Binary Tree||67.7%|Easy|| |0966|Vowel Spellchecker||47.7%|Medium|| |0967|Numbers With Same Consecutive Differences||44.5%|Medium|| @@ -1111,51 +1111,51 @@ |0971|Flip Binary Tree To Match Preorder Traversal||46.1%|Medium|| |0972|Equal Rational Numbers||41.9%|Hard|| |0973|K Closest Points to Origin|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0973.K-Closest-Points-to-Origin)|64.5%|Medium|| -|0974|Subarray Sums Divisible by K||50.5%|Medium|| -|0975|Odd Even Jump||41.5%|Hard|| +|0974|Subarray Sums Divisible by K||50.6%|Medium|| +|0975|Odd Even Jump||41.6%|Hard|| |0976|Largest Perimeter Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0976.Largest-Perimeter-Triangle)|58.5%|Easy|| |0977|Squares of a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0977.Squares-of-a-Sorted-Array)|72.3%|Easy|| |0978|Longest Turbulent Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0978.Longest-Turbulent-Subarray)|46.6%|Medium|| |0979|Distribute Coins in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0979.Distribute-Coins-in-Binary-Tree)|69.5%|Medium|| -|0980|Unique Paths III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0980.Unique-Paths-III)|77.1%|Hard|| -|0981|Time Based Key-Value Store|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0981.Time-Based-Key-Value-Store)|53.9%|Medium|| +|0980|Unique Paths III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0980.Unique-Paths-III)|77.2%|Hard|| +|0981|Time Based Key-Value Store|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0981.Time-Based-Key-Value-Store)|54.0%|Medium|| |0982|Triples with Bitwise AND Equal To Zero||56.1%|Hard|| |0983|Minimum Cost For Tickets||62.6%|Medium|| -|0984|String Without AAA or BBB|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0984.String-Without-AAA-or-BBB)|38.4%|Medium|| -|0985|Sum of Even Numbers After Queries|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0985.Sum-of-Even-Numbers-After-Queries)|60.8%|Easy|| +|0984|String Without AAA or BBB|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0984.String-Without-AAA-or-BBB)|38.5%|Medium|| +|0985|Sum of Even Numbers After Queries|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0985.Sum-of-Even-Numbers-After-Queries)|60.7%|Easy|| |0986|Interval List Intersections|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0986.Interval-List-Intersections)|68.1%|Medium|| |0987|Vertical Order Traversal of a Binary Tree||37.6%|Medium|| |0988|Smallest String Starting From Leaf||46.6%|Medium|| |0989|Add to Array-Form of Integer||44.7%|Easy|| -|0990|Satisfiability of Equality Equations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0990.Satisfiability-of-Equality-Equations)|46.4%|Medium|| +|0990|Satisfiability of Equality Equations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0990.Satisfiability-of-Equality-Equations)|46.5%|Medium|| |0991|Broken Calculator||46.4%|Medium|| -|0992|Subarrays with K Different Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0992.Subarrays-with-K-Different-Integers)|50.4%|Hard|| +|0992|Subarrays with K Different Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0992.Subarrays-with-K-Different-Integers)|50.5%|Hard|| |0993|Cousins in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0993.Cousins-in-Binary-Tree)|52.2%|Easy|| -|0994|Rotting Oranges||49.5%|Medium|| +|0994|Rotting Oranges||49.6%|Medium|| |0995|Minimum Number of K Consecutive Bit Flips|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0995.Minimum-Number-of-K-Consecutive-Bit-Flips)|49.6%|Hard|| -|0996|Number of Squareful Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0996.Number-of-Squareful-Arrays)|47.9%|Hard|| +|0996|Number of Squareful Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0996.Number-of-Squareful-Arrays)|48.0%|Hard|| |0997|Find the Town Judge||49.8%|Easy|| -|0998|Maximum Binary Tree II||63.6%|Medium|| +|0998|Maximum Binary Tree II||63.7%|Medium|| |0999|Available Captures for Rook|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0999.Available-Captures-for-Rook)|66.8%|Easy|| |1000|Minimum Cost to Merge Stones||40.4%|Hard|| |1001|Grid Illumination||36.6%|Hard|| |1002|Find Common Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1002.Find-Common-Characters)|68.1%|Easy|| -|1003|Check If Word Is Valid After Substitutions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions)|56.0%|Medium|| +|1003|Check If Word Is Valid After Substitutions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions)|56.1%|Medium|| |1004|Max Consecutive Ones III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1004.Max-Consecutive-Ones-III)|60.5%|Medium|| |1005|Maximize Sum Of Array After K Negations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations)|52.3%|Easy|| |1006|Clumsy Factorial||53.7%|Medium|| -|1007|Minimum Domino Rotations For Equal Row||50.9%|Medium|| +|1007|Minimum Domino Rotations For Equal Row||51.0%|Medium|| |1008|Construct Binary Search Tree from Preorder Traversal||78.7%|Medium|| |1009|Complement of Base 10 Integer||61.5%|Easy|| |1010|Pairs of Songs With Total Durations Divisible by 60||49.8%|Medium|| |1011|Capacity To Ship Packages Within D Days|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1011.Capacity-To-Ship-Packages-Within-D-Days)|59.5%|Medium|| |1012|Numbers With Repeated Digits||37.7%|Hard|| |1013|Partition Array Into Three Parts With Equal Sum||49.4%|Easy|| -|1014|Best Sightseeing Pair||52.9%|Medium|| +|1014|Best Sightseeing Pair||52.8%|Medium|| |1015|Smallest Integer Divisible by K||41.8%|Medium|| |1016|Binary String With Substrings Representing 1 To N||59.1%|Medium|| |1017|Convert to Base -2|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1017.Convert-to-Base--2)|59.6%|Medium|| -|1018|Binary Prefix Divisible By 5|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1018.Binary-Prefix-Divisible-By-5)|47.8%|Easy|| +|1018|Binary Prefix Divisible By 5|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1018.Binary-Prefix-Divisible-By-5)|47.9%|Easy|| |1019|Next Greater Node In Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1019.Next-Greater-Node-In-Linked-List)|58.2%|Medium|| |1020|Number of Enclaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1020.Number-of-Enclaves)|58.7%|Medium|| |1021|Remove Outermost Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1021.Remove-Outermost-Parentheses)|78.7%|Easy|| @@ -1163,37 +1163,37 @@ |1023|Camelcase Matching||57.3%|Medium|| |1024|Video Stitching||49.1%|Medium|| |1025|Divisor Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1025.Divisor-Game)|66.1%|Easy|| -|1026|Maximum Difference Between Node and Ancestor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor)|69.1%|Medium|| -|1027|Longest Arithmetic Subsequence||49.9%|Medium|| +|1026|Maximum Difference Between Node and Ancestor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor)|69.2%|Medium|| +|1027|Longest Arithmetic Subsequence||49.8%|Medium|| |1028|Recover a Tree From Preorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1028.Recover-a-Tree-From-Preorder-Traversal)|70.7%|Hard|| |1029|Two City Scheduling||57.6%|Medium|| |1030|Matrix Cells in Distance Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1030.Matrix-Cells-in-Distance-Order)|66.9%|Easy|| |1031|Maximum Sum of Two Non-Overlapping Subarrays||58.8%|Medium|| |1032|Stream of Characters||48.6%|Hard|| |1033|Moving Stones Until Consecutive||43.0%|Easy|| -|1034|Coloring A Border||45.4%|Medium|| +|1034|Coloring A Border||45.5%|Medium|| |1035|Uncrossed Lines||56.0%|Medium|| |1036|Escape a Large Maze||34.8%|Hard|| |1037|Valid Boomerang|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1037.Valid-Boomerang)|37.8%|Easy|| |1038|Binary Search Tree to Greater Sum Tree||82.0%|Medium|| |1039|Minimum Score Triangulation of Polygon||50.0%|Medium|| -|1040|Moving Stones Until Consecutive II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1040.Moving-Stones-Until-Consecutive-II)|54.0%|Medium|| +|1040|Moving Stones Until Consecutive II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1040.Moving-Stones-Until-Consecutive-II)|53.9%|Medium|| |1041|Robot Bounded In Circle||54.7%|Medium|| |1042|Flower Planting With No Adjacent||48.7%|Medium|| -|1043|Partition Array for Maximum Sum||66.7%|Medium|| +|1043|Partition Array for Maximum Sum||66.8%|Medium|| |1044|Longest Duplicate Substring||31.5%|Hard|| |1045|Customers Who Bought All Products||68.3%|Medium|| |1046|Last Stone Weight||62.4%|Easy|| -|1047|Remove All Adjacent Duplicates In String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String)|70.2%|Easy|| +|1047|Remove All Adjacent Duplicates In String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String)|70.3%|Easy|| |1048|Longest String Chain||55.3%|Medium|| |1049|Last Stone Weight II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II)|45.0%|Medium|| |1050|Actors and Directors Who Cooperated At Least Three Times||72.1%|Easy|| -|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.9%|Easy|| +|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.8%|Easy|| |1052|Grumpy Bookstore Owner|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1052.Grumpy-Bookstore-Owner)|55.7%|Medium|| |1053|Previous Permutation With One Swap||50.8%|Medium|| |1054|Distant Barcodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1054.Distant-Barcodes)|44.2%|Medium|| |1055|Shortest Way to Form String||57.1%|Medium|| -|1056|Confusing Number||47.2%|Easy|| +|1056|Confusing Number||47.1%|Easy|| |1057|Campus Bikes||57.6%|Medium|| |1058|Minimize Rounding Error to Meet Target||43.2%|Medium|| |1059|All Paths from Source Lead to Destination||43.3%|Medium|| @@ -1203,62 +1203,62 @@ |1063|Number of Valid Subarrays||72.2%|Hard|| |1064|Fixed Point||65.5%|Easy|| |1065|Index Pairs of a String||61.0%|Easy|| -|1066|Campus Bikes II||54.0%|Medium|| -|1067|Digit Count in Range||41.1%|Hard|| -|1068|Product Sales Analysis I||82.4%|Easy|| +|1066|Campus Bikes II||54.1%|Medium|| +|1067|Digit Count in Range||41.0%|Hard|| +|1068|Product Sales Analysis I||82.3%|Easy|| |1069|Product Sales Analysis II||83.2%|Easy|| |1070|Product Sales Analysis III||49.7%|Medium|| |1071|Greatest Common Divisor of Strings||51.4%|Easy|| |1072|Flip Columns For Maximum Number of Equal Rows||61.2%|Medium|| |1073|Adding Two Negabinary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1073.Adding-Two-Negabinary-Numbers)|34.7%|Medium|| -|1074|Number of Submatrices That Sum to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1074.Number-of-Submatrices-That-Sum-to-Target)|61.4%|Hard|| +|1074|Number of Submatrices That Sum to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1074.Number-of-Submatrices-That-Sum-to-Target)|61.5%|Hard|| |1075|Project Employees I||66.0%|Easy|| |1076|Project Employees II||53.2%|Easy|| |1077|Project Employees III||77.3%|Medium|| -|1078|Occurrences After Bigram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1078.Occurrences-After-Bigram)|64.9%|Easy|| +|1078|Occurrences After Bigram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1078.Occurrences-After-Bigram)|64.8%|Easy|| |1079|Letter Tile Possibilities|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1079.Letter-Tile-Possibilities)|75.8%|Medium|| -|1080|Insufficient Nodes in Root to Leaf Paths||49.7%|Medium|| +|1080|Insufficient Nodes in Root to Leaf Paths||49.8%|Medium|| |1081|Smallest Subsequence of Distinct Characters||53.4%|Medium|| |1082|Sales Analysis I||73.3%|Easy|| |1083|Sales Analysis II||50.7%|Easy|| -|1084|Sales Analysis III||54.7%|Easy|| -|1085|Sum of Digits in the Minimum Number||75.0%|Easy|| -|1086|High Five||78.8%|Easy|| +|1084|Sales Analysis III||54.6%|Easy|| +|1085|Sum of Digits in the Minimum Number||75.1%|Easy|| +|1086|High Five||78.7%|Easy|| |1087|Brace Expansion||63.1%|Medium|| |1088|Confusing Number II||45.1%|Hard|| |1089|Duplicate Zeros|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1089.Duplicate-Zeros)|52.0%|Easy|| -|1090|Largest Values From Labels||60.0%|Medium|| +|1090|Largest Values From Labels||60.1%|Medium|| |1091|Shortest Path in Binary Matrix||39.0%|Medium|| -|1092|Shortest Common Supersequence ||52.7%|Hard|| -|1093|Statistics from a Large Sample|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1093.Statistics-from-a-Large-Sample)|49.3%|Medium|| +|1092|Shortest Common Supersequence ||52.8%|Hard|| +|1093|Statistics from a Large Sample|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1093.Statistics-from-a-Large-Sample)|49.4%|Medium|| |1094|Car Pooling||59.0%|Medium|| -|1095|Find in Mountain Array||35.9%|Hard|| +|1095|Find in Mountain Array||36.0%|Hard|| |1096|Brace Expansion II||62.4%|Hard|| |1097|Game Play Analysis V||56.4%|Hard|| -|1098|Unpopular Books||45.6%|Medium|| +|1098|Unpopular Books||45.5%|Medium|| |1099|Two Sum Less Than K||60.8%|Easy|| |1100|Find K-Length Substrings With No Repeated Characters||73.2%|Medium|| |1101|The Earliest Moment When Everyone Become Friends||67.5%|Medium|| |1102|Path With Maximum Minimum Value||50.2%|Medium|| |1103|Distribute Candies to People||63.6%|Easy|| |1104|Path In Zigzag Labelled Binary Tree||73.0%|Medium|| -|1105|Filling Bookcase Shelves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1105.Filling-Bookcase-Shelves)|57.8%|Medium|| -|1106|Parsing A Boolean Expression||59.0%|Hard|| -|1107|New Users Daily Count||45.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.1%|Hard|| +|1107|New Users Daily Count||45.7%|Medium|| |1108|Defanging an IP Address|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1108.Defanging-an-IP-Address)|88.5%|Easy|| -|1109|Corporate Flight Bookings||54.1%|Medium|| +|1109|Corporate Flight Bookings||54.2%|Medium|| |1110|Delete Nodes And Return Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1110.Delete-Nodes-And-Return-Forest)|67.6%|Medium|| |1111|Maximum Nesting Depth of Two Valid Parentheses Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings)|72.4%|Medium|| |1112|Highest Grade For Each Student||71.7%|Medium|| |1113|Reported Posts||65.4%|Easy|| -|1114|Print in Order||66.9%|Easy|| +|1114|Print in Order||67.0%|Easy|| |1115|Print FooBar Alternately||59.0%|Medium|| |1116|Print Zero Even Odd||57.6%|Medium|| -|1117|Building H2O||53.1%|Medium|| +|1117|Building H2O||53.2%|Medium|| |1118|Number of Days in a Month||57.5%|Easy|| -|1119|Remove Vowels from a String||90.4%|Easy|| +|1119|Remove Vowels from a String||90.5%|Easy|| |1120|Maximum Average Subtree||63.5%|Medium|| -|1121|Divide Array Into Increasing Sequences||58.0%|Hard|| +|1121|Divide Array Into Increasing Sequences||57.9%|Hard|| |1122|Relative Sort Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1122.Relative-Sort-Array)|67.7%|Easy|| |1123|Lowest Common Ancestor of Deepest Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves)|67.8%|Medium|| |1124|Longest Well-Performing Interval||33.2%|Medium|| @@ -1272,7 +1272,7 @@ |1132|Reported Posts II||34.6%|Medium|| |1133|Largest Unique Number||67.2%|Easy|| |1134|Armstrong Number||78.2%|Easy|| -|1135|Connecting Cities With Minimum Cost||59.0%|Medium|| +|1135|Connecting Cities With Minimum Cost||59.1%|Medium|| |1136|Parallel Courses||61.3%|Hard|| |1137|N-th Tribonacci Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1137.N-th-Tribonacci-Number)|56.1%|Easy|| |1138|Alphabet Board Path||50.6%|Medium|| @@ -1283,209 +1283,209 @@ |1143|Longest Common Subsequence||58.6%|Medium|| |1144|Decrease Elements To Make Array Zigzag||46.0%|Medium|| |1145|Binary Tree Coloring Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1145.Binary-Tree-Coloring-Game)|51.4%|Medium|| -|1146|Snapshot Array||36.8%|Medium|| +|1146|Snapshot Array||36.9%|Medium|| |1147|Longest Chunked Palindrome Decomposition||59.4%|Hard|| -|1148|Article Views I||77.0%|Easy|| +|1148|Article Views I||76.9%|Easy|| |1149|Article Views II||48.4%|Medium|| |1150|Check If a Number Is Majority Element in a Sorted Array||57.9%|Easy|| |1151|Minimum Swaps to Group All 1's Together||58.2%|Medium|| -|1152|Analyze User Website Visit Pattern||43.4%|Medium|| +|1152|Analyze User Website Visit Pattern||43.3%|Medium|| |1153|String Transforms Into Another String||36.0%|Hard|| |1154|Day of the Year|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1154.Day-of-the-Year)|49.3%|Easy|| -|1155|Number of Dice Rolls With Target Sum||47.6%|Medium|| -|1156|Swap For Longest Repeated Character Substring||47.5%|Medium|| +|1155|Number of Dice Rolls With Target Sum||47.5%|Medium|| +|1156|Swap For Longest Repeated Character Substring||47.4%|Medium|| |1157|Online Majority Element In Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1157.Online-Majority-Element-In-Subarray)|39.5%|Hard|| |1158|Market Analysis I||63.5%|Medium|| |1159|Market Analysis II||55.1%|Hard|| |1160|Find Words That Can Be Formed by Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters)|67.5%|Easy|| |1161|Maximum Level Sum of a Binary Tree||70.1%|Medium|| -|1162|As Far from Land as Possible||44.9%|Medium|| +|1162|As Far from Land as Possible||45.0%|Medium|| |1163|Last Substring in Lexicographical Order||36.3%|Hard|| |1164|Product Price at a Given Date||68.0%|Medium|| -|1165|Single-Row Keyboard||84.7%|Easy|| -|1166|Design File System||58.2%|Medium|| -|1167|Minimum Cost to Connect Sticks||64.1%|Medium|| -|1168|Optimize Water Distribution in a Village||62.2%|Hard|| +|1165|Single-Row Keyboard||84.8%|Easy|| +|1166|Design File System||58.3%|Medium|| +|1167|Minimum Cost to Connect Sticks||64.2%|Medium|| +|1168|Optimize Water Distribution in a Village||62.1%|Hard|| |1169|Invalid Transactions||31.6%|Medium|| |1170|Compare Strings by Frequency of the Smallest Character|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character)|59.5%|Easy|| |1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List)|41.4%|Medium|| |1172|Dinner Plate Stacks||37.8%|Hard|| |1173|Immediate Food Delivery I||82.2%|Easy|| -|1174|Immediate Food Delivery II||61.0%|Medium|| +|1174|Immediate Food Delivery II||61.1%|Medium|| |1175|Prime Arrangements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1175.Prime-Arrangements)|51.8%|Easy|| |1176|Diet Plan Performance||54.0%|Easy|| |1177|Can Make Palindrome from Substring||36.1%|Medium|| -|1178|Number of Valid Words for Each Puzzle||38.5%|Hard|| -|1179|Reformat Department Table||82.0%|Easy|| -|1180|Count Substrings with Only One Distinct Letter||77.5%|Easy|| +|1178|Number of Valid Words for Each Puzzle||38.6%|Hard|| +|1179|Reformat Department Table||82.1%|Easy|| +|1180|Count Substrings with Only One Distinct Letter||77.6%|Easy|| |1181|Before and After Puzzle||44.5%|Medium|| |1182|Shortest Distance to Target Color||53.4%|Medium|| -|1183|Maximum Number of Ones||56.7%|Hard|| -|1184|Distance Between Bus Stops|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1184.Distance-Between-Bus-Stops)|54.2%|Easy|| -|1185|Day of the Week|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week)|62.0%|Easy|| -|1186|Maximum Subarray Sum with One Deletion||38.4%|Medium|| -|1187|Make Array Strictly Increasing||41.7%|Hard|| +|1183|Maximum Number of Ones||56.8%|Hard|| +|1184|Distance Between Bus Stops|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1184.Distance-Between-Bus-Stops)|54.1%|Easy|| +|1185|Day of the Week|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week)|61.9%|Easy|| +|1186|Maximum Subarray Sum with One Deletion||38.5%|Medium|| +|1187|Make Array Strictly Increasing||41.6%|Hard|| |1188|Design Bounded Blocking Queue||72.6%|Medium|| |1189|Maximum Number of Balloons|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1189.Maximum-Number-of-Balloons)|61.8%|Easy|| |1190|Reverse Substrings Between Each Pair of Parentheses||64.0%|Medium|| -|1191|K-Concatenation Maximum Sum||25.5%|Medium|| -|1192|Critical Connections in a Network||49.8%|Hard|| -|1193|Monthly Transactions I||69.0%|Medium|| -|1194|Tournament Winners||52.1%|Hard|| +|1191|K-Concatenation Maximum Sum||25.4%|Medium|| +|1192|Critical Connections in a Network||49.9%|Hard|| +|1193|Monthly Transactions I||69.1%|Medium|| +|1194|Tournament Winners||52.2%|Hard|| |1195|Fizz Buzz Multithreaded||70.4%|Medium|| |1196|How Many Apples Can You Put into the Basket||68.2%|Easy|| |1197|Minimum Knight Moves||37.1%|Medium|| |1198|Find Smallest Common Element in All Rows||75.2%|Medium|| |1199|Minimum Time to Build Blocks||38.4%|Hard|| |1200|Minimum Absolute Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1200.Minimum-Absolute-Difference)|66.8%|Easy|| -|1201|Ugly Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1201.Ugly-Number-III)|26.4%|Medium|| -|1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|48.3%|Medium|| -|1203|Sort Items by Groups Respecting Dependencies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies)|49.0%|Hard|| -|1204|Last Person to Fit in the Elevator||71.4%|Medium|| -|1205|Monthly Transactions II||46.0%|Medium|| +|1201|Ugly Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1201.Ugly-Number-III)|26.3%|Medium|| +|1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|48.4%|Medium|| +|1203|Sort Items by Groups Respecting Dependencies||49.0%|Hard|| +|1204|Last Person to Fit in the Elevator||71.5%|Medium|| +|1205|Monthly Transactions II||45.9%|Medium|| |1206|Design Skiplist||58.9%|Hard|| |1207|Unique Number of Occurrences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1207.Unique-Number-of-Occurrences)|71.6%|Easy|| |1208|Get Equal Substrings Within Budget|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1208.Get-Equal-Substrings-Within-Budget)|43.6%|Medium|| -|1209|Remove All Adjacent Duplicates in String II||57.4%|Medium|| +|1209|Remove All Adjacent Duplicates in String II||57.3%|Medium|| |1210|Minimum Moves to Reach Target with Rotations||46.2%|Hard|| -|1211|Queries Quality and Percentage||69.9%|Easy|| +|1211|Queries Quality and Percentage||69.8%|Easy|| |1212|Team Scores in Football Tournament||56.7%|Medium|| |1213|Intersection of Three Sorted Arrays||79.2%|Easy|| |1214|Two Sum BSTs||67.8%|Medium|| |1215|Stepping Numbers||43.1%|Medium|| -|1216|Valid Palindrome III||49.5%|Hard|| +|1216|Valid Palindrome III||49.6%|Hard|| |1217|Minimum Cost to Move Chips to The Same Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position)|71.2%|Easy|| |1218|Longest Arithmetic Subsequence of Given Difference||46.4%|Medium|| -|1219|Path with Maximum Gold||65.5%|Medium|| +|1219|Path with Maximum Gold||65.6%|Medium|| |1220|Count Vowels Permutation||54.2%|Hard|| |1221|Split a String in Balanced Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1221.Split-a-String-in-Balanced-Strings)|84.0%|Easy|| |1222|Queens That Can Attack the King||69.3%|Medium|| |1223|Dice Roll Simulation||46.7%|Medium|| -|1224|Maximum Equal Frequency||34.4%|Hard|| +|1224|Maximum Equal Frequency||34.5%|Hard|| |1225|Report Contiguous Dates||62.4%|Hard|| -|1226|The Dining Philosophers||58.5%|Medium|| +|1226|The Dining Philosophers||59.8%|Medium|| |1227|Airplane Seat Assignment Probability||62.0%|Medium|| -|1228|Missing Number In Arithmetic Progression||51.7%|Easy|| +|1228|Missing Number In Arithmetic Progression||51.6%|Easy|| |1229|Meeting Scheduler||54.2%|Medium|| -|1230|Toss Strange Coins||49.8%|Medium|| -|1231|Divide Chocolate||53.4%|Hard|| -|1232|Check If It Is a Straight Line|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1232.Check-If-It-Is-a-Straight-Line)|43.9%|Easy|| +|1230|Toss Strange Coins||49.7%|Medium|| +|1231|Divide Chocolate||53.3%|Hard|| +|1232|Check If It Is a Straight Line|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1232.Check-If-It-Is-a-Straight-Line)|43.8%|Easy|| |1233|Remove Sub-Folders from the Filesystem||61.7%|Medium|| |1234|Replace the Substring for Balanced String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1234.Replace-the-Substring-for-Balanced-String)|34.4%|Medium|| |1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|46.9%|Hard|| |1236|Web Crawler||64.5%|Medium|| |1237|Find Positive Integer Solution for a Given Equation||69.7%|Easy|| |1238|Circular Permutation in Binary Representation||65.8%|Medium|| -|1239|Maximum Length of a Concatenated String with Unique Characters||49.2%|Medium|| -|1240|Tiling a Rectangle with the Fewest Squares||52.4%|Hard|| -|1241|Number of Comments per Post||67.6%|Easy|| +|1239|Maximum Length of a Concatenated String with Unique Characters||49.3%|Medium|| +|1240|Tiling a Rectangle with the Fewest Squares||52.3%|Hard|| +|1241|Number of Comments per Post||67.5%|Easy|| |1242|Web Crawler Multithreaded||47.9%|Medium|| |1243|Array Transformation||50.3%|Easy|| -|1244|Design A Leaderboard||65.8%|Medium|| +|1244|Design A Leaderboard||65.9%|Medium|| |1245|Tree Diameter||61.2%|Medium|| -|1246|Palindrome Removal||45.8%|Hard|| -|1247|Minimum Swaps to Make Strings Equal||62.3%|Medium|| -|1248|Count Number of Nice Subarrays||56.4%|Medium|| +|1246|Palindrome Removal||45.7%|Hard|| +|1247|Minimum Swaps to Make Strings Equal||62.4%|Medium|| +|1248|Count Number of Nice Subarrays||56.3%|Medium|| |1249|Minimum Remove to Make Valid Parentheses||63.5%|Medium|| |1250|Check If It Is a Good Array||56.3%|Hard|| |1251|Average Selling Price||82.5%|Easy|| -|1252|Cells with Odd Values in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix)|78.5%|Easy|| +|1252|Cells with Odd Values in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix)|78.6%|Easy|| |1253|Reconstruct a 2-Row Binary Matrix||41.4%|Medium|| -|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|61.4%|Medium|| +|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|61.5%|Medium|| |1255|Maximum Score Words Formed by Letters||69.8%|Hard|| -|1256|Encode Number||67.4%|Medium|| -|1257|Smallest Common Region||60.3%|Medium|| -|1258|Synonymous Sentences||65.2%|Medium|| +|1256|Encode Number||67.5%|Medium|| +|1257|Smallest Common Region||60.4%|Medium|| +|1258|Synonymous Sentences||64.9%|Medium|| |1259|Handshakes That Don't Cross||54.1%|Hard|| |1260|Shift 2D Grid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1260.Shift-2D-Grid)|61.8%|Easy|| |1261|Find Elements in a Contaminated Binary Tree||74.5%|Medium|| -|1262|Greatest Sum Divisible by Three||49.2%|Medium|| +|1262|Greatest Sum Divisible by Three||49.3%|Medium|| |1263|Minimum Moves to Move a Box to Their Target Location||42.8%|Hard|| -|1264|Page Recommendations||69.1%|Medium|| -|1265|Print Immutable Linked List in Reverse||94.4%|Medium|| +|1264|Page Recommendations||69.2%|Medium|| +|1265|Print Immutable Linked List in Reverse||94.3%|Medium|| |1266|Minimum Time Visiting All Points|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1266.Minimum-Time-Visiting-All-Points)|79.3%|Easy|| |1267|Count Servers that Communicate||57.8%|Medium|| -|1268|Search Suggestions System||64.4%|Medium|| +|1268|Search Suggestions System||64.5%|Medium|| |1269|Number of Ways to Stay in the Same Place After Some Steps||43.2%|Hard|| |1270|All People Report to the Given Manager||88.3%|Medium|| -|1271|Hexspeak||55.2%|Easy|| +|1271|Hexspeak||55.3%|Easy|| |1272|Remove Interval||57.8%|Medium|| |1273|Delete Tree Nodes||62.5%|Medium|| -|1274|Number of Ships in a Rectangle||66.2%|Hard|| -|1275|Find Winner on a Tic Tac Toe Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game)|53.0%|Easy|| +|1274|Number of Ships in a Rectangle||66.3%|Hard|| +|1275|Find Winner on a Tic Tac Toe Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game)|52.9%|Easy|| |1276|Number of Burgers with No Waste of Ingredients||50.0%|Medium|| |1277|Count Square Submatrices with All Ones||72.9%|Medium|| |1278|Palindrome Partitioning III||60.6%|Hard|| -|1279|Traffic Light Controlled Intersection||75.6%|Easy|| -|1280|Students and Examinations||74.3%|Easy|| +|1279|Traffic Light Controlled Intersection||75.7%|Easy|| +|1280|Students and Examinations||74.2%|Easy|| |1281|Subtract the Product and Sum of Digits of an Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer)|85.6%|Easy|| |1282|Group the People Given the Group Size They Belong To||84.3%|Medium|| -|1283|Find the Smallest Divisor Given a Threshold|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold)|49.1%|Medium|| +|1283|Find the Smallest Divisor Given a Threshold|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold)|49.2%|Medium|| |1284|Minimum Number of Flips to Convert Binary Matrix to Zero Matrix||70.1%|Hard|| -|1285|Find the Start and End Number of Continuous Ranges||86.7%|Medium|| +|1285|Find the Start and End Number of Continuous Ranges||86.9%|Medium|| |1286|Iterator for Combination||70.9%|Medium|| |1287|Element Appearing More Than 25% In Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1287.Element-Appearing-More-Than-25%-In-Sorted-Array)|60.2%|Easy|| |1288|Remove Covered Intervals||57.2%|Medium|| -|1289|Minimum Falling Path Sum II||62.2%|Hard|| -|1290|Convert Binary Number in a Linked List to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer)|81.6%|Easy|| +|1289|Minimum Falling Path Sum II||62.3%|Hard|| +|1290|Convert Binary Number in a Linked List to Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer)|81.7%|Easy|| |1291|Sequential Digits||57.4%|Medium|| |1292|Maximum Side Length of a Square with Sum Less than or Equal to Threshold||50.5%|Medium|| |1293|Shortest Path in a Grid with Obstacles Elimination||42.9%|Hard|| |1294|Weather Type in Each Country||66.1%|Easy|| -|1295|Find Numbers with Even Number of Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits)|79.4%|Easy|| +|1295|Find Numbers with Even Number of Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits)|79.3%|Easy|| |1296|Divide Array in Sets of K Consecutive Numbers||55.3%|Medium|| |1297|Maximum Number of Occurrences of a Substring||49.2%|Medium|| |1298|Maximum Candies You Can Get from Boxes||59.6%|Hard|| -|1299|Replace Elements with Greatest Element on Right Side|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side)|74.1%|Easy|| +|1299|Replace Elements with Greatest Element on Right Side|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side)|74.2%|Easy|| |1300|Sum of Mutated Array Closest to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target)|43.3%|Medium|| |1301|Number of Paths with Max Score||38.0%|Hard|| |1302|Deepest Leaves Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1302.Deepest-Leaves-Sum)|84.1%|Medium|| |1303|Find the Team Size||89.4%|Easy|| -|1304|Find N Unique Integers Sum up to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero)|76.5%|Easy|| +|1304|Find N Unique Integers Sum up to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero)|76.6%|Easy|| |1305|All Elements in Two Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1305.All-Elements-in-Two-Binary-Search-Trees)|77.8%|Medium|| -|1306|Jump Game III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1306.Jump-Game-III)|62.6%|Medium|| -|1307|Verbal Arithmetic Puzzle||37.2%|Hard|| +|1306|Jump Game III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1306.Jump-Game-III)|62.5%|Medium|| +|1307|Verbal Arithmetic Puzzle||37.1%|Hard|| |1308|Running Total for Different Genders||87.1%|Medium|| -|1309|Decrypt String from Alphabet to Integer Mapping||77.3%|Easy|| +|1309|Decrypt String from Alphabet to Integer Mapping||77.2%|Easy|| |1310|XOR Queries of a Subarray||69.2%|Medium|| |1311|Get Watched Videos by Your Friends||44.1%|Medium|| -|1312|Minimum Insertion Steps to Make a String Palindrome||59.2%|Hard|| +|1312|Minimum Insertion Steps to Make a String Palindrome||59.3%|Hard|| |1313|Decompress Run-Length Encoded List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1313.Decompress-Run-Length-Encoded-List)|85.3%|Easy|| -|1314|Matrix Block Sum||73.7%|Medium|| +|1314|Matrix Block Sum||73.6%|Medium|| |1315|Sum of Nodes with Even-Valued Grandparent||84.1%|Medium|| -|1316|Distinct Echo Substrings||49.6%|Hard|| +|1316|Distinct Echo Substrings||49.7%|Hard|| |1317|Convert Integer to the Sum of Two No-Zero Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers)|56.8%|Easy|| -|1318|Minimum Flips to Make a OR b Equal to c||63.7%|Medium|| -|1319|Number of Operations to Make Network Connected||54.7%|Medium|| +|1318|Minimum Flips to Make a OR b Equal to c||63.8%|Medium|| +|1319|Number of Operations to Make Network Connected||54.8%|Medium|| |1320|Minimum Distance to Type a Word Using Two Fingers||62.8%|Hard|| -|1321|Restaurant Growth||70.5%|Medium|| -|1322|Ads Performance||57.8%|Easy|| +|1321|Restaurant Growth||70.6%|Medium|| +|1322|Ads Performance||57.9%|Easy|| |1323|Maximum 69 Number||78.0%|Easy|| -|1324|Print Words Vertically||58.6%|Medium|| +|1324|Print Words Vertically||58.7%|Medium|| |1325|Delete Leaves With a Given Value||73.5%|Medium|| -|1326|Minimum Number of Taps to Open to Water a Garden||46.1%|Hard|| -|1327|List the Products Ordered in a Period||77.5%|Easy|| +|1326|Minimum Number of Taps to Open to Water a Garden||46.2%|Hard|| +|1327|List the Products Ordered in a Period||77.4%|Easy|| |1328|Break a Palindrome||45.6%|Medium|| |1329|Sort the Matrix Diagonally||79.4%|Medium|| -|1330|Reverse Subarray To Maximize Array Value||36.4%|Hard|| -|1331|Rank Transform of an Array||57.7%|Easy|| +|1330|Reverse Subarray To Maximize Array Value||36.5%|Hard|| +|1331|Rank Transform of an Array||57.6%|Easy|| |1332|Remove Palindromic Subsequences||62.8%|Easy|| |1333|Filter Restaurants by Vegan-Friendly, Price and Distance||57.0%|Medium|| |1334|Find the City With the Smallest Number of Neighbors at a Threshold Distance||46.6%|Medium|| |1335|Minimum Difficulty of a Job Schedule||57.3%|Hard|| -|1336|Number of Transactions per Visit||47.3%|Hard|| -|1337|The K Weakest Rows in a Matrix||69.6%|Easy|| +|1336|Number of Transactions per Visit||47.4%|Hard|| +|1337|The K Weakest Rows in a Matrix||69.7%|Easy|| |1338|Reduce Array Size to The Half||66.7%|Medium|| -|1339|Maximum Product of Splitted Binary Tree||37.9%|Medium|| -|1340|Jump Game V||58.9%|Hard|| -|1341|Movie Rating||58.4%|Medium|| +|1339|Maximum Product of Splitted Binary Tree||38.0%|Medium|| +|1340|Jump Game V||59.0%|Hard|| +|1341|Movie Rating||58.5%|Medium|| |1342|Number of Steps to Reduce a Number to Zero||85.7%|Easy|| |1343|Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold||64.6%|Medium|| -|1344|Angle Between Hands of a Clock||61.3%|Medium|| +|1344|Angle Between Hands of a Clock||61.2%|Medium|| |1345|Jump Game IV||41.9%|Hard|| |1346|Check If N and Its Double Exist||36.5%|Easy|| |1347|Minimum Number of Steps to Make Two Strings Anagram||75.3%|Medium|| -|1348|Tweet Counts Per Frequency||33.8%|Medium|| +|1348|Tweet Counts Per Frequency||34.0%|Medium|| |1349|Maximum Students Taking Exam||44.0%|Hard|| |1350|Students With Invalid Departments||90.6%|Easy|| |1351|Count Negative Numbers in a Sorted Matrix||75.8%|Easy|| @@ -1494,373 +1494,379 @@ |1354|Construct Target Array With Multiple Sums||31.3%|Hard|| |1355|Activity Participants||74.1%|Medium|| |1356|Sort Integers by The Number of 1 Bits||69.6%|Easy|| -|1357|Apply Discount Every n Orders||66.6%|Medium|| -|1358|Number of Substrings Containing All Three Characters||60.3%|Medium|| -|1359|Count All Valid Pickup and Delivery Options||56.9%|Hard|| +|1357|Apply Discount Every n Orders||66.5%|Medium|| +|1358|Number of Substrings Containing All Three Characters||60.4%|Medium|| +|1359|Count All Valid Pickup and Delivery Options||56.8%|Hard|| |1360|Number of Days Between Two Dates||46.9%|Easy|| -|1361|Validate Binary Tree Nodes||44.3%|Medium|| +|1361|Validate Binary Tree Nodes||44.2%|Medium|| |1362|Closest Divisors||57.5%|Medium|| |1363|Largest Multiple of Three||33.9%|Hard|| -|1364|Number of Trusted Contacts of a Customer||77.9%|Medium|| +|1364|Number of Trusted Contacts of a Customer||78.0%|Medium|| |1365|How Many Numbers Are Smaller Than the Current Number||85.9%|Easy|| -|1366|Rank Teams by Votes||55.0%|Medium|| +|1366|Rank Teams by Votes||54.9%|Medium|| |1367|Linked List in Binary Tree||41.1%|Medium|| |1368|Minimum Cost to Make at Least One Valid Path in a Grid||56.8%|Hard|| -|1369|Get the Second Most Recent Activity||68.5%|Hard|| +|1369|Get the Second Most Recent Activity||68.4%|Hard|| |1370|Increasing Decreasing String||76.4%|Easy|| -|1371|Find the Longest Substring Containing Vowels in Even Counts||61.3%|Medium|| -|1372|Longest ZigZag Path in a Binary Tree||54.6%|Medium|| +|1371|Find the Longest Substring Containing Vowels in Even Counts||61.2%|Medium|| +|1372|Longest ZigZag Path in a Binary Tree||54.7%|Medium|| |1373|Maximum Sum BST in Binary Tree||37.6%|Hard|| |1374|Generate a String With Characters That Have Odd Counts||76.2%|Easy|| |1375|Bulb Switcher III||64.1%|Medium|| |1376|Time Needed to Inform All Employees||56.3%|Medium|| |1377|Frog Position After T Seconds||34.8%|Hard|| |1378|Replace Employee ID With The Unique Identifier||89.8%|Easy|| -|1379|Find a Corresponding Node of a Binary Tree in a Clone of That Tree||85.2%|Medium|| +|1379|Find a Corresponding Node of a Binary Tree in a Clone of That Tree||85.0%|Medium|| |1380|Lucky Numbers in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix)|70.9%|Easy|| |1381|Design a Stack With Increment Operation||75.8%|Medium|| |1382|Balance a Binary Search Tree||76.0%|Medium|| |1383|Maximum Performance of a Team||35.1%|Hard|| -|1384|Total Sales Amount by Year||64.1%|Hard|| +|1384|Total Sales Amount by Year||64.4%|Hard|| |1385|Find the Distance Value Between Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays)|66.4%|Easy|| |1386|Cinema Seat Allocation||35.5%|Medium|| |1387|Sort Integers by The Power Value||70.5%|Medium|| |1388|Pizza With 3n Slices||45.4%|Hard|| -|1389|Create Target Array in the Given Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1389.Create-Target-Array-in-the-Given-Order)|84.8%|Easy|| +|1389|Create Target Array in the Given Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1389.Create-Target-Array-in-the-Given-Order)|84.7%|Easy|| |1390|Four Divisors||39.0%|Medium|| |1391|Check if There is a Valid Path in a Grid||44.9%|Medium|| |1392|Longest Happy Prefix||41.3%|Hard|| |1393|Capital Gain/Loss||90.6%|Medium|| |1394|Find Lucky Integer in an Array||63.2%|Easy|| -|1395|Count Number of Teams||81.7%|Medium|| -|1396|Design Underground System||68.8%|Medium|| +|1395|Count Number of Teams||81.0%|Medium|| +|1396|Design Underground System||69.0%|Medium|| |1397|Find All Good Strings||38.1%|Hard|| |1398|Customers Who Bought Products A and B but Not C||82.1%|Medium|| -|1399|Count Largest Group||65.3%|Easy|| +|1399|Count Largest Group||65.4%|Easy|| |1400|Construct K Palindrome Strings||62.8%|Medium|| |1401|Circle and Rectangle Overlapping||42.3%|Medium|| -|1402|Reducing Dishes||72.3%|Hard|| +|1402|Reducing Dishes||72.2%|Hard|| |1403|Minimum Subsequence in Non-Increasing Order||71.1%|Easy|| |1404|Number of Steps to Reduce a Number in Binary Representation to One||49.8%|Medium|| |1405|Longest Happy String||52.2%|Medium|| -|1406|Stone Game III||57.2%|Hard|| -|1407|Top Travellers||83.7%|Easy|| -|1408|String Matching in an Array||62.7%|Easy|| +|1406|Stone Game III||57.3%|Hard|| +|1407|Top Travellers||83.5%|Easy|| +|1408|String Matching in an Array||62.8%|Easy|| |1409|Queries on a Permutation With Key||81.4%|Medium|| |1410|HTML Entity Parser||54.4%|Medium|| |1411|Number of Ways to Paint N × 3 Grid||60.4%|Hard|| -|1412|Find the Quiet Students in All Exams||65.6%|Hard|| -|1413|Minimum Value to Get Positive Step by Step Sum||65.3%|Easy|| +|1412|Find the Quiet Students in All Exams||65.4%|Hard|| +|1413|Minimum Value to Get Positive Step by Step Sum||65.4%|Easy|| |1414|Find the Minimum Number of Fibonacci Numbers Whose Sum Is K||63.8%|Medium|| -|1415|The k-th Lexicographical String of All Happy Strings of Length n||70.0%|Medium|| +|1415|The k-th Lexicographical String of All Happy Strings of Length n||70.1%|Medium|| |1416|Restore The Array||36.3%|Hard|| |1417|Reformat The String||55.4%|Easy|| -|1418|Display Table of Food Orders in a Restaurant||68.2%|Medium|| -|1419|Minimum Number of Frogs Croaking||47.2%|Medium|| +|1418|Display Table of Food Orders in a Restaurant||68.3%|Medium|| +|1419|Minimum Number of Frogs Croaking||47.3%|Medium|| |1420|Build Array Where You Can Find The Maximum Exactly K Comparisons||64.3%|Hard|| -|1421|NPV Queries||81.8%|Medium|| -|1422|Maximum Score After Splitting a String||56.1%|Easy|| -|1423|Maximum Points You Can Obtain from Cards||46.3%|Medium|| +|1421|NPV Queries||81.9%|Medium|| +|1422|Maximum Score After Splitting a String||56.0%|Easy|| +|1423|Maximum Points You Can Obtain from Cards||46.4%|Medium|| |1424|Diagonal Traverse II||45.5%|Medium|| -|1425|Constrained Subsequence Sum||44.9%|Hard|| +|1425|Constrained Subsequence Sum||45.0%|Hard|| |1426|Counting Elements||59.0%|Easy|| |1427|Perform String Shifts||53.4%|Easy|| |1428|Leftmost Column with at Least a One||48.8%|Medium|| |1429|First Unique Number||49.1%|Medium|| |1430|Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree||45.1%|Medium|| -|1431|Kids With the Greatest Number of Candies||88.6%|Easy|| -|1432|Max Difference You Can Get From Changing an Integer||42.9%|Medium|| -|1433|Check If a String Can Break Another String||66.9%|Medium|| +|1431|Kids With the Greatest Number of Candies||88.5%|Easy|| +|1432|Max Difference You Can Get From Changing an Integer||42.8%|Medium|| +|1433|Check If a String Can Break Another String||67.0%|Medium|| |1434|Number of Ways to Wear Different Hats to Each Other||39.2%|Hard|| |1435|Create a Session Bar Chart||77.8%|Easy|| |1436|Destination City||77.1%|Easy|| |1437|Check If All 1's Are at Least Length K Places Away||61.8%|Medium|| -|1438|Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit||43.9%|Medium|| -|1439|Find the Kth Smallest Sum of a Matrix With Sorted Rows||59.9%|Hard|| -|1440|Evaluate Boolean Expression||74.5%|Medium|| +|1438|Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit||44.0%|Medium|| +|1439|Find the Kth Smallest Sum of a Matrix With Sorted Rows||60.0%|Hard|| +|1440|Evaluate Boolean Expression||74.6%|Medium|| |1441|Build an Array With Stack Operations||69.1%|Easy|| -|1442|Count Triplets That Can Form Two Arrays of Equal XOR||70.9%|Medium|| +|1442|Count Triplets That Can Form Two Arrays of Equal XOR||71.0%|Medium|| |1443|Minimum Time to Collect All Apples in a Tree||54.6%|Medium|| |1444|Number of Ways of Cutting a Pizza||53.7%|Hard|| -|1445|Apples & Oranges||90.7%|Medium|| +|1445|Apples & Oranges||90.8%|Medium|| |1446|Consecutive Characters||61.1%|Easy|| |1447|Simplified Fractions||62.2%|Medium|| |1448|Count Good Nodes in Binary Tree||70.3%|Medium|| -|1449|Form Largest Integer With Digits That Add up to Target||43.7%|Hard|| +|1449|Form Largest Integer With Digits That Add up to Target||43.8%|Hard|| |1450|Number of Students Doing Homework at a Given Time||76.9%|Easy|| -|1451|Rearrange Words in a Sentence||59.0%|Medium|| -|1452|People Whose List of Favorite Companies Is Not a Subset of Another List||54.8%|Medium|| +|1451|Rearrange Words in a Sentence||59.1%|Medium|| +|1452|People Whose List of Favorite Companies Is Not a Subset of Another List||54.9%|Medium|| |1453|Maximum Number of Darts Inside of a Circular Dartboard||35.2%|Hard|| |1454|Active Users||38.6%|Medium|| -|1455|Check If a Word Occurs As a Prefix of Any Word in a Sentence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence)|64.8%|Easy|| -|1456|Maximum Number of Vowels in a Substring of Given Length||54.3%|Medium|| -|1457|Pseudo-Palindromic Paths in a Binary Tree||71.4%|Medium|| +|1455|Check If a Word Occurs As a Prefix of Any Word in a Sentence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence)|64.7%|Easy|| +|1456|Maximum Number of Vowels in a Substring of Given Length||54.4%|Medium|| +|1457|Pseudo-Palindromic Paths in a Binary Tree||71.3%|Medium|| |1458|Max Dot Product of Two Subsequences||42.9%|Hard|| -|1459|Rectangles Area||64.2%|Medium|| +|1459|Rectangles Area||64.3%|Medium|| |1460|Make Two Arrays Equal by Reversing Sub-arrays||72.1%|Easy|| -|1461|Check If a String Contains All Binary Codes of Size K||46.9%|Medium|| -|1462|Course Schedule IV||44.3%|Medium|| -|1463|Cherry Pickup II||69.5%|Hard|| +|1461|Check If a String Contains All Binary Codes of Size K||47.0%|Medium|| +|1462|Course Schedule IV||44.4%|Medium|| +|1463|Cherry Pickup II||69.4%|Hard|| |1464|Maximum Product of Two Elements in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array)|76.9%|Easy|| -|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.7%|Medium|| +|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.8%|Medium|| |1466|Reorder Routes to Make All Paths Lead to the City Zero||61.3%|Medium|| -|1467|Probability of a Two Boxes Having The Same Number of Distinct Balls||61.0%|Hard|| -|1468|Calculate Salaries||81.1%|Medium|| -|1469|Find All The Lonely Nodes||80.5%|Easy|| +|1467|Probability of a Two Boxes Having The Same Number of Distinct Balls||60.9%|Hard|| +|1468|Calculate Salaries||81.3%|Medium|| +|1469|Find All The Lonely Nodes||80.6%|Easy|| |1470|Shuffle the Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1470.Shuffle-the-Array)|88.5%|Easy|| |1471|The k Strongest Values in an Array||58.4%|Medium|| |1472|Design Browser History||70.3%|Medium|| -|1473|Paint House III||48.8%|Hard|| -|1474|Delete N Nodes After M Nodes of a Linked List||74.7%|Easy|| +|1473|Paint House III||48.7%|Hard|| +|1474|Delete N Nodes After M Nodes of a Linked List||74.6%|Easy|| |1475|Final Prices With a Special Discount in a Shop||74.7%|Easy|| |1476|Subrectangle Queries||88.6%|Medium|| |1477|Find Two Non-overlapping Sub-arrays Each With Target Sum||34.1%|Medium|| |1478|Allocate Mailboxes||54.2%|Hard|| -|1479|Sales by Day of the Week||83.6%|Hard|| -|1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|89.6%|Easy|| +|1479|Sales by Day of the Week||83.9%|Hard|| +|1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|89.5%|Easy|| |1481|Least Number of Unique Integers after K Removals||55.5%|Medium|| |1482|Minimum Number of Days to Make m Bouquets||49.7%|Medium|| |1483|Kth Ancestor of a Tree Node||30.3%|Hard|| -|1484|Group Sold Products By The Date||86.0%|Easy|| +|1484|Group Sold Products By The Date||85.9%|Easy|| |1485|Clone Binary Tree With Random Pointer||79.5%|Medium|| |1486|XOR Operation in an Array||84.0%|Easy|| |1487|Making File Names Unique||30.5%|Medium|| |1488|Avoid Flood in The City||24.7%|Medium|| |1489|Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree||52.3%|Hard|| -|1490|Clone N-ary Tree||83.4%|Medium|| -|1491|Average Salary Excluding the Minimum and Maximum Salary||68.4%|Easy|| +|1490|Clone N-ary Tree||83.5%|Medium|| +|1491|Average Salary Excluding the Minimum and Maximum Salary||68.3%|Easy|| |1492|The kth Factor of n||63.4%|Medium|| |1493|Longest Subarray of 1's After Deleting One Element||58.2%|Medium|| -|1494|Parallel Courses II||31.2%|Hard|| -|1495|Friendly Movies Streamed Last Month||51.3%|Easy|| +|1494|Parallel Courses II||31.4%|Hard|| +|1495|Friendly Movies Streamed Last Month||51.4%|Easy|| |1496|Path Crossing||55.5%|Easy|| |1497|Check If Array Pairs Are Divisible by k||40.5%|Medium|| -|1498|Number of Subsequences That Satisfy the Given Sum Condition||38.2%|Medium|| +|1498|Number of Subsequences That Satisfy the Given Sum Condition||38.3%|Medium|| |1499|Max Value of Equation||45.2%|Hard|| |1500|Design a File Sharing System||46.0%|Medium|| -|1501|Countries You Can Safely Invest In||60.0%|Medium|| -|1502|Can Make Arithmetic Progression From Sequence||70.8%|Easy|| -|1503|Last Moment Before All Ants Fall Out of a Plank||53.0%|Medium|| -|1504|Count Submatrices With All Ones||61.0%|Medium|| -|1505|Minimum Possible Integer After at Most K Adjacent Swaps On Digits||36.2%|Hard|| -|1506|Find Root of N-Ary Tree||80.8%|Medium|| -|1507|Reformat Date||60.3%|Easy|| +|1501|Countries You Can Safely Invest In||60.1%|Medium|| +|1502|Can Make Arithmetic Progression From Sequence||70.7%|Easy|| +|1503|Last Moment Before All Ants Fall Out of a Plank||53.1%|Medium|| +|1504|Count Submatrices With All Ones||60.9%|Medium|| +|1505|Minimum Possible Integer After at Most K Adjacent Swaps On Digits||36.0%|Hard|| +|1506|Find Root of N-Ary Tree||80.7%|Medium|| +|1507|Reformat Date||60.2%|Easy|| |1508|Range Sum of Sorted Subarray Sums||62.0%|Medium|| |1509|Minimum Difference Between Largest and Smallest Value in Three Moves||51.8%|Medium|| |1510|Stone Game IV||58.8%|Hard|| -|1511|Customer Order Frequency||73.2%|Easy|| +|1511|Customer Order Frequency||73.4%|Easy|| |1512|Number of Good Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1512.Number-of-Good-Pairs)|87.9%|Easy|| |1513|Number of Substrings With Only 1s||41.4%|Medium|| -|1514|Path with Maximum Probability||39.4%|Medium|| +|1514|Path with Maximum Probability||39.5%|Medium|| |1515|Best Position for a Service Centre||37.0%|Hard|| -|1516|Move Sub-Tree of N-Ary Tree||62.8%|Hard|| -|1517|Find Users With Valid E-Mails||71.9%|Easy|| +|1516|Move Sub-Tree of N-Ary Tree||62.7%|Hard|| +|1517|Find Users With Valid E-Mails||71.8%|Easy|| |1518|Water Bottles||60.7%|Easy|| -|1519|Number of Nodes in the Sub-Tree With the Same Label||36.8%|Medium|| -|1520|Maximum Number of Non-Overlapping Substrings||35.9%|Hard|| +|1519|Number of Nodes in the Sub-Tree With the Same Label||36.9%|Medium|| +|1520|Maximum Number of Non-Overlapping Substrings||36.0%|Hard|| |1521|Find a Value of a Mysterious Function Closest to Target||44.4%|Hard|| -|1522|Diameter of N-Ary Tree||68.8%|Medium|| -|1523|Count Odd Numbers in an Interval Range||55.1%|Easy|| +|1522|Diameter of N-Ary Tree||68.9%|Medium|| +|1523|Count Odd Numbers in an Interval Range||55.0%|Easy|| |1524|Number of Sub-arrays With Odd Sum||39.5%|Medium|| -|1525|Number of Good Ways to Split a String||66.9%|Medium|| -|1526|Minimum Number of Increments on Subarrays to Form a Target Array||59.7%|Hard|| -|1527|Patients With a Condition||76.1%|Easy|| -|1528|Shuffle String||85.8%|Easy|| -|1529|Bulb Switcher IV||70.8%|Medium|| +|1525|Number of Good Ways to Split a String||66.7%|Medium|| +|1526|Minimum Number of Increments on Subarrays to Form a Target Array||59.8%|Hard|| +|1527|Patients With a Condition||75.0%|Easy|| +|1528|Shuffle String||85.7%|Easy|| +|1529|Bulb Switcher IV||70.9%|Medium|| |1530|Number of Good Leaf Nodes Pairs||55.8%|Medium|| |1531|String Compression II||33.3%|Hard|| -|1532|The Most Recent Three Orders||73.0%|Medium|| -|1533|Find the Index of the Large Integer||54.7%|Medium|| +|1532|The Most Recent Three Orders||73.1%|Medium|| +|1533|Find the Index of the Large Integer||54.6%|Medium|| |1534|Count Good Triplets||80.2%|Easy|| |1535|Find the Winner of an Array Game||47.2%|Medium|| |1536|Minimum Swaps to Arrange a Binary Grid||43.1%|Medium|| -|1537|Get the Maximum Score||36.3%|Hard|| -|1538|Guess the Majority in a Hidden Array||61.4%|Medium|| -|1539|Kth Missing Positive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1539.Kth-Missing-Positive-Number)|55.4%|Easy|| -|1540|Can Convert String in K Moves||30.5%|Medium|| -|1541|Minimum Insertions to Balance a Parentheses String||42.4%|Medium|| +|1537|Get the Maximum Score||36.4%|Hard|| +|1538|Guess the Majority in a Hidden Array||61.5%|Medium|| +|1539|Kth Missing Positive Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1539.Kth-Missing-Positive-Number)|55.3%|Easy|| +|1540|Can Convert String in K Moves||30.6%|Medium|| +|1541|Minimum Insertions to Balance a Parentheses String||42.6%|Medium|| |1542|Find Longest Awesome Substring||36.5%|Hard|| |1543|Fix Product Name Format||68.0%|Easy|| |1544|Make The String Great||55.1%|Easy|| -|1545|Find Kth Bit in Nth Binary String||57.2%|Medium|| -|1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||43.7%|Medium|| -|1547|Minimum Cost to Cut a Stick||52.0%|Hard|| -|1548|The Most Similar Path in a Graph||54.1%|Hard|| -|1549|The Most Recent Orders for Each Product||66.2%|Medium|| +|1545|Find Kth Bit in Nth Binary String||57.3%|Medium|| +|1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||43.8%|Medium|| +|1547|Minimum Cost to Cut a Stick||52.1%|Hard|| +|1548|The Most Similar Path in a Graph||53.8%|Hard|| +|1549|The Most Recent Orders for Each Product||66.3%|Medium|| |1550|Three Consecutive Odds||65.3%|Easy|| |1551|Minimum Operations to Make Array Equal||77.8%|Medium|| |1552|Magnetic Force Between Two Balls||48.6%|Medium|| -|1553|Minimum Number of Days to Eat N Oranges||29.1%|Hard|| -|1554|Strings Differ by One Character||63.6%|Medium|| -|1555|Bank Account Summary||52.7%|Medium|| -|1556|Thousand Separator||58.2%|Easy|| -|1557|Minimum Number of Vertices to Reach All Nodes||75.3%|Medium|| -|1558|Minimum Numbers of Function Calls to Make Target Array||62.5%|Medium|| -|1559|Detect Cycles in 2D Grid||44.7%|Hard|| +|1553|Minimum Number of Days to Eat N Oranges||29.2%|Hard|| +|1554|Strings Differ by One Character||63.8%|Medium|| +|1555|Bank Account Summary||52.8%|Medium|| +|1556|Thousand Separator||58.1%|Easy|| +|1557|Minimum Number of Vertices to Reach All Nodes||75.4%|Medium|| +|1558|Minimum Numbers of Function Calls to Make Target Array||62.6%|Medium|| +|1559|Detect Cycles in 2D Grid||44.8%|Hard|| |1560|Most Visited Sector in a Circular Track||57.0%|Easy|| |1561|Maximum Number of Coins You Can Get||78.0%|Medium|| -|1562|Find Latest Group of Size M||39.3%|Medium|| +|1562|Find Latest Group of Size M||39.4%|Medium|| |1563|Stone Game V||40.0%|Hard|| -|1564|Put Boxes Into the Warehouse I||66.1%|Medium|| -|1565|Unique Orders and Customers Per Month||83.9%|Easy|| +|1564|Put Boxes Into the Warehouse I||66.0%|Medium|| +|1565|Unique Orders and Customers Per Month||83.5%|Easy|| |1566|Detect Pattern of Length M Repeated K or More Times||42.3%|Easy|| -|1567|Maximum Length of Subarray With Positive Product||36.4%|Medium|| -|1568|Minimum Number of Days to Disconnect Island||50.4%|Hard|| -|1569|Number of Ways to Reorder Array to Get Same BST||50.0%|Hard|| +|1567|Maximum Length of Subarray With Positive Product||36.5%|Medium|| +|1568|Minimum Number of Days to Disconnect Island||50.3%|Hard|| +|1569|Number of Ways to Reorder Array to Get Same BST||49.9%|Hard|| |1570|Dot Product of Two Sparse Vectors||91.4%|Medium|| |1571|Warehouse Manager||89.9%|Easy|| |1572|Matrix Diagonal Sum||78.2%|Easy|| -|1573|Number of Ways to Split a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1573.Number-of-Ways-to-Split-a-String)|30.8%|Medium|| -|1574|Shortest Subarray to be Removed to Make Array Sorted||32.9%|Medium|| -|1575|Count All Possible Routes||57.5%|Hard|| +|1573|Number of Ways to Split a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1573.Number-of-Ways-to-Split-a-String)|30.9%|Medium|| +|1574|Shortest Subarray to be Removed to Make Array Sorted||33.0%|Medium|| +|1575|Count All Possible Routes||57.4%|Hard|| |1576|Replace All ?'s to Avoid Consecutive Repeating Characters||48.1%|Easy|| -|1577|Number of Ways Where Square of Number Is Equal to Product of Two Numbers||37.2%|Medium|| -|1578|Minimum Deletion Cost to Avoid Repeating Letters||60.3%|Medium|| -|1579|Remove Max Number of Edges to Keep Graph Fully Traversable||45.7%|Hard|| -|1580|Put Boxes Into the Warehouse II||62.2%|Medium|| +|1577|Number of Ways Where Square of Number Is Equal to Product of Two Numbers||37.3%|Medium|| +|1578|Minimum Deletion Cost to Avoid Repeating Letters||60.4%|Medium|| +|1579|Remove Max Number of Edges to Keep Graph Fully Traversable||45.8%|Hard|| +|1580|Put Boxes Into the Warehouse II||62.0%|Medium|| |1581|Customer Who Visited but Did Not Make Any Transactions||90.2%|Easy|| -|1582|Special Positions in a Binary Matrix||64.2%|Easy|| -|1583|Count Unhappy Friends||53.7%|Medium|| -|1584|Min Cost to Connect All Points||50.2%|Medium|| -|1585|Check If String Is Transformable With Substring Sort Operations||48.3%|Hard|| -|1586|Binary Search Tree Iterator II||66.5%|Medium|| -|1587|Bank Account Summary II||90.3%|Easy|| -|1588|Sum of All Odd Length Subarrays||82.0%|Easy|| -|1589|Maximum Sum Obtained of Any Permutation||34.6%|Medium|| +|1582|Special Positions in a Binary Matrix||64.3%|Easy|| +|1583|Count Unhappy Friends||53.8%|Medium|| +|1584|Min Cost to Connect All Points||50.5%|Medium|| +|1585|Check If String Is Transformable With Substring Sort Operations||48.2%|Hard|| +|1586|Binary Search Tree Iterator II||66.3%|Medium|| +|1587|Bank Account Summary II||90.2%|Easy|| +|1588|Sum of All Odd Length Subarrays||81.9%|Easy|| +|1589|Maximum Sum Obtained of Any Permutation||34.7%|Medium|| |1590|Make Sum Divisible by P||27.3%|Medium|| -|1591|Strange Printer II||55.4%|Hard|| +|1591|Strange Printer II||55.5%|Hard|| |1592|Rearrange Spaces Between Words||43.8%|Easy|| |1593|Split a String Into the Max Number of Unique Substrings||48.3%|Medium|| -|1594|Maximum Non Negative Product in a Matrix||31.9%|Medium|| -|1595|Minimum Cost to Connect Two Groups of Points||42.7%|Hard|| -|1596|The Most Frequently Ordered Products for Each Customer||84.4%|Medium|| -|1597|Build Binary Expression Tree From Infix Expression||65.3%|Hard|| +|1594|Maximum Non Negative Product in a Matrix||31.8%|Medium|| +|1595|Minimum Cost to Connect Two Groups of Points||42.8%|Hard|| +|1596|The Most Frequently Ordered Products for Each Customer||84.5%|Medium|| +|1597|Build Binary Expression Tree From Infix Expression||65.7%|Hard|| |1598|Crawler Log Folder||64.3%|Easy|| |1599|Maximum Profit of Operating a Centennial Wheel||43.5%|Medium|| |1600|Throne Inheritance||59.8%|Medium|| -|1601|Maximum Number of Achievable Transfer Requests||47.4%|Hard|| -|1602|Find Nearest Right Node in Binary Tree||74.1%|Medium|| -|1603|Design Parking System||86.8%|Easy|| -|1604|Alert Using Same Key-Card Three or More Times in a One Hour Period||42.1%|Medium|| +|1601|Maximum Number of Achievable Transfer Requests||47.5%|Hard|| +|1602|Find Nearest Right Node in Binary Tree||73.9%|Medium|| +|1603|Design Parking System||86.7%|Easy|| +|1604|Alert Using Same Key-Card Three or More Times in a One Hour Period||42.2%|Medium|| |1605|Find Valid Matrix Given Row and Column Sums||77.7%|Medium|| |1606|Find Servers That Handled Most Number of Requests||36.8%|Hard|| -|1607|Sellers With No Sales||56.1%|Easy|| +|1607|Sellers With No Sales||55.9%|Easy|| |1608|Special Array With X Elements Greater Than or Equal X||61.8%|Easy|| |1609|Even Odd Tree||53.2%|Medium|| -|1610|Maximum Number of Visible Points||28.5%|Hard|| +|1610|Maximum Number of Visible Points||28.6%|Hard|| |1611|Minimum One Bit Operations to Make Integers Zero||57.1%|Hard|| -|1612|Check If Two Expression Trees are Equivalent||69.9%|Medium|| -|1613|Find the Missing IDs||72.2%|Medium|| +|1612|Check If Two Expression Trees are Equivalent||69.7%|Medium|| +|1613|Find the Missing IDs||72.4%|Medium|| |1614|Maximum Nesting Depth of the Parentheses||83.5%|Easy|| -|1615|Maximal Network Rank||51.8%|Medium|| -|1616|Split Two Strings to Make Palindrome||36.5%|Medium|| +|1615|Maximal Network Rank||51.7%|Medium|| +|1616|Split Two Strings to Make Palindrome||36.4%|Medium|| |1617|Count Subtrees With Max Distance Between Cities||63.5%|Hard|| |1618|Maximum Font to Fit a Sentence in a Screen||58.1%|Medium|| -|1619|Mean of Array After Removing Some Elements||65.6%|Easy|| +|1619|Mean of Array After Removing Some Elements||65.5%|Easy|| |1620|Coordinate With Maximum Network Quality||37.0%|Medium|| |1621|Number of Sets of K Non-Overlapping Line Segments||41.2%|Medium|| |1622|Fancy Sequence||15.6%|Hard|| |1623|All Valid Triplets That Can Represent a Country||89.1%|Easy|| -|1624|Largest Substring Between Two Equal Characters||59.2%|Easy|| -|1625|Lexicographically Smallest String After Applying Operations||63.4%|Medium|| -|1626|Best Team With No Conflicts||37.1%|Medium|| -|1627|Graph Connectivity With Threshold||38.3%|Hard|| -|1628|Design an Expression Tree With Evaluate Function||80.4%|Medium|| -|1629|Slowest Key||59.0%|Easy|| +|1624|Largest Substring Between Two Equal Characters||59.1%|Easy|| +|1625|Lexicographically Smallest String After Applying Operations||63.5%|Medium|| +|1626|Best Team With No Conflicts||37.3%|Medium|| +|1627|Graph Connectivity With Threshold||38.2%|Hard|| +|1628|Design an Expression Tree With Evaluate Function||80.5%|Medium|| +|1629|Slowest Key||58.9%|Easy|| |1630|Arithmetic Subarrays||77.7%|Medium|| -|1631|Path With Minimum Effort||43.4%|Medium|| -|1632|Rank Transform of a Matrix||30.3%|Hard|| -|1633|Percentage of Users Attended a Contest||73.2%|Easy|| -|1634|Add Two Polynomials Represented as Linked Lists||55.9%|Medium|| +|1631|Path With Minimum Effort||43.6%|Medium|| +|1632|Rank Transform of a Matrix||30.4%|Hard|| +|1633|Percentage of Users Attended a Contest||73.4%|Easy|| +|1634|Add Two Polynomials Represented as Linked Lists||55.7%|Medium|| |1635|Hopper Company Queries I||56.1%|Hard|| -|1636|Sort Array by Increasing Frequency||66.6%|Easy|| -|1637|Widest Vertical Area Between Two Points Containing No Points||83.8%|Medium|| -|1638|Count Substrings That Differ by One Character||67.9%|Medium|| +|1636|Sort Array by Increasing Frequency||66.7%|Easy|| +|1637|Widest Vertical Area Between Two Points Containing No Points||83.7%|Medium|| +|1638|Count Substrings That Differ by One Character||68.0%|Medium|| |1639|Number of Ways to Form a Target String Given a Dictionary||39.3%|Hard|| -|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.6%|Easy|| -|1641|Count Sorted Vowel Strings||74.6%|Medium|| -|1642|Furthest Building You Can Reach||51.4%|Medium|| -|1643|Kth Smallest Instructions||42.8%|Hard|| -|1644|Lowest Common Ancestor of a Binary Tree II||57.7%|Medium|| -|1645|Hopper Company Queries II||41.2%|Hard|| -|1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|48.4%|Easy|| -|1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|53.9%|Medium|| +|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.1%|Easy|| +|1641|Count Sorted Vowel Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1641.Count-Sorted-Vowel-Strings)|77.5%|Medium|| +|1642|Furthest Building You Can Reach||51.3%|Medium|| +|1643|Kth Smallest Instructions||42.9%|Hard|| +|1644|Lowest Common Ancestor of a Binary Tree II||57.6%|Medium|| +|1645|Hopper Company Queries II||41.1%|Hard|| +|1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|53.8%|Easy|| +|1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|53.8%|Medium|| |1648|Sell Diminishing-Valued Colored Balls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls)|30.9%|Medium|| -|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.4%|Hard|| -|1650|Lowest Common Ancestor of a Binary Tree III||77.4%|Medium|| -|1651|Hopper Company Queries III||66.8%|Hard|| -|1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.4%|Easy|| -|1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.7%|Medium|| -|1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.4%|Medium|| -|1655|Distribute Repeating Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1655.Distribute-Repeating-Integers)|40.7%|Hard|| -|1656|Design an Ordered Stream|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1656.Design-an-Ordered-Stream)|82.6%|Easy|| +|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.2%|Hard|| +|1650|Lowest Common Ancestor of a Binary Tree III||77.5%|Medium|| +|1651|Hopper Company Queries III||67.1%|Hard|| +|1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.2%|Easy|| +|1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.9%|Medium|| +|1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.3%|Medium|| +|1655|Distribute Repeating Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1655.Distribute-Repeating-Integers)|40.5%|Hard|| +|1656|Design an Ordered Stream|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1656.Design-an-Ordered-Stream)|82.4%|Easy|| |1657|Determine if Two Strings Are Close|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1657.Determine-if-Two-Strings-Are-Close)|51.3%|Medium|| -|1658|Minimum Operations to Reduce X to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero)|30.7%|Medium|| +|1658|Minimum Operations to Reduce X to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero)|33.4%|Medium|| |1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|35.1%|Hard|| -|1660|Correct a Binary Tree||79.1%|Medium|| -|1661|Average Time of Process per Machine||79.6%|Easy|| -|1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|83.8%|Easy|| +|1660|Correct a Binary Tree||79.4%|Medium|| +|1661|Average Time of Process per Machine||79.5%|Easy|| +|1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|83.6%|Easy|| |1663|Smallest String With A Given Numeric Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value)|60.1%|Medium|| |1664|Ways to Make a Fair Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1664.Ways-to-Make-a-Fair-Array)|60.6%|Medium|| -|1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|68.2%|Hard|| -|1666|Change the Root of a Binary Tree||68.5%|Medium|| -|1667|Fix Names in a Table||64.0%|Easy|| +|1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|67.8%|Hard|| +|1666|Change the Root of a Binary Tree||68.7%|Medium|| +|1667|Fix Names in a Table||64.1%|Easy|| |1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.7%|Easy|| -|1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.4%|Medium|| +|1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.2%|Medium|| |1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.6%|Medium|| -|1671|Minimum Number of Removals to Make Mountain Array||45.8%|Hard|| -|1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.8%|Easy|| -|1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|38.1%|Medium|| -|1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|34.3%|Medium|| +|1671|Minimum Number of Removals to Make Mountain Array||45.7%|Hard|| +|1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.5%|Easy|| +|1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|38.3%|Medium|| +|1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|34.6%|Medium|| |1675|Minimize Deviation in Array||44.9%|Hard|| -|1676|Lowest Common Ancestor of a Binary Tree IV||77.6%|Medium|| -|1677|Product's Worth Over Invoices||74.4%|Easy|| -|1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.8%|Easy|| -|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|51.9%|Medium|| +|1676|Lowest Common Ancestor of a Binary Tree IV||77.9%|Medium|| +|1677|Product's Worth Over Invoices||74.7%|Easy|| +|1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.7%|Easy|| +|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|51.8%|Medium|| |1680|Concatenation of Consecutive Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers)|45.1%|Medium|| -|1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|34.9%|Hard|| -|1682|Longest Palindromic Subsequence II||51.8%|Medium|| -|1683|Invalid Tweets||91.5%|Easy|| -|1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|84.2%|Easy|| +|1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|35.0%|Hard|| +|1682|Longest Palindromic Subsequence II||51.5%|Medium|| +|1683|Invalid Tweets||91.2%|Easy|| +|1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|84.3%|Easy|| |1685|Sum of Absolute Differences in a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array)|61.8%|Medium|| |1686|Stone Game VI||48.8%|Medium|| |1687|Delivering Boxes from Storage to Ports||34.7%|Hard|| -|1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|83.3%|Easy|| -|1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.2%|Medium|| -|1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|46.5%|Medium|| +|1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|83.1%|Easy|| +|1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.0%|Medium|| +|1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|46.6%|Medium|| |1691|Maximum Height by Stacking Cuboids ||49.8%|Hard|| -|1692|Count Ways to Distribute Candies||62.4%|Hard|| -|1693|Daily Leads and Partners||91.3%|Easy|| -|1694|Reformat Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1694.Reformat-Phone-Number)|67.1%|Easy|| +|1692|Count Ways to Distribute Candies||62.2%|Hard|| +|1693|Daily Leads and Partners||90.9%|Easy|| +|1694|Reformat Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1694.Reformat-Phone-Number)|67.0%|Easy|| |1695|Maximum Erasure Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1695.Maximum-Erasure-Value)|49.5%|Medium|| -|1696|Jump Game VI||56.0%|Medium|| -|1697|Checking Existence of Edge Length Limited Paths||55.8%|Hard|| -|1698|Number of Distinct Substrings in a String||55.1%|Medium|| -|1699|Number of Calls Between Two Persons||85.8%|Medium|| -|1700|Number of Students Unable to Eat Lunch||70.3%|Easy|| -|1701|Average Waiting Time||61.8%|Medium|| -|1702|Maximum Binary String After Change||61.8%|Medium|| -|1703|Minimum Adjacent Swaps for K Consecutive Ones||40.7%|Hard|| +|1696|Jump Game VI||55.3%|Medium|| +|1697|Checking Existence of Edge Length Limited Paths||56.3%|Hard|| +|1698|Number of Distinct Substrings in a String||55.4%|Medium|| +|1699|Number of Calls Between Two Persons||86.1%|Medium|| +|1700|Number of Students Unable to Eat Lunch||70.0%|Easy|| +|1701|Average Waiting Time||61.6%|Medium|| +|1702|Maximum Binary String After Change||61.6%|Medium|| +|1703|Minimum Adjacent Swaps for K Consecutive Ones||40.8%|Hard|| |1704|Determine if String Halves Are Alike||78.2%|Easy|| -|1705|Maximum Number of Eaten Apples||42.4%|Medium|| -|1706|Where Will the Ball Fall||58.2%|Medium|| -|1707|Maximum XOR With an Element From Array||48.5%|Hard|| -|1708|Largest Subarray Length K||64.4%|Easy|| -|1709|Biggest Window Between Visits||81.1%|Medium|| -|1710|Maximum Units on a Truck||72.3%|Easy|| -|1711|Count Good Meals||25.6%|Medium|| -|1712|Ways to Split Array Into Three Subarrays||29.9%|Medium|| +|1705|Maximum Number of Eaten Apples||42.3%|Medium|| +|1706|Where Will the Ball Fall||58.3%|Medium|| +|1707|Maximum XOR With an Element From Array||48.1%|Hard|| +|1708|Largest Subarray Length K||64.0%|Easy|| +|1709|Biggest Window Between Visits||82.0%|Medium|| +|1710|Maximum Units on a Truck||71.6%|Easy|| +|1711|Count Good Meals||25.5%|Medium|| +|1712|Ways to Split Array Into Three Subarrays||29.7%|Medium|| |1713|Minimum Operations to Make a Subsequence||45.4%|Hard|| -|1714|Sum Of Special Evenly-Spaced Elements In Array||45.0%|Hard|| -|1715|Count Apples and Oranges||79.3%|Medium|| -|1716|Calculate Money in Leetcode Bank||70.4%|Easy|| -|1717|Maximum Score From Removing Substrings||36.8%|Medium|| -|1718|Construct the Lexicographically Largest Valid Sequence||41.4%|Medium|| -|1719|Number Of Ways To Reconstruct A Tree||37.9%|Hard|| -|1720|Decode XORed Array||86.6%|Easy|| -|1721|Swapping Nodes in a Linked List||66.1%|Medium|| -|1722|Minimize Hamming Distance After Swap Operations||57.8%|Medium|| -|1723|Find Minimum Time to Finish All Jobs||43.7%|Hard|| +|1714|Sum Of Special Evenly-Spaced Elements In Array||47.2%|Hard|| +|1715|Count Apples and Oranges||78.2%|Medium|| +|1716|Calculate Money in Leetcode Bank||69.4%|Easy|| +|1717|Maximum Score From Removing Substrings||38.0%|Medium|| +|1718|Construct the Lexicographically Largest Valid Sequence||42.9%|Medium|| +|1719|Number Of Ways To Reconstruct A Tree||39.8%|Hard|| +|1720|Decode XORed Array||86.3%|Easy|| +|1721|Swapping Nodes in a Linked List||65.7%|Medium|| +|1722|Minimize Hamming Distance After Swap Operations||56.8%|Medium|| +|1723|Find Minimum Time to Finish All Jobs||44.5%|Hard|| +|1724|Checking Existence of Edge Length Limited Paths II||58.5%|Hard|| +|1725|Number Of Rectangles That Can Form The Largest Square||77.4%|Easy|| +|1726|Tuple with Same Product||50.3%|Medium|| +|1727|Largest Submatrix With Rearrangements||53.9%|Medium|| +|1728|Cat and Mouse II||33.9%|Hard|| +|1729|Find Followers Count||68.3%|Easy|| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------| ------------------------------------------------------------------ diff --git a/ctl/command.go b/ctl/command.go index c54fb184..a440a571 100644 --- a/ctl/command.go +++ b/ctl/command.go @@ -25,5 +25,6 @@ func init() { newBuildCommand(), newLabelCommand(), newPDFCommand(), + newRefresh(), ) } diff --git a/ctl/refresh.go b/ctl/refresh.go new file mode 100644 index 00000000..2bc041d7 --- /dev/null +++ b/ctl/refresh.go @@ -0,0 +1,25 @@ +package main + +import ( + "github.com/spf13/cobra" +) + +func newRefresh() *cobra.Command { + cmd := &cobra.Command{ + Use: "refresh", + Short: "Refresh all document", + Run: func(cmd *cobra.Command, args []string) { + refresh() + }, + } + // cmd.Flags().StringVar(&alias, "alias", "", "alias") + // cmd.Flags().StringVar(&appId, "appid", "", "appid") + return cmd +} + +func refresh() { + delPreNext() + buildREADME() + buildChapterTwo(true) + addPreNext() +} diff --git a/leetcode/1641.Count-Sorted-Vowel-Strings/1641. Count Sorted Vowel Strings.go b/leetcode/1641.Count-Sorted-Vowel-Strings/1641. Count Sorted Vowel Strings.go new file mode 100644 index 00000000..be2ec59d --- /dev/null +++ b/leetcode/1641.Count-Sorted-Vowel-Strings/1641. Count Sorted Vowel Strings.go @@ -0,0 +1,35 @@ +package leetcode + +// 解法一 打表 +func countVowelStrings(n int) int { + res := []int{1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001, 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315, 8855, 10626, 12650, 14950, 17550, 20475, 23751, 27405, 31465, 35960, 40920, 46376, 52360, 58905, 66045, 73815, 82251, 91390, 101270, 111930, 123410, 135751, 148995, 163185, 178365, 194580, 211876, 230300, 249900, 270725, 292825, 316251} + return res[n] +} + +func makeTable() []int { + res, array := 0, []int{} + for i := 0; i < 51; i++ { + countVowelStringsDFS(i, 0, []string{}, []string{"a", "e", "i", "o", "u"}, &res) + array = append(array, res) + res = 0 + } + return array +} + +func countVowelStringsDFS(n, index int, cur []string, vowels []string, res *int) { + vowels = vowels[index:] + if len(cur) == n { + (*res)++ + return + } + for i := 0; i < len(vowels); i++ { + cur = append(cur, vowels[i]) + countVowelStringsDFS(n, i, cur, vowels, res) + cur = cur[:len(cur)-1] + } +} + +// 解法二 数学方法 —— 组合 +func countVowelStrings1(n int) int { + return (n + 1) * (n + 2) * (n + 3) * (n + 4) / 24 +} diff --git a/leetcode/1641.Count-Sorted-Vowel-Strings/1641. Count Sorted Vowel Strings_test.go b/leetcode/1641.Count-Sorted-Vowel-Strings/1641. Count Sorted Vowel Strings_test.go new file mode 100644 index 00000000..081ffbcd --- /dev/null +++ b/leetcode/1641.Count-Sorted-Vowel-Strings/1641. Count Sorted Vowel Strings_test.go @@ -0,0 +1,52 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1641 struct { + para1641 + ans1641 +} + +// para 是参数 +// one 代表第一个参数 +type para1641 struct { + n int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1641 struct { + one int +} + +func Test_Problem1641(t *testing.T) { + + qs := []question1641{ + + { + para1641{1}, + ans1641{5}, + }, + + { + para1641{2}, + ans1641{15}, + }, + + { + para1641{33}, + ans1641{66045}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1641------------------------\n") + + for _, q := range qs { + _, p := q.ans1641, q.para1641 + fmt.Printf("【input】:%v 【output】:%v \n", p, countVowelStrings(p.n)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1641.Count-Sorted-Vowel-Strings/README.md b/leetcode/1641.Count-Sorted-Vowel-Strings/README.md new file mode 100644 index 00000000..8da3acfd --- /dev/null +++ b/leetcode/1641.Count-Sorted-Vowel-Strings/README.md @@ -0,0 +1,90 @@ +# [1641. Count Sorted Vowel Strings](https://leetcode.com/problems/count-sorted-vowel-strings/) + + +## 题目 + +Given an integer `n`, return *the number of strings of length* `n` *that consist only of vowels (*`a`*,* `e`*,* `i`*,* `o`*,* `u`*) and are **lexicographically sorted**.* + +A string `s` is **lexicographically sorted** if for all valid `i`, `s[i]` is the same as or comes before `s[i+1]` in the alphabet. + +**Example 1:** + +``` +Input: n = 1 +Output: 5 +Explanation: The 5 sorted strings that consist of vowels only are ["a","e","i","o","u"]. +``` + +**Example 2:** + +``` +Input: n = 2 +Output: 15 +Explanation: The 15 sorted strings that consist of vowels only are +["aa","ae","ai","ao","au","ee","ei","eo","eu","ii","io","iu","oo","ou","uu"]. +Note that "ea" is not a valid string since 'e' comes after 'a' in the alphabet. + +``` + +**Example 3:** + +``` +Input: n = 33 +Output: 66045 + +``` + +**Constraints:** + +- `1 <= n <= 50` + +## 题目大意 + +给你一个整数 n,请返回长度为 n 、仅由元音 (a, e, i, o, u) 组成且按 字典序排列 的字符串数量。 + +字符串 s 按 字典序排列 需要满足:对于所有有效的 i,s[i] 在字母表中的位置总是与 s[i+1] 相同或在 s[i+1] 之前。 + +## 解题思路 + +- 题目给的数据量并不大,第一个思路是利用 DFS 遍历打表法。时间复杂度 O(1),空间复杂度 O(1)。 +- 第二个思路是利用数学中的组合公式计算结果。题目等价于假设现在有 n 个字母,要求取 4 次球(可以选择不取)将字母分为 5 堆,问有几种取法。确定了取法以后,`a`,`e`,`i`,`o`,`u`,每个字母的个数就确定了,据题意要求按照字母序排序,那么最终字符串也就确定了。现在关注解决这个组合问题就可以了。把问题再转化一次,等价于,有 n+4 个字母,取 4 次,问有几种取法。+4 代表 4 个空操作,取走它们意味着不取。根据组合的数学定义,答案为 C(n+4,4)。 + +## 代码 + +```go +package leetcode + +// 解法一 打表 +func countVowelStrings(n int) int { + res := []int{1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001, 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315, 8855, 10626, 12650, 14950, 17550, 20475, 23751, 27405, 31465, 35960, 40920, 46376, 52360, 58905, 66045, 73815, 82251, 91390, 101270, 111930, 123410, 135751, 148995, 163185, 178365, 194580, 211876, 230300, 249900, 270725, 292825, 316251} + return res[n] +} + +func makeTable() []int { + res, array := 0, []int{} + for i := 0; i < 51; i++ { + countVowelStringsDFS(i, 0, []string{}, []string{"a", "e", "i", "o", "u"}, &res) + array = append(array, res) + res = 0 + } + return array +} + +func countVowelStringsDFS(n, index int, cur []string, vowels []string, res *int) { + vowels = vowels[index:] + if len(cur) == n { + (*res)++ + return + } + for i := 0; i < len(vowels); i++ { + cur = append(cur, vowels[i]) + countVowelStringsDFS(n, i, cur, vowels, res) + cur = cur[:len(cur)-1] + } +} + +// 解法二 数学方法 —— 组合 +func countVowelStrings1(n int) int { + return (n + 1) * (n + 2) * (n + 3) * (n + 4) / 24 +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md b/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md index 45aa66a1..5889f65b 100644 --- a/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md +++ b/website/content/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md @@ -98,5 +98,5 @@ func canFormArray(arr []int, pieces [][]int) bool { ---------------------------------------------- diff --git a/website/content/ChapterFour/1641.Count-Sorted-Vowel-Strings.md b/website/content/ChapterFour/1641.Count-Sorted-Vowel-Strings.md new file mode 100644 index 00000000..79480691 --- /dev/null +++ b/website/content/ChapterFour/1641.Count-Sorted-Vowel-Strings.md @@ -0,0 +1,97 @@ +# [1641. Count Sorted Vowel Strings](https://leetcode.com/problems/count-sorted-vowel-strings/) + + +## 题目 + +Given an integer `n`, return *the number of strings of length* `n` *that consist only of vowels (*`a`*,* `e`*,* `i`*,* `o`*,* `u`*) and are **lexicographically sorted**.* + +A string `s` is **lexicographically sorted** if for all valid `i`, `s[i]` is the same as or comes before `s[i+1]` in the alphabet. + +**Example 1:** + +``` +Input: n = 1 +Output: 5 +Explanation: The 5 sorted strings that consist of vowels only are ["a","e","i","o","u"]. +``` + +**Example 2:** + +``` +Input: n = 2 +Output: 15 +Explanation: The 15 sorted strings that consist of vowels only are +["aa","ae","ai","ao","au","ee","ei","eo","eu","ii","io","iu","oo","ou","uu"]. +Note that "ea" is not a valid string since 'e' comes after 'a' in the alphabet. + +``` + +**Example 3:** + +``` +Input: n = 33 +Output: 66045 + +``` + +**Constraints:** + +- `1 <= n <= 50` + +## 题目大意 + +给你一个整数 n,请返回长度为 n 、仅由元音 (a, e, i, o, u) 组成且按 字典序排列 的字符串数量。 + +字符串 s 按 字典序排列 需要满足:对于所有有效的 i,s[i] 在字母表中的位置总是与 s[i+1] 相同或在 s[i+1] 之前。 + +## 解题思路 + +- 题目给的数据量并不大,第一个思路是利用 DFS 遍历打表法。时间复杂度 O(1),空间复杂度 O(1)。 +- 第二个思路是利用数学中的组合公式计算结果。题目等价于假设现在有 n 个字母,要求取 4 次球(可以选择不取)将字母分为 5 堆,问有几种取法。确定了取法以后,`a`,`e`,`i`,`o`,`u`,每个字母的个数就确定了,据题意要求按照字母序排序,那么最终字符串也就确定了。现在关注解决这个组合问题就可以了。把问题再转化一次,等价于,有 n+4 个字母,取 4 次,问有几种取法。+4 代表 4 个空操作,取走它们意味着不取。根据组合的数学定义,答案为 C(n+4,4)。 + +## 代码 + +```go +package leetcode + +// 解法一 打表 +func countVowelStrings(n int) int { + res := []int{1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001, 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315, 8855, 10626, 12650, 14950, 17550, 20475, 23751, 27405, 31465, 35960, 40920, 46376, 52360, 58905, 66045, 73815, 82251, 91390, 101270, 111930, 123410, 135751, 148995, 163185, 178365, 194580, 211876, 230300, 249900, 270725, 292825, 316251} + return res[n] +} + +func makeTable() []int { + res, array := 0, []int{} + for i := 0; i < 51; i++ { + countVowelStringsDFS(i, 0, []string{}, []string{"a", "e", "i", "o", "u"}, &res) + array = append(array, res) + res = 0 + } + return array +} + +func countVowelStringsDFS(n, index int, cur []string, vowels []string, res *int) { + vowels = vowels[index:] + if len(cur) == n { + (*res)++ + return + } + for i := 0; i < len(vowels); i++ { + cur = append(cur, vowels[i]) + countVowelStringsDFS(n, i, cur, vowels, res) + cur = cur[:len(cur)-1] + } +} + +// 解法二 数学方法 —— 组合 +func countVowelStrings1(n int) int { + return (n + 1) * (n + 2) * (n + 3) * (n + 4) / 24 +} +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md b/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md index 9a6f0290..b14b1501 100644 --- a/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md +++ b/website/content/ChapterFour/1646.Get-Maximum-in-Generated-Array.md @@ -98,6 +98,6 @@ func getMaximumGenerated(n int) int { ---------------------------------------------- diff --git a/website/content/ChapterTwo/Array.md b/website/content/ChapterTwo/Array.md index 394e72d8..02480245 100644 --- a/website/content/ChapterTwo/Array.md +++ b/website/content/ChapterTwo/Array.md @@ -18,16 +18,16 @@ type: docs |0033|Search in Rotated Sorted Array|[Go]({{< relref "/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md" >}})|Medium||||35.6%| |0034|Find First and Last Position of Element in Sorted Array|[Go]({{< relref "/ChapterFour/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array.md" >}})|Medium||||37.1%| |0035|Search Insert Position|[Go]({{< relref "/ChapterFour/0035.Search-Insert-Position.md" >}})|Easy||||42.8%| -|0039|Combination Sum|[Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})|Medium| O(n log n)| O(n)||58.7%| +|0039|Combination Sum|[Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})|Medium| O(n log n)| O(n)||58.8%| |0040|Combination Sum II|[Go]({{< relref "/ChapterFour/0040.Combination-Sum-II.md" >}})|Medium| O(n log n)| O(n)||49.8%| |0041|First Missing Positive|[Go]({{< relref "/ChapterFour/0041.First-Missing-Positive.md" >}})|Hard| O(n)| O(n)||33.4%| -|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|50.7%| -|0048|Rotate Image|[Go]({{< relref "/ChapterFour/0048.Rotate-Image.md" >}})|Medium| O(n)| O(1)||59.3%| +|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|50.8%| +|0048|Rotate Image|[Go]({{< relref "/ChapterFour/0048.Rotate-Image.md" >}})|Medium| O(n)| O(1)||59.4%| |0053|Maximum Subarray|[Go]({{< relref "/ChapterFour/0053.Maximum-Subarray.md" >}})|Easy| O(n)| O(n)||47.5%| |0054|Spiral Matrix|[Go]({{< relref "/ChapterFour/0054.Spiral-Matrix.md" >}})|Medium| O(n)| O(n^2)||35.5%| |0055|Jump Game|[Go]({{< relref "/ChapterFour/0055.Jump-Game.md" >}})|Medium||||35.1%| |0056|Merge Intervals|[Go]({{< relref "/ChapterFour/0056.Merge-Intervals.md" >}})|Medium| O(n log n)| O(1)||40.7%| -|0057|Insert Interval|[Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})|Medium| O(n)| O(1)||34.8%| +|0057|Insert Interval|[Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})|Medium| O(n)| O(1)||34.9%| |0059|Spiral Matrix II|[Go]({{< relref "/ChapterFour/0059.Spiral-Matrix-II.md" >}})|Medium| O(n)| O(n^2)||57.4%| |0062|Unique Paths|[Go]({{< relref "/ChapterFour/0062.Unique-Paths.md" >}})|Medium| O(n^2)| O(n^2)||55.6%| |0063|Unique Paths II|[Go]({{< relref "/ChapterFour/0063.Unique-Paths-II.md" >}})|Medium| O(n^2)| O(n^2)||35.1%| @@ -37,25 +37,25 @@ type: docs |0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|48.9%| |0078|Subsets|[Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|64.5%| |0079|Word Search|[Go]({{< relref "/ChapterFour/0079.Word-Search.md" >}})|Medium| O(n^2)| O(n^2)|❤️|36.6%| -|0080|Remove Duplicates from Sorted Array II|[Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})|Medium| O(n)| O(1||45.8%| +|0080|Remove Duplicates from Sorted Array II|[Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})|Medium| O(n)| O(1||45.9%| |0081|Search in Rotated Sorted Array II|[Go]({{< relref "/ChapterFour/0081.Search-in-Rotated-Sorted-Array-II.md" >}})|Medium||||33.5%| |0084|Largest Rectangle in Histogram|[Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}})|Hard| O(n)| O(n)|❤️|36.8%| |0088|Merge Sorted Array|[Go]({{< relref "/ChapterFour/0088.Merge-Sorted-Array.md" >}})|Easy| O(n)| O(1)|❤️|40.6%| |0090|Subsets II|[Go]({{< relref "/ChapterFour/0090.Subsets-II.md" >}})|Medium| O(n^2)| O(n)|❤️|48.5%| |0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| -|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.1%| +|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.2%| |0118|Pascal's Triangle|[Go]({{< relref "/ChapterFour/0118.Pascals-Triangle.md" >}})|Easy||||54.4%| |0120|Triangle|[Go]({{< relref "/ChapterFour/0120.Triangle.md" >}})|Medium| O(n^2)| O(n)||45.5%| -|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||51.2%| -|0122|Best Time to Buy and Sell Stock II|[Go]({{< relref "/ChapterFour/0122.Best-Time-to-Buy-and-Sell-Stock-II.md" >}})|Easy| O(n)| O(1)||58.2%| +|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||51.3%| +|0122|Best Time to Buy and Sell Stock II|[Go]({{< relref "/ChapterFour/0122.Best-Time-to-Buy-and-Sell-Stock-II.md" >}})|Easy| O(n)| O(1)||58.3%| |0126|Word Ladder II|[Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})|Hard| O(n)| O(n^2)|❤️|23.4%| -|0128|Longest Consecutive Sequence|[Go]({{< relref "/ChapterFour/0128.Longest-Consecutive-Sequence.md" >}})|Hard||||46.0%| +|0128|Longest Consecutive Sequence|[Go]({{< relref "/ChapterFour/0128.Longest-Consecutive-Sequence.md" >}})|Hard||||46.1%| |0152|Maximum Product Subarray|[Go]({{< relref "/ChapterFour/0152.Maximum-Product-Subarray.md" >}})|Medium| O(n)| O(1)||32.6%| |0153|Find Minimum in Rotated Sorted Array|[Go]({{< relref "/ChapterFour/0153.Find-Minimum-in-Rotated-Sorted-Array.md" >}})|Medium||||45.9%| |0154|Find Minimum in Rotated Sorted Array II|[Go]({{< relref "/ChapterFour/0154.Find-Minimum-in-Rotated-Sorted-Array-II.md" >}})|Hard||||41.9%| |0162|Find Peak Element|[Go]({{< relref "/ChapterFour/0162.Find-Peak-Element.md" >}})|Medium||||43.8%| |0167|Two Sum II - Input array is sorted|[Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})|Easy| O(n)| O(1)||55.4%| -|0169|Majority Element|[Go]({{< relref "/ChapterFour/0169.Majority-Element.md" >}})|Easy||||59.8%| +|0169|Majority Element|[Go]({{< relref "/ChapterFour/0169.Majority-Element.md" >}})|Easy||||59.9%| |0189|Rotate Array|[Go]({{< relref "/ChapterFour/0189.Rotate-Array.md" >}})|Medium||||36.4%| |0209|Minimum Size Subarray Sum|[Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})|Medium| O(n)| O(1)||39.2%| |0216|Combination Sum III|[Go]({{< relref "/ChapterFour/0216.Combination-Sum-III.md" >}})|Medium| O(n)| O(1)|❤️|59.9%| @@ -65,14 +65,14 @@ type: docs |0229|Majority Element II|[Go]({{< relref "/ChapterFour/0229.Majority-Element-II.md" >}})|Medium||||38.5%| |0268|Missing Number|[Go]({{< relref "/ChapterFour/0268.Missing-Number.md" >}})|Easy||||53.4%| |0283|Move Zeroes|[Go]({{< relref "/ChapterFour/0283.Move-Zeroes.md" >}})|Easy| O(n)| O(1)||58.4%| -|0287|Find the Duplicate Number|[Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})|Medium| O(n)| O(1)|❤️|57.1%| +|0287|Find the Duplicate Number|[Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})|Medium| O(n)| O(1)|❤️|57.2%| |0414|Third Maximum Number|[Go]({{< relref "/ChapterFour/0414.Third-Maximum-Number.md" >}})|Easy||||30.6%| |0448|Find All Numbers Disappeared in an Array|[Go]({{< relref "/ChapterFour/0448.Find-All-Numbers-Disappeared-in-an-Array.md" >}})|Easy||||56.1%| |0457|Circular Array Loop|[Go]({{< relref "/ChapterFour/0457.Circular-Array-Loop.md" >}})|Medium||||30.0%| |0485|Max Consecutive Ones|[Go]({{< relref "/ChapterFour/0485.Max-Consecutive-Ones.md" >}})|Easy||||53.2%| |0509|Fibonacci Number|[Go]({{< relref "/ChapterFour/0509.Fibonacci-Number.md" >}})|Easy||||67.3%| |0532|K-diff Pairs in an Array|[Go]({{< relref "/ChapterFour/0532.K-diff-Pairs-in-an-Array.md" >}})|Medium| O(n)| O(n)||34.9%| -|0561|Array Partition I|[Go]({{< relref "/ChapterFour/0561.Array-Partition-I.md" >}})|Easy||||72.8%| +|0561|Array Partition I|[Go]({{< relref "/ChapterFour/0561.Array-Partition-I.md" >}})|Easy||||72.9%| |0566|Reshape the Matrix|[Go]({{< relref "/ChapterFour/0566.Reshape-the-Matrix.md" >}})|Easy| O(n^2)| O(n^2)||61.0%| |0605|Can Place Flowers|[Go]({{< relref "/ChapterFour/0605.Can-Place-Flowers.md" >}})|Easy||||31.9%| |0628|Maximum Product of Three Numbers|[Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})|Easy| O(n)| O(1)||47.0%| @@ -80,18 +80,18 @@ type: docs |0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| |0697|Degree of an Array|[Go]({{< relref "/ChapterFour/0697.Degree-of-an-Array.md" >}})|Easy||||54.3%| |0713|Subarray Product Less Than K|[Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})|Medium| O(n)| O(1)||40.4%| -|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.8%| +|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.9%| |0717|1-bit and 2-bit Characters|[Go]({{< relref "/ChapterFour/0717.1-bit-and-2-bit-Characters.md" >}})|Easy||||47.6%| |0718|Maximum Length of Repeated Subarray|[Go]({{< relref "/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md" >}})|Medium||||50.1%| -|0719|Find K-th Smallest Pair Distance|[Go]({{< relref "/ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md" >}})|Hard||||32.5%| +|0719|Find K-th Smallest Pair Distance|[Go]({{< relref "/ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md" >}})|Hard||||32.4%| |0724|Find Pivot Index|[Go]({{< relref "/ChapterFour/0724.Find-Pivot-Index.md" >}})|Easy||||45.0%| |0729|My Calendar I|[Go]({{< relref "/ChapterFour/0729.My-Calendar-I.md" >}})|Medium||||53.1%| |0746|Min Cost Climbing Stairs|[Go]({{< relref "/ChapterFour/0746.Min-Cost-Climbing-Stairs.md" >}})|Easy| O(n)| O(1)||50.9%| -|0766|Toeplitz Matrix|[Go]({{< relref "/ChapterFour/0766.Toeplitz-Matrix.md" >}})|Easy| O(n)| O(1)||65.7%| +|0766|Toeplitz Matrix|[Go]({{< relref "/ChapterFour/0766.Toeplitz-Matrix.md" >}})|Easy| O(n)| O(1)||65.8%| |0830|Positions of Large Groups|[Go]({{< relref "/ChapterFour/0830.Positions-of-Large-Groups.md" >}})|Easy||||50.2%| |0832|Flipping an Image|[Go]({{< relref "/ChapterFour/0832.Flipping-an-Image.md" >}})|Easy||||77.9%| |0867|Transpose Matrix|[Go]({{< relref "/ChapterFour/0867.Transpose-Matrix.md" >}})|Easy| O(n)| O(1)||62.2%| -|0888|Fair Candy Swap|[Go]({{< relref "/ChapterFour/0888.Fair-Candy-Swap.md" >}})|Easy||||58.7%| +|0888|Fair Candy Swap|[Go]({{< relref "/ChapterFour/0888.Fair-Candy-Swap.md" >}})|Easy||||58.8%| |0891|Sum of Subsequence Widths|[Go]({{< relref "/ChapterFour/0891.Sum-of-Subsequence-Widths.md" >}})|Hard| O(n log n)| O(1)||32.8%| |0896|Monotonic Array|[Go]({{< relref "/ChapterFour/0896.Monotonic-Array.md" >}})|Easy||||58.0%| |0907|Sum of Subarray Minimums|[Go]({{< relref "/ChapterFour/0907.Sum-of-Subarray-Minimums.md" >}})|Medium| O(n)| O(n)|❤️|33.2%| @@ -105,31 +105,31 @@ type: docs |0999|Available Captures for Rook|[Go]({{< relref "/ChapterFour/0999.Available-Captures-for-Rook.md" >}})|Easy||||66.8%| |1002|Find Common Characters|[Go]({{< relref "/ChapterFour/1002.Find-Common-Characters.md" >}})|Easy||||68.1%| |1011|Capacity To Ship Packages Within D Days|[Go]({{< relref "/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md" >}})|Medium||||59.5%| -|1018|Binary Prefix Divisible By 5|[Go]({{< relref "/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md" >}})|Easy||||47.8%| -|1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium||||54.0%| -|1051|Height Checker|[Go]({{< relref "/ChapterFour/1051.Height-Checker.md" >}})|Easy||||71.9%| -|1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})|Medium||||55.6%| -|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.4%| +|1018|Binary Prefix Divisible By 5|[Go]({{< relref "/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md" >}})|Easy||||47.9%| +|1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium||||53.9%| +|1051|Height Checker|[Go]({{< relref "/ChapterFour/1051.Height-Checker.md" >}})|Easy||||71.8%| +|1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})|Medium||||55.7%| +|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.5%| |1089|Duplicate Zeros|[Go]({{< relref "/ChapterFour/1089.Duplicate-Zeros.md" >}})|Easy||||52.0%| |1122|Relative Sort Array|[Go]({{< relref "/ChapterFour/1122.Relative-Sort-Array.md" >}})|Easy||||67.7%| |1128|Number of Equivalent Domino Pairs|[Go]({{< relref "/ChapterFour/1128.Number-of-Equivalent-Domino-Pairs.md" >}})|Easy||||46.6%| |1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard||||39.5%| |1160|Find Words That Can Be Formed by Characters|[Go]({{< relref "/ChapterFour/1160.Find-Words-That-Can-Be-Formed-by-Characters.md" >}})|Easy||||67.5%| |1170|Compare Strings by Frequency of the Smallest Character|[Go]({{< relref "/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md" >}})|Easy||||59.5%| -|1184|Distance Between Bus Stops|[Go]({{< relref "/ChapterFour/1184.Distance-Between-Bus-Stops.md" >}})|Easy||||54.2%| -|1185|Day of the Week|[Go]({{< relref "/ChapterFour/1185.Day-of-the-Week.md" >}})|Easy||||62.0%| +|1184|Distance Between Bus Stops|[Go]({{< relref "/ChapterFour/1184.Distance-Between-Bus-Stops.md" >}})|Easy||||54.1%| +|1185|Day of the Week|[Go]({{< relref "/ChapterFour/1185.Day-of-the-Week.md" >}})|Easy||||61.9%| |1200|Minimum Absolute Difference|[Go]({{< relref "/ChapterFour/1200.Minimum-Absolute-Difference.md" >}})|Easy||||66.8%| -|1202|Smallest String With Swaps|[Go]({{< relref "/ChapterFour/1202.Smallest-String-With-Swaps.md" >}})|Medium||||48.3%| -|1208|Get Equal Substrings Within Budget|[Go]({{< relref "/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md" >}})|Medium||||43.7%| +|1202|Smallest String With Swaps|[Go]({{< relref "/ChapterFour/1202.Smallest-String-With-Swaps.md" >}})|Medium||||48.4%| +|1208|Get Equal Substrings Within Budget|[Go]({{< relref "/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md" >}})|Medium||||43.6%| |1217|Minimum Cost to Move Chips to The Same Position|[Go]({{< relref "/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md" >}})|Easy||||71.2%| -|1232|Check If It Is a Straight Line|[Go]({{< relref "/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md" >}})|Easy||||43.9%| -|1252|Cells with Odd Values in a Matrix|[Go]({{< relref "/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md" >}})|Easy||||78.5%| +|1232|Check If It Is a Straight Line|[Go]({{< relref "/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md" >}})|Easy||||43.8%| +|1252|Cells with Odd Values in a Matrix|[Go]({{< relref "/ChapterFour/1252.Cells-with-Odd-Values-in-a-Matrix.md" >}})|Easy||||78.6%| |1260|Shift 2D Grid|[Go]({{< relref "/ChapterFour/1260.Shift-2D-Grid.md" >}})|Easy||||61.8%| |1266|Minimum Time Visiting All Points|[Go]({{< relref "/ChapterFour/1266.Minimum-Time-Visiting-All-Points.md" >}})|Easy||||79.3%| |1275|Find Winner on a Tic Tac Toe Game|[Go]({{< relref "/ChapterFour/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md" >}})|Easy||||52.9%| |1287|Element Appearing More Than 25% In Sorted Array|[Go]({{< relref "/ChapterFour/1287.Element-Appearing-More-Than-25-In-Sorted-Array.md" >}})|Easy||||60.2%| -|1295|Find Numbers with Even Number of Digits|[Go]({{< relref "/ChapterFour/1295.Find-Numbers-with-Even-Number-of-Digits.md" >}})|Easy||||79.4%| -|1299|Replace Elements with Greatest Element on Right Side|[Go]({{< relref "/ChapterFour/1299.Replace-Elements-with-Greatest-Element-on-Right-Side.md" >}})|Easy||||74.1%| +|1295|Find Numbers with Even Number of Digits|[Go]({{< relref "/ChapterFour/1295.Find-Numbers-with-Even-Number-of-Digits.md" >}})|Easy||||79.3%| +|1299|Replace Elements with Greatest Element on Right Side|[Go]({{< relref "/ChapterFour/1299.Replace-Elements-with-Greatest-Element-on-Right-Side.md" >}})|Easy||||74.2%| |1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.3%| |1304|Find N Unique Integers Sum up to Zero|[Go]({{< relref "/ChapterFour/1304.Find-N-Unique-Integers-Sum-up-to-Zero.md" >}})|Easy||||76.6%| |1313|Decompress Run-Length Encoded List|[Go]({{< relref "/ChapterFour/1313.Decompress-Run-Length-Encoded-List.md" >}})|Easy||||85.3%| @@ -138,14 +138,14 @@ type: docs |1389|Create Target Array in the Given Order|[Go]({{< relref "/ChapterFour/1389.Create-Target-Array-in-the-Given-Order.md" >}})|Easy||||84.7%| |1464|Maximum Product of Two Elements in an Array|[Go]({{< relref "/ChapterFour/1464.Maximum-Product-of-Two-Elements-in-an-Array.md" >}})|Easy||||76.9%| |1470|Shuffle the Array|[Go]({{< relref "/ChapterFour/1470.Shuffle-the-Array.md" >}})|Easy||||88.5%| -|1480|Running Sum of 1d Array|[Go]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}})|Easy||||89.6%| +|1480|Running Sum of 1d Array|[Go]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}})|Easy||||89.5%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| |1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.3%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.3%| -|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||52.3%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.1%| +|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||53.8%| |1652|Defuse the Bomb|[Go]({{< relref "/ChapterFour/1652.Defuse-the-Bomb.md" >}})|Easy||||64.2%| -|1656|Design an Ordered Stream|[Go]({{< relref "/ChapterFour/1656.Design-an-Ordered-Stream.md" >}})|Easy||||82.5%| -|1672|Richest Customer Wealth|[Go]({{< relref "/ChapterFour/1672.Richest-Customer-Wealth.md" >}})|Easy||||88.6%| +|1656|Design an Ordered Stream|[Go]({{< relref "/ChapterFour/1656.Design-an-Ordered-Stream.md" >}})|Easy||||82.4%| +|1672|Richest Customer Wealth|[Go]({{< relref "/ChapterFour/1672.Richest-Customer-Wealth.md" >}})|Easy||||88.5%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Backtracking.md b/website/content/ChapterTwo/Backtracking.md index 87565235..bb044419 100644 --- a/website/content/ChapterTwo/Backtracking.md +++ b/website/content/ChapterTwo/Backtracking.md @@ -99,14 +99,14 @@ func updateMatrix_BFS(matrix [][]int) [][]int { | No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | -|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium| O(log n)| O(1)||48.6%| +|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium| O(log n)| O(1)||48.7%| |0022|Generate Parentheses|[Go]({{< relref "/ChapterFour/0022.Generate-Parentheses.md" >}})|Medium| O(log n)| O(1)||64.8%| -|0037|Sudoku Solver|[Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})|Hard| O(n^2)| O(n^2)|❤️|45.9%| -|0039|Combination Sum|[Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})|Medium| O(n log n)| O(n)||58.7%| +|0037|Sudoku Solver|[Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})|Hard| O(n^2)| O(n^2)|❤️|46.0%| +|0039|Combination Sum|[Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})|Medium| O(n log n)| O(n)||58.8%| |0040|Combination Sum II|[Go]({{< relref "/ChapterFour/0040.Combination-Sum-II.md" >}})|Medium| O(n log n)| O(n)||49.8%| -|0046|Permutations|[Go]({{< relref "/ChapterFour/0046.Permutations.md" >}})|Medium| O(n)| O(n)|❤️|66.0%| +|0046|Permutations|[Go]({{< relref "/ChapterFour/0046.Permutations.md" >}})|Medium| O(n)| O(n)|❤️|66.1%| |0047|Permutations II|[Go]({{< relref "/ChapterFour/0047.Permutations-II.md" >}})|Medium| O(n^2)| O(n)|❤️|49.0%| -|0051|N-Queens|[Go]({{< relref "/ChapterFour/0051.N-Queens.md" >}})|Hard| O(n^2)| O(n)|❤️|49.0%| +|0051|N-Queens|[Go]({{< relref "/ChapterFour/0051.N-Queens.md" >}})|Hard| O(n^2)| O(n)|❤️|49.1%| |0052|N-Queens II|[Go]({{< relref "/ChapterFour/0052.N-Queens-II.md" >}})|Hard| O(n^2)| O(n)|❤️|59.7%| |0060|Permutation Sequence|[Go]({{< relref "/ChapterFour/0060.Permutation-Sequence.md" >}})|Hard| O(n log n)| O(1)||39.2%| |0077|Combinations|[Go]({{< relref "/ChapterFour/0077.Combinations.md" >}})|Medium| O(n)| O(n)|❤️|56.9%| @@ -116,23 +116,24 @@ func updateMatrix_BFS(matrix [][]int) [][]int { |0090|Subsets II|[Go]({{< relref "/ChapterFour/0090.Subsets-II.md" >}})|Medium| O(n^2)| O(n)|❤️|48.5%| |0093|Restore IP Addresses|[Go]({{< relref "/ChapterFour/0093.Restore-IP-Addresses.md" >}})|Medium| O(n)| O(n)|❤️|37.2%| |0126|Word Ladder II|[Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})|Hard| O(n)| O(n^2)|❤️|23.4%| -|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})|Medium| O(n)| O(n^2)|❤️|51.3%| +|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})|Medium| O(n)| O(n^2)|❤️|51.4%| |0211|Design Add and Search Words Data Structure|[Go]({{< relref "/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md" >}})|Medium| O(n)| O(n)|❤️|39.8%| -|0212|Word Search II|[Go]({{< relref "/ChapterFour/0212.Word-Search-II.md" >}})|Hard| O(n^2)| O(n^2)|❤️|36.5%| +|0212|Word Search II|[Go]({{< relref "/ChapterFour/0212.Word-Search-II.md" >}})|Hard| O(n^2)| O(n^2)|❤️|36.6%| |0216|Combination Sum III|[Go]({{< relref "/ChapterFour/0216.Combination-Sum-III.md" >}})|Medium| O(n)| O(1)|❤️|59.9%| |0306|Additive Number|[Go]({{< relref "/ChapterFour/0306.Additive-Number.md" >}})|Medium| O(n^2)| O(1)|❤️|29.6%| -|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.7%| +|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.8%| |0401|Binary Watch|[Go]({{< relref "/ChapterFour/0401.Binary-Watch.md" >}})|Easy| O(1)| O(1)||48.3%| |0526|Beautiful Arrangement|[Go]({{< relref "/ChapterFour/0526.Beautiful-Arrangement.md" >}})|Medium| O(n^2)| O(1)|❤️|61.7%| |0784|Letter Case Permutation|[Go]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}})|Medium| O(n)| O(n)||66.2%| |0842|Split Array into Fibonacci Sequence|[Go]({{< relref "/ChapterFour/0842.Split-Array-into-Fibonacci-Sequence.md" >}})|Medium| O(n^2)| O(1)|❤️|36.7%| -|0980|Unique Paths III|[Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})|Hard| O(n log n)| O(n)||77.1%| +|0980|Unique Paths III|[Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})|Hard| O(n log n)| O(n)||77.2%| |0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.0%| |1079|Letter Tile Possibilities|[Go]({{< relref "/ChapterFour/1079.Letter-Tile-Possibilities.md" >}})|Medium| O(n^2)| O(1)|❤️|75.8%| -|1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.7%| -|1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.2%| +|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.6%| +|1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.5%| +|1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.1%| |1681|Minimum Incompatibility|[Go]({{< relref "/ChapterFour/1681.Minimum-Incompatibility.md" >}})|Hard||||35.0%| -|1688|Count of Matches in Tournament|[Go]({{< relref "/ChapterFour/1688.Count-of-Matches-in-Tournament.md" >}})|Easy||||83.2%| +|1688|Count of Matches in Tournament|[Go]({{< relref "/ChapterFour/1688.Count-of-Matches-in-Tournament.md" >}})|Easy||||83.1%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Binary_Search.md b/website/content/ChapterTwo/Binary_Search.md index 30aa8513..d02f81bc 100644 --- a/website/content/ChapterTwo/Binary_Search.md +++ b/website/content/ChapterTwo/Binary_Search.md @@ -143,13 +143,13 @@ func peakIndexInMountainArray(A []int) int { |0154|Find Minimum in Rotated Sorted Array II|[Go]({{< relref "/ChapterFour/0154.Find-Minimum-in-Rotated-Sorted-Array-II.md" >}})|Hard||||41.9%| |0162|Find Peak Element|[Go]({{< relref "/ChapterFour/0162.Find-Peak-Element.md" >}})|Medium||||43.8%| |0167|Two Sum II - Input array is sorted|[Go]({{< relref "/ChapterFour/0167.Two-Sum-II---Input-array-is-sorted.md" >}})|Easy| O(n)| O(1)||55.4%| -|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0174.Dungeon-Game.md" >}})|Hard||||33.1%| +|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0174.Dungeon-Game.md" >}})|Hard||||33.2%| |0209|Minimum Size Subarray Sum|[Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})|Medium| O(n)| O(1)||39.2%| |0222|Count Complete Tree Nodes|[Go]({{< relref "/ChapterFour/0222.Count-Complete-Tree-Nodes.md" >}})|Medium| O(n)| O(1)||48.8%| -|0230|Kth Smallest Element in a BST|[Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})|Medium| O(n)| O(1)||62.1%| -|0240|Search a 2D Matrix II|[Go]({{< relref "/ChapterFour/0240.Search-a-2D-Matrix-II.md" >}})|Medium||||44.1%| +|0230|Kth Smallest Element in a BST|[Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})|Medium| O(n)| O(1)||62.2%| +|0240|Search a 2D Matrix II|[Go]({{< relref "/ChapterFour/0240.Search-a-2D-Matrix-II.md" >}})|Medium||||44.2%| |0275|H-Index II|[Go]({{< relref "/ChapterFour/0275.H-Index-II.md" >}})|Medium||||36.2%| -|0287|Find the Duplicate Number|[Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})|Medium| O(n)| O(1)|❤️|57.1%| +|0287|Find the Duplicate Number|[Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})|Medium| O(n)| O(1)|❤️|57.2%| |0300|Longest Increasing Subsequence|[Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})|Medium| O(n log n)| O(n)||43.6%| |0315|Count of Smaller Numbers After Self|[Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})|Hard||||42.6%| |0327|Count of Range Sum|[Go]({{< relref "/ChapterFour/0327.Count-of-Range-Sum.md" >}})|Hard||||35.9%| @@ -157,7 +157,7 @@ func peakIndexInMountainArray(A []int) int { |0350|Intersection of Two Arrays II|[Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})|Easy| O(n)| O(n) ||51.9%| |0354|Russian Doll Envelopes|[Go]({{< relref "/ChapterFour/0354.Russian-Doll-Envelopes.md" >}})|Hard||||36.1%| |0367|Valid Perfect Square|[Go]({{< relref "/ChapterFour/0367.Valid-Perfect-Square.md" >}})|Easy||||42.0%| -|0378|Kth Smallest Element in a Sorted Matrix|[Go]({{< relref "/ChapterFour/0378.Kth-Smallest-Element-in-a-Sorted-Matrix.md" >}})|Medium||||55.8%| +|0378|Kth Smallest Element in a Sorted Matrix|[Go]({{< relref "/ChapterFour/0378.Kth-Smallest-Element-in-a-Sorted-Matrix.md" >}})|Medium||||55.9%| |0392|Is Subsequence|[Go]({{< relref "/ChapterFour/0392.Is-Subsequence.md" >}})|Easy| O(n)| O(1)||49.5%| |0410|Split Array Largest Sum|[Go]({{< relref "/ChapterFour/0410.Split-Array-Largest-Sum.md" >}})|Hard||||46.1%| |0436|Find Right Interval|[Go]({{< relref "/ChapterFour/0436.Find-Right-Interval.md" >}})|Medium||||48.4%| @@ -168,15 +168,15 @@ func peakIndexInMountainArray(A []int) int { |0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})|Hard||||26.6%| |0497|Random Point in Non-overlapping Rectangles|[Go]({{< relref "/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md" >}})|Medium||||39.1%| |0528|Random Pick with Weight|[Go]({{< relref "/ChapterFour/0528.Random-Pick-with-Weight.md" >}})|Medium||||44.5%| -|0658|Find K Closest Elements|[Go]({{< relref "/ChapterFour/0658.Find-K-Closest-Elements.md" >}})|Medium||||41.7%| -|0668|Kth Smallest Number in Multiplication Table|[Go]({{< relref "/ChapterFour/0668.Kth-Smallest-Number-in-Multiplication-Table.md" >}})|Hard||||47.6%| +|0658|Find K Closest Elements|[Go]({{< relref "/ChapterFour/0658.Find-K-Closest-Elements.md" >}})|Medium||||41.8%| +|0668|Kth Smallest Number in Multiplication Table|[Go]({{< relref "/ChapterFour/0668.Kth-Smallest-Number-in-Multiplication-Table.md" >}})|Hard||||47.7%| |0704|Binary Search|[Go]({{< relref "/ChapterFour/0704.Binary-Search.md" >}})|Easy||||54.0%| |0710|Random Pick with Blacklist|[Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})|Hard| O(n)| O(n) ||32.7%| |0718|Maximum Length of Repeated Subarray|[Go]({{< relref "/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md" >}})|Medium||||50.1%| -|0719|Find K-th Smallest Pair Distance|[Go]({{< relref "/ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md" >}})|Hard||||32.5%| +|0719|Find K-th Smallest Pair Distance|[Go]({{< relref "/ChapterFour/0719.Find-K-th-Smallest-Pair-Distance.md" >}})|Hard||||32.4%| |0744|Find Smallest Letter Greater Than Target|[Go]({{< relref "/ChapterFour/0744.Find-Smallest-Letter-Greater-Than-Target.md" >}})|Easy||||45.6%| |0778|Swim in Rising Water|[Go]({{< relref "/ChapterFour/0778.Swim-in-Rising-Water.md" >}})|Hard||||54.4%| -|0786|K-th Smallest Prime Fraction|[Go]({{< relref "/ChapterFour/0786.K-th-Smallest-Prime-Fraction.md" >}})|Hard||||41.7%| +|0786|K-th Smallest Prime Fraction|[Go]({{< relref "/ChapterFour/0786.K-th-Smallest-Prime-Fraction.md" >}})|Hard||||41.8%| |0793|Preimage Size of Factorial Zeroes Function|[Go]({{< relref "/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md" >}})|Hard||||40.6%| |0852|Peak Index in a Mountain Array|[Go]({{< relref "/ChapterFour/0852.Peak-Index-in-a-Mountain-Array.md" >}})|Easy||||71.8%| |0862|Shortest Subarray with Sum at Least K|[Go]({{< relref "/ChapterFour/0862.Shortest-Subarray-with-Sum-at-Least-K.md" >}})|Hard||||25.1%| @@ -185,7 +185,7 @@ func peakIndexInMountainArray(A []int) int { |0887|Super Egg Drop|[Go]({{< relref "/ChapterFour/0887.Super-Egg-Drop.md" >}})|Hard||||27.0%| |0911|Online Election|[Go]({{< relref "/ChapterFour/0911.Online-Election.md" >}})|Medium||||51.2%| |0927|Three Equal Parts|[Go]({{< relref "/ChapterFour/0927.Three-Equal-Parts.md" >}})|Hard||||34.5%| -|0981|Time Based Key-Value Store|[Go]({{< relref "/ChapterFour/0981.Time-Based-Key-Value-Store.md" >}})|Medium||||53.9%| +|0981|Time Based Key-Value Store|[Go]({{< relref "/ChapterFour/0981.Time-Based-Key-Value-Store.md" >}})|Medium||||54.0%| |1011|Capacity To Ship Packages Within D Days|[Go]({{< relref "/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md" >}})|Medium||||59.5%| |1111|Maximum Nesting Depth of Two Valid Parentheses Strings|[Go]({{< relref "/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md" >}})|Medium||||72.4%| |1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard||||39.5%| @@ -194,7 +194,7 @@ func peakIndexInMountainArray(A []int) int { |1283|Find the Smallest Divisor Given a Threshold|[Go]({{< relref "/ChapterFour/1283.Find-the-Smallest-Divisor-Given-a-Threshold.md" >}})|Medium||||49.2%| |1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.3%| |1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| -|1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.6%| +|1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.4%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Bit_Manipulation.md b/website/content/ChapterTwo/Bit_Manipulation.md index e4298d6f..aba365bf 100644 --- a/website/content/ChapterTwo/Bit_Manipulation.md +++ b/website/content/ChapterTwo/Bit_Manipulation.md @@ -46,15 +46,15 @@ X & ~X = 0 |0078|Subsets|[Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|64.5%| |0136|Single Number|[Go]({{< relref "/ChapterFour/0136.Single-Number.md" >}})|Easy| O(n)| O(1)||66.4%| |0137|Single Number II|[Go]({{< relref "/ChapterFour/0137.Single-Number-II.md" >}})|Medium| O(n)| O(1)|❤️|53.5%| -|0169|Majority Element|[Go]({{< relref "/ChapterFour/0169.Majority-Element.md" >}})|Easy| O(n)| O(1)|❤️|59.8%| +|0169|Majority Element|[Go]({{< relref "/ChapterFour/0169.Majority-Element.md" >}})|Easy| O(n)| O(1)|❤️|59.9%| |0187|Repeated DNA Sequences|[Go]({{< relref "/ChapterFour/0187.Repeated-DNA-Sequences.md" >}})|Medium| O(n)| O(1)||41.2%| -|0190|Reverse Bits|[Go]({{< relref "/ChapterFour/0190.Reverse-Bits.md" >}})|Easy| O(n)| O(1)|❤️|41.6%| +|0190|Reverse Bits|[Go]({{< relref "/ChapterFour/0190.Reverse-Bits.md" >}})|Easy| O(n)| O(1)|❤️|41.7%| |0191|Number of 1 Bits|[Go]({{< relref "/ChapterFour/0191.Number-of-1-Bits.md" >}})|Easy| O(n)| O(1)||51.9%| |0201|Bitwise AND of Numbers Range|[Go]({{< relref "/ChapterFour/0201.Bitwise-AND-of-Numbers-Range.md" >}})|Medium| O(n)| O(1)|❤️|39.6%| |0231|Power of Two|[Go]({{< relref "/ChapterFour/0231.Power-of-Two.md" >}})|Easy| O(1)| O(1)||43.8%| |0260|Single Number III|[Go]({{< relref "/ChapterFour/0260.Single-Number-III.md" >}})|Medium| O(n)| O(1)|❤️|65.2%| |0268|Missing Number|[Go]({{< relref "/ChapterFour/0268.Missing-Number.md" >}})|Easy| O(n)| O(1)||53.4%| -|0318|Maximum Product of Word Lengths|[Go]({{< relref "/ChapterFour/0318.Maximum-Product-of-Word-Lengths.md" >}})|Medium| O(n)| O(1)||52.0%| +|0318|Maximum Product of Word Lengths|[Go]({{< relref "/ChapterFour/0318.Maximum-Product-of-Word-Lengths.md" >}})|Medium| O(n)| O(1)||52.1%| |0338|Counting Bits|[Go]({{< relref "/ChapterFour/0338.Counting-Bits.md" >}})|Medium| O(n)| O(n)||70.2%| |0342|Power of Four|[Go]({{< relref "/ChapterFour/0342.Power-of-Four.md" >}})|Easy| O(n)| O(1)||41.6%| |0371|Sum of Two Integers|[Go]({{< relref "/ChapterFour/0371.Sum-of-Two-Integers.md" >}})|Medium| O(n)| O(1)||50.6%| @@ -72,7 +72,7 @@ X & ~X = 0 |0762|Prime Number of Set Bits in Binary Representation|[Go]({{< relref "/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md" >}})|Easy| O(n)| O(1)||64.1%| |0784|Letter Case Permutation|[Go]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}})|Medium| O(n)| O(1)||66.2%| |0898|Bitwise ORs of Subarrays|[Go]({{< relref "/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md" >}})|Medium| O(n)| O(1)||34.0%| -|1290|Convert Binary Number in a Linked List to Integer|[Go]({{< relref "/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md" >}})|Easy||||81.6%| +|1290|Convert Binary Number in a Linked List to Integer|[Go]({{< relref "/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md" >}})|Easy||||81.7%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Breadth_First_Search.md b/website/content/ChapterTwo/Breadth_First_Search.md index 57254d40..7c6033a6 100644 --- a/website/content/ChapterTwo/Breadth_First_Search.md +++ b/website/content/ChapterTwo/Breadth_First_Search.md @@ -11,7 +11,7 @@ type: docs |0101|Symmetric Tree|[Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})|Easy| O(n)| O(1)||47.9%| |0102|Binary Tree Level Order Traversal|[Go]({{< relref "/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md" >}})|Medium| O(n)| O(1)||56.2%| |0103|Binary Tree Zigzag Level Order Traversal|[Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})|Medium| O(n)| O(n)||49.8%| -|0107|Binary Tree Level Order Traversal II|[Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})|Easy| O(n)| O(1)||54.8%| +|0107|Binary Tree Level Order Traversal II|[Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})|Easy| O(n)| O(1)||54.9%| |0111|Minimum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||39.2%| |0126|Word Ladder II|[Go]({{< relref "/ChapterFour/0126.Word-Ladder-II.md" >}})|Hard| O(n)| O(n^2)|❤️|23.4%| |0127|Word Ladder|[Go]({{< relref "/ChapterFour/0127.Word-Ladder.md" >}})|Hard| O(n)| O(n)||31.5%| @@ -19,7 +19,7 @@ type: docs |0199|Binary Tree Right Side View|[Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})|Medium| O(n)| O(1)||55.7%| |0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})|Medium| O(n^2)| O(n^2)||48.6%| |0207|Course Schedule|[Go]({{< relref "/ChapterFour/0207.Course-Schedule.md" >}})|Medium| O(n^2)| O(n^2)||44.2%| -|0210|Course Schedule II|[Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})|Medium| O(n^2)| O(n^2)||42.2%| +|0210|Course Schedule II|[Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})|Medium| O(n^2)| O(n^2)||42.3%| |0513|Find Bottom Left Tree Value|[Go]({{< relref "/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md" >}})|Medium||||62.3%| |0515|Find Largest Value in Each Tree Row|[Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})|Medium| O(n)| O(n)||62.0%| |0529|Minesweeper|[Go]({{< relref "/ChapterFour/0529.Minesweeper.md" >}})|Medium||||60.7%| @@ -29,8 +29,8 @@ type: docs |0863|All Nodes Distance K in Binary Tree|[Go]({{< relref "/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}})|Medium||||57.5%| |0864|Shortest Path to Get All Keys|[Go]({{< relref "/ChapterFour/0864.Shortest-Path-to-Get-All-Keys.md" >}})|Hard||||41.5%| |0993|Cousins in Binary Tree|[Go]({{< relref "/ChapterFour/0993.Cousins-in-Binary-Tree.md" >}})|Easy| O(n)| O(1)||52.2%| -|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.6%| -|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.4%| +|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.5%| +|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.3%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Depth_First_Search.md b/website/content/ChapterTwo/Depth_First_Search.md index a9496644..dfcc5865 100644 --- a/website/content/ChapterTwo/Depth_First_Search.md +++ b/website/content/ChapterTwo/Depth_First_Search.md @@ -8,36 +8,36 @@ type: docs | No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | -|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium||||48.6%| +|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium||||48.7%| |0098|Validate Binary Search Tree|[Go]({{< relref "/ChapterFour/0098.Validate-Binary-Search-Tree.md" >}})|Medium| O(n)| O(1)||28.6%| -|0099|Recover Binary Search Tree|[Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}})|Hard| O(n)| O(1)||42.1%| +|0099|Recover Binary Search Tree|[Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}})|Hard| O(n)| O(1)||42.2%| |0100|Same Tree|[Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}})|Easy| O(n)| O(1)||54.0%| |0101|Symmetric Tree|[Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})|Easy| O(n)| O(1)||47.9%| |0104|Maximum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||67.7%| |0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| -|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.1%| -|0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||59.9%| +|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.2%| +|0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||60.0%| |0109|Convert Sorted List to Binary Search Tree|[Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})|Medium| O(log n)| O(n)||49.8%| |0110|Balanced Binary Tree|[Go]({{< relref "/ChapterFour/0110.Balanced-Binary-Tree.md" >}})|Easy| O(n)| O(1)||44.6%| |0111|Minimum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||39.2%| |0112|Path Sum|[Go]({{< relref "/ChapterFour/0112.Path-Sum.md" >}})|Easy| O(n)| O(1)||42.1%| -|0113|Path Sum II|[Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}})|Medium| O(n)| O(1)||48.6%| -|0114|Flatten Binary Tree to Linked List|[Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})|Medium| O(n)| O(1)||51.4%| -|0124|Binary Tree Maximum Path Sum|[Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}})|Hard| O(n)| O(1)||35.2%| +|0113|Path Sum II|[Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}})|Medium| O(n)| O(1)||48.7%| +|0114|Flatten Binary Tree to Linked List|[Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})|Medium| O(n)| O(1)||51.5%| +|0124|Binary Tree Maximum Path Sum|[Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}})|Hard| O(n)| O(1)||35.3%| |0129|Sum Root to Leaf Numbers|[Go]({{< relref "/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md" >}})|Medium| O(n)| O(1)||50.6%| |0130|Surrounded Regions|[Go]({{< relref "/ChapterFour/0130.Surrounded-Regions.md" >}})|Medium||||29.2%| -|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})|Medium||||51.3%| +|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})|Medium||||51.4%| |0199|Binary Tree Right Side View|[Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})|Medium| O(n)| O(1)||55.7%| |0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})|Medium| O(n^2)| O(n^2)||48.6%| |0207|Course Schedule|[Go]({{< relref "/ChapterFour/0207.Course-Schedule.md" >}})|Medium| O(n^2)| O(n^2)||44.2%| -|0210|Course Schedule II|[Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})|Medium| O(n^2)| O(n^2)||42.2%| +|0210|Course Schedule II|[Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})|Medium| O(n^2)| O(n^2)||42.3%| |0211|Design Add and Search Words Data Structure|[Go]({{< relref "/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md" >}})|Medium||||39.8%| |0257|Binary Tree Paths|[Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})|Easy| O(n)| O(1)||53.2%| |0329|Longest Increasing Path in a Matrix|[Go]({{< relref "/ChapterFour/0329.Longest-Increasing-Path-in-a-Matrix.md" >}})|Hard||||44.4%| |0337|House Robber III|[Go]({{< relref "/ChapterFour/0337.House-Robber-III.md" >}})|Medium||||51.7%| -|0394|Decode String|[Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})|Medium| O(n)| O(n)||52.3%| +|0394|Decode String|[Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})|Medium| O(n)| O(n)||52.4%| |0491|Increasing Subsequences|[Go]({{< relref "/ChapterFour/0491.Increasing-Subsequences.md" >}})|Medium||||47.3%| -|0494|Target Sum|[Go]({{< relref "/ChapterFour/0494.Target-Sum.md" >}})|Medium||||45.9%| +|0494|Target Sum|[Go]({{< relref "/ChapterFour/0494.Target-Sum.md" >}})|Medium||||45.8%| |0513|Find Bottom Left Tree Value|[Go]({{< relref "/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md" >}})|Medium||||62.3%| |0515|Find Largest Value in Each Tree Row|[Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})|Medium| O(n)| O(n)||62.0%| |0526|Beautiful Arrangement|[Go]({{< relref "/ChapterFour/0526.Beautiful-Arrangement.md" >}})|Medium||||61.7%| @@ -45,7 +45,7 @@ type: docs |0542|01 Matrix|[Go]({{< relref "/ChapterFour/0542.01-Matrix.md" >}})|Medium| O(n)| O(1)||40.6%| |0547|Number of Provinces|[Go]({{< relref "/ChapterFour/0547.Number-of-Provinces.md" >}})|Medium||||60.1%| |0563|Binary Tree Tilt|[Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}})|Easy||||52.6%| -|0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.5%| +|0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.6%| |0685|Redundant Connection II|[Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})|Hard||||32.9%| |0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| |0721|Accounts Merge|[Go]({{< relref "/ChapterFour/0721.Accounts-Merge.md" >}})|Medium||||51.2%| @@ -56,7 +56,7 @@ type: docs |0785|Is Graph Bipartite?|[Go]({{< relref "/ChapterFour/0785.Is-Graph-Bipartite.md" >}})|Medium||||48.2%| |0802|Find Eventual Safe States|[Go]({{< relref "/ChapterFour/0802.Find-Eventual-Safe-States.md" >}})|Medium||||49.7%| |0834|Sum of Distances in Tree|[Go]({{< relref "/ChapterFour/0834.Sum-of-Distances-in-Tree.md" >}})|Hard||||45.5%| -|0839|Similar String Groups|[Go]({{< relref "/ChapterFour/0839.Similar-String-Groups.md" >}})|Hard||||40.0%| +|0839|Similar String Groups|[Go]({{< relref "/ChapterFour/0839.Similar-String-Groups.md" >}})|Hard||||40.1%| |0841|Keys and Rooms|[Go]({{< relref "/ChapterFour/0841.Keys-and-Rooms.md" >}})|Medium||||65.2%| |0851|Loud and Rich|[Go]({{< relref "/ChapterFour/0851.Loud-and-Rich.md" >}})|Medium||||52.4%| |0863|All Nodes Distance K in Binary Tree|[Go]({{< relref "/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}})|Medium||||57.5%| @@ -65,23 +65,23 @@ type: docs |0924|Minimize Malware Spread|[Go]({{< relref "/ChapterFour/0924.Minimize-Malware-Spread.md" >}})|Hard||||41.8%| |0928|Minimize Malware Spread II|[Go]({{< relref "/ChapterFour/0928.Minimize-Malware-Spread-II.md" >}})|Hard||||41.2%| |0947|Most Stones Removed with Same Row or Column|[Go]({{< relref "/ChapterFour/0947.Most-Stones-Removed-with-Same-Row-or-Column.md" >}})|Medium||||55.4%| -|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0959.Regions-Cut-By-Slashes.md" >}})|Medium||||66.8%| +|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0959.Regions-Cut-By-Slashes.md" >}})|Medium||||66.9%| |0968|Binary Tree Cameras|[Go]({{< relref "/ChapterFour/0968.Binary-Tree-Cameras.md" >}})|Hard||||38.5%| |0979|Distribute Coins in Binary Tree|[Go]({{< relref "/ChapterFour/0979.Distribute-Coins-in-Binary-Tree.md" >}})|Medium||||69.5%| -|0980|Unique Paths III|[Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})|Hard| O(n log n)| O(n)||77.1%| +|0980|Unique Paths III|[Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})|Hard| O(n log n)| O(n)||77.2%| |1020|Number of Enclaves|[Go]({{< relref "/ChapterFour/1020.Number-of-Enclaves.md" >}})|Medium||||58.7%| -|1026|Maximum Difference Between Node and Ancestor|[Go]({{< relref "/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}})|Medium||||69.1%| +|1026|Maximum Difference Between Node and Ancestor|[Go]({{< relref "/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}})|Medium||||69.2%| |1028|Recover a Tree From Preorder Traversal|[Go]({{< relref "/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md" >}})|Hard||||70.7%| -|1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||67.5%| +|1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||67.6%| |1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||67.8%| |1145|Binary Tree Coloring Game|[Go]({{< relref "/ChapterFour/1145.Binary-Tree-Coloring-Game.md" >}})|Medium||||51.4%| |1254|Number of Closed Islands|[Go]({{< relref "/ChapterFour/1254.Number-of-Closed-Islands.md" >}})|Medium||||61.5%| |1302|Deepest Leaves Sum|[Go]({{< relref "/ChapterFour/1302.Deepest-Leaves-Sum.md" >}})|Medium||||84.1%| -|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.6%| -|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| +|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.5%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + ----------------------------------------------

⬅️上一页

diff --git a/website/content/ChapterTwo/Dynamic_Programming.md b/website/content/ChapterTwo/Dynamic_Programming.md index 95aa17e6..09487701 100644 --- a/website/content/ChapterTwo/Dynamic_Programming.md +++ b/website/content/ChapterTwo/Dynamic_Programming.md @@ -8,7 +8,7 @@ type: docs | No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | -|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard||||50.7%| +|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard||||50.8%| |0053|Maximum Subarray|[Go]({{< relref "/ChapterFour/0053.Maximum-Subarray.md" >}})|Easy| O(n)| O(n)||47.5%| |0062|Unique Paths|[Go]({{< relref "/ChapterFour/0062.Unique-Paths.md" >}})|Medium| O(n^2)| O(n^2)||55.6%| |0063|Unique Paths II|[Go]({{< relref "/ChapterFour/0063.Unique-Paths-II.md" >}})|Medium| O(n^2)| O(n^2)||35.1%| @@ -16,30 +16,30 @@ type: docs |0070|Climbing Stairs|[Go]({{< relref "/ChapterFour/0070.Climbing-Stairs.md" >}})|Easy| O(n)| O(n)||48.5%| |0091|Decode Ways|[Go]({{< relref "/ChapterFour/0091.Decode-Ways.md" >}})|Medium| O(n)| O(n)||26.2%| |0095|Unique Binary Search Trees II|[Go]({{< relref "/ChapterFour/0095.Unique-Binary-Search-Trees-II.md" >}})|Medium||||42.1%| -|0096|Unique Binary Search Trees|[Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}})|Medium| O(n)| O(n)||54.1%| +|0096|Unique Binary Search Trees|[Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}})|Medium| O(n)| O(n)||54.2%| |0120|Triangle|[Go]({{< relref "/ChapterFour/0120.Triangle.md" >}})|Medium| O(n^2)| O(n)||45.5%| -|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||51.2%| -|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})|Medium||||51.3%| +|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||51.3%| +|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0131.Palindrome-Partitioning.md" >}})|Medium||||51.4%| |0152|Maximum Product Subarray|[Go]({{< relref "/ChapterFour/0152.Maximum-Product-Subarray.md" >}})|Medium| O(n)| O(1)||32.6%| -|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0174.Dungeon-Game.md" >}})|Hard||||33.1%| +|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0174.Dungeon-Game.md" >}})|Hard||||33.2%| |0198|House Robber|[Go]({{< relref "/ChapterFour/0198.House-Robber.md" >}})|Medium| O(n)| O(n)||42.7%| |0213|House Robber II|[Go]({{< relref "/ChapterFour/0213.House-Robber-II.md" >}})|Medium| O(n)| O(n)||37.4%| |0300|Longest Increasing Subsequence|[Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})|Medium| O(n log n)| O(n)||43.6%| -|0303|Range Sum Query - Immutable|[Go]({{< relref "/ChapterFour/0303.Range-Sum-Query---Immutable.md" >}})|Easy||||47.0%| +|0303|Range Sum Query - Immutable|[Go]({{< relref "/ChapterFour/0303.Range-Sum-Query---Immutable.md" >}})|Easy||||47.1%| |0309|Best Time to Buy and Sell Stock with Cooldown|[Go]({{< relref "/ChapterFour/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md" >}})|Medium| O(n)| O(n)||48.0%| |0322|Coin Change|[Go]({{< relref "/ChapterFour/0322.Coin-Change.md" >}})|Medium| O(n)| O(n)||36.9%| |0337|House Robber III|[Go]({{< relref "/ChapterFour/0337.House-Robber-III.md" >}})|Medium||||51.7%| |0338|Counting Bits|[Go]({{< relref "/ChapterFour/0338.Counting-Bits.md" >}})|Medium| O(n)| O(n)||70.2%| -|0343|Integer Break|[Go]({{< relref "/ChapterFour/0343.Integer-Break.md" >}})|Medium| O(n^2)| O(n)||51.0%| +|0343|Integer Break|[Go]({{< relref "/ChapterFour/0343.Integer-Break.md" >}})|Medium| O(n^2)| O(n)||51.1%| |0354|Russian Doll Envelopes|[Go]({{< relref "/ChapterFour/0354.Russian-Doll-Envelopes.md" >}})|Hard||||36.1%| -|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.7%| +|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.8%| |0392|Is Subsequence|[Go]({{< relref "/ChapterFour/0392.Is-Subsequence.md" >}})|Easy| O(n)| O(1)||49.5%| |0410|Split Array Largest Sum|[Go]({{< relref "/ChapterFour/0410.Split-Array-Largest-Sum.md" >}})|Hard||||46.1%| |0416|Partition Equal Subset Sum|[Go]({{< relref "/ChapterFour/0416.Partition-Equal-Subset-Sum.md" >}})|Medium| O(n^2)| O(n)||44.7%| |0474|Ones and Zeroes|[Go]({{< relref "/ChapterFour/0474.Ones-and-Zeroes.md" >}})|Medium||||43.4%| -|0494|Target Sum|[Go]({{< relref "/ChapterFour/0494.Target-Sum.md" >}})|Medium||||45.9%| -|0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.5%| -|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.8%| +|0494|Target Sum|[Go]({{< relref "/ChapterFour/0494.Target-Sum.md" >}})|Medium||||45.8%| +|0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.6%| +|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.9%| |0718|Maximum Length of Repeated Subarray|[Go]({{< relref "/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md" >}})|Medium||||50.1%| |0746|Min Cost Climbing Stairs|[Go]({{< relref "/ChapterFour/0746.Min-Cost-Climbing-Stairs.md" >}})|Easy| O(n)| O(1)||50.9%| |0838|Push Dominoes|[Go]({{< relref "/ChapterFour/0838.Push-Dominoes.md" >}})|Medium| O(n)| O(n)||49.7%| @@ -50,14 +50,15 @@ type: docs |0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0978.Longest-Turbulent-Subarray.md" >}})|Medium||||46.6%| |1025|Divisor Game|[Go]({{< relref "/ChapterFour/1025.Divisor-Game.md" >}})|Easy| O(1)| O(1)||66.1%| |1049|Last Stone Weight II|[Go]({{< relref "/ChapterFour/1049.Last-Stone-Weight-II.md" >}})|Medium||||45.0%| -|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.4%| +|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.5%| |1105|Filling Bookcase Shelves|[Go]({{< relref "/ChapterFour/1105.Filling-Bookcase-Shelves.md" >}})|Medium||||57.7%| |1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| -|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.4%| -|1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.7%| -|1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.2%| +|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.6%| +|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.3%| +|1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.5%| +|1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.1%| |1664|Ways to Make a Fair Array|[Go]({{< relref "/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md" >}})|Medium||||60.6%| -|1690|Stone Game VII|[Go]({{< relref "/ChapterFour/1690.Stone-Game-VII.md" >}})|Medium||||46.5%| +|1690|Stone Game VII|[Go]({{< relref "/ChapterFour/1690.Stone-Game-VII.md" >}})|Medium||||46.6%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Hash_Table.md b/website/content/ChapterTwo/Hash_Table.md index d2b6dbc6..6ba97ff6 100644 --- a/website/content/ChapterTwo/Hash_Table.md +++ b/website/content/ChapterTwo/Hash_Table.md @@ -13,7 +13,7 @@ type: docs |0018|4Sum|[Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})|Medium| O(n^3)| O(n^2)|❤️|34.6%| |0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.0%| |0036|Valid Sudoku|[Go]({{< relref "/ChapterFour/0036.Valid-Sudoku.md" >}})|Medium| O(n^2)| O(n^2)||50.2%| -|0037|Sudoku Solver|[Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})|Hard| O(n^2)| O(n^2)|❤️|45.9%| +|0037|Sudoku Solver|[Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})|Hard| O(n^2)| O(n^2)|❤️|46.0%| |0049|Group Anagrams|[Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})|Medium| O(n log n)| O(n)||58.8%| |0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|35.7%| |0094|Binary Tree Inorder Traversal|[Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})|Medium| O(n)| O(1)||65.4%| @@ -21,12 +21,12 @@ type: docs |0187|Repeated DNA Sequences|[Go]({{< relref "/ChapterFour/0187.Repeated-DNA-Sequences.md" >}})|Medium||||41.2%| |0202|Happy Number|[Go]({{< relref "/ChapterFour/0202.Happy-Number.md" >}})|Easy| O(log n)| O(1)||51.1%| |0204|Count Primes|[Go]({{< relref "/ChapterFour/0204.Count-Primes.md" >}})|Easy||||32.1%| -|0205|Isomorphic Strings|[Go]({{< relref "/ChapterFour/0205.Isomorphic-Strings.md" >}})|Easy| O(log n)| O(n)||40.3%| +|0205|Isomorphic Strings|[Go]({{< relref "/ChapterFour/0205.Isomorphic-Strings.md" >}})|Easy| O(log n)| O(n)||40.4%| |0217|Contains Duplicate|[Go]({{< relref "/ChapterFour/0217.Contains-Duplicate.md" >}})|Easy| O(n)| O(n)||56.5%| |0219|Contains Duplicate II|[Go]({{< relref "/ChapterFour/0219.Contains-Duplicate-II.md" >}})|Easy| O(n)| O(n)||38.5%| |0242|Valid Anagram|[Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})|Easy| O(n)| O(n) ||57.9%| |0274|H-Index|[Go]({{< relref "/ChapterFour/0274.H-Index.md" >}})|Medium| O(n)| O(n) ||36.3%| -|0290|Word Pattern|[Go]({{< relref "/ChapterFour/0290.Word-Pattern.md" >}})|Easy| O(n)| O(n) ||38.2%| +|0290|Word Pattern|[Go]({{< relref "/ChapterFour/0290.Word-Pattern.md" >}})|Easy| O(n)| O(n) ||38.3%| |0347|Top K Frequent Elements|[Go]({{< relref "/ChapterFour/0347.Top-K-Frequent-Elements.md" >}})|Medium| O(n)| O(n) ||62.2%| |0349|Intersection of Two Arrays|[Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})|Easy| O(n)| O(n) ||64.4%| |0350|Intersection of Two Arrays II|[Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})|Easy| O(n)| O(n) ||51.9%| @@ -44,40 +44,41 @@ type: docs |0594|Longest Harmonious Subsequence|[Go]({{< relref "/ChapterFour/0594.Longest-Harmonious-Subsequence.md" >}})|Easy||||47.7%| |0599|Minimum Index Sum of Two Lists|[Go]({{< relref "/ChapterFour/0599.Minimum-Index-Sum-of-Two-Lists.md" >}})|Easy||||51.5%| |0632|Smallest Range Covering Elements from K Lists|[Go]({{< relref "/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md" >}})|Hard||||53.9%| -|0645|Set Mismatch|[Go]({{< relref "/ChapterFour/0645.Set-Mismatch.md" >}})|Easy||||42.5%| +|0645|Set Mismatch|[Go]({{< relref "/ChapterFour/0645.Set-Mismatch.md" >}})|Easy||||42.4%| |0648|Replace Words|[Go]({{< relref "/ChapterFour/0648.Replace-Words.md" >}})|Medium| O(n)| O(n) ||58.2%| |0676|Implement Magic Dictionary|[Go]({{< relref "/ChapterFour/0676.Implement-Magic-Dictionary.md" >}})|Medium| O(n)| O(n) ||55.1%| |0705|Design HashSet|[Go]({{< relref "/ChapterFour/0705.Design-HashSet.md" >}})|Easy||||64.6%| -|0706|Design HashMap|[Go]({{< relref "/ChapterFour/0706.Design-HashMap.md" >}})|Easy||||62.5%| +|0706|Design HashMap|[Go]({{< relref "/ChapterFour/0706.Design-HashMap.md" >}})|Easy||||62.6%| |0710|Random Pick with Blacklist|[Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})|Hard| O(n)| O(n) ||32.7%| |0718|Maximum Length of Repeated Subarray|[Go]({{< relref "/ChapterFour/0718.Maximum-Length-of-Repeated-Subarray.md" >}})|Medium||||50.1%| -|0720|Longest Word in Dictionary|[Go]({{< relref "/ChapterFour/0720.Longest-Word-in-Dictionary.md" >}})|Easy| O(n)| O(n) ||49.0%| +|0720|Longest Word in Dictionary|[Go]({{< relref "/ChapterFour/0720.Longest-Word-in-Dictionary.md" >}})|Easy| O(n)| O(n) ||49.1%| |0726|Number of Atoms|[Go]({{< relref "/ChapterFour/0726.Number-of-Atoms.md" >}})|Hard| O(n)| O(n) |❤️|51.0%| |0739|Daily Temperatures|[Go]({{< relref "/ChapterFour/0739.Daily-Temperatures.md" >}})|Medium| O(n)| O(n) ||64.3%| |0748|Shortest Completing Word|[Go]({{< relref "/ChapterFour/0748.Shortest-Completing-Word.md" >}})|Easy||||57.4%| |0771|Jewels and Stones|[Go]({{< relref "/ChapterFour/0771.Jewels-and-Stones.md" >}})|Easy||||86.8%| |0781|Rabbits in Forest|[Go]({{< relref "/ChapterFour/0781.Rabbits-in-Forest.md" >}})|Medium||||55.4%| |0811|Subdomain Visit Count|[Go]({{< relref "/ChapterFour/0811.Subdomain-Visit-Count.md" >}})|Easy||||71.2%| -|0884|Uncommon Words from Two Sentences|[Go]({{< relref "/ChapterFour/0884.Uncommon-Words-from-Two-Sentences.md" >}})|Easy||||63.9%| +|0884|Uncommon Words from Two Sentences|[Go]({{< relref "/ChapterFour/0884.Uncommon-Words-from-Two-Sentences.md" >}})|Easy||||64.0%| |0895|Maximum Frequency Stack|[Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})|Hard| O(n)| O(n) ||62.1%| |0930|Binary Subarrays With Sum|[Go]({{< relref "/ChapterFour/0930.Binary-Subarrays-With-Sum.md" >}})|Medium| O(n)| O(n) |❤️|44.3%| |0953|Verifying an Alien Dictionary|[Go]({{< relref "/ChapterFour/0953.Verifying-an-Alien-Dictionary.md" >}})|Easy||||52.5%| |0961|N-Repeated Element in Size 2N Array|[Go]({{< relref "/ChapterFour/0961.N-Repeated-Element-in-Size-2N-Array.md" >}})|Easy||||74.4%| |0970|Powerful Integers|[Go]({{< relref "/ChapterFour/0970.Powerful-Integers.md" >}})|Easy||||39.9%| -|0981|Time Based Key-Value Store|[Go]({{< relref "/ChapterFour/0981.Time-Based-Key-Value-Store.md" >}})|Medium||||53.9%| -|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n) |❤️|50.4%| +|0981|Time Based Key-Value Store|[Go]({{< relref "/ChapterFour/0981.Time-Based-Key-Value-Store.md" >}})|Medium||||54.0%| +|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n) |❤️|50.5%| |1002|Find Common Characters|[Go]({{< relref "/ChapterFour/1002.Find-Common-Characters.md" >}})|Easy||||68.1%| -|1078|Occurrences After Bigram|[Go]({{< relref "/ChapterFour/1078.Occurrences-After-Bigram.md" >}})|Easy||||64.9%| +|1078|Occurrences After Bigram|[Go]({{< relref "/ChapterFour/1078.Occurrences-After-Bigram.md" >}})|Easy||||64.8%| |1160|Find Words That Can Be Formed by Characters|[Go]({{< relref "/ChapterFour/1160.Find-Words-That-Can-Be-Formed-by-Characters.md" >}})|Easy||||67.5%| |1189|Maximum Number of Balloons|[Go]({{< relref "/ChapterFour/1189.Maximum-Number-of-Balloons.md" >}})|Easy||||61.8%| |1207|Unique Number of Occurrences|[Go]({{< relref "/ChapterFour/1207.Unique-Number-of-Occurrences.md" >}})|Easy||||71.6%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| |1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.3%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.3%| -|1679|Max Number of K-Sum Pairs|[Go]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}})|Medium||||52.0%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.1%| +|1679|Max Number of K-Sum Pairs|[Go]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}})|Medium||||51.8%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| + ----------------------------------------------

⬅️上一页

diff --git a/website/content/ChapterTwo/Linked_List.md b/website/content/ChapterTwo/Linked_List.md index d9a5a75d..9c5fa705 100644 --- a/website/content/ChapterTwo/Linked_List.md +++ b/website/content/ChapterTwo/Linked_List.md @@ -24,22 +24,22 @@ type: docs |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | |0002|Add Two Numbers|[Go]({{< relref "/ChapterFour/0002.Add-Two-Numbers.md" >}})|Medium| O(n)| O(1)||35.2%| |0019|Remove Nth Node From End of List|[Go]({{< relref "/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md" >}})|Medium| O(n)| O(1)||35.6%| -|0021|Merge Two Sorted Lists|[Go]({{< relref "/ChapterFour/0021.Merge-Two-Sorted-Lists.md" >}})|Easy| O(log n)| O(1)||55.6%| +|0021|Merge Two Sorted Lists|[Go]({{< relref "/ChapterFour/0021.Merge-Two-Sorted-Lists.md" >}})|Easy| O(log n)| O(1)||55.7%| |0023|Merge k Sorted Lists|[Go]({{< relref "/ChapterFour/0023.Merge-k-Sorted-Lists.md" >}})|Hard| O(log n)| O(1)|❤️|42.0%| -|0024|Swap Nodes in Pairs|[Go]({{< relref "/ChapterFour/0024.Swap-Nodes-in-Pairs.md" >}})|Medium| O(n)| O(1)||52.6%| -|0025|Reverse Nodes in k-Group|[Go]({{< relref "/ChapterFour/0025.Reverse-Nodes-in-k-Group.md" >}})|Hard| O(log n)| O(1)|❤️|44.2%| +|0024|Swap Nodes in Pairs|[Go]({{< relref "/ChapterFour/0024.Swap-Nodes-in-Pairs.md" >}})|Medium| O(n)| O(1)||52.7%| +|0025|Reverse Nodes in k-Group|[Go]({{< relref "/ChapterFour/0025.Reverse-Nodes-in-k-Group.md" >}})|Hard| O(log n)| O(1)|❤️|44.3%| |0061|Rotate List|[Go]({{< relref "/ChapterFour/0061.Rotate-List.md" >}})|Medium| O(n)| O(1)||31.6%| |0082|Remove Duplicates from Sorted List II|[Go]({{< relref "/ChapterFour/0082.Remove-Duplicates-from-Sorted-List-II.md" >}})|Medium| O(n)| O(1)||39.0%| |0083|Remove Duplicates from Sorted List|[Go]({{< relref "/ChapterFour/0083.Remove-Duplicates-from-Sorted-List.md" >}})|Easy| O(n)| O(1)||46.3%| |0086|Partition List|[Go]({{< relref "/ChapterFour/0086.Partition-List.md" >}})|Medium| O(n)| O(1)|❤️|43.0%| -|0092|Reverse Linked List II|[Go]({{< relref "/ChapterFour/0092.Reverse-Linked-List-II.md" >}})|Medium| O(n)| O(1)|❤️|40.2%| +|0092|Reverse Linked List II|[Go]({{< relref "/ChapterFour/0092.Reverse-Linked-List-II.md" >}})|Medium| O(n)| O(1)|❤️|40.3%| |0109|Convert Sorted List to Binary Search Tree|[Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})|Medium| O(log n)| O(n)||49.8%| |0141|Linked List Cycle|[Go]({{< relref "/ChapterFour/0141.Linked-List-Cycle.md" >}})|Easy| O(n)| O(1)|❤️|42.2%| |0142|Linked List Cycle II|[Go]({{< relref "/ChapterFour/0142.Linked-List-Cycle-II.md" >}})|Medium| O(n)| O(1)|❤️|39.3%| |0143|Reorder List|[Go]({{< relref "/ChapterFour/0143.Reorder-List.md" >}})|Medium| O(n)| O(1)|❤️|40.2%| |0147|Insertion Sort List|[Go]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}})|Medium| O(n)| O(1)|❤️|44.1%| |0148|Sort List|[Go]({{< relref "/ChapterFour/0148.Sort-List.md" >}})|Medium| O(n log n)| O(n)|❤️|45.8%| -|0160|Intersection of Two Linked Lists|[Go]({{< relref "/ChapterFour/0160.Intersection-of-Two-Linked-Lists.md" >}})|Easy| O(n)| O(1)|❤️|42.6%| +|0160|Intersection of Two Linked Lists|[Go]({{< relref "/ChapterFour/0160.Intersection-of-Two-Linked-Lists.md" >}})|Easy| O(n)| O(1)|❤️|42.7%| |0203|Remove Linked List Elements|[Go]({{< relref "/ChapterFour/0203.Remove-Linked-List-Elements.md" >}})|Easy| O(n)| O(1)||39.0%| |0206|Reverse Linked List|[Go]({{< relref "/ChapterFour/0206.Reverse-Linked-List.md" >}})|Easy| O(n)| O(1)||64.8%| |0234|Palindrome Linked List|[Go]({{< relref "/ChapterFour/0234.Palindrome-Linked-List.md" >}})|Easy| O(n)| O(1)||40.2%| @@ -52,7 +52,7 @@ type: docs |0876|Middle of the Linked List|[Go]({{< relref "/ChapterFour/0876.Middle-of-the-Linked-List.md" >}})|Easy| O(n)| O(1)|❤️|68.9%| |1019|Next Greater Node In Linked List|[Go]({{< relref "/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md" >}})|Medium| O(n)| O(1)||58.2%| |1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go]({{< relref "/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md" >}})|Medium||||41.4%| -|1290|Convert Binary Number in a Linked List to Integer|[Go]({{< relref "/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md" >}})|Easy||||81.6%| +|1290|Convert Binary Number in a Linked List to Integer|[Go]({{< relref "/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md" >}})|Easy||||81.7%| |1669|Merge In Between Linked Lists|[Go]({{< relref "/ChapterFour/1669.Merge-In-Between-Linked-Lists.md" >}})|Medium||||78.2%| |1670|Design Front Middle Back Queue|[Go]({{< relref "/ChapterFour/1670.Design-Front-Middle-Back-Queue.md" >}})|Medium||||54.6%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Math.md b/website/content/ChapterTwo/Math.md index 18831b4f..c2c6013a 100644 --- a/website/content/ChapterTwo/Math.md +++ b/website/content/ChapterTwo/Math.md @@ -9,7 +9,7 @@ type: docs | No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | |0002|Add Two Numbers|[Go]({{< relref "/ChapterFour/0002.Add-Two-Numbers.md" >}})|Medium| O(n)| O(1)||35.2%| -|0007|Reverse Integer|[Go]({{< relref "/ChapterFour/0007.Reverse-Integer.md" >}})|Easy||||25.8%| +|0007|Reverse Integer|[Go]({{< relref "/ChapterFour/0007.Reverse-Integer.md" >}})|Easy||||25.9%| |0009|Palindrome Number|[Go]({{< relref "/ChapterFour/0009.Palindrome-Number.md" >}})|Easy||||49.5%| |0013|Roman to Integer|[Go]({{< relref "/ChapterFour/0013.Roman-to-Integer.md" >}})|Easy||||56.4%| |0029|Divide Two Integers|[Go]({{< relref "/ChapterFour/0029.Divide-Two-Integers.md" >}})|Medium||||16.6%| @@ -18,19 +18,19 @@ type: docs |0067|Add Binary|[Go]({{< relref "/ChapterFour/0067.Add-Binary.md" >}})|Easy||||46.6%| |0069|Sqrt(x)|[Go]({{< relref "/ChapterFour/0069.Sqrtx.md" >}})|Easy| O(log n)| O(1)||34.8%| |0168|Excel Sheet Column Title|[Go]({{< relref "/ChapterFour/0168.Excel-Sheet-Column-Title.md" >}})|Easy||||31.6%| -|0171|Excel Sheet Column Number|[Go]({{< relref "/ChapterFour/0171.Excel-Sheet-Column-Number.md" >}})|Easy||||56.7%| +|0171|Excel Sheet Column Number|[Go]({{< relref "/ChapterFour/0171.Excel-Sheet-Column-Number.md" >}})|Easy||||56.8%| |0172|Factorial Trailing Zeroes|[Go]({{< relref "/ChapterFour/0172.Factorial-Trailing-Zeroes.md" >}})|Easy||||38.4%| |0202|Happy Number|[Go]({{< relref "/ChapterFour/0202.Happy-Number.md" >}})|Easy| O(log n)| O(1)||51.1%| |0204|Count Primes|[Go]({{< relref "/ChapterFour/0204.Count-Primes.md" >}})|Easy||||32.1%| |0223|Rectangle Area|[Go]({{< relref "/ChapterFour/0223.Rectangle-Area.md" >}})|Medium||||38.1%| |0224|Basic Calculator|[Go]({{< relref "/ChapterFour/0224.Basic-Calculator.md" >}})|Hard| O(n)| O(n)||38.0%| |0231|Power of Two|[Go]({{< relref "/ChapterFour/0231.Power-of-Two.md" >}})|Easy| O(1)| O(1)||43.8%| -|0258|Add Digits|[Go]({{< relref "/ChapterFour/0258.Add-Digits.md" >}})|Easy||||58.3%| +|0258|Add Digits|[Go]({{< relref "/ChapterFour/0258.Add-Digits.md" >}})|Easy||||58.4%| |0263|Ugly Number|[Go]({{< relref "/ChapterFour/0263.Ugly-Number.md" >}})|Easy| O(log n)| O(1)||41.7%| |0268|Missing Number|[Go]({{< relref "/ChapterFour/0268.Missing-Number.md" >}})|Easy||||53.4%| |0326|Power of Three|[Go]({{< relref "/ChapterFour/0326.Power-of-Three.md" >}})|Easy| O(1)| O(1)||42.1%| -|0343|Integer Break|[Go]({{< relref "/ChapterFour/0343.Integer-Break.md" >}})|Medium| O(n^2)| O(n)||51.0%| -|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.7%| +|0343|Integer Break|[Go]({{< relref "/ChapterFour/0343.Integer-Break.md" >}})|Medium| O(n^2)| O(n)||51.1%| +|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.8%| |0367|Valid Perfect Square|[Go]({{< relref "/ChapterFour/0367.Valid-Perfect-Square.md" >}})|Easy||||42.0%| |0372|Super Pow|[Go]({{< relref "/ChapterFour/0372.Super-Pow.md" >}})|Medium||||36.6%| |0397|Integer Replacement|[Go]({{< relref "/ChapterFour/0397.Integer-Replacement.md" >}})|Medium||||33.4%| @@ -43,7 +43,7 @@ type: docs |0598|Range Addition II|[Go]({{< relref "/ChapterFour/0598.Range-Addition-II.md" >}})|Easy||||50.0%| |0628|Maximum Product of Three Numbers|[Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})|Easy| O(n)| O(1)||47.0%| |0633|Sum of Square Numbers|[Go]({{< relref "/ChapterFour/0633.Sum-of-Square-Numbers.md" >}})|Medium||||32.4%| -|0645|Set Mismatch|[Go]({{< relref "/ChapterFour/0645.Set-Mismatch.md" >}})|Easy||||42.5%| +|0645|Set Mismatch|[Go]({{< relref "/ChapterFour/0645.Set-Mismatch.md" >}})|Easy||||42.4%| |0753|Cracking the Safe|[Go]({{< relref "/ChapterFour/0753.Cracking-the-Safe.md" >}})|Hard||||52.0%| |0781|Rabbits in Forest|[Go]({{< relref "/ChapterFour/0781.Rabbits-in-Forest.md" >}})|Medium||||55.4%| |0812|Largest Triangle Area|[Go]({{< relref "/ChapterFour/0812.Largest-Triangle-Area.md" >}})|Easy||||58.8%| @@ -52,7 +52,7 @@ type: docs |0885|Spiral Matrix III|[Go]({{< relref "/ChapterFour/0885.Spiral-Matrix-III.md" >}})|Medium| O(n^2)| O(1)||70.5%| |0887|Super Egg Drop|[Go]({{< relref "/ChapterFour/0887.Super-Egg-Drop.md" >}})|Hard||||27.0%| |0891|Sum of Subsequence Widths|[Go]({{< relref "/ChapterFour/0891.Sum-of-Subsequence-Widths.md" >}})|Hard| O(n log n)| O(1)||32.8%| -|0892|Surface Area of 3D Shapes|[Go]({{< relref "/ChapterFour/0892.Surface-Area-of-3D-Shapes.md" >}})|Easy||||59.5%| +|0892|Surface Area of 3D Shapes|[Go]({{< relref "/ChapterFour/0892.Surface-Area-of-3D-Shapes.md" >}})|Easy||||59.6%| |0910|Smallest Range II|[Go]({{< relref "/ChapterFour/0910.Smallest-Range-II.md" >}})|Medium||||31.2%| |0914|X of a Kind in a Deck of Cards|[Go]({{< relref "/ChapterFour/0914.X-of-a-Kind-in-a-Deck-of-Cards.md" >}})|Easy||||34.4%| |0927|Three Equal Parts|[Go]({{< relref "/ChapterFour/0927.Three-Equal-Parts.md" >}})|Hard||||34.5%| @@ -64,20 +64,21 @@ type: docs |0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.0%| |1017|Convert to Base -2|[Go]({{< relref "/ChapterFour/1017.Convert-to-Base--2.md" >}})|Medium||||59.6%| |1025|Divisor Game|[Go]({{< relref "/ChapterFour/1025.Divisor-Game.md" >}})|Easy| O(1)| O(1)||66.1%| -|1037|Valid Boomerang|[Go]({{< relref "/ChapterFour/1037.Valid-Boomerang.md" >}})|Easy||||37.9%| +|1037|Valid Boomerang|[Go]({{< relref "/ChapterFour/1037.Valid-Boomerang.md" >}})|Easy||||37.8%| |1073|Adding Two Negabinary Numbers|[Go]({{< relref "/ChapterFour/1073.Adding-Two-Negabinary-Numbers.md" >}})|Medium||||34.7%| |1093|Statistics from a Large Sample|[Go]({{< relref "/ChapterFour/1093.Statistics-from-a-Large-Sample.md" >}})|Medium||||49.3%| |1154|Day of the Year|[Go]({{< relref "/ChapterFour/1154.Day-of-the-Year.md" >}})|Easy||||49.3%| |1175|Prime Arrangements|[Go]({{< relref "/ChapterFour/1175.Prime-Arrangements.md" >}})|Easy||||51.8%| |1201|Ugly Number III|[Go]({{< relref "/ChapterFour/1201.Ugly-Number-III.md" >}})|Medium||||26.3%| |1217|Minimum Cost to Move Chips to The Same Position|[Go]({{< relref "/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md" >}})|Easy||||71.2%| -|1232|Check If It Is a Straight Line|[Go]({{< relref "/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md" >}})|Easy||||43.9%| +|1232|Check If It Is a Straight Line|[Go]({{< relref "/ChapterFour/1232.Check-If-It-Is-a-Straight-Line.md" >}})|Easy||||43.8%| |1281|Subtract the Product and Sum of Digits of an Integer|[Go]({{< relref "/ChapterFour/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer.md" >}})|Easy||||85.6%| |1317|Convert Integer to the Sum of Two No-Zero Integers|[Go]({{< relref "/ChapterFour/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers.md" >}})|Easy||||56.8%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| +|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.6%| |1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%| |1680|Concatenation of Consecutive Binary Numbers|[Go]({{< relref "/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md" >}})|Medium||||45.1%| -|1685|Sum of Absolute Differences in a Sorted Array|[Go]({{< relref "/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md" >}})|Medium||||61.7%| +|1685|Sum of Absolute Differences in a Sorted Array|[Go]({{< relref "/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md" >}})|Medium||||61.8%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Segment_Tree.md b/website/content/ChapterTwo/Segment_Tree.md index cd233ee8..bc090d52 100644 --- a/website/content/ChapterTwo/Segment_Tree.md +++ b/website/content/ChapterTwo/Segment_Tree.md @@ -44,7 +44,7 @@ type: docs |0699|Falling Squares|[Go]({{< relref "/ChapterFour/0699.Falling-Squares.md" >}})|Hard| O(n log n)| O(n)|❤️|42.4%| |0715|Range Module|[Go]({{< relref "/ChapterFour/0715.Range-Module.md" >}})|Hard| O(log n)| O(n)|❤️|40.0%| |0732|My Calendar III|[Go]({{< relref "/ChapterFour/0732.My-Calendar-III.md" >}})|Hard| O(log n)| O(n)|❤️|61.4%| -|0850|Rectangle Area II|[Go]({{< relref "/ChapterFour/0850.Rectangle-Area-II.md" >}})|Hard| O(n log n)| O(n)|❤️|48.4%| +|0850|Rectangle Area II|[Go]({{< relref "/ChapterFour/0850.Rectangle-Area-II.md" >}})|Hard| O(n log n)| O(n)|❤️|48.3%| |1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard| O(log n)| O(n)|❤️|39.5%| |1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Sliding_Window.md b/website/content/ChapterTwo/Sliding_Window.md index 32c1f276..c6b98e76 100644 --- a/website/content/ChapterTwo/Sliding_Window.md +++ b/website/content/ChapterTwo/Sliding_Window.md @@ -35,14 +35,14 @@ type: docs |0480|Sliding Window Median|[Go]({{< relref "/ChapterFour/0480.Sliding-Window-Median.md" >}})|Hard| O(n * log k)| O(k)|❤️|38.4%| |0567|Permutation in String|[Go]({{< relref "/ChapterFour/0567.Permutation-in-String.md" >}})|Medium| O(n)| O(1)|❤️|44.6%| |0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0978.Longest-Turbulent-Subarray.md" >}})|Medium| O(n)| O(1)|❤️|46.6%| -|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n)|❤️|50.4%| +|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n)|❤️|50.5%| |0995|Minimum Number of K Consecutive Bit Flips|[Go]({{< relref "/ChapterFour/0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md" >}})|Hard| O(n)| O(1)|❤️|49.6%| |1004|Max Consecutive Ones III|[Go]({{< relref "/ChapterFour/1004.Max-Consecutive-Ones-III.md" >}})|Medium| O(n)| O(1) ||60.5%| -|1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium| O(n log n)| O(1) |❤️|54.0%| -|1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})|Medium| O(n log n)| O(1) ||55.6%| -|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard| O(n^3)| O(n) |❤️|61.4%| -|1208|Get Equal Substrings Within Budget|[Go]({{< relref "/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md" >}})|Medium||||43.7%| -|1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.6%| +|1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium| O(n log n)| O(1) |❤️|53.9%| +|1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})|Medium| O(n log n)| O(1) ||55.7%| +|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard| O(n^3)| O(n) |❤️|61.5%| +|1208|Get Equal Substrings Within Budget|[Go]({{< relref "/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md" >}})|Medium||||43.6%| +|1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.4%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Sort.md b/website/content/ChapterTwo/Sort.md index c50678f5..7dbd043a 100644 --- a/website/content/ChapterTwo/Sort.md +++ b/website/content/ChapterTwo/Sort.md @@ -18,7 +18,7 @@ type: docs | No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | |0056|Merge Intervals|[Go]({{< relref "/ChapterFour/0056.Merge-Intervals.md" >}})|Medium| O(n log n)| O(log n)||40.7%| -|0057|Insert Interval|[Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})|Medium| O(n)| O(1)||34.8%| +|0057|Insert Interval|[Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})|Medium| O(n)| O(1)||34.9%| |0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|48.9%| |0147|Insertion Sort List|[Go]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}})|Medium| O(n)| O(1) |❤️|44.1%| |0148|Sort List|[Go]({{< relref "/ChapterFour/0148.Sort-List.md" >}})|Medium|O(n log n)| O(log n)|❤️|45.8%| @@ -28,7 +28,7 @@ type: docs |0242|Valid Anagram|[Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})|Easy| O(n)| O(n) ||57.9%| |0274|H-Index|[Go]({{< relref "/ChapterFour/0274.H-Index.md" >}})|Medium| O(n)| O(n) ||36.3%| |0315|Count of Smaller Numbers After Self|[Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})|Hard||||42.6%| -|0324|Wiggle Sort II|[Go]({{< relref "/ChapterFour/0324.Wiggle-Sort-II.md" >}})|Medium| O(n)| O(n)|❤️|30.5%| +|0324|Wiggle Sort II|[Go]({{< relref "/ChapterFour/0324.Wiggle-Sort-II.md" >}})|Medium| O(n)| O(n)|❤️|30.6%| |0327|Count of Range Sum|[Go]({{< relref "/ChapterFour/0327.Count-of-Range-Sum.md" >}})|Hard||||35.9%| |0349|Intersection of Two Arrays|[Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})|Easy| O(n)| O(n) ||64.4%| |0350|Intersection of Two Arrays II|[Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})|Easy| O(n)| O(n) ||51.9%| @@ -46,8 +46,8 @@ type: docs |1122|Relative Sort Array|[Go]({{< relref "/ChapterFour/1122.Relative-Sort-Array.md" >}})|Easy||||67.7%| |1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| |1305|All Elements in Two Binary Search Trees|[Go]({{< relref "/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}})|Medium||||77.8%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.3%| -|1647|Minimum Deletions to Make Character Frequencies Unique|[Go]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}})|Medium||||53.9%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.1%| +|1647|Minimum Deletions to Make Character Frequencies Unique|[Go]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}})|Medium||||53.8%| |1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Stack.md b/website/content/ChapterTwo/Stack.md index 7a030346..71218ed9 100644 --- a/website/content/ChapterTwo/Stack.md +++ b/website/content/ChapterTwo/Stack.md @@ -17,7 +17,7 @@ type: docs | No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | |0020|Valid Parentheses|[Go]({{< relref "/ChapterFour/0020.Valid-Parentheses.md" >}})|Easy| O(log n)| O(1)||39.5%| -|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|50.7%| +|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|50.8%| |0071|Simplify Path|[Go]({{< relref "/ChapterFour/0071.Simplify-Path.md" >}})|Medium| O(n)| O(n)|❤️|33.6%| |0084|Largest Rectangle in Histogram|[Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}})|Hard| O(n)| O(n)|❤️|36.8%| |0094|Binary Tree Inorder Traversal|[Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})|Medium| O(n)| O(1)||65.4%| @@ -32,10 +32,10 @@ type: docs |0232|Implement Queue using Stacks|[Go]({{< relref "/ChapterFour/0232.Implement-Queue-using-Stacks.md" >}})|Easy| O(n)| O(n)||51.6%| |0331|Verify Preorder Serialization of a Binary Tree|[Go]({{< relref "/ChapterFour/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md" >}})|Medium| O(n)| O(1)||40.9%| |0385|Mini Parser|[Go]({{< relref "/ChapterFour/0385.Mini-Parser.md" >}})|Medium||||34.3%| -|0394|Decode String|[Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})|Medium| O(n)| O(n)||52.3%| +|0394|Decode String|[Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})|Medium| O(n)| O(n)||52.4%| |0402|Remove K Digits|[Go]({{< relref "/ChapterFour/0402.Remove-K-Digits.md" >}})|Medium| O(n)| O(1)||28.6%| |0456|132 Pattern|[Go]({{< relref "/ChapterFour/0456.132-Pattern.md" >}})|Medium| O(n)| O(n)||30.6%| -|0496|Next Greater Element I|[Go]({{< relref "/ChapterFour/0496.Next-Greater-Element-I.md" >}})|Easy| O(n)| O(n)||65.1%| +|0496|Next Greater Element I|[Go]({{< relref "/ChapterFour/0496.Next-Greater-Element-I.md" >}})|Easy| O(n)| O(n)||65.2%| |0503|Next Greater Element II|[Go]({{< relref "/ChapterFour/0503.Next-Greater-Element-II.md" >}})|Medium| O(n)| O(n)||58.1%| |0636|Exclusive Time of Functions|[Go]({{< relref "/ChapterFour/0636.Exclusive-Time-of-Functions.md" >}})|Medium| O(n)| O(n)||53.9%| |0682|Baseball Game|[Go]({{< relref "/ChapterFour/0682.Baseball-Game.md" >}})|Easy| O(n)| O(n)||66.1%| @@ -46,14 +46,14 @@ type: docs |0856|Score of Parentheses|[Go]({{< relref "/ChapterFour/0856.Score-of-Parentheses.md" >}})|Medium| O(n)| O(n)||62.2%| |0880|Decoded String at Index|[Go]({{< relref "/ChapterFour/0880.Decoded-String-at-Index.md" >}})|Medium| O(n)| O(n)||28.3%| |0895|Maximum Frequency Stack|[Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})|Hard| O(n)| O(n) ||62.1%| -|0901|Online Stock Span|[Go]({{< relref "/ChapterFour/0901.Online-Stock-Span.md" >}})|Medium| O(n)| O(n) ||61.1%| +|0901|Online Stock Span|[Go]({{< relref "/ChapterFour/0901.Online-Stock-Span.md" >}})|Medium| O(n)| O(n) ||61.2%| |0907|Sum of Subarray Minimums|[Go]({{< relref "/ChapterFour/0907.Sum-of-Subarray-Minimums.md" >}})|Medium| O(n)| O(n)|❤️|33.2%| |0921|Minimum Add to Make Parentheses Valid|[Go]({{< relref "/ChapterFour/0921.Minimum-Add-to-Make-Parentheses-Valid.md" >}})|Medium| O(n)| O(n)||74.6%| |0946|Validate Stack Sequences|[Go]({{< relref "/ChapterFour/0946.Validate-Stack-Sequences.md" >}})|Medium| O(n)| O(n)||63.4%| |1003|Check If Word Is Valid After Substitutions|[Go]({{< relref "/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md" >}})|Medium| O(n)| O(1)||56.1%| |1019|Next Greater Node In Linked List|[Go]({{< relref "/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md" >}})|Medium| O(n)| O(1)||58.2%| |1021|Remove Outermost Parentheses|[Go]({{< relref "/ChapterFour/1021.Remove-Outermost-Parentheses.md" >}})|Easy| O(n)| O(1)||78.7%| -|1047|Remove All Adjacent Duplicates In String|[Go]({{< relref "/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md" >}})|Easy| O(n)| O(1)||70.2%| +|1047|Remove All Adjacent Duplicates In String|[Go]({{< relref "/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md" >}})|Easy| O(n)| O(1)||70.3%| |1673|Find the Most Competitive Subsequence|[Go]({{< relref "/ChapterFour/1673.Find-the-Most-Competitive-Subsequence.md" >}})|Medium||||38.3%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/String.md b/website/content/ChapterTwo/String.md index ce72f226..5f7dc201 100644 --- a/website/content/ChapterTwo/String.md +++ b/website/content/ChapterTwo/String.md @@ -10,10 +10,10 @@ type: docs |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | |0003|Longest Substring Without Repeating Characters|[Go]({{< relref "/ChapterFour/0003.Longest-Substring-Without-Repeating-Characters.md" >}})|Medium| O(n)| O(1)|❤️|31.3%| |0013|Roman to Integer|[Go]({{< relref "/ChapterFour/0013.Roman-to-Integer.md" >}})|Easy||||56.4%| -|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium| O(log n)| O(1)||48.6%| +|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium| O(log n)| O(1)||48.7%| |0020|Valid Parentheses|[Go]({{< relref "/ChapterFour/0020.Valid-Parentheses.md" >}})|Easy| O(log n)| O(1)||39.5%| |0022|Generate Parentheses|[Go]({{< relref "/ChapterFour/0022.Generate-Parentheses.md" >}})|Medium| O(log n)| O(1)||64.8%| -|0028|Implement strStr()|[Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})|Easy| O(n)| O(1)||35.0%| +|0028|Implement strStr()|[Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})|Easy| O(n)| O(1)||35.1%| |0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.0%| |0049|Group Anagrams|[Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})|Medium| O(n log n)| O(n)||58.8%| |0067|Add Binary|[Go]({{< relref "/ChapterFour/0067.Add-Binary.md" >}})|Easy||||46.6%| @@ -30,7 +30,7 @@ type: docs |0387|First Unique Character in a String|[Go]({{< relref "/ChapterFour/0387.First-Unique-Character-in-a-String.md" >}})|Easy||||53.7%| |0537|Complex Number Multiplication|[Go]({{< relref "/ChapterFour/0537.Complex-Number-Multiplication.md" >}})|Medium||||68.3%| |0541|Reverse String II|[Go]({{< relref "/ChapterFour/0541.Reverse-String-II.md" >}})|Easy||||49.0%| -|0557|Reverse Words in a String III|[Go]({{< relref "/ChapterFour/0557.Reverse-Words-in-a-String-III.md" >}})|Easy||||71.5%| +|0557|Reverse Words in a String III|[Go]({{< relref "/ChapterFour/0557.Reverse-Words-in-a-String-III.md" >}})|Easy||||71.6%| |0632|Smallest Range Covering Elements from K Lists|[Go]({{< relref "/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md" >}})|Hard||||53.9%| |0767|Reorganize String|[Go]({{< relref "/ChapterFour/0767.Reorganize-String.md" >}})|Medium| O(n log n)| O(log n) |❤️|49.9%| |0819|Most Common Word|[Go]({{< relref "/ChapterFour/0819.Most-Common-Word.md" >}})|Easy||||45.4%| @@ -44,13 +44,13 @@ type: docs |1221|Split a String in Balanced Strings|[Go]({{< relref "/ChapterFour/1221.Split-a-String-in-Balanced-Strings.md" >}})|Easy||||84.0%| |1234|Replace the Substring for Balanced String|[Go]({{< relref "/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md" >}})|Medium||||34.4%| |1455|Check If a Word Occurs As a Prefix of Any Word in a Sentence|[Go]({{< relref "/ChapterFour/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence.md" >}})|Easy||||64.7%| -|1573|Number of Ways to Split a String|[Go]({{< relref "/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md" >}})|Medium||||30.8%| -|1653|Minimum Deletions to Make String Balanced|[Go]({{< relref "/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}})|Medium||||49.7%| -|1662|Check If Two String Arrays are Equivalent|[Go]({{< relref "/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md" >}})|Easy||||83.7%| +|1573|Number of Ways to Split a String|[Go]({{< relref "/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md" >}})|Medium||||30.9%| +|1653|Minimum Deletions to Make String Balanced|[Go]({{< relref "/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}})|Medium||||49.9%| +|1662|Check If Two String Arrays are Equivalent|[Go]({{< relref "/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md" >}})|Easy||||83.6%| |1668|Maximum Repeating Substring|[Go]({{< relref "/ChapterFour/1668.Maximum-Repeating-Substring.md" >}})|Easy||||38.7%| |1678|Goal Parser Interpretation|[Go]({{< relref "/ChapterFour/1678.Goal-Parser-Interpretation.md" >}})|Easy||||86.7%| |1684|Count the Number of Consistent Strings|[Go]({{< relref "/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md" >}})|Easy||||84.2%| -|1694|Reformat Phone Number|[Go]({{< relref "/ChapterFour/1694.Reformat-Phone-Number.md" >}})|Easy||||67.1%| +|1694|Reformat Phone Number|[Go]({{< relref "/ChapterFour/1694.Reformat-Phone-Number.md" >}})|Easy||||67.0%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Tree.md b/website/content/ChapterTwo/Tree.md index 7ac05a12..7b02a714 100644 --- a/website/content/ChapterTwo/Tree.md +++ b/website/content/ChapterTwo/Tree.md @@ -10,24 +10,24 @@ type: docs |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | |0094|Binary Tree Inorder Traversal|[Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})|Medium| O(n)| O(1)||65.4%| |0095|Unique Binary Search Trees II|[Go]({{< relref "/ChapterFour/0095.Unique-Binary-Search-Trees-II.md" >}})|Medium||||42.1%| -|0096|Unique Binary Search Trees|[Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}})|Medium| O(n^2)| O(n)||54.1%| +|0096|Unique Binary Search Trees|[Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}})|Medium| O(n^2)| O(n)||54.2%| |0098|Validate Binary Search Tree|[Go]({{< relref "/ChapterFour/0098.Validate-Binary-Search-Tree.md" >}})|Medium| O(n)| O(1)||28.6%| -|0099|Recover Binary Search Tree|[Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}})|Hard| O(n)| O(1)||42.1%| +|0099|Recover Binary Search Tree|[Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}})|Hard| O(n)| O(1)||42.2%| |0100|Same Tree|[Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}})|Easy| O(n)| O(1)||54.0%| |0101|Symmetric Tree|[Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})|Easy| O(n)| O(1)||47.9%| |0102|Binary Tree Level Order Traversal|[Go]({{< relref "/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md" >}})|Medium| O(n)| O(1)||56.2%| |0103|Binary Tree Zigzag Level Order Traversal|[Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})|Medium| O(n)| O(n)||49.8%| |0104|Maximum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||67.7%| |0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| -|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.1%| -|0107|Binary Tree Level Order Traversal II|[Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})|Easy| O(n)| O(1)||54.8%| -|0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||59.9%| +|0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.2%| +|0107|Binary Tree Level Order Traversal II|[Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})|Easy| O(n)| O(1)||54.9%| +|0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||60.0%| |0110|Balanced Binary Tree|[Go]({{< relref "/ChapterFour/0110.Balanced-Binary-Tree.md" >}})|Easy| O(n)| O(1)||44.6%| |0111|Minimum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||39.2%| |0112|Path Sum|[Go]({{< relref "/ChapterFour/0112.Path-Sum.md" >}})|Easy| O(n)| O(1)||42.1%| -|0113|Path Sum II|[Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}})|Medium| O(n)| O(1)||48.6%| -|0114|Flatten Binary Tree to Linked List|[Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})|Medium| O(n)| O(1)||51.4%| -|0124|Binary Tree Maximum Path Sum|[Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}})|Hard| O(n)| O(1)||35.2%| +|0113|Path Sum II|[Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}})|Medium| O(n)| O(1)||48.7%| +|0114|Flatten Binary Tree to Linked List|[Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})|Medium| O(n)| O(1)||51.5%| +|0124|Binary Tree Maximum Path Sum|[Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}})|Hard| O(n)| O(1)||35.3%| |0129|Sum Root to Leaf Numbers|[Go]({{< relref "/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md" >}})|Medium| O(n)| O(1)||50.6%| |0144|Binary Tree Preorder Traversal|[Go]({{< relref "/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md" >}})|Medium| O(n)| O(1)||57.1%| |0145|Binary Tree Postorder Traversal|[Go]({{< relref "/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md" >}})|Medium| O(n)| O(1)||57.1%| @@ -35,7 +35,7 @@ type: docs |0199|Binary Tree Right Side View|[Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}})|Medium| O(n)| O(1)||55.7%| |0222|Count Complete Tree Nodes|[Go]({{< relref "/ChapterFour/0222.Count-Complete-Tree-Nodes.md" >}})|Medium| O(n)| O(1)||48.8%| |0226|Invert Binary Tree|[Go]({{< relref "/ChapterFour/0226.Invert-Binary-Tree.md" >}})|Easy| O(n)| O(1)||66.6%| -|0230|Kth Smallest Element in a BST|[Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})|Medium| O(n)| O(1)||62.1%| +|0230|Kth Smallest Element in a BST|[Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})|Medium| O(n)| O(1)||62.2%| |0235|Lowest Common Ancestor of a Binary Search Tree|[Go]({{< relref "/ChapterFour/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||51.4%| |0236|Lowest Common Ancestor of a Binary Tree|[Go]({{< relref "/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md" >}})|Medium| O(n)| O(1)||48.1%| |0257|Binary Tree Paths|[Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})|Easy| O(n)| O(1)||53.2%| @@ -50,7 +50,7 @@ type: docs |0637|Average of Levels in Binary Tree|[Go]({{< relref "/ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md" >}})|Easy| O(n)| O(n)||64.5%| |0653|Two Sum IV - Input is a BST|[Go]({{< relref "/ChapterFour/0653.Two-Sum-IV---Input-is-a-BST.md" >}})|Easy||||56.1%| |0662|Maximum Width of Binary Tree|[Go]({{< relref "/ChapterFour/0662.Maximum-Width-of-Binary-Tree.md" >}})|Medium||||40.0%| -|0684|Redundant Connection|[Go]({{< relref "/ChapterFour/0684.Redundant-Connection.md" >}})|Medium||||58.7%| +|0684|Redundant Connection|[Go]({{< relref "/ChapterFour/0684.Redundant-Connection.md" >}})|Medium||||58.8%| |0685|Redundant Connection II|[Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})|Hard||||32.9%| |0834|Sum of Distances in Tree|[Go]({{< relref "/ChapterFour/0834.Sum-of-Distances-in-Tree.md" >}})|Hard||||45.5%| |0863|All Nodes Distance K in Binary Tree|[Go]({{< relref "/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}})|Medium||||57.5%| @@ -59,9 +59,9 @@ type: docs |0968|Binary Tree Cameras|[Go]({{< relref "/ChapterFour/0968.Binary-Tree-Cameras.md" >}})|Hard||||38.5%| |0979|Distribute Coins in Binary Tree|[Go]({{< relref "/ChapterFour/0979.Distribute-Coins-in-Binary-Tree.md" >}})|Medium||||69.5%| |0993|Cousins in Binary Tree|[Go]({{< relref "/ChapterFour/0993.Cousins-in-Binary-Tree.md" >}})|Easy| O(n)| O(1)||52.2%| -|1026|Maximum Difference Between Node and Ancestor|[Go]({{< relref "/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}})|Medium||||69.1%| +|1026|Maximum Difference Between Node and Ancestor|[Go]({{< relref "/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}})|Medium||||69.2%| |1028|Recover a Tree From Preorder Traversal|[Go]({{< relref "/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md" >}})|Hard||||70.7%| -|1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||67.5%| +|1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||67.6%| |1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||67.8%| |1145|Binary Tree Coloring Game|[Go]({{< relref "/ChapterFour/1145.Binary-Tree-Coloring-Game.md" >}})|Medium||||51.4%| |1302|Deepest Leaves Sum|[Go]({{< relref "/ChapterFour/1302.Deepest-Leaves-Sum.md" >}})|Medium||||84.1%| diff --git a/website/content/ChapterTwo/Two_Pointers.md b/website/content/ChapterTwo/Two_Pointers.md index bc5beed2..39c922b8 100644 --- a/website/content/ChapterTwo/Two_Pointers.md +++ b/website/content/ChapterTwo/Two_Pointers.md @@ -39,13 +39,13 @@ type: docs |0019|Remove Nth Node From End of List|[Go]({{< relref "/ChapterFour/0019.Remove-Nth-Node-From-End-of-List.md" >}})|Medium| O(n)| O(1)||35.6%| |0026|Remove Duplicates from Sorted Array|[Go]({{< relref "/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md" >}})|Easy| O(n)| O(1)||46.3%| |0027|Remove Element|[Go]({{< relref "/ChapterFour/0027.Remove-Element.md" >}})|Easy| O(n)| O(1)||49.0%| -|0028|Implement strStr()|[Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})|Easy| O(n)| O(1)||35.0%| +|0028|Implement strStr()|[Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})|Easy| O(n)| O(1)||35.1%| |0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.0%| -|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|50.7%| +|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|50.8%| |0061|Rotate List|[Go]({{< relref "/ChapterFour/0061.Rotate-List.md" >}})|Medium| O(n)| O(1)||31.6%| |0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|48.9%| |0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|35.7%| -|0080|Remove Duplicates from Sorted Array II|[Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})|Medium| O(n)| O(1||45.8%| +|0080|Remove Duplicates from Sorted Array II|[Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})|Medium| O(n)| O(1||45.9%| |0086|Partition List|[Go]({{< relref "/ChapterFour/0086.Partition-List.md" >}})|Medium| O(n)| O(1)|❤️|43.0%| |0088|Merge Sorted Array|[Go]({{< relref "/ChapterFour/0088.Merge-Sorted-Array.md" >}})|Easy| O(n)| O(1)|❤️|40.6%| |0125|Valid Palindrome|[Go]({{< relref "/ChapterFour/0125.Valid-Palindrome.md" >}})|Easy| O(n)| O(1)||37.9%| @@ -55,7 +55,7 @@ type: docs |0209|Minimum Size Subarray Sum|[Go]({{< relref "/ChapterFour/0209.Minimum-Size-Subarray-Sum.md" >}})|Medium| O(n)| O(1)||39.2%| |0234|Palindrome Linked List|[Go]({{< relref "/ChapterFour/0234.Palindrome-Linked-List.md" >}})|Easy| O(n)| O(1)||40.2%| |0283|Move Zeroes|[Go]({{< relref "/ChapterFour/0283.Move-Zeroes.md" >}})|Easy| O(n)| O(1)||58.4%| -|0287|Find the Duplicate Number|[Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})|Medium| O(n)| O(1)|❤️|57.1%| +|0287|Find the Duplicate Number|[Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})|Medium| O(n)| O(1)|❤️|57.2%| |0344|Reverse String|[Go]({{< relref "/ChapterFour/0344.Reverse-String.md" >}})|Easy| O(n)| O(1)||70.0%| |0345|Reverse Vowels of a String|[Go]({{< relref "/ChapterFour/0345.Reverse-Vowels-of-a-String.md" >}})|Easy| O(n)| O(1)||44.9%| |0349|Intersection of Two Arrays|[Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})|Easy| O(n)| O(n) ||64.4%| @@ -80,11 +80,11 @@ type: docs |0930|Binary Subarrays With Sum|[Go]({{< relref "/ChapterFour/0930.Binary-Subarrays-With-Sum.md" >}})|Medium| O(n)| O(n) |❤️|44.3%| |0977|Squares of a Sorted Array|[Go]({{< relref "/ChapterFour/0977.Squares-of-a-Sorted-Array.md" >}})|Easy| O(n)| O(1)||72.3%| |0986|Interval List Intersections|[Go]({{< relref "/ChapterFour/0986.Interval-List-Intersections.md" >}})|Medium| O(n)| O(1)||68.1%| -|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n)|❤️|50.4%| +|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n)|❤️|50.5%| |1004|Max Consecutive Ones III|[Go]({{< relref "/ChapterFour/1004.Max-Consecutive-Ones-III.md" >}})|Medium| O(n)| O(1) ||60.5%| |1093|Statistics from a Large Sample|[Go]({{< relref "/ChapterFour/1093.Statistics-from-a-Large-Sample.md" >}})|Medium| O(n)| O(1) ||49.3%| |1234|Replace the Substring for Balanced String|[Go]({{< relref "/ChapterFour/1234.Replace-the-Substring-for-Balanced-String.md" >}})|Medium||||34.4%| -|1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.6%| +|1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.4%| |1695|Maximum Erasure Value|[Go]({{< relref "/ChapterFour/1695.Maximum-Erasure-Value.md" >}})|Medium||||49.5%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Union_Find.md b/website/content/ChapterTwo/Union_Find.md index 08b8323c..db9fd736 100644 --- a/website/content/ChapterTwo/Union_Find.md +++ b/website/content/ChapterTwo/Union_Find.md @@ -18,25 +18,25 @@ type: docs | No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance | |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | -|0128|Longest Consecutive Sequence|[Go]({{< relref "/ChapterFour/0128.Longest-Consecutive-Sequence.md" >}})|Hard| O(n)| O(n)|❤️|46.0%| +|0128|Longest Consecutive Sequence|[Go]({{< relref "/ChapterFour/0128.Longest-Consecutive-Sequence.md" >}})|Hard| O(n)| O(n)|❤️|46.1%| |0130|Surrounded Regions|[Go]({{< relref "/ChapterFour/0130.Surrounded-Regions.md" >}})|Medium| O(m\*n)| O(m\*n)||29.2%| |0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200.Number-of-Islands.md" >}})|Medium| O(m\*n)| O(m\*n)||48.6%| |0399|Evaluate Division|[Go]({{< relref "/ChapterFour/0399.Evaluate-Division.md" >}})|Medium| O(n)| O(n)||54.0%| |0547|Number of Provinces|[Go]({{< relref "/ChapterFour/0547.Number-of-Provinces.md" >}})|Medium| O(n^2)| O(n)||60.1%| -|0684|Redundant Connection|[Go]({{< relref "/ChapterFour/0684.Redundant-Connection.md" >}})|Medium| O(n)| O(n)||58.7%| +|0684|Redundant Connection|[Go]({{< relref "/ChapterFour/0684.Redundant-Connection.md" >}})|Medium| O(n)| O(n)||58.8%| |0685|Redundant Connection II|[Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})|Hard| O(n)| O(n)||32.9%| |0721|Accounts Merge|[Go]({{< relref "/ChapterFour/0721.Accounts-Merge.md" >}})|Medium| O(n)| O(n)|❤️|51.2%| |0765|Couples Holding Hands|[Go]({{< relref "/ChapterFour/0765.Couples-Holding-Hands.md" >}})|Hard| O(n)| O(n)|❤️|55.3%| |0778|Swim in Rising Water|[Go]({{< relref "/ChapterFour/0778.Swim-in-Rising-Water.md" >}})|Hard| O(n^2)| O(n)|❤️|54.4%| -|0803|Bricks Falling When Hit|[Go]({{< relref "/ChapterFour/0803.Bricks-Falling-When-Hit.md" >}})|Hard| O(n^2)| O(n)|❤️|31.2%| -|0839|Similar String Groups|[Go]({{< relref "/ChapterFour/0839.Similar-String-Groups.md" >}})|Hard| O(n^2)| O(n)||40.0%| +|0803|Bricks Falling When Hit|[Go]({{< relref "/ChapterFour/0803.Bricks-Falling-When-Hit.md" >}})|Hard| O(n^2)| O(n)|❤️|31.3%| +|0839|Similar String Groups|[Go]({{< relref "/ChapterFour/0839.Similar-String-Groups.md" >}})|Hard| O(n^2)| O(n)||40.1%| |0924|Minimize Malware Spread|[Go]({{< relref "/ChapterFour/0924.Minimize-Malware-Spread.md" >}})|Hard| O(m\*n)| O(n)||41.8%| |0928|Minimize Malware Spread II|[Go]({{< relref "/ChapterFour/0928.Minimize-Malware-Spread-II.md" >}})|Hard| O(m\*n)| O(n)|❤️|41.2%| |0947|Most Stones Removed with Same Row or Column|[Go]({{< relref "/ChapterFour/0947.Most-Stones-Removed-with-Same-Row-or-Column.md" >}})|Medium| O(n)| O(n)||55.4%| |0952|Largest Component Size by Common Factor|[Go]({{< relref "/ChapterFour/0952.Largest-Component-Size-by-Common-Factor.md" >}})|Hard| O(n)| O(n)|❤️|36.1%| -|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0959.Regions-Cut-By-Slashes.md" >}})|Medium| O(n^2)| O(n^2)|❤️|66.8%| -|0990|Satisfiability of Equality Equations|[Go]({{< relref "/ChapterFour/0990.Satisfiability-of-Equality-Equations.md" >}})|Medium| O(n)| O(n)||46.4%| -|1202|Smallest String With Swaps|[Go]({{< relref "/ChapterFour/1202.Smallest-String-With-Swaps.md" >}})|Medium||||48.3%| +|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0959.Regions-Cut-By-Slashes.md" >}})|Medium| O(n^2)| O(n^2)|❤️|66.9%| +|0990|Satisfiability of Equality Equations|[Go]({{< relref "/ChapterFour/0990.Satisfiability-of-Equality-Equations.md" >}})|Medium| O(n)| O(n)||46.5%| +|1202|Smallest String With Swaps|[Go]({{< relref "/ChapterFour/1202.Smallest-String-With-Swaps.md" >}})|Medium||||48.4%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 60a9f27c..c80d2474 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -561,6 +561,7 @@ headless: true - [1539.Kth-Missing-Positive-Number]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}}) - [1573.Number-of-Ways-to-Split-a-String]({{< relref "/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md" >}}) - [1640.Check-Array-Formation-Through-Concatenation]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}}) + - [1641.Count-Sorted-Vowel-Strings]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}}) - [1646.Get-Maximum-in-Generated-Array]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}}) - [1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}}) - [1648.Sell-Diminishing-Valued-Colored-Balls]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}}) From ff570474b3e498ccaa3ddc4ae922e611181a666d Mon Sep 17 00:00:00 2001 From: YDZ Date: Mon, 18 Jan 2021 18:13:30 +0800 Subject: [PATCH 80/82] Add solution 1203 --- README.md | 288 +++++++++--------- ...Items by Groups Respecting Dependencies.go | 123 ++++++++ ... by Groups Respecting Dependencies_test.go | 50 +++ .../README.md | 191 ++++++++++++ .../1202.Smallest-String-With-Swaps.md | 2 +- ...Items-by-Groups-Respecting-Dependencies.md | 198 ++++++++++++ .../1207.Unique-Number-of-Occurrences.md | 2 +- website/content/ChapterTwo/Array.md | 12 +- website/content/ChapterTwo/Backtracking.md | 2 +- website/content/ChapterTwo/Binary_Search.md | 4 +- .../content/ChapterTwo/Bit_Manipulation.md | 4 +- .../content/ChapterTwo/Depth_First_Search.md | 10 +- .../content/ChapterTwo/Dynamic_Programming.md | 6 +- website/content/ChapterTwo/Hash_Table.md | 10 +- website/content/ChapterTwo/Linked_List.md | 2 +- website/content/ChapterTwo/Math.md | 6 +- website/content/ChapterTwo/Sort.md | 4 +- website/content/ChapterTwo/Stack.md | 6 +- website/content/ChapterTwo/String.md | 6 +- website/content/ChapterTwo/Tree.md | 6 +- website/content/menu/index.md | 1 + 21 files changed, 748 insertions(+), 185 deletions(-) create mode 100644 leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies.go create mode 100644 leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies_test.go create mode 100644 leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md create mode 100644 website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md diff --git a/README.md b/README.md index 748aac45..9b420742 100755 --- a/README.md +++ b/README.md @@ -125,16 +125,16 @@ | | Easy | Medium | Hard | Total | |:--------:|:--------:|:--------:|:--------:|:--------:| -|Optimizing|39|44|16|99| +|Optimizing|39|44|15|98| |Accepted|**250**|**315**|**95**|**660**| |Total|459|903|367|1729| -|Perfection Rate|84.4%|86.0%|83.2%|85.0%| +|Perfection Rate|84.4%|86.0%|84.2%|85.2%| |Completion Rate|54.5%|34.9%|25.9%|38.2%| |------------|----------------------------|----------------------------|----------------------------|----------------------------| ## 二. 目录 -以下已经收录了 561 道题的题解,还有 12 道题在尝试优化到 beats 100% +以下已经收录了 562 道题的题解,还有 11 道题在尝试优化到 beats 100% | No. | Title | Solution | Acceptance | Difficulty | Frequency | |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| @@ -186,7 +186,7 @@ |0046|Permutations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0046.Permutations)|66.1%|Medium|| |0047|Permutations II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0047.Permutations-II)|49.0%|Medium|| |0048|Rotate Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0048.Rotate-Image)|59.4%|Medium|| -|0049|Group Anagrams|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams)|58.8%|Medium|| +|0049|Group Anagrams|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams)|58.9%|Medium|| |0050|Pow(x, n)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0050.Pow(x,-n))|30.8%|Medium|| |0051|N-Queens|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0051.N-Queens)|49.1%|Hard|| |0052|N-Queens II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0052.N-Queens-II)|59.7%|Hard|| @@ -242,7 +242,7 @@ |0102|Binary Tree Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0102.Binary-Tree-Level-Order-Traversal)|56.2%|Medium|| |0103|Binary Tree Zigzag Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal)|49.8%|Medium|| |0104|Maximum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0104.Maximum-Depth-of-Binary-Tree)|67.7%|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)|51.2%|Medium|| +|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)|51.3%|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)|49.2%|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)|54.9%|Easy|| |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)|60.0%|Easy|| @@ -308,7 +308,7 @@ |0168|Excel Sheet Column Title|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0168.Excel-Sheet-Column-Title)|31.6%|Easy|| |0169|Majority Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0169.Majority-Element)|59.9%|Easy|| |0170|Two Sum III - Data structure design||34.7%|Easy|| -|0171|Excel Sheet Column Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0171.Excel-Sheet-Column-Number)|56.8%|Easy|| +|0171|Excel Sheet Column Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0171.Excel-Sheet-Column-Number)|56.7%|Easy|| |0172|Factorial Trailing Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0172.Factorial-Trailing-Zeroes)|38.4%|Easy|| |0173|Binary Search Tree Iterator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0173.Binary-Search-Tree-Iterator)|59.6%|Medium|| |0174|Dungeon Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0174.Dungeon-Game)|33.2%|Hard|| @@ -419,7 +419,7 @@ |0279|Perfect Squares||48.6%|Medium|| |0280|Wiggle Sort||64.5%|Medium|| |0281|Zigzag Iterator||59.2%|Medium|| -|0282|Expression Add Operators||36.5%|Hard|| +|0282|Expression Add Operators||36.6%|Hard|| |0283|Move Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0283.Move-Zeroes)|58.4%|Easy|| |0284|Peeking Iterator||47.4%|Medium|| |0285|Inorder Successor in BST||42.4%|Medium|| @@ -466,7 +466,7 @@ |0326|Power of Three|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0326.Power-of-Three)|42.1%|Easy|| |0327|Count of Range Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0327.Count-of-Range-Sum)|35.9%|Hard|| |0328|Odd Even Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0328.Odd-Even-Linked-List)|56.9%|Medium|| -|0329|Longest Increasing Path in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0329.Longest-Increasing-Path-in-a-Matrix)|44.4%|Hard|| +|0329|Longest Increasing Path in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0329.Longest-Increasing-Path-in-a-Matrix)|44.5%|Hard|| |0330|Patching Array||34.9%|Hard|| |0331|Verify Preorder Serialization of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree)|40.9%|Medium|| |0332|Reconstruct Itinerary||37.7%|Medium|| @@ -492,7 +492,7 @@ |0352|Data Stream as Disjoint Intervals||48.4%|Hard|| |0353|Design Snake Game||35.2%|Medium|| |0354|Russian Doll Envelopes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0354.Russian-Doll-Envelopes)|36.1%|Hard|| -|0355|Design Twitter||31.1%|Medium|| +|0355|Design Twitter||31.2%|Medium|| |0356|Line Reflection||32.7%|Medium|| |0357|Count Numbers with Unique Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0357.Count-Numbers-with-Unique-Digits)|48.8%|Medium|| |0358|Rearrange String k Distance Apart||35.5%|Hard|| @@ -501,7 +501,7 @@ |0361|Bomb Enemy||46.5%|Medium|| |0362|Design Hit Counter||65.0%|Medium|| |0363|Max Sum of Rectangle No Larger Than K||38.3%|Hard|| -|0364|Nested List Weight Sum II||63.4%|Medium|| +|0364|Nested List Weight Sum II||63.5%|Medium|| |0365|Water and Jug Problem||31.0%|Medium|| |0366|Find Leaves of Binary Tree||71.6%|Medium|| |0367|Valid Perfect Square|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0367.Valid-Perfect-Square)|42.0%|Easy|| @@ -542,11 +542,11 @@ |0402|Remove K Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0402.Remove-K-Digits)|28.6%|Medium|| |0403|Frog Jump||41.1%|Hard|| |0404|Sum of Left Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0404.Sum-of-Left-Leaves)|52.2%|Easy|| -|0405|Convert a Number to Hexadecimal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0405.Convert-a-Number-to-Hexadecimal)|44.3%|Easy|| +|0405|Convert a Number to Hexadecimal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0405.Convert-a-Number-to-Hexadecimal)|44.4%|Easy|| |0406|Queue Reconstruction by Height||68.1%|Medium|| |0407|Trapping Rain Water II||43.8%|Hard|| |0408|Valid Word Abbreviation||31.3%|Easy|| -|0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.1%|Easy|| +|0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.2%|Easy|| |0410|Split Array Largest Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0410.Split-Array-Largest-Sum)|46.1%|Hard|| |0411|Minimum Unique Word Abbreviation||37.0%|Hard|| |0412|Fizz Buzz|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0412.Fizz-Buzz)|63.5%|Easy|| @@ -565,7 +565,7 @@ |0425|Word Squares||49.9%|Hard|| |0426|Convert Binary Search Tree to Sorted Doubly Linked List||60.8%|Medium|| |0427|Construct Quad Tree||62.4%|Medium|| -|0428|Serialize and Deserialize N-ary Tree||61.1%|Hard|| +|0428|Serialize and Deserialize N-ary Tree||61.2%|Hard|| |0429|N-ary Tree Level Order Traversal||66.4%|Medium|| |0430|Flatten a Multilevel Doubly Linked List||56.6%|Medium|| |0431|Encode N-ary Tree to Binary Tree||74.4%|Hard|| @@ -609,9 +609,9 @@ |0469|Convex Polygon||37.4%|Medium|| |0470|Implement Rand10() Using Rand7()|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0470.Implement-Rand10()-Using-Rand7())|46.0%|Medium|| |0471|Encode String with Shortest Length||48.9%|Hard|| -|0472|Concatenated Words||44.6%|Hard|| +|0472|Concatenated Words||44.5%|Hard|| |0473|Matchsticks to Square||38.1%|Medium|| -|0474|Ones and Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0474.Ones-and-Zeroes)|43.4%|Medium|| +|0474|Ones and Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0474.Ones-and-Zeroes)|43.5%|Medium|| |0475|Heaters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0475.Heaters)|33.5%|Medium|| |0476|Number Complement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0476.Number-Complement)|65.1%|Easy|| |0477|Total Hamming Distance|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0477.Total-Hamming-Distance)|50.6%|Medium|| @@ -626,7 +626,7 @@ |0486|Predict the Winner||48.4%|Medium|| |0487|Max Consecutive Ones II||47.9%|Medium|| |0488|Zuma Game||38.6%|Hard|| -|0489|Robot Room Cleaner||72.1%|Hard|| +|0489|Robot Room Cleaner||72.2%|Hard|| |0490|The Maze||52.6%|Medium|| |0491|Increasing Subsequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0491.Increasing-Subsequences)|47.3%|Medium|| |0492|Construct the Rectangle||50.2%|Easy|| @@ -634,15 +634,15 @@ |0494|Target Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0494.Target-Sum)|45.8%|Medium|| |0495|Teemo Attacking||56.1%|Medium|| |0496|Next Greater Element I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0496.Next-Greater-Element-I)|65.2%|Easy|| -|0497|Random Point in Non-overlapping Rectangles|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles)|39.1%|Medium|| +|0497|Random Point in Non-overlapping Rectangles|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles)|39.0%|Medium|| |0498|Diagonal Traverse|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0498.Diagonal-Traverse)|50.1%|Medium|| |0499|The Maze III||42.2%|Hard|| |0500|Keyboard Row|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0500.Keyboard-Row)|65.5%|Easy|| |0501|Find Mode in Binary Search Tree||43.2%|Easy|| |0502|IPO||41.3%|Hard|| -|0503|Next Greater Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0503.Next-Greater-Element-II)|58.1%|Medium|| +|0503|Next Greater Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0503.Next-Greater-Element-II)|58.2%|Medium|| |0504|Base 7||46.4%|Easy|| -|0505|The Maze II||48.3%|Medium|| +|0505|The Maze II||48.4%|Medium|| |0506|Relative Ranks||51.1%|Easy|| |0507|Perfect Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0507.Perfect-Number)|36.0%|Easy|| |0508|Most Frequent Subtree Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0508.Most-Frequent-Subtree-Sum)|58.9%|Medium|| @@ -671,7 +671,7 @@ |0531|Lonely Pixel I||59.4%|Medium|| |0532|K-diff Pairs in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0532.K-diff-Pairs-in-an-Array)|34.9%|Medium|| |0533|Lonely Pixel II||48.0%|Medium|| -|0534|Game Play Analysis III||78.6%|Medium|| +|0534|Game Play Analysis III||78.7%|Medium|| |0535|Encode and Decode TinyURL||80.7%|Medium|| |0536|Construct Binary Tree from String||50.4%|Medium|| |0537|Complex Number Multiplication|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0537.Complex-Number-Multiplication)|68.3%|Medium|| @@ -697,10 +697,10 @@ |0557|Reverse Words in a String III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0557.Reverse-Words-in-a-String-III)|71.6%|Easy|| |0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.5%|Medium|| |0559|Maximum Depth of N-ary Tree||69.4%|Easy|| -|0560|Subarray Sum Equals K||43.8%|Medium|| +|0560|Subarray Sum Equals K||43.9%|Medium|| |0561|Array Partition I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0561.Array-Partition-I)|72.9%|Easy|| |0562|Longest Line of Consecutive One in Matrix||46.2%|Medium|| -|0563|Binary Tree Tilt|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0563.Binary-Tree-Tilt)|52.6%|Easy|| +|0563|Binary Tree Tilt|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0563.Binary-Tree-Tilt)|52.7%|Easy|| |0564|Find the Closest Palindrome||20.2%|Hard|| |0565|Array Nesting||55.9%|Medium|| |0566|Reshape the Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0566.Reshape-the-Matrix)|61.0%|Easy|| @@ -768,12 +768,12 @@ |0628|Maximum Product of Three Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0628.Maximum-Product-of-Three-Numbers)|47.0%|Easy|| |0629|K Inverse Pairs Array||31.6%|Hard|| |0630|Course Schedule III||33.7%|Hard|| -|0631|Design Excel Sum Formula||32.1%|Hard|| +|0631|Design Excel Sum Formula||32.0%|Hard|| |0632|Smallest Range Covering Elements from K Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists)|53.9%|Hard|| |0633|Sum of Square Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0633.Sum-of-Square-Numbers)|32.4%|Medium|| |0634|Find the Derangement of An Array||40.4%|Medium|| |0635|Design Log Storage System||59.5%|Medium|| -|0636|Exclusive Time of Functions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0636.Exclusive-Time-of-Functions)|53.9%|Medium|| +|0636|Exclusive Time of Functions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0636.Exclusive-Time-of-Functions)|54.0%|Medium|| |0637|Average of Levels in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0637.Average-of-Levels-in-Binary-Tree)|64.5%|Easy|| |0638|Shopping Offers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0638.Shopping-Offers)|52.6%|Medium|| |0639|Decode Ways II||27.5%|Hard|| @@ -792,7 +792,7 @@ |0652|Find Duplicate Subtrees||52.0%|Medium|| |0653|Two Sum IV - Input is a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0653.Two-Sum-IV---Input-is-a-BST)|56.1%|Easy|| |0654|Maximum Binary Tree||80.9%|Medium|| -|0655|Print Binary Tree||55.8%|Medium|| +|0655|Print Binary Tree||55.9%|Medium|| |0656|Coin Path||29.5%|Hard|| |0657|Robot Return to Origin||73.6%|Easy|| |0658|Find K Closest Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0658.Find-K-Closest-Elements)|41.8%|Medium|| @@ -834,7 +834,7 @@ |0694|Number of Distinct Islands||57.4%|Medium|| |0695|Max Area of Island|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0695.Max-Area-of-Island)|64.3%|Medium|| |0696|Count Binary Substrings||57.3%|Easy|| -|0697|Degree of an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0697.Degree-of-an-Array)|54.3%|Easy|| +|0697|Degree of an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0697.Degree-of-an-Array)|54.4%|Easy|| |0698|Partition to K Equal Sum Subsets||45.5%|Medium|| |0699|Falling Squares|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0699.Falling-Squares)|42.4%|Hard|| |0700|Search in a Binary Search Tree||73.4%|Easy|| @@ -860,7 +860,7 @@ |0720|Longest Word in Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0720.Longest-Word-in-Dictionary)|49.1%|Easy|| |0721|Accounts Merge|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0721.Accounts-Merge)|51.2%|Medium|| |0722|Remove Comments||35.8%|Medium|| -|0723|Candy Crush||72.3%|Medium|| +|0723|Candy Crush||72.4%|Medium|| |0724|Find Pivot Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0724.Find-Pivot-Index)|45.0%|Easy|| |0725|Split Linked List in Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0725.Split-Linked-List-in-Parts)|52.8%|Medium|| |0726|Number of Atoms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0726.Number-of-Atoms)|51.0%|Hard|| @@ -895,11 +895,11 @@ |0755|Pour Water||44.0%|Medium|| |0756|Pyramid Transition Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0756.Pyramid-Transition-Matrix)|55.5%|Medium|| |0757|Set Intersection Size At Least Two||42.1%|Hard|| -|0758|Bold Words in String||47.1%|Easy|| +|0758|Bold Words in String||47.2%|Easy|| |0759|Employee Free Time||67.9%|Hard|| |0760|Find Anagram Mappings||81.7%|Easy|| |0761|Special Binary String||58.5%|Hard|| -|0762|Prime Number of Set Bits in Binary Representation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation)|64.1%|Easy|| +|0762|Prime Number of Set Bits in Binary Representation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation)|64.2%|Easy|| |0763|Partition Labels|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0763.Partition-Labels)|77.9%|Medium|| |0764|Largest Plus Sign||46.3%|Medium|| |0765|Couples Holding Hands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0765.Couples-Holding-Hands)|55.3%|Hard|| @@ -943,8 +943,8 @@ |0803|Bricks Falling When Hit|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0803.Bricks-Falling-When-Hit)|31.3%|Hard|| |0804|Unique Morse Code Words||78.8%|Easy|| |0805|Split Array With Same Average||26.7%|Hard|| -|0806|Number of Lines To Write String||65.4%|Easy|| -|0807|Max Increase to Keep City Skyline||84.2%|Medium|| +|0806|Number of Lines To Write String||65.5%|Easy|| +|0807|Max Increase to Keep City Skyline||84.3%|Medium|| |0808|Soup Servings||40.8%|Medium|| |0809|Expressive Words||46.6%|Medium|| |0810|Chalkboard XOR Game||49.4%|Hard|| @@ -966,7 +966,7 @@ |0826|Most Profit Assigning Work|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0826.Most-Profit-Assigning-Work)|38.9%|Medium|| |0827|Making A Large Island||47.1%|Hard|| |0828|Count Unique Characters of All Substrings of a Given String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String)|46.8%|Hard|| -|0829|Consecutive Numbers Sum||39.4%|Hard|| +|0829|Consecutive Numbers Sum||39.3%|Hard|| |0830|Positions of Large Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0830.Positions-of-Large-Groups)|50.2%|Easy|| |0831|Masking Personal Information||44.7%|Medium|| |0832|Flipping an Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0832.Flipping-an-Image)|77.9%|Easy|| @@ -996,14 +996,14 @@ |0856|Score of Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0856.Score-of-Parentheses)|62.2%|Medium|| |0857|Minimum Cost to Hire K Workers||50.3%|Hard|| |0858|Mirror Reflection||59.5%|Medium|| -|0859|Buddy Strings||29.7%|Easy|| -|0860|Lemonade Change||51.8%|Easy|| +|0859|Buddy Strings||29.6%|Easy|| +|0860|Lemonade Change||51.9%|Easy|| |0861|Score After Flipping Matrix||73.4%|Medium|| |0862|Shortest Subarray with Sum at Least K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K)|25.1%|Hard|| |0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|57.5%|Medium|| |0864|Shortest Path to Get All Keys|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0864.Shortest-Path-to-Get-All-Keys)|41.5%|Hard|| |0865|Smallest Subtree with all the Deepest Nodes||64.6%|Medium|| -|0866|Prime Palindrome||25.0%|Medium|| +|0866|Prime Palindrome||25.1%|Medium|| |0867|Transpose Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0867.Transpose-Matrix)|62.2%|Easy|| |0868|Binary Gap||60.8%|Easy|| |0869|Reordered Power of 2||54.1%|Medium|| @@ -1031,8 +1031,8 @@ |0891|Sum of Subsequence Widths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0891.Sum-of-Subsequence-Widths)|32.8%|Hard|| |0892|Surface Area of 3D Shapes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0892.Surface-Area-of-3D-Shapes)|59.6%|Easy|| |0893|Groups of Special-Equivalent Strings||68.2%|Easy|| -|0894|All Possible Full Binary Trees||76.9%|Medium|| -|0895|Maximum Frequency Stack|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0895.Maximum-Frequency-Stack)|62.1%|Hard|| +|0894|All Possible Full Binary Trees||77.0%|Medium|| +|0895|Maximum Frequency Stack|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0895.Maximum-Frequency-Stack)|62.2%|Hard|| |0896|Monotonic Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0896.Monotonic-Array)|58.0%|Easy|| |0897|Increasing Order Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0897.Increasing-Order-Search-Tree)|74.3%|Easy|| |0898|Bitwise ORs of Subarrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0898.Bitwise-ORs-of-Subarrays)|34.0%|Medium|| @@ -1042,7 +1042,7 @@ |0902|Numbers At Most N Given Digit Set||36.1%|Hard|| |0903|Valid Permutations for DI Sequence||54.1%|Hard|| |0904|Fruit Into Baskets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets)|42.9%|Medium|| -|0905|Sort Array By Parity||74.9%|Easy|| +|0905|Sort Array By Parity||75.0%|Easy|| |0906|Super Palindromes||32.9%|Hard|| |0907|Sum of Subarray Minimums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0907.Sum-of-Subarray-Minimums)|33.2%|Medium|| |0908|Smallest Range I||66.4%|Easy|| @@ -1082,7 +1082,7 @@ |0942|DI String Match|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0942.DI-String-Match)|73.4%|Easy|| |0943|Find the Shortest Superstring||43.5%|Hard|| |0944|Delete Columns to Make Sorted||71.1%|Easy|| -|0945|Minimum Increment to Make Array Unique||46.6%|Medium|| +|0945|Minimum Increment to Make Array Unique||46.7%|Medium|| |0946|Validate Stack Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0946.Validate-Stack-Sequences)|63.4%|Medium|| |0947|Most Stones Removed with Same Row or Column|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0947.Most-Stones-Removed-with-Same-Row-or-Column)|55.4%|Medium|| |0948|Bag of Tokens||46.1%|Medium|| @@ -1102,7 +1102,7 @@ |0962|Maximum Width Ramp||46.3%|Medium|| |0963|Minimum Area Rectangle II||51.7%|Medium|| |0964|Least Operators to Express Number||44.9%|Hard|| -|0965|Univalued Binary Tree||67.7%|Easy|| +|0965|Univalued Binary Tree||67.8%|Easy|| |0966|Vowel Spellchecker||47.7%|Medium|| |0967|Numbers With Same Consecutive Differences||44.5%|Medium|| |0968|Binary Tree Cameras|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0968.Binary-Tree-Cameras)|38.5%|Hard|| @@ -1174,13 +1174,13 @@ |1034|Coloring A Border||45.5%|Medium|| |1035|Uncrossed Lines||56.0%|Medium|| |1036|Escape a Large Maze||34.8%|Hard|| -|1037|Valid Boomerang|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1037.Valid-Boomerang)|37.8%|Easy|| +|1037|Valid Boomerang|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1037.Valid-Boomerang)|37.9%|Easy|| |1038|Binary Search Tree to Greater Sum Tree||82.0%|Medium|| |1039|Minimum Score Triangulation of Polygon||50.0%|Medium|| |1040|Moving Stones Until Consecutive II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1040.Moving-Stones-Until-Consecutive-II)|53.9%|Medium|| |1041|Robot Bounded In Circle||54.7%|Medium|| |1042|Flower Planting With No Adjacent||48.7%|Medium|| -|1043|Partition Array for Maximum Sum||66.8%|Medium|| +|1043|Partition Array for Maximum Sum||66.7%|Medium|| |1044|Longest Duplicate Substring||31.5%|Hard|| |1045|Customers Who Bought All Products||68.3%|Medium|| |1046|Last Stone Weight||62.4%|Easy|| @@ -1188,7 +1188,7 @@ |1048|Longest String Chain||55.3%|Medium|| |1049|Last Stone Weight II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II)|45.0%|Medium|| |1050|Actors and Directors Who Cooperated At Least Three Times||72.1%|Easy|| -|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.8%|Easy|| +|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.9%|Easy|| |1052|Grumpy Bookstore Owner|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1052.Grumpy-Bookstore-Owner)|55.7%|Medium|| |1053|Previous Permutation With One Swap||50.8%|Medium|| |1054|Distant Barcodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1054.Distant-Barcodes)|44.2%|Medium|| @@ -1196,14 +1196,14 @@ |1056|Confusing Number||47.1%|Easy|| |1057|Campus Bikes||57.6%|Medium|| |1058|Minimize Rounding Error to Meet Target||43.2%|Medium|| -|1059|All Paths from Source Lead to Destination||43.3%|Medium|| +|1059|All Paths from Source Lead to Destination||43.2%|Medium|| |1060|Missing Element in Sorted Array||54.7%|Medium|| -|1061|Lexicographically Smallest Equivalent String||66.6%|Medium|| +|1061|Lexicographically Smallest Equivalent String||66.7%|Medium|| |1062|Longest Repeating Substring||58.0%|Medium|| |1063|Number of Valid Subarrays||72.2%|Hard|| -|1064|Fixed Point||65.5%|Easy|| +|1064|Fixed Point||65.4%|Easy|| |1065|Index Pairs of a String||61.0%|Easy|| -|1066|Campus Bikes II||54.1%|Medium|| +|1066|Campus Bikes II||54.0%|Medium|| |1067|Digit Count in Range||41.0%|Hard|| |1068|Product Sales Analysis I||82.3%|Easy|| |1069|Product Sales Analysis II||83.2%|Easy|| @@ -1230,15 +1230,15 @@ |1090|Largest Values From Labels||60.1%|Medium|| |1091|Shortest Path in Binary Matrix||39.0%|Medium|| |1092|Shortest Common Supersequence ||52.8%|Hard|| -|1093|Statistics from a Large Sample|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1093.Statistics-from-a-Large-Sample)|49.4%|Medium|| +|1093|Statistics from a Large Sample|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1093.Statistics-from-a-Large-Sample)|49.3%|Medium|| |1094|Car Pooling||59.0%|Medium|| |1095|Find in Mountain Array||36.0%|Hard|| |1096|Brace Expansion II||62.4%|Hard|| -|1097|Game Play Analysis V||56.4%|Hard|| +|1097|Game Play Analysis V||56.3%|Hard|| |1098|Unpopular Books||45.5%|Medium|| |1099|Two Sum Less Than K||60.8%|Easy|| |1100|Find K-Length Substrings With No Repeated Characters||73.2%|Medium|| -|1101|The Earliest Moment When Everyone Become Friends||67.5%|Medium|| +|1101|The Earliest Moment When Everyone Become Friends||67.6%|Medium|| |1102|Path With Maximum Minimum Value||50.2%|Medium|| |1103|Distribute Candies to People||63.6%|Easy|| |1104|Path In Zigzag Labelled Binary Tree||73.0%|Medium|| @@ -1252,7 +1252,7 @@ |1112|Highest Grade For Each Student||71.7%|Medium|| |1113|Reported Posts||65.4%|Easy|| |1114|Print in Order||67.0%|Easy|| -|1115|Print FooBar Alternately||59.0%|Medium|| +|1115|Print FooBar Alternately||59.1%|Medium|| |1116|Print Zero Even Odd||57.6%|Medium|| |1117|Building H2O||53.2%|Medium|| |1118|Number of Days in a Month||57.5%|Easy|| @@ -1260,7 +1260,7 @@ |1120|Maximum Average Subtree||63.5%|Medium|| |1121|Divide Array Into Increasing Sequences||57.9%|Hard|| |1122|Relative Sort Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1122.Relative-Sort-Array)|67.7%|Easy|| -|1123|Lowest Common Ancestor of Deepest Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves)|67.8%|Medium|| +|1123|Lowest Common Ancestor of Deepest Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves)|67.9%|Medium|| |1124|Longest Well-Performing Interval||33.2%|Medium|| |1125|Smallest Sufficient Team||47.0%|Hard|| |1126|Active Businesses||68.7%|Medium|| @@ -1289,7 +1289,7 @@ |1149|Article Views II||48.4%|Medium|| |1150|Check If a Number Is Majority Element in a Sorted Array||57.9%|Easy|| |1151|Minimum Swaps to Group All 1's Together||58.2%|Medium|| -|1152|Analyze User Website Visit Pattern||43.3%|Medium|| +|1152|Analyze User Website Visit Pattern||43.4%|Medium|| |1153|String Transforms Into Another String||36.0%|Hard|| |1154|Day of the Year|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1154.Day-of-the-Year)|49.3%|Easy|| |1155|Number of Dice Rolls With Target Sum||47.5%|Medium|| @@ -1301,12 +1301,12 @@ |1161|Maximum Level Sum of a Binary Tree||70.1%|Medium|| |1162|As Far from Land as Possible||45.0%|Medium|| |1163|Last Substring in Lexicographical Order||36.3%|Hard|| -|1164|Product Price at a Given Date||68.0%|Medium|| +|1164|Product Price at a Given Date||68.1%|Medium|| |1165|Single-Row Keyboard||84.8%|Easy|| |1166|Design File System||58.3%|Medium|| |1167|Minimum Cost to Connect Sticks||64.2%|Medium|| |1168|Optimize Water Distribution in a Village||62.1%|Hard|| -|1169|Invalid Transactions||31.6%|Medium|| +|1169|Invalid Transactions||31.5%|Medium|| |1170|Compare Strings by Frequency of the Smallest Character|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character)|59.5%|Easy|| |1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List)|41.4%|Medium|| |1172|Dinner Plate Stacks||37.8%|Hard|| @@ -1324,15 +1324,15 @@ |1184|Distance Between Bus Stops|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1184.Distance-Between-Bus-Stops)|54.1%|Easy|| |1185|Day of the Week|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week)|61.9%|Easy|| |1186|Maximum Subarray Sum with One Deletion||38.5%|Medium|| -|1187|Make Array Strictly Increasing||41.6%|Hard|| -|1188|Design Bounded Blocking Queue||72.6%|Medium|| +|1187|Make Array Strictly Increasing||41.7%|Hard|| +|1188|Design Bounded Blocking Queue||72.5%|Medium|| |1189|Maximum Number of Balloons|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1189.Maximum-Number-of-Balloons)|61.8%|Easy|| |1190|Reverse Substrings Between Each Pair of Parentheses||64.0%|Medium|| |1191|K-Concatenation Maximum Sum||25.4%|Medium|| |1192|Critical Connections in a Network||49.9%|Hard|| |1193|Monthly Transactions I||69.1%|Medium|| |1194|Tournament Winners||52.2%|Hard|| -|1195|Fizz Buzz Multithreaded||70.4%|Medium|| +|1195|Fizz Buzz Multithreaded||70.5%|Medium|| |1196|How Many Apples Can You Put into the Basket||68.2%|Easy|| |1197|Minimum Knight Moves||37.1%|Medium|| |1198|Find Smallest Common Element in All Rows||75.2%|Medium|| @@ -1340,14 +1340,14 @@ |1200|Minimum Absolute Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1200.Minimum-Absolute-Difference)|66.8%|Easy|| |1201|Ugly Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1201.Ugly-Number-III)|26.3%|Medium|| |1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|48.4%|Medium|| -|1203|Sort Items by Groups Respecting Dependencies||49.0%|Hard|| +|1203|Sort Items by Groups Respecting Dependencies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies)|49.1%|Hard|| |1204|Last Person to Fit in the Elevator||71.5%|Medium|| |1205|Monthly Transactions II||45.9%|Medium|| -|1206|Design Skiplist||58.9%|Hard|| +|1206|Design Skiplist||59.0%|Hard|| |1207|Unique Number of Occurrences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1207.Unique-Number-of-Occurrences)|71.6%|Easy|| |1208|Get Equal Substrings Within Budget|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1208.Get-Equal-Substrings-Within-Budget)|43.6%|Medium|| |1209|Remove All Adjacent Duplicates in String II||57.3%|Medium|| -|1210|Minimum Moves to Reach Target with Rotations||46.2%|Hard|| +|1210|Minimum Moves to Reach Target with Rotations||46.3%|Hard|| |1211|Queries Quality and Percentage||69.8%|Easy|| |1212|Team Scores in Football Tournament||56.7%|Medium|| |1213|Intersection of Three Sorted Arrays||79.2%|Easy|| @@ -1363,16 +1363,16 @@ |1223|Dice Roll Simulation||46.7%|Medium|| |1224|Maximum Equal Frequency||34.5%|Hard|| |1225|Report Contiguous Dates||62.4%|Hard|| -|1226|The Dining Philosophers||59.8%|Medium|| -|1227|Airplane Seat Assignment Probability||62.0%|Medium|| +|1226|The Dining Philosophers||59.7%|Medium|| +|1227|Airplane Seat Assignment Probability||62.1%|Medium|| |1228|Missing Number In Arithmetic Progression||51.6%|Easy|| -|1229|Meeting Scheduler||54.2%|Medium|| +|1229|Meeting Scheduler||54.3%|Medium|| |1230|Toss Strange Coins||49.7%|Medium|| |1231|Divide Chocolate||53.3%|Hard|| |1232|Check If It Is a Straight Line|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1232.Check-If-It-Is-a-Straight-Line)|43.8%|Easy|| |1233|Remove Sub-Folders from the Filesystem||61.7%|Medium|| |1234|Replace the Substring for Balanced String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1234.Replace-the-Substring-for-Balanced-String)|34.4%|Medium|| -|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|46.9%|Hard|| +|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|47.0%|Hard|| |1236|Web Crawler||64.5%|Medium|| |1237|Find Positive Integer Solution for a Given Equation||69.7%|Easy|| |1238|Circular Permutation in Binary Representation||65.8%|Medium|| @@ -1383,8 +1383,8 @@ |1243|Array Transformation||50.3%|Easy|| |1244|Design A Leaderboard||65.9%|Medium|| |1245|Tree Diameter||61.2%|Medium|| -|1246|Palindrome Removal||45.7%|Hard|| -|1247|Minimum Swaps to Make Strings Equal||62.4%|Medium|| +|1246|Palindrome Removal||45.8%|Hard|| +|1247|Minimum Swaps to Make Strings Equal||62.3%|Medium|| |1248|Count Number of Nice Subarrays||56.3%|Medium|| |1249|Minimum Remove to Make Valid Parentheses||63.5%|Medium|| |1250|Check If It Is a Good Array||56.3%|Hard|| @@ -1407,7 +1407,7 @@ |1267|Count Servers that Communicate||57.8%|Medium|| |1268|Search Suggestions System||64.5%|Medium|| |1269|Number of Ways to Stay in the Same Place After Some Steps||43.2%|Hard|| -|1270|All People Report to the Given Manager||88.3%|Medium|| +|1270|All People Report to the Given Manager||88.4%|Medium|| |1271|Hexspeak||55.3%|Easy|| |1272|Remove Interval||57.8%|Medium|| |1273|Delete Tree Nodes||62.5%|Medium|| @@ -1421,7 +1421,7 @@ |1281|Subtract the Product and Sum of Digits of an Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer)|85.6%|Easy|| |1282|Group the People Given the Group Size They Belong To||84.3%|Medium|| |1283|Find the Smallest Divisor Given a Threshold|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold)|49.2%|Medium|| -|1284|Minimum Number of Flips to Convert Binary Matrix to Zero Matrix||70.1%|Hard|| +|1284|Minimum Number of Flips to Convert Binary Matrix to Zero Matrix||70.2%|Hard|| |1285|Find the Start and End Number of Continuous Ranges||86.9%|Medium|| |1286|Iterator for Combination||70.9%|Medium|| |1287|Element Appearing More Than 25% In Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1287.Element-Appearing-More-Than-25%-In-Sorted-Array)|60.2%|Easy|| @@ -1434,7 +1434,7 @@ |1294|Weather Type in Each Country||66.1%|Easy|| |1295|Find Numbers with Even Number of Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits)|79.3%|Easy|| |1296|Divide Array in Sets of K Consecutive Numbers||55.3%|Medium|| -|1297|Maximum Number of Occurrences of a Substring||49.2%|Medium|| +|1297|Maximum Number of Occurrences of a Substring||49.3%|Medium|| |1298|Maximum Candies You Can Get from Boxes||59.6%|Hard|| |1299|Replace Elements with Greatest Element on Right Side|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side)|74.2%|Easy|| |1300|Sum of Mutated Array Closest to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target)|43.3%|Medium|| @@ -1459,7 +1459,7 @@ |1319|Number of Operations to Make Network Connected||54.8%|Medium|| |1320|Minimum Distance to Type a Word Using Two Fingers||62.8%|Hard|| |1321|Restaurant Growth||70.6%|Medium|| -|1322|Ads Performance||57.9%|Easy|| +|1322|Ads Performance||57.8%|Easy|| |1323|Maximum 69 Number||78.0%|Easy|| |1324|Print Words Vertically||58.7%|Medium|| |1325|Delete Leaves With a Given Value||73.5%|Medium|| @@ -1472,13 +1472,13 @@ |1332|Remove Palindromic Subsequences||62.8%|Easy|| |1333|Filter Restaurants by Vegan-Friendly, Price and Distance||57.0%|Medium|| |1334|Find the City With the Smallest Number of Neighbors at a Threshold Distance||46.6%|Medium|| -|1335|Minimum Difficulty of a Job Schedule||57.3%|Hard|| +|1335|Minimum Difficulty of a Job Schedule||57.4%|Hard|| |1336|Number of Transactions per Visit||47.4%|Hard|| |1337|The K Weakest Rows in a Matrix||69.7%|Easy|| |1338|Reduce Array Size to The Half||66.7%|Medium|| |1339|Maximum Product of Splitted Binary Tree||38.0%|Medium|| |1340|Jump Game V||59.0%|Hard|| -|1341|Movie Rating||58.5%|Medium|| +|1341|Movie Rating||58.6%|Medium|| |1342|Number of Steps to Reduce a Number to Zero||85.7%|Easy|| |1343|Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold||64.6%|Medium|| |1344|Angle Between Hands of a Clock||61.2%|Medium|| @@ -1498,14 +1498,14 @@ |1358|Number of Substrings Containing All Three Characters||60.4%|Medium|| |1359|Count All Valid Pickup and Delivery Options||56.8%|Hard|| |1360|Number of Days Between Two Dates||46.9%|Easy|| -|1361|Validate Binary Tree Nodes||44.2%|Medium|| +|1361|Validate Binary Tree Nodes||44.3%|Medium|| |1362|Closest Divisors||57.5%|Medium|| |1363|Largest Multiple of Three||33.9%|Hard|| -|1364|Number of Trusted Contacts of a Customer||78.0%|Medium|| +|1364|Number of Trusted Contacts of a Customer||78.1%|Medium|| |1365|How Many Numbers Are Smaller Than the Current Number||85.9%|Easy|| -|1366|Rank Teams by Votes||54.9%|Medium|| +|1366|Rank Teams by Votes||55.0%|Medium|| |1367|Linked List in Binary Tree||41.1%|Medium|| -|1368|Minimum Cost to Make at Least One Valid Path in a Grid||56.8%|Hard|| +|1368|Minimum Cost to Make at Least One Valid Path in a Grid||56.9%|Hard|| |1369|Get the Second Most Recent Activity||68.4%|Hard|| |1370|Increasing Decreasing String||76.4%|Easy|| |1371|Find the Longest Substring Containing Vowels in Even Counts||61.2%|Medium|| @@ -1517,14 +1517,14 @@ |1377|Frog Position After T Seconds||34.8%|Hard|| |1378|Replace Employee ID With The Unique Identifier||89.8%|Easy|| |1379|Find a Corresponding Node of a Binary Tree in a Clone of That Tree||85.0%|Medium|| -|1380|Lucky Numbers in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix)|70.9%|Easy|| +|1380|Lucky Numbers in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix)|70.8%|Easy|| |1381|Design a Stack With Increment Operation||75.8%|Medium|| |1382|Balance a Binary Search Tree||76.0%|Medium|| -|1383|Maximum Performance of a Team||35.1%|Hard|| +|1383|Maximum Performance of a Team||35.2%|Hard|| |1384|Total Sales Amount by Year||64.4%|Hard|| |1385|Find the Distance Value Between Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays)|66.4%|Easy|| |1386|Cinema Seat Allocation||35.5%|Medium|| -|1387|Sort Integers by The Power Value||70.5%|Medium|| +|1387|Sort Integers by The Power Value||70.6%|Medium|| |1388|Pizza With 3n Slices||45.4%|Hard|| |1389|Create Target Array in the Given Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1389.Create-Target-Array-in-the-Given-Order)|84.7%|Easy|| |1390|Four Divisors||39.0%|Medium|| @@ -1532,7 +1532,7 @@ |1392|Longest Happy Prefix||41.3%|Hard|| |1393|Capital Gain/Loss||90.6%|Medium|| |1394|Find Lucky Integer in an Array||63.2%|Easy|| -|1395|Count Number of Teams||81.0%|Medium|| +|1395|Count Number of Teams||80.9%|Medium|| |1396|Design Underground System||69.0%|Medium|| |1397|Find All Good Strings||38.1%|Hard|| |1398|Customers Who Bought Products A and B but Not C||82.1%|Medium|| @@ -1549,13 +1549,13 @@ |1409|Queries on a Permutation With Key||81.4%|Medium|| |1410|HTML Entity Parser||54.4%|Medium|| |1411|Number of Ways to Paint N × 3 Grid||60.4%|Hard|| -|1412|Find the Quiet Students in All Exams||65.4%|Hard|| +|1412|Find the Quiet Students in All Exams||65.5%|Hard|| |1413|Minimum Value to Get Positive Step by Step Sum||65.4%|Easy|| |1414|Find the Minimum Number of Fibonacci Numbers Whose Sum Is K||63.8%|Medium|| |1415|The k-th Lexicographical String of All Happy Strings of Length n||70.1%|Medium|| |1416|Restore The Array||36.3%|Hard|| |1417|Reformat The String||55.4%|Easy|| -|1418|Display Table of Food Orders in a Restaurant||68.3%|Medium|| +|1418|Display Table of Food Orders in a Restaurant||68.4%|Medium|| |1419|Minimum Number of Frogs Croaking||47.3%|Medium|| |1420|Build Array Where You Can Find The Maximum Exactly K Comparisons||64.3%|Hard|| |1421|NPV Queries||81.9%|Medium|| @@ -1587,7 +1587,7 @@ |1447|Simplified Fractions||62.2%|Medium|| |1448|Count Good Nodes in Binary Tree||70.3%|Medium|| |1449|Form Largest Integer With Digits That Add up to Target||43.8%|Hard|| -|1450|Number of Students Doing Homework at a Given Time||76.9%|Easy|| +|1450|Number of Students Doing Homework at a Given Time||77.0%|Easy|| |1451|Rearrange Words in a Sentence||59.1%|Medium|| |1452|People Whose List of Favorite Companies Is Not a Subset of Another List||54.9%|Medium|| |1453|Maximum Number of Darts Inside of a Circular Dartboard||35.2%|Hard|| @@ -1602,7 +1602,7 @@ |1462|Course Schedule IV||44.4%|Medium|| |1463|Cherry Pickup II||69.4%|Hard|| |1464|Maximum Product of Two Elements in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array)|76.9%|Easy|| -|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.8%|Medium|| +|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.7%|Medium|| |1466|Reorder Routes to Make All Paths Lead to the City Zero||61.3%|Medium|| |1467|Probability of a Two Boxes Having The Same Number of Distinct Balls||60.9%|Hard|| |1468|Calculate Salaries||81.3%|Medium|| @@ -1619,7 +1619,7 @@ |1479|Sales by Day of the Week||83.9%|Hard|| |1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|89.5%|Easy|| |1481|Least Number of Unique Integers after K Removals||55.5%|Medium|| -|1482|Minimum Number of Days to Make m Bouquets||49.7%|Medium|| +|1482|Minimum Number of Days to Make m Bouquets||49.8%|Medium|| |1483|Kth Ancestor of a Tree Node||30.3%|Hard|| |1484|Group Sold Products By The Date||85.9%|Easy|| |1485|Clone Binary Tree With Random Pointer||79.5%|Medium|| @@ -1637,10 +1637,10 @@ |1497|Check If Array Pairs Are Divisible by k||40.5%|Medium|| |1498|Number of Subsequences That Satisfy the Given Sum Condition||38.3%|Medium|| |1499|Max Value of Equation||45.2%|Hard|| -|1500|Design a File Sharing System||46.0%|Medium|| +|1500|Design a File Sharing System||46.1%|Medium|| |1501|Countries You Can Safely Invest In||60.1%|Medium|| |1502|Can Make Arithmetic Progression From Sequence||70.7%|Easy|| -|1503|Last Moment Before All Ants Fall Out of a Plank||53.1%|Medium|| +|1503|Last Moment Before All Ants Fall Out of a Plank||53.0%|Medium|| |1504|Count Submatrices With All Ones||60.9%|Medium|| |1505|Minimum Possible Integer After at Most K Adjacent Swaps On Digits||36.0%|Hard|| |1506|Find Root of N-Ary Tree||80.7%|Medium|| @@ -1657,19 +1657,19 @@ |1517|Find Users With Valid E-Mails||71.8%|Easy|| |1518|Water Bottles||60.7%|Easy|| |1519|Number of Nodes in the Sub-Tree With the Same Label||36.9%|Medium|| -|1520|Maximum Number of Non-Overlapping Substrings||36.0%|Hard|| +|1520|Maximum Number of Non-Overlapping Substrings||36.1%|Hard|| |1521|Find a Value of a Mysterious Function Closest to Target||44.4%|Hard|| -|1522|Diameter of N-Ary Tree||68.9%|Medium|| +|1522|Diameter of N-Ary Tree||68.8%|Medium|| |1523|Count Odd Numbers in an Interval Range||55.0%|Easy|| |1524|Number of Sub-arrays With Odd Sum||39.5%|Medium|| |1525|Number of Good Ways to Split a String||66.7%|Medium|| |1526|Minimum Number of Increments on Subarrays to Form a Target Array||59.8%|Hard|| -|1527|Patients With a Condition||75.0%|Easy|| +|1527|Patients With a Condition||74.9%|Easy|| |1528|Shuffle String||85.7%|Easy|| |1529|Bulb Switcher IV||70.9%|Medium|| |1530|Number of Good Leaf Nodes Pairs||55.8%|Medium|| |1531|String Compression II||33.3%|Hard|| -|1532|The Most Recent Three Orders||73.1%|Medium|| +|1532|The Most Recent Three Orders||73.0%|Medium|| |1533|Find the Index of the Large Integer||54.6%|Medium|| |1534|Count Good Triplets||80.2%|Easy|| |1535|Find the Winner of an Array Game||47.2%|Medium|| @@ -1685,8 +1685,8 @@ |1545|Find Kth Bit in Nth Binary String||57.3%|Medium|| |1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||43.8%|Medium|| |1547|Minimum Cost to Cut a Stick||52.1%|Hard|| -|1548|The Most Similar Path in a Graph||53.8%|Hard|| -|1549|The Most Recent Orders for Each Product||66.3%|Medium|| +|1548|The Most Similar Path in a Graph||53.9%|Hard|| +|1549|The Most Recent Orders for Each Product||66.2%|Medium|| |1550|Three Consecutive Odds||65.3%|Easy|| |1551|Minimum Operations to Make Array Equal||77.8%|Medium|| |1552|Magnetic Force Between Two Balls||48.6%|Medium|| @@ -1695,7 +1695,7 @@ |1555|Bank Account Summary||52.8%|Medium|| |1556|Thousand Separator||58.1%|Easy|| |1557|Minimum Number of Vertices to Reach All Nodes||75.4%|Medium|| -|1558|Minimum Numbers of Function Calls to Make Target Array||62.6%|Medium|| +|1558|Minimum Numbers of Function Calls to Make Target Array||62.5%|Medium|| |1559|Detect Cycles in 2D Grid||44.8%|Hard|| |1560|Most Visited Sector in a Circular Track||57.0%|Easy|| |1561|Maximum Number of Coins You Can Get||78.0%|Medium|| @@ -1722,18 +1722,18 @@ |1582|Special Positions in a Binary Matrix||64.3%|Easy|| |1583|Count Unhappy Friends||53.8%|Medium|| |1584|Min Cost to Connect All Points||50.5%|Medium|| -|1585|Check If String Is Transformable With Substring Sort Operations||48.2%|Hard|| +|1585|Check If String Is Transformable With Substring Sort Operations||48.1%|Hard|| |1586|Binary Search Tree Iterator II||66.3%|Medium|| -|1587|Bank Account Summary II||90.2%|Easy|| -|1588|Sum of All Odd Length Subarrays||81.9%|Easy|| +|1587|Bank Account Summary II||90.3%|Easy|| +|1588|Sum of All Odd Length Subarrays||82.0%|Easy|| |1589|Maximum Sum Obtained of Any Permutation||34.7%|Medium|| |1590|Make Sum Divisible by P||27.3%|Medium|| -|1591|Strange Printer II||55.5%|Hard|| +|1591|Strange Printer II||55.4%|Hard|| |1592|Rearrange Spaces Between Words||43.8%|Easy|| |1593|Split a String Into the Max Number of Unique Substrings||48.3%|Medium|| |1594|Maximum Non Negative Product in a Matrix||31.8%|Medium|| |1595|Minimum Cost to Connect Two Groups of Points||42.8%|Hard|| -|1596|The Most Frequently Ordered Products for Each Customer||84.5%|Medium|| +|1596|The Most Frequently Ordered Products for Each Customer||84.6%|Medium|| |1597|Build Binary Expression Tree From Infix Expression||65.7%|Hard|| |1598|Crawler Log Folder||64.3%|Easy|| |1599|Maximum Profit of Operating a Centennial Wheel||43.5%|Medium|| @@ -1745,22 +1745,22 @@ |1605|Find Valid Matrix Given Row and Column Sums||77.7%|Medium|| |1606|Find Servers That Handled Most Number of Requests||36.8%|Hard|| |1607|Sellers With No Sales||55.9%|Easy|| -|1608|Special Array With X Elements Greater Than or Equal X||61.8%|Easy|| +|1608|Special Array With X Elements Greater Than or Equal X||61.9%|Easy|| |1609|Even Odd Tree||53.2%|Medium|| |1610|Maximum Number of Visible Points||28.6%|Hard|| |1611|Minimum One Bit Operations to Make Integers Zero||57.1%|Hard|| -|1612|Check If Two Expression Trees are Equivalent||69.7%|Medium|| +|1612|Check If Two Expression Trees are Equivalent||69.9%|Medium|| |1613|Find the Missing IDs||72.4%|Medium|| |1614|Maximum Nesting Depth of the Parentheses||83.5%|Easy|| |1615|Maximal Network Rank||51.7%|Medium|| |1616|Split Two Strings to Make Palindrome||36.4%|Medium|| |1617|Count Subtrees With Max Distance Between Cities||63.5%|Hard|| -|1618|Maximum Font to Fit a Sentence in a Screen||58.1%|Medium|| +|1618|Maximum Font to Fit a Sentence in a Screen||58.0%|Medium|| |1619|Mean of Array After Removing Some Elements||65.5%|Easy|| |1620|Coordinate With Maximum Network Quality||37.0%|Medium|| |1621|Number of Sets of K Non-Overlapping Line Segments||41.2%|Medium|| |1622|Fancy Sequence||15.6%|Hard|| -|1623|All Valid Triplets That Can Represent a Country||89.1%|Easy|| +|1623|All Valid Triplets That Can Represent a Country||89.0%|Easy|| |1624|Largest Substring Between Two Equal Characters||59.1%|Easy|| |1625|Lexicographically Smallest String After Applying Operations||63.5%|Medium|| |1626|Best Team With No Conflicts||37.3%|Medium|| @@ -1768,27 +1768,27 @@ |1628|Design an Expression Tree With Evaluate Function||80.5%|Medium|| |1629|Slowest Key||58.9%|Easy|| |1630|Arithmetic Subarrays||77.7%|Medium|| -|1631|Path With Minimum Effort||43.6%|Medium|| -|1632|Rank Transform of a Matrix||30.4%|Hard|| -|1633|Percentage of Users Attended a Contest||73.4%|Easy|| +|1631|Path With Minimum Effort||43.5%|Medium|| +|1632|Rank Transform of a Matrix||30.5%|Hard|| +|1633|Percentage of Users Attended a Contest||73.5%|Easy|| |1634|Add Two Polynomials Represented as Linked Lists||55.7%|Medium|| -|1635|Hopper Company Queries I||56.1%|Hard|| +|1635|Hopper Company Queries I||56.0%|Hard|| |1636|Sort Array by Increasing Frequency||66.7%|Easy|| -|1637|Widest Vertical Area Between Two Points Containing No Points||83.7%|Medium|| -|1638|Count Substrings That Differ by One Character||68.0%|Medium|| +|1637|Widest Vertical Area Between Two Points Containing No Points||83.8%|Medium|| +|1638|Count Substrings That Differ by One Character||68.1%|Medium|| |1639|Number of Ways to Form a Target String Given a Dictionary||39.3%|Hard|| -|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.1%|Easy|| -|1641|Count Sorted Vowel Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1641.Count-Sorted-Vowel-Strings)|77.5%|Medium|| +|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.2%|Easy|| +|1641|Count Sorted Vowel Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1641.Count-Sorted-Vowel-Strings)|77.7%|Medium|| |1642|Furthest Building You Can Reach||51.3%|Medium|| -|1643|Kth Smallest Instructions||42.9%|Hard|| +|1643|Kth Smallest Instructions||43.0%|Hard|| |1644|Lowest Common Ancestor of a Binary Tree II||57.6%|Medium|| -|1645|Hopper Company Queries II||41.1%|Hard|| -|1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|53.8%|Easy|| +|1645|Hopper Company Queries II||41.2%|Hard|| +|1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|53.7%|Easy|| |1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|53.8%|Medium|| |1648|Sell Diminishing-Valued Colored Balls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls)|30.9%|Medium|| |1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.2%|Hard|| -|1650|Lowest Common Ancestor of a Binary Tree III||77.5%|Medium|| -|1651|Hopper Company Queries III||67.1%|Hard|| +|1650|Lowest Common Ancestor of a Binary Tree III||77.4%|Medium|| +|1651|Hopper Company Queries III||67.0%|Hard|| |1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.2%|Easy|| |1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.9%|Medium|| |1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.3%|Medium|| @@ -1797,17 +1797,17 @@ |1657|Determine if Two Strings Are Close|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1657.Determine-if-Two-Strings-Are-Close)|51.3%|Medium|| |1658|Minimum Operations to Reduce X to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero)|33.4%|Medium|| |1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|35.1%|Hard|| -|1660|Correct a Binary Tree||79.4%|Medium|| -|1661|Average Time of Process per Machine||79.5%|Easy|| +|1660|Correct a Binary Tree||79.3%|Medium|| +|1661|Average Time of Process per Machine||79.3%|Easy|| |1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|83.6%|Easy|| |1663|Smallest String With A Given Numeric Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value)|60.1%|Medium|| |1664|Ways to Make a Fair Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1664.Ways-to-Make-a-Fair-Array)|60.6%|Medium|| |1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|67.8%|Hard|| -|1666|Change the Root of a Binary Tree||68.7%|Medium|| +|1666|Change the Root of a Binary Tree||68.6%|Medium|| |1667|Fix Names in a Table||64.1%|Easy|| -|1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.7%|Easy|| +|1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.8%|Easy|| |1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.2%|Medium|| -|1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.6%|Medium|| +|1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.7%|Medium|| |1671|Minimum Number of Removals to Make Mountain Array||45.7%|Hard|| |1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.5%|Easy|| |1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|38.3%|Medium|| @@ -1816,15 +1816,15 @@ |1676|Lowest Common Ancestor of a Binary Tree IV||77.9%|Medium|| |1677|Product's Worth Over Invoices||74.7%|Easy|| |1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.7%|Easy|| -|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|51.8%|Medium|| +|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|54.1%|Medium|| |1680|Concatenation of Consecutive Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers)|45.1%|Medium|| |1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|35.0%|Hard|| -|1682|Longest Palindromic Subsequence II||51.5%|Medium|| +|1682|Longest Palindromic Subsequence II||51.7%|Medium|| |1683|Invalid Tweets||91.2%|Easy|| -|1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|84.3%|Easy|| +|1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|84.1%|Easy|| |1685|Sum of Absolute Differences in a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array)|61.8%|Medium|| |1686|Stone Game VI||48.8%|Medium|| -|1687|Delivering Boxes from Storage to Ports||34.7%|Hard|| +|1687|Delivering Boxes from Storage to Ports||34.8%|Hard|| |1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|83.1%|Easy|| |1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.0%|Medium|| |1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|46.6%|Medium|| @@ -1835,38 +1835,38 @@ |1695|Maximum Erasure Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1695.Maximum-Erasure-Value)|49.5%|Medium|| |1696|Jump Game VI||55.3%|Medium|| |1697|Checking Existence of Edge Length Limited Paths||56.3%|Hard|| -|1698|Number of Distinct Substrings in a String||55.4%|Medium|| -|1699|Number of Calls Between Two Persons||86.1%|Medium|| -|1700|Number of Students Unable to Eat Lunch||70.0%|Easy|| +|1698|Number of Distinct Substrings in a String||55.5%|Medium|| +|1699|Number of Calls Between Two Persons||86.2%|Medium|| +|1700|Number of Students Unable to Eat Lunch||70.1%|Easy|| |1701|Average Waiting Time||61.6%|Medium|| -|1702|Maximum Binary String After Change||61.6%|Medium|| +|1702|Maximum Binary String After Change||61.5%|Medium|| |1703|Minimum Adjacent Swaps for K Consecutive Ones||40.8%|Hard|| |1704|Determine if String Halves Are Alike||78.2%|Easy|| |1705|Maximum Number of Eaten Apples||42.3%|Medium|| -|1706|Where Will the Ball Fall||58.3%|Medium|| -|1707|Maximum XOR With an Element From Array||48.1%|Hard|| -|1708|Largest Subarray Length K||64.0%|Easy|| +|1706|Where Will the Ball Fall||58.4%|Medium|| +|1707|Maximum XOR With an Element From Array||48.0%|Hard|| +|1708|Largest Subarray Length K||64.2%|Easy|| |1709|Biggest Window Between Visits||82.0%|Medium|| |1710|Maximum Units on a Truck||71.6%|Easy|| |1711|Count Good Meals||25.5%|Medium|| |1712|Ways to Split Array Into Three Subarrays||29.7%|Medium|| -|1713|Minimum Operations to Make a Subsequence||45.4%|Hard|| +|1713|Minimum Operations to Make a Subsequence||45.5%|Hard|| |1714|Sum Of Special Evenly-Spaced Elements In Array||47.2%|Hard|| |1715|Count Apples and Oranges||78.2%|Medium|| -|1716|Calculate Money in Leetcode Bank||69.4%|Easy|| +|1716|Calculate Money in Leetcode Bank||69.5%|Easy|| |1717|Maximum Score From Removing Substrings||38.0%|Medium|| -|1718|Construct the Lexicographically Largest Valid Sequence||42.9%|Medium|| -|1719|Number Of Ways To Reconstruct A Tree||39.8%|Hard|| -|1720|Decode XORed Array||86.3%|Easy|| -|1721|Swapping Nodes in a Linked List||65.7%|Medium|| +|1718|Construct the Lexicographically Largest Valid Sequence||43.1%|Medium|| +|1719|Number Of Ways To Reconstruct A Tree||39.9%|Hard|| +|1720|Decode XORed Array||86.4%|Easy|| +|1721|Swapping Nodes in a Linked List||65.8%|Medium|| |1722|Minimize Hamming Distance After Swap Operations||56.8%|Medium|| |1723|Find Minimum Time to Finish All Jobs||44.5%|Hard|| -|1724|Checking Existence of Edge Length Limited Paths II||58.5%|Hard|| +|1724|Checking Existence of Edge Length Limited Paths II||58.2%|Hard|| |1725|Number Of Rectangles That Can Form The Largest Square||77.4%|Easy|| -|1726|Tuple with Same Product||50.3%|Medium|| -|1727|Largest Submatrix With Rearrangements||53.9%|Medium|| -|1728|Cat and Mouse II||33.9%|Hard|| -|1729|Find Followers Count||68.3%|Easy|| +|1726|Tuple with Same Product||51.2%|Medium|| +|1727|Largest Submatrix With Rearrangements||54.8%|Medium|| +|1728|Cat and Mouse II||34.9%|Hard|| +|1729|Find Followers Count||70.2%|Easy|| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------| ------------------------------------------------------------------ diff --git a/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies.go b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies.go new file mode 100644 index 00000000..07a715b8 --- /dev/null +++ b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies.go @@ -0,0 +1,123 @@ +package leetcode + +// 解法一 拓扑排序版的 DFS +func sortItems(n int, m int, group []int, beforeItems [][]int) []int { + groups, inDegrees := make([][]int, n+m), make([]int, n+m) + for i, g := range group { + if g > -1 { + g += n + groups[g] = append(groups[g], i) + inDegrees[i]++ + } + } + for i, ancestors := range beforeItems { + gi := group[i] + if gi == -1 { + gi = i + } else { + gi += n + } + for _, ancestor := range ancestors { + ga := group[ancestor] + if ga == -1 { + ga = ancestor + } else { + ga += n + } + if gi == ga { + groups[ancestor] = append(groups[ancestor], i) + inDegrees[i]++ + } else { + groups[ga] = append(groups[ga], gi) + inDegrees[gi]++ + } + } + } + res := []int{} + for i, d := range inDegrees { + if d == 0 { + sortItemsDFS(i, n, &res, &inDegrees, &groups) + } + } + if len(res) != n { + return nil + } + return res +} + +func sortItemsDFS(i, n int, res, inDegrees *[]int, groups *[][]int) { + if i < n { + *res = append(*res, i) + } + (*inDegrees)[i] = -1 + for _, ch := range (*groups)[i] { + if (*inDegrees)[ch]--; (*inDegrees)[ch] == 0 { + sortItemsDFS(ch, n, res, inDegrees, groups) + } + } +} + +// 解法二 二维拓扑排序 时间复杂度 O(m+n),空间复杂度 O(m+n) +func sortItems1(n int, m int, group []int, beforeItems [][]int) []int { + groupItems, res := map[int][]int{}, []int{} + for i := 0; i < len(group); i++ { + if group[i] == -1 { + group[i] = m + i + } + groupItems[group[i]] = append(groupItems[group[i]], i) + } + groupGraph, groupDegree, itemGraph, itemDegree := make([][]int, m+n), make([]int, m+n), make([][]int, n), make([]int, n) + for i := 0; i < len(beforeItems); i++ { + for j := 0; j < len(beforeItems[i]); j++ { + if group[beforeItems[i][j]] != group[i] { + // 不同组项目,确定组间依赖关系 + groupGraph[group[beforeItems[i][j]]] = append(groupGraph[group[beforeItems[i][j]]], group[i]) + groupDegree[group[i]]++ + } else { + // 同组项目,确定组内依赖关系 + itemGraph[beforeItems[i][j]] = append(itemGraph[beforeItems[i][j]], i) + itemDegree[i]++ + } + } + } + items := []int{} + for i := 0; i < m+n; i++ { + items = append(items, i) + } + // 组间拓扑 + groupOrders := topSort(groupGraph, groupDegree, items) + if len(groupOrders) < len(items) { + return nil + } + for i := 0; i < len(groupOrders); i++ { + items := groupItems[groupOrders[i]] + // 组内拓扑 + orders := topSort(itemGraph, itemDegree, items) + if len(orders) < len(items) { + return nil + } + res = append(res, orders...) + } + return res +} + +func topSort(graph [][]int, deg, items []int) (orders []int) { + q := []int{} + for _, i := range items { + if deg[i] == 0 { + q = append(q, i) + } + } + for len(q) > 0 { + from := q[0] + q = q[1:] + orders = append(orders, from) + for _, to := range graph[from] { + deg[to]-- + if deg[to] == 0 { + q = append(q, to) + } + } + } + return +} diff --git a/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies_test.go b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies_test.go new file mode 100644 index 00000000..6abb3b54 --- /dev/null +++ b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies_test.go @@ -0,0 +1,50 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1203 struct { + para1203 + ans1203 +} + +// para 是参数 +// one 代表第一个参数 +type para1203 struct { + n int + m int + group []int + beforeItems [][]int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1203 struct { + one []int +} + +func Test_Problem1203(t *testing.T) { + + qs := []question1203{ + + { + para1203{8, 2, []int{-1, -1, 1, 0, 0, 1, 0, -1}, [][]int{{}, {6}, {5}, {6}, {3, 6}, {}, {}, {}}}, + ans1203{[]int{6, 3, 4, 5, 2, 0, 7, 1}}, + }, + + { + para1203{8, 2, []int{-1, -1, 1, 0, 0, 1, 0, -1}, [][]int{{}, {6}, {5}, {6}, {3}, {}, {4}, {}}}, + ans1203{[]int{}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1203------------------------\n") + + for _, q := range qs { + _, p := q.ans1203, q.para1203 + fmt.Printf("【input】:%v 【output】:%v\n", p, sortItems1(p.n, p.m, p.group, p.beforeItems)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md new file mode 100644 index 00000000..3fec764b --- /dev/null +++ b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md @@ -0,0 +1,191 @@ +# [1203. Sort Items by Groups Respecting Dependencies](https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies/) + + +## 题目 + +There are `n` items each belonging to zero or one of `m` groups where `group[i]` is the group that the `i`-th item belongs to and it's equal to `-1` if the `i`-th item belongs to no group. The items and the groups are zero indexed. A group can have no item belonging to it. + +Return a sorted list of the items such that: + +- The items that belong to the same group are next to each other in the sorted list. +- There are some relations between these items where `beforeItems[i]` is a list containing all the items that should come before the `i`th item in the sorted array (to the left of the `i`th item). + +Return any solution if there is more than one solution and return an **empty list** if there is no solution. + +**Example 1:** + +![https://assets.leetcode.com/uploads/2019/09/11/1359_ex1.png](https://assets.leetcode.com/uploads/2019/09/11/1359_ex1.png) + +``` +Input: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3,6],[],[],[]] +Output: [6,3,4,1,5,2,0,7] + +``` + +**Example 2:** + +``` +Input: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3],[],[4],[]] +Output: [] +Explanation: This is the same as example 1 except that 4 needs to be before 6 in the sorted list. + +``` + +**Constraints:** + +- `1 <= m <= n <= 3 * 104` +- `group.length == beforeItems.length == n` +- `1 <= group[i] <= m - 1` +- `0 <= beforeItems[i].length <= n - 1` +- `0 <= beforeItems[i][j] <= n - 1` +- `i != beforeItems[i][j]` +- `beforeItems[i]` does not contain duplicates elements. + +## 题目大意 + +有 n 个项目,每个项目或者不属于任何小组,或者属于 m 个小组之一。group[i] 表示第 i 个小组所属的小组,如果第 i 个项目不属于任何小组,则 group[i] 等于 -1。项目和小组都是从零开始编号的。可能存在小组不负责任何项目,即没有任何项目属于这个小组。 + +请你帮忙按要求安排这些项目的进度,并返回排序后的项目列表: + +- 同一小组的项目,排序后在列表中彼此相邻。 +- 项目之间存在一定的依赖关系,我们用一个列表 beforeItems 来表示,其中 beforeItems[i] 表示在进行第 i 个项目前(位于第 i 个项目左侧)应该完成的所有项目。 + +如果存在多个解决方案,只需要返回其中任意一个即可。如果没有合适的解决方案,就请返回一个 空列表 。 + +## 解题思路 + +- 读完题能确定这一题是拓扑排序。但是和单纯的拓扑排序有区别的是,同一小组内的项目需要彼此相邻。用 2 次拓扑排序即可解决。第一次拓扑排序排出组间的顺序,第二次拓扑排序排出组内的顺序。为了实现方便,用 map 给虚拟分组标记编号。如下图,将 3,4,6 三个任务打包到 0 号分组里面,将 2,5 两个任务打包到 1 号分组里面,其他任务单独各自为一组。组间的依赖是 6 号任务依赖 1 号任务。由于 6 号任务封装在 0 号分组里,所以 3 号分组依赖 0 号分组。先组间排序,确定分组顺序,再组内拓扑排序,排出最终顺序。 + + ![https://img.halfrost.com/Leetcode/leetcode_1203_1.png](https://img.halfrost.com/Leetcode/leetcode_1203_1.png) + +- 上面的解法可以 AC,但是时间太慢了。因为做了一些不必要的操作。有没有可能只用一次拓扑排序呢?将必须要在一起的结点统一依赖一个虚拟结点,例如下图中的虚拟结点 8 和 9 。3,4,6 都依赖 8 号任务,2 和 5 都依赖 9 号任务。1 号任务本来依赖 6 号任务,由于 6 由依赖 8 ,所以添加 1 依赖 8 的边。通过增加虚拟结点,增加了需要打包在一起结点的入度。构建出以上关系以后,按照入度为 0 的原则,依次进行 DFS。8 号和 9 号两个虚拟结点的入度都为 0 ,对它们进行 DFS,必定会使得与它关联的节点都被安排在一起,这样就满足了题意:同一小组的项目,排序后在列表中彼此相邻。一遍扫完,满足题意的顺序就排出来了。这个解法 beat 100%! + + ![https://img.halfrost.com/Leetcode/leetcode_1203_2.png](https://img.halfrost.com/Leetcode/leetcode_1203_2.png) + +## 代码 + +```go +package leetcode + +// 解法一 拓扑排序版的 DFS +func sortItems(n int, m int, group []int, beforeItems [][]int) []int { + groups, inDegrees := make([][]int, n+m), make([]int, n+m) + for i, g := range group { + if g > -1 { + g += n + groups[g] = append(groups[g], i) + inDegrees[i]++ + } + } + for i, ancestors := range beforeItems { + gi := group[i] + if gi == -1 { + gi = i + } else { + gi += n + } + for _, ancestor := range ancestors { + ga := group[ancestor] + if ga == -1 { + ga = ancestor + } else { + ga += n + } + if gi == ga { + groups[ancestor] = append(groups[ancestor], i) + inDegrees[i]++ + } else { + groups[ga] = append(groups[ga], gi) + inDegrees[gi]++ + } + } + } + res := []int{} + for i, d := range inDegrees { + if d == 0 { + sortItemsDFS(i, n, &res, &inDegrees, &groups) + } + } + if len(res) != n { + return nil + } + return res +} + +func sortItemsDFS(i, n int, res, inDegrees *[]int, groups *[][]int) { + if i < n { + *res = append(*res, i) + } + (*inDegrees)[i] = -1 + for _, ch := range (*groups)[i] { + if (*inDegrees)[ch]--; (*inDegrees)[ch] == 0 { + sortItemsDFS(ch, n, res, inDegrees, groups) + } + } +} + +// 解法二 二维拓扑排序 时间复杂度 O(m+n),空间复杂度 O(m+n) +func sortItems1(n int, m int, group []int, beforeItems [][]int) []int { + groupItems, res := map[int][]int{}, []int{} + for i := 0; i < len(group); i++ { + if group[i] == -1 { + group[i] = m + i + } + groupItems[group[i]] = append(groupItems[group[i]], i) + } + groupGraph, groupDegree, itemGraph, itemDegree := make([][]int, m+n), make([]int, m+n), make([][]int, n), make([]int, n) + for i := 0; i < len(beforeItems); i++ { + for j := 0; j < len(beforeItems[i]); j++ { + if group[beforeItems[i][j]] != group[i] { + // 不同组项目,确定组间依赖关系 + groupGraph[group[beforeItems[i][j]]] = append(groupGraph[group[beforeItems[i][j]]], group[i]) + groupDegree[group[i]]++ + } else { + // 同组项目,确定组内依赖关系 + itemGraph[beforeItems[i][j]] = append(itemGraph[beforeItems[i][j]], i) + itemDegree[i]++ + } + } + } + items := []int{} + for i := 0; i < m+n; i++ { + items = append(items, i) + } + // 组间拓扑 + groupOrders := topSort(groupGraph, groupDegree, items) + if len(groupOrders) < len(items) { + return nil + } + for i := 0; i < len(groupOrders); i++ { + items := groupItems[groupOrders[i]] + // 组内拓扑 + orders := topSort(itemGraph, itemDegree, items) + if len(orders) < len(items) { + return nil + } + res = append(res, orders...) + } + return res +} + +func topSort(graph [][]int, deg, items []int) (orders []int) { + q := []int{} + for _, i := range items { + if deg[i] == 0 { + q = append(q, i) + } + } + for len(q) > 0 { + from := q[0] + q = q[1:] + orders = append(orders, from) + for _, to := range graph[from] { + deg[to]-- + if deg[to] == 0 { + q = append(q, to) + } + } + } + return +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md b/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md index f82a83f8..903771e8 100755 --- a/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md +++ b/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md @@ -105,5 +105,5 @@ func smallestStringWithSwaps(s string, pairs [][]int) string { ---------------------------------------------- diff --git a/website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md b/website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md new file mode 100644 index 00000000..4e8cd26c --- /dev/null +++ b/website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md @@ -0,0 +1,198 @@ +# [1203. Sort Items by Groups Respecting Dependencies](https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies/) + + +## 题目 + +There are `n` items each belonging to zero or one of `m` groups where `group[i]` is the group that the `i`-th item belongs to and it's equal to `-1` if the `i`-th item belongs to no group. The items and the groups are zero indexed. A group can have no item belonging to it. + +Return a sorted list of the items such that: + +- The items that belong to the same group are next to each other in the sorted list. +- There are some relations between these items where `beforeItems[i]` is a list containing all the items that should come before the `i`th item in the sorted array (to the left of the `i`th item). + +Return any solution if there is more than one solution and return an **empty list** if there is no solution. + +**Example 1:** + +![https://assets.leetcode.com/uploads/2019/09/11/1359_ex1.png](https://assets.leetcode.com/uploads/2019/09/11/1359_ex1.png) + +``` +Input: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3,6],[],[],[]] +Output: [6,3,4,1,5,2,0,7] + +``` + +**Example 2:** + +``` +Input: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3],[],[4],[]] +Output: [] +Explanation: This is the same as example 1 except that 4 needs to be before 6 in the sorted list. + +``` + +**Constraints:** + +- `1 <= m <= n <= 3 * 104` +- `group.length == beforeItems.length == n` +- `1 <= group[i] <= m - 1` +- `0 <= beforeItems[i].length <= n - 1` +- `0 <= beforeItems[i][j] <= n - 1` +- `i != beforeItems[i][j]` +- `beforeItems[i]` does not contain duplicates elements. + +## 题目大意 + +有 n 个项目,每个项目或者不属于任何小组,或者属于 m 个小组之一。group[i] 表示第 i 个小组所属的小组,如果第 i 个项目不属于任何小组,则 group[i] 等于 -1。项目和小组都是从零开始编号的。可能存在小组不负责任何项目,即没有任何项目属于这个小组。 + +请你帮忙按要求安排这些项目的进度,并返回排序后的项目列表: + +- 同一小组的项目,排序后在列表中彼此相邻。 +- 项目之间存在一定的依赖关系,我们用一个列表 beforeItems 来表示,其中 beforeItems[i] 表示在进行第 i 个项目前(位于第 i 个项目左侧)应该完成的所有项目。 + +如果存在多个解决方案,只需要返回其中任意一个即可。如果没有合适的解决方案,就请返回一个 空列表 。 + +## 解题思路 + +- 读完题能确定这一题是拓扑排序。但是和单纯的拓扑排序有区别的是,同一小组内的项目需要彼此相邻。用 2 次拓扑排序即可解决。第一次拓扑排序排出组间的顺序,第二次拓扑排序排出组内的顺序。为了实现方便,用 map 给虚拟分组标记编号。如下图,将 3,4,6 三个任务打包到 0 号分组里面,将 2,5 两个任务打包到 1 号分组里面,其他任务单独各自为一组。组间的依赖是 6 号任务依赖 1 号任务。由于 6 号任务封装在 0 号分组里,所以 3 号分组依赖 0 号分组。先组间排序,确定分组顺序,再组内拓扑排序,排出最终顺序。 + + ![https://img.halfrost.com/Leetcode/leetcode_1203_1.png](https://img.halfrost.com/Leetcode/leetcode_1203_1.png) + +- 上面的解法可以 AC,但是时间太慢了。因为做了一些不必要的操作。有没有可能只用一次拓扑排序呢?将必须要在一起的结点统一依赖一个虚拟结点,例如下图中的虚拟结点 8 和 9 。3,4,6 都依赖 8 号任务,2 和 5 都依赖 9 号任务。1 号任务本来依赖 6 号任务,由于 6 由依赖 8 ,所以添加 1 依赖 8 的边。通过增加虚拟结点,增加了需要打包在一起结点的入度。构建出以上关系以后,按照入度为 0 的原则,依次进行 DFS。8 号和 9 号两个虚拟结点的入度都为 0 ,对它们进行 DFS,必定会使得与它关联的节点都被安排在一起,这样就满足了题意:同一小组的项目,排序后在列表中彼此相邻。一遍扫完,满足题意的顺序就排出来了。这个解法 beat 100%! + + ![https://img.halfrost.com/Leetcode/leetcode_1203_2.png](https://img.halfrost.com/Leetcode/leetcode_1203_2.png) + +## 代码 + +```go +package leetcode + +// 解法一 拓扑排序版的 DFS +func sortItems(n int, m int, group []int, beforeItems [][]int) []int { + groups, inDegrees := make([][]int, n+m), make([]int, n+m) + for i, g := range group { + if g > -1 { + g += n + groups[g] = append(groups[g], i) + inDegrees[i]++ + } + } + for i, ancestors := range beforeItems { + gi := group[i] + if gi == -1 { + gi = i + } else { + gi += n + } + for _, ancestor := range ancestors { + ga := group[ancestor] + if ga == -1 { + ga = ancestor + } else { + ga += n + } + if gi == ga { + groups[ancestor] = append(groups[ancestor], i) + inDegrees[i]++ + } else { + groups[ga] = append(groups[ga], gi) + inDegrees[gi]++ + } + } + } + res := []int{} + for i, d := range inDegrees { + if d == 0 { + sortItemsDFS(i, n, &res, &inDegrees, &groups) + } + } + if len(res) != n { + return nil + } + return res +} + +func sortItemsDFS(i, n int, res, inDegrees *[]int, groups *[][]int) { + if i < n { + *res = append(*res, i) + } + (*inDegrees)[i] = -1 + for _, ch := range (*groups)[i] { + if (*inDegrees)[ch]--; (*inDegrees)[ch] == 0 { + sortItemsDFS(ch, n, res, inDegrees, groups) + } + } +} + +// 解法二 二维拓扑排序 时间复杂度 O(m+n),空间复杂度 O(m+n) +func sortItems1(n int, m int, group []int, beforeItems [][]int) []int { + groupItems, res := map[int][]int{}, []int{} + for i := 0; i < len(group); i++ { + if group[i] == -1 { + group[i] = m + i + } + groupItems[group[i]] = append(groupItems[group[i]], i) + } + groupGraph, groupDegree, itemGraph, itemDegree := make([][]int, m+n), make([]int, m+n), make([][]int, n), make([]int, n) + for i := 0; i < len(beforeItems); i++ { + for j := 0; j < len(beforeItems[i]); j++ { + if group[beforeItems[i][j]] != group[i] { + // 不同组项目,确定组间依赖关系 + groupGraph[group[beforeItems[i][j]]] = append(groupGraph[group[beforeItems[i][j]]], group[i]) + groupDegree[group[i]]++ + } else { + // 同组项目,确定组内依赖关系 + itemGraph[beforeItems[i][j]] = append(itemGraph[beforeItems[i][j]], i) + itemDegree[i]++ + } + } + } + items := []int{} + for i := 0; i < m+n; i++ { + items = append(items, i) + } + // 组间拓扑 + groupOrders := topSort(groupGraph, groupDegree, items) + if len(groupOrders) < len(items) { + return nil + } + for i := 0; i < len(groupOrders); i++ { + items := groupItems[groupOrders[i]] + // 组内拓扑 + orders := topSort(itemGraph, itemDegree, items) + if len(orders) < len(items) { + return nil + } + res = append(res, orders...) + } + return res +} + +func topSort(graph [][]int, deg, items []int) (orders []int) { + q := []int{} + for _, i := range items { + if deg[i] == 0 { + q = append(q, i) + } + } + for len(q) > 0 { + from := q[0] + q = q[1:] + orders = append(orders, from) + for _, to := range graph[from] { + deg[to]-- + if deg[to] == 0 { + q = append(q, to) + } + } + } + return +} +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md b/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md index a4d435fe..1b3aff67 100755 --- a/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md +++ b/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md @@ -70,6 +70,6 @@ func uniqueOccurrences(arr []int) bool { ---------------------------------------------- diff --git a/website/content/ChapterTwo/Array.md b/website/content/ChapterTwo/Array.md index 02480245..82110657 100644 --- a/website/content/ChapterTwo/Array.md +++ b/website/content/ChapterTwo/Array.md @@ -42,7 +42,7 @@ type: docs |0084|Largest Rectangle in Histogram|[Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}})|Hard| O(n)| O(n)|❤️|36.8%| |0088|Merge Sorted Array|[Go]({{< relref "/ChapterFour/0088.Merge-Sorted-Array.md" >}})|Easy| O(n)| O(1)|❤️|40.6%| |0090|Subsets II|[Go]({{< relref "/ChapterFour/0090.Subsets-II.md" >}})|Medium| O(n^2)| O(n)|❤️|48.5%| -|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| +|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.3%| |0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.2%| |0118|Pascal's Triangle|[Go]({{< relref "/ChapterFour/0118.Pascals-Triangle.md" >}})|Easy||||54.4%| |0120|Triangle|[Go]({{< relref "/ChapterFour/0120.Triangle.md" >}})|Medium| O(n^2)| O(n)||45.5%| @@ -78,7 +78,7 @@ type: docs |0628|Maximum Product of Three Numbers|[Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})|Easy| O(n)| O(1)||47.0%| |0661|Image Smoother|[Go]({{< relref "/ChapterFour/0661.Image-Smoother.md" >}})|Easy||||52.2%| |0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| -|0697|Degree of an Array|[Go]({{< relref "/ChapterFour/0697.Degree-of-an-Array.md" >}})|Easy||||54.3%| +|0697|Degree of an Array|[Go]({{< relref "/ChapterFour/0697.Degree-of-an-Array.md" >}})|Easy||||54.4%| |0713|Subarray Product Less Than K|[Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})|Medium| O(n)| O(1)||40.4%| |0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.9%| |0717|1-bit and 2-bit Characters|[Go]({{< relref "/ChapterFour/0717.1-bit-and-2-bit-Characters.md" >}})|Easy||||47.6%| @@ -107,7 +107,7 @@ type: docs |1011|Capacity To Ship Packages Within D Days|[Go]({{< relref "/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md" >}})|Medium||||59.5%| |1018|Binary Prefix Divisible By 5|[Go]({{< relref "/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md" >}})|Easy||||47.9%| |1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium||||53.9%| -|1051|Height Checker|[Go]({{< relref "/ChapterFour/1051.Height-Checker.md" >}})|Easy||||71.8%| +|1051|Height Checker|[Go]({{< relref "/ChapterFour/1051.Height-Checker.md" >}})|Easy||||71.9%| |1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})|Medium||||55.7%| |1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.5%| |1089|Duplicate Zeros|[Go]({{< relref "/ChapterFour/1089.Duplicate-Zeros.md" >}})|Easy||||52.0%| @@ -133,7 +133,7 @@ type: docs |1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.3%| |1304|Find N Unique Integers Sum up to Zero|[Go]({{< relref "/ChapterFour/1304.Find-N-Unique-Integers-Sum-up-to-Zero.md" >}})|Easy||||76.6%| |1313|Decompress Run-Length Encoded List|[Go]({{< relref "/ChapterFour/1313.Decompress-Run-Length-Encoded-List.md" >}})|Easy||||85.3%| -|1380|Lucky Numbers in a Matrix|[Go]({{< relref "/ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md" >}})|Easy||||70.9%| +|1380|Lucky Numbers in a Matrix|[Go]({{< relref "/ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md" >}})|Easy||||70.8%| |1385|Find the Distance Value Between Two Arrays|[Go]({{< relref "/ChapterFour/1385.Find-the-Distance-Value-Between-Two-Arrays.md" >}})|Easy||||66.4%| |1389|Create Target Array in the Given Order|[Go]({{< relref "/ChapterFour/1389.Create-Target-Array-in-the-Given-Order.md" >}})|Easy||||84.7%| |1464|Maximum Product of Two Elements in an Array|[Go]({{< relref "/ChapterFour/1464.Maximum-Product-of-Two-Elements-in-an-Array.md" >}})|Easy||||76.9%| @@ -141,8 +141,8 @@ type: docs |1480|Running Sum of 1d Array|[Go]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}})|Easy||||89.5%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| |1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.3%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.1%| -|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||53.8%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.2%| +|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||53.7%| |1652|Defuse the Bomb|[Go]({{< relref "/ChapterFour/1652.Defuse-the-Bomb.md" >}})|Easy||||64.2%| |1656|Design an Ordered Stream|[Go]({{< relref "/ChapterFour/1656.Design-an-Ordered-Stream.md" >}})|Easy||||82.4%| |1672|Richest Customer Wealth|[Go]({{< relref "/ChapterFour/1672.Richest-Customer-Wealth.md" >}})|Easy||||88.5%| diff --git a/website/content/ChapterTwo/Backtracking.md b/website/content/ChapterTwo/Backtracking.md index bb044419..746f23ee 100644 --- a/website/content/ChapterTwo/Backtracking.md +++ b/website/content/ChapterTwo/Backtracking.md @@ -129,7 +129,7 @@ func updateMatrix_BFS(matrix [][]int) [][]int { |0980|Unique Paths III|[Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})|Hard| O(n log n)| O(n)||77.2%| |0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.0%| |1079|Letter Tile Possibilities|[Go]({{< relref "/ChapterFour/1079.Letter-Tile-Possibilities.md" >}})|Medium| O(n^2)| O(1)|❤️|75.8%| -|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.6%| +|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.7%| |1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.5%| |1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.1%| |1681|Minimum Incompatibility|[Go]({{< relref "/ChapterFour/1681.Minimum-Incompatibility.md" >}})|Hard||||35.0%| diff --git a/website/content/ChapterTwo/Binary_Search.md b/website/content/ChapterTwo/Binary_Search.md index d02f81bc..1244690e 100644 --- a/website/content/ChapterTwo/Binary_Search.md +++ b/website/content/ChapterTwo/Binary_Search.md @@ -166,7 +166,7 @@ func peakIndexInMountainArray(A []int) int { |0475|Heaters|[Go]({{< relref "/ChapterFour/0475.Heaters.md" >}})|Medium||||33.5%| |0483|Smallest Good Base|[Go]({{< relref "/ChapterFour/0483.Smallest-Good-Base.md" >}})|Hard||||36.2%| |0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})|Hard||||26.6%| -|0497|Random Point in Non-overlapping Rectangles|[Go]({{< relref "/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md" >}})|Medium||||39.1%| +|0497|Random Point in Non-overlapping Rectangles|[Go]({{< relref "/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md" >}})|Medium||||39.0%| |0528|Random Pick with Weight|[Go]({{< relref "/ChapterFour/0528.Random-Pick-with-Weight.md" >}})|Medium||||44.5%| |0658|Find K Closest Elements|[Go]({{< relref "/ChapterFour/0658.Find-K-Closest-Elements.md" >}})|Medium||||41.8%| |0668|Kth Smallest Number in Multiplication Table|[Go]({{< relref "/ChapterFour/0668.Kth-Smallest-Number-in-Multiplication-Table.md" >}})|Hard||||47.7%| @@ -190,7 +190,7 @@ func peakIndexInMountainArray(A []int) int { |1111|Maximum Nesting Depth of Two Valid Parentheses Strings|[Go]({{< relref "/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md" >}})|Medium||||72.4%| |1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard||||39.5%| |1201|Ugly Number III|[Go]({{< relref "/ChapterFour/1201.Ugly-Number-III.md" >}})|Medium||||26.3%| -|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| +|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.0%| |1283|Find the Smallest Divisor Given a Threshold|[Go]({{< relref "/ChapterFour/1283.Find-the-Smallest-Divisor-Given-a-Threshold.md" >}})|Medium||||49.2%| |1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.3%| |1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| diff --git a/website/content/ChapterTwo/Bit_Manipulation.md b/website/content/ChapterTwo/Bit_Manipulation.md index aba365bf..029fa3fd 100644 --- a/website/content/ChapterTwo/Bit_Manipulation.md +++ b/website/content/ChapterTwo/Bit_Manipulation.md @@ -62,14 +62,14 @@ X & ~X = 0 |0393|UTF-8 Validation|[Go]({{< relref "/ChapterFour/0393.UTF-8-Validation.md" >}})|Medium| O(n)| O(1)||37.9%| |0397|Integer Replacement|[Go]({{< relref "/ChapterFour/0397.Integer-Replacement.md" >}})|Medium| O(n)| O(1)||33.4%| |0401|Binary Watch|[Go]({{< relref "/ChapterFour/0401.Binary-Watch.md" >}})|Easy| O(1)| O(1)||48.3%| -|0405|Convert a Number to Hexadecimal|[Go]({{< relref "/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md" >}})|Easy| O(n)| O(1)||44.3%| +|0405|Convert a Number to Hexadecimal|[Go]({{< relref "/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md" >}})|Easy| O(n)| O(1)||44.4%| |0421|Maximum XOR of Two Numbers in an Array|[Go]({{< relref "/ChapterFour/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md" >}})|Medium| O(n)| O(1)|❤️|53.9%| |0461|Hamming Distance|[Go]({{< relref "/ChapterFour/0461.Hamming-Distance.md" >}})|Easy| O(n)| O(1)||73.1%| |0476|Number Complement|[Go]({{< relref "/ChapterFour/0476.Number-Complement.md" >}})|Easy| O(n)| O(1)||65.1%| |0477|Total Hamming Distance|[Go]({{< relref "/ChapterFour/0477.Total-Hamming-Distance.md" >}})|Medium| O(n)| O(1)||50.6%| |0693|Binary Number with Alternating Bits|[Go]({{< relref "/ChapterFour/0693.Binary-Number-with-Alternating-Bits.md" >}})|Easy| O(n)| O(1)|❤️|59.7%| |0756|Pyramid Transition Matrix|[Go]({{< relref "/ChapterFour/0756.Pyramid-Transition-Matrix.md" >}})|Medium| O(n log n)| O(n)||55.5%| -|0762|Prime Number of Set Bits in Binary Representation|[Go]({{< relref "/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md" >}})|Easy| O(n)| O(1)||64.1%| +|0762|Prime Number of Set Bits in Binary Representation|[Go]({{< relref "/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md" >}})|Easy| O(n)| O(1)||64.2%| |0784|Letter Case Permutation|[Go]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}})|Medium| O(n)| O(1)||66.2%| |0898|Bitwise ORs of Subarrays|[Go]({{< relref "/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md" >}})|Medium| O(n)| O(1)||34.0%| |1290|Convert Binary Number in a Linked List to Integer|[Go]({{< relref "/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md" >}})|Easy||||81.7%| diff --git a/website/content/ChapterTwo/Depth_First_Search.md b/website/content/ChapterTwo/Depth_First_Search.md index dfcc5865..053f1690 100644 --- a/website/content/ChapterTwo/Depth_First_Search.md +++ b/website/content/ChapterTwo/Depth_First_Search.md @@ -14,7 +14,7 @@ type: docs |0100|Same Tree|[Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}})|Easy| O(n)| O(1)||54.0%| |0101|Symmetric Tree|[Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})|Easy| O(n)| O(1)||47.9%| |0104|Maximum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||67.7%| -|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| +|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.3%| |0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.2%| |0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||60.0%| |0109|Convert Sorted List to Binary Search Tree|[Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})|Medium| O(log n)| O(n)||49.8%| @@ -33,7 +33,7 @@ type: docs |0210|Course Schedule II|[Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})|Medium| O(n^2)| O(n^2)||42.3%| |0211|Design Add and Search Words Data Structure|[Go]({{< relref "/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md" >}})|Medium||||39.8%| |0257|Binary Tree Paths|[Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})|Easy| O(n)| O(1)||53.2%| -|0329|Longest Increasing Path in a Matrix|[Go]({{< relref "/ChapterFour/0329.Longest-Increasing-Path-in-a-Matrix.md" >}})|Hard||||44.4%| +|0329|Longest Increasing Path in a Matrix|[Go]({{< relref "/ChapterFour/0329.Longest-Increasing-Path-in-a-Matrix.md" >}})|Hard||||44.5%| |0337|House Robber III|[Go]({{< relref "/ChapterFour/0337.House-Robber-III.md" >}})|Medium||||51.7%| |0394|Decode String|[Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})|Medium| O(n)| O(n)||52.4%| |0491|Increasing Subsequences|[Go]({{< relref "/ChapterFour/0491.Increasing-Subsequences.md" >}})|Medium||||47.3%| @@ -44,7 +44,7 @@ type: docs |0529|Minesweeper|[Go]({{< relref "/ChapterFour/0529.Minesweeper.md" >}})|Medium||||60.7%| |0542|01 Matrix|[Go]({{< relref "/ChapterFour/0542.01-Matrix.md" >}})|Medium| O(n)| O(1)||40.6%| |0547|Number of Provinces|[Go]({{< relref "/ChapterFour/0547.Number-of-Provinces.md" >}})|Medium||||60.1%| -|0563|Binary Tree Tilt|[Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}})|Easy||||52.6%| +|0563|Binary Tree Tilt|[Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}})|Easy||||52.7%| |0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.6%| |0685|Redundant Connection II|[Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})|Hard||||32.9%| |0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| @@ -73,15 +73,15 @@ type: docs |1026|Maximum Difference Between Node and Ancestor|[Go]({{< relref "/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}})|Medium||||69.2%| |1028|Recover a Tree From Preorder Traversal|[Go]({{< relref "/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md" >}})|Hard||||70.7%| |1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||67.6%| -|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||67.8%| +|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||67.9%| |1145|Binary Tree Coloring Game|[Go]({{< relref "/ChapterFour/1145.Binary-Tree-Coloring-Game.md" >}})|Medium||||51.4%| +|1203|Sort Items by Groups Respecting Dependencies|[Go]({{< relref "/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md" >}})|Hard||||49.1%| |1254|Number of Closed Islands|[Go]({{< relref "/ChapterFour/1254.Number-of-Closed-Islands.md" >}})|Medium||||61.5%| |1302|Deepest Leaves Sum|[Go]({{< relref "/ChapterFour/1302.Deepest-Leaves-Sum.md" >}})|Medium||||84.1%| |1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.5%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| - ----------------------------------------------

⬅️上一页

diff --git a/website/content/ChapterTwo/Dynamic_Programming.md b/website/content/ChapterTwo/Dynamic_Programming.md index 09487701..2b5fffa7 100644 --- a/website/content/ChapterTwo/Dynamic_Programming.md +++ b/website/content/ChapterTwo/Dynamic_Programming.md @@ -36,7 +36,7 @@ type: docs |0392|Is Subsequence|[Go]({{< relref "/ChapterFour/0392.Is-Subsequence.md" >}})|Easy| O(n)| O(1)||49.5%| |0410|Split Array Largest Sum|[Go]({{< relref "/ChapterFour/0410.Split-Array-Largest-Sum.md" >}})|Hard||||46.1%| |0416|Partition Equal Subset Sum|[Go]({{< relref "/ChapterFour/0416.Partition-Equal-Subset-Sum.md" >}})|Medium| O(n^2)| O(n)||44.7%| -|0474|Ones and Zeroes|[Go]({{< relref "/ChapterFour/0474.Ones-and-Zeroes.md" >}})|Medium||||43.4%| +|0474|Ones and Zeroes|[Go]({{< relref "/ChapterFour/0474.Ones-and-Zeroes.md" >}})|Medium||||43.5%| |0494|Target Sum|[Go]({{< relref "/ChapterFour/0494.Target-Sum.md" >}})|Medium||||45.8%| |0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.6%| |0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.9%| @@ -52,8 +52,8 @@ type: docs |1049|Last Stone Weight II|[Go]({{< relref "/ChapterFour/1049.Last-Stone-Weight-II.md" >}})|Medium||||45.0%| |1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.5%| |1105|Filling Bookcase Shelves|[Go]({{< relref "/ChapterFour/1105.Filling-Bookcase-Shelves.md" >}})|Medium||||57.7%| -|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| -|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.6%| +|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.0%| +|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.7%| |1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.3%| |1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.5%| |1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.1%| diff --git a/website/content/ChapterTwo/Hash_Table.md b/website/content/ChapterTwo/Hash_Table.md index 6ba97ff6..4286dd69 100644 --- a/website/content/ChapterTwo/Hash_Table.md +++ b/website/content/ChapterTwo/Hash_Table.md @@ -14,7 +14,7 @@ type: docs |0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.0%| |0036|Valid Sudoku|[Go]({{< relref "/ChapterFour/0036.Valid-Sudoku.md" >}})|Medium| O(n^2)| O(n^2)||50.2%| |0037|Sudoku Solver|[Go]({{< relref "/ChapterFour/0037.Sudoku-Solver.md" >}})|Hard| O(n^2)| O(n^2)|❤️|46.0%| -|0049|Group Anagrams|[Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})|Medium| O(n log n)| O(n)||58.8%| +|0049|Group Anagrams|[Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})|Medium| O(n log n)| O(n)||58.9%| |0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|35.7%| |0094|Binary Tree Inorder Traversal|[Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}})|Medium| O(n)| O(1)||65.4%| |0136|Single Number|[Go]({{< relref "/ChapterFour/0136.Single-Number.md" >}})|Easy||||66.4%| @@ -32,7 +32,7 @@ type: docs |0350|Intersection of Two Arrays II|[Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})|Easy| O(n)| O(n) ||51.9%| |0387|First Unique Character in a String|[Go]({{< relref "/ChapterFour/0387.First-Unique-Character-in-a-String.md" >}})|Easy||||53.7%| |0389|Find the Difference|[Go]({{< relref "/ChapterFour/0389.Find-the-Difference.md" >}})|Easy||||57.7%| -|0409|Longest Palindrome|[Go]({{< relref "/ChapterFour/0409.Longest-Palindrome.md" >}})|Easy||||52.1%| +|0409|Longest Palindrome|[Go]({{< relref "/ChapterFour/0409.Longest-Palindrome.md" >}})|Easy||||52.2%| |0438|Find All Anagrams in a String|[Go]({{< relref "/ChapterFour/0438.Find-All-Anagrams-in-a-String.md" >}})|Medium| O(n)| O(1) ||44.7%| |0447|Number of Boomerangs|[Go]({{< relref "/ChapterFour/0447.Number-of-Boomerangs.md" >}})|Medium| O(n)| O(1) ||52.3%| |0451|Sort Characters By Frequency|[Go]({{< relref "/ChapterFour/0451.Sort-Characters-By-Frequency.md" >}})|Medium| O(n log n)| O(1) ||64.1%| @@ -59,7 +59,7 @@ type: docs |0781|Rabbits in Forest|[Go]({{< relref "/ChapterFour/0781.Rabbits-in-Forest.md" >}})|Medium||||55.4%| |0811|Subdomain Visit Count|[Go]({{< relref "/ChapterFour/0811.Subdomain-Visit-Count.md" >}})|Easy||||71.2%| |0884|Uncommon Words from Two Sentences|[Go]({{< relref "/ChapterFour/0884.Uncommon-Words-from-Two-Sentences.md" >}})|Easy||||64.0%| -|0895|Maximum Frequency Stack|[Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})|Hard| O(n)| O(n) ||62.1%| +|0895|Maximum Frequency Stack|[Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})|Hard| O(n)| O(n) ||62.2%| |0930|Binary Subarrays With Sum|[Go]({{< relref "/ChapterFour/0930.Binary-Subarrays-With-Sum.md" >}})|Medium| O(n)| O(n) |❤️|44.3%| |0953|Verifying an Alien Dictionary|[Go]({{< relref "/ChapterFour/0953.Verifying-an-Alien-Dictionary.md" >}})|Easy||||52.5%| |0961|N-Repeated Element in Size 2N Array|[Go]({{< relref "/ChapterFour/0961.N-Repeated-Element-in-Size-2N-Array.md" >}})|Easy||||74.4%| @@ -73,8 +73,8 @@ type: docs |1207|Unique Number of Occurrences|[Go]({{< relref "/ChapterFour/1207.Unique-Number-of-Occurrences.md" >}})|Easy||||71.6%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| |1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.3%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.1%| -|1679|Max Number of K-Sum Pairs|[Go]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}})|Medium||||51.8%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.2%| +|1679|Max Number of K-Sum Pairs|[Go]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}})|Medium||||54.1%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Linked_List.md b/website/content/ChapterTwo/Linked_List.md index 9c5fa705..5bb57bb5 100644 --- a/website/content/ChapterTwo/Linked_List.md +++ b/website/content/ChapterTwo/Linked_List.md @@ -54,7 +54,7 @@ type: docs |1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go]({{< relref "/ChapterFour/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md" >}})|Medium||||41.4%| |1290|Convert Binary Number in a Linked List to Integer|[Go]({{< relref "/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md" >}})|Easy||||81.7%| |1669|Merge In Between Linked Lists|[Go]({{< relref "/ChapterFour/1669.Merge-In-Between-Linked-Lists.md" >}})|Medium||||78.2%| -|1670|Design Front Middle Back Queue|[Go]({{< relref "/ChapterFour/1670.Design-Front-Middle-Back-Queue.md" >}})|Medium||||54.6%| +|1670|Design Front Middle Back Queue|[Go]({{< relref "/ChapterFour/1670.Design-Front-Middle-Back-Queue.md" >}})|Medium||||54.7%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Math.md b/website/content/ChapterTwo/Math.md index c2c6013a..f45a399f 100644 --- a/website/content/ChapterTwo/Math.md +++ b/website/content/ChapterTwo/Math.md @@ -18,7 +18,7 @@ type: docs |0067|Add Binary|[Go]({{< relref "/ChapterFour/0067.Add-Binary.md" >}})|Easy||||46.6%| |0069|Sqrt(x)|[Go]({{< relref "/ChapterFour/0069.Sqrtx.md" >}})|Easy| O(log n)| O(1)||34.8%| |0168|Excel Sheet Column Title|[Go]({{< relref "/ChapterFour/0168.Excel-Sheet-Column-Title.md" >}})|Easy||||31.6%| -|0171|Excel Sheet Column Number|[Go]({{< relref "/ChapterFour/0171.Excel-Sheet-Column-Number.md" >}})|Easy||||56.8%| +|0171|Excel Sheet Column Number|[Go]({{< relref "/ChapterFour/0171.Excel-Sheet-Column-Number.md" >}})|Easy||||56.7%| |0172|Factorial Trailing Zeroes|[Go]({{< relref "/ChapterFour/0172.Factorial-Trailing-Zeroes.md" >}})|Easy||||38.4%| |0202|Happy Number|[Go]({{< relref "/ChapterFour/0202.Happy-Number.md" >}})|Easy| O(log n)| O(1)||51.1%| |0204|Count Primes|[Go]({{< relref "/ChapterFour/0204.Count-Primes.md" >}})|Easy||||32.1%| @@ -64,7 +64,7 @@ type: docs |0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.0%| |1017|Convert to Base -2|[Go]({{< relref "/ChapterFour/1017.Convert-to-Base--2.md" >}})|Medium||||59.6%| |1025|Divisor Game|[Go]({{< relref "/ChapterFour/1025.Divisor-Game.md" >}})|Easy| O(1)| O(1)||66.1%| -|1037|Valid Boomerang|[Go]({{< relref "/ChapterFour/1037.Valid-Boomerang.md" >}})|Easy||||37.8%| +|1037|Valid Boomerang|[Go]({{< relref "/ChapterFour/1037.Valid-Boomerang.md" >}})|Easy||||37.9%| |1073|Adding Two Negabinary Numbers|[Go]({{< relref "/ChapterFour/1073.Adding-Two-Negabinary-Numbers.md" >}})|Medium||||34.7%| |1093|Statistics from a Large Sample|[Go]({{< relref "/ChapterFour/1093.Statistics-from-a-Large-Sample.md" >}})|Medium||||49.3%| |1154|Day of the Year|[Go]({{< relref "/ChapterFour/1154.Day-of-the-Year.md" >}})|Easy||||49.3%| @@ -75,7 +75,7 @@ type: docs |1281|Subtract the Product and Sum of Digits of an Integer|[Go]({{< relref "/ChapterFour/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer.md" >}})|Easy||||85.6%| |1317|Convert Integer to the Sum of Two No-Zero Integers|[Go]({{< relref "/ChapterFour/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers.md" >}})|Easy||||56.8%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| -|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.6%| +|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.7%| |1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%| |1680|Concatenation of Consecutive Binary Numbers|[Go]({{< relref "/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md" >}})|Medium||||45.1%| |1685|Sum of Absolute Differences in a Sorted Array|[Go]({{< relref "/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md" >}})|Medium||||61.8%| diff --git a/website/content/ChapterTwo/Sort.md b/website/content/ChapterTwo/Sort.md index 7dbd043a..be71338c 100644 --- a/website/content/ChapterTwo/Sort.md +++ b/website/content/ChapterTwo/Sort.md @@ -44,9 +44,9 @@ type: docs |1030|Matrix Cells in Distance Order|[Go]({{< relref "/ChapterFour/1030.Matrix-Cells-in-Distance-Order.md" >}})|Easy| O(n^2)| O(1) ||66.9%| |1054|Distant Barcodes|[Go]({{< relref "/ChapterFour/1054.Distant-Barcodes.md" >}})|Medium| O(n log n)| O(log n) |❤️|44.2%| |1122|Relative Sort Array|[Go]({{< relref "/ChapterFour/1122.Relative-Sort-Array.md" >}})|Easy||||67.7%| -|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| +|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.0%| |1305|All Elements in Two Binary Search Trees|[Go]({{< relref "/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}})|Medium||||77.8%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.1%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.2%| |1647|Minimum Deletions to Make Character Frequencies Unique|[Go]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}})|Medium||||53.8%| |1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Stack.md b/website/content/ChapterTwo/Stack.md index 71218ed9..72e845a8 100644 --- a/website/content/ChapterTwo/Stack.md +++ b/website/content/ChapterTwo/Stack.md @@ -36,8 +36,8 @@ type: docs |0402|Remove K Digits|[Go]({{< relref "/ChapterFour/0402.Remove-K-Digits.md" >}})|Medium| O(n)| O(1)||28.6%| |0456|132 Pattern|[Go]({{< relref "/ChapterFour/0456.132-Pattern.md" >}})|Medium| O(n)| O(n)||30.6%| |0496|Next Greater Element I|[Go]({{< relref "/ChapterFour/0496.Next-Greater-Element-I.md" >}})|Easy| O(n)| O(n)||65.2%| -|0503|Next Greater Element II|[Go]({{< relref "/ChapterFour/0503.Next-Greater-Element-II.md" >}})|Medium| O(n)| O(n)||58.1%| -|0636|Exclusive Time of Functions|[Go]({{< relref "/ChapterFour/0636.Exclusive-Time-of-Functions.md" >}})|Medium| O(n)| O(n)||53.9%| +|0503|Next Greater Element II|[Go]({{< relref "/ChapterFour/0503.Next-Greater-Element-II.md" >}})|Medium| O(n)| O(n)||58.2%| +|0636|Exclusive Time of Functions|[Go]({{< relref "/ChapterFour/0636.Exclusive-Time-of-Functions.md" >}})|Medium| O(n)| O(n)||54.0%| |0682|Baseball Game|[Go]({{< relref "/ChapterFour/0682.Baseball-Game.md" >}})|Easy| O(n)| O(n)||66.1%| |0726|Number of Atoms|[Go]({{< relref "/ChapterFour/0726.Number-of-Atoms.md" >}})|Hard| O(n)| O(n) |❤️|51.0%| |0735|Asteroid Collision|[Go]({{< relref "/ChapterFour/0735.Asteroid-Collision.md" >}})|Medium| O(n)| O(n) ||43.2%| @@ -45,7 +45,7 @@ type: docs |0844|Backspace String Compare|[Go]({{< relref "/ChapterFour/0844.Backspace-String-Compare.md" >}})|Easy| O(n)| O(n) ||46.8%| |0856|Score of Parentheses|[Go]({{< relref "/ChapterFour/0856.Score-of-Parentheses.md" >}})|Medium| O(n)| O(n)||62.2%| |0880|Decoded String at Index|[Go]({{< relref "/ChapterFour/0880.Decoded-String-at-Index.md" >}})|Medium| O(n)| O(n)||28.3%| -|0895|Maximum Frequency Stack|[Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})|Hard| O(n)| O(n) ||62.1%| +|0895|Maximum Frequency Stack|[Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}})|Hard| O(n)| O(n) ||62.2%| |0901|Online Stock Span|[Go]({{< relref "/ChapterFour/0901.Online-Stock-Span.md" >}})|Medium| O(n)| O(n) ||61.2%| |0907|Sum of Subarray Minimums|[Go]({{< relref "/ChapterFour/0907.Sum-of-Subarray-Minimums.md" >}})|Medium| O(n)| O(n)|❤️|33.2%| |0921|Minimum Add to Make Parentheses Valid|[Go]({{< relref "/ChapterFour/0921.Minimum-Add-to-Make-Parentheses-Valid.md" >}})|Medium| O(n)| O(n)||74.6%| diff --git a/website/content/ChapterTwo/String.md b/website/content/ChapterTwo/String.md index 5f7dc201..0acea5cc 100644 --- a/website/content/ChapterTwo/String.md +++ b/website/content/ChapterTwo/String.md @@ -15,7 +15,7 @@ type: docs |0022|Generate Parentheses|[Go]({{< relref "/ChapterFour/0022.Generate-Parentheses.md" >}})|Medium| O(log n)| O(1)||64.8%| |0028|Implement strStr()|[Go]({{< relref "/ChapterFour/0028.Implement-strStr.md" >}})|Easy| O(n)| O(1)||35.1%| |0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.0%| -|0049|Group Anagrams|[Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})|Medium| O(n log n)| O(n)||58.8%| +|0049|Group Anagrams|[Go]({{< relref "/ChapterFour/0049.Group-Anagrams.md" >}})|Medium| O(n log n)| O(n)||58.9%| |0067|Add Binary|[Go]({{< relref "/ChapterFour/0067.Add-Binary.md" >}})|Easy||||46.6%| |0071|Simplify Path|[Go]({{< relref "/ChapterFour/0071.Simplify-Path.md" >}})|Medium| O(n)| O(n)||33.6%| |0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|35.7%| @@ -47,9 +47,9 @@ type: docs |1573|Number of Ways to Split a String|[Go]({{< relref "/ChapterFour/1573.Number-of-Ways-to-Split-a-String.md" >}})|Medium||||30.9%| |1653|Minimum Deletions to Make String Balanced|[Go]({{< relref "/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}})|Medium||||49.9%| |1662|Check If Two String Arrays are Equivalent|[Go]({{< relref "/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md" >}})|Easy||||83.6%| -|1668|Maximum Repeating Substring|[Go]({{< relref "/ChapterFour/1668.Maximum-Repeating-Substring.md" >}})|Easy||||38.7%| +|1668|Maximum Repeating Substring|[Go]({{< relref "/ChapterFour/1668.Maximum-Repeating-Substring.md" >}})|Easy||||38.8%| |1678|Goal Parser Interpretation|[Go]({{< relref "/ChapterFour/1678.Goal-Parser-Interpretation.md" >}})|Easy||||86.7%| -|1684|Count the Number of Consistent Strings|[Go]({{< relref "/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md" >}})|Easy||||84.2%| +|1684|Count the Number of Consistent Strings|[Go]({{< relref "/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md" >}})|Easy||||84.1%| |1694|Reformat Phone Number|[Go]({{< relref "/ChapterFour/1694.Reformat-Phone-Number.md" >}})|Easy||||67.0%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Tree.md b/website/content/ChapterTwo/Tree.md index 7b02a714..0f20b8a7 100644 --- a/website/content/ChapterTwo/Tree.md +++ b/website/content/ChapterTwo/Tree.md @@ -18,7 +18,7 @@ type: docs |0102|Binary Tree Level Order Traversal|[Go]({{< relref "/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md" >}})|Medium| O(n)| O(1)||56.2%| |0103|Binary Tree Zigzag Level Order Traversal|[Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}})|Medium| O(n)| O(n)||49.8%| |0104|Maximum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||67.7%| -|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| +|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.3%| |0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.2%| |0107|Binary Tree Level Order Traversal II|[Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}})|Easy| O(n)| O(1)||54.9%| |0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||60.0%| @@ -45,7 +45,7 @@ type: docs |0508|Most Frequent Subtree Sum|[Go]({{< relref "/ChapterFour/0508.Most-Frequent-Subtree-Sum.md" >}})|Medium||||58.9%| |0513|Find Bottom Left Tree Value|[Go]({{< relref "/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md" >}})|Medium||||62.3%| |0515|Find Largest Value in Each Tree Row|[Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}})|Medium| O(n)| O(n)||62.0%| -|0563|Binary Tree Tilt|[Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}})|Easy||||52.6%| +|0563|Binary Tree Tilt|[Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}})|Easy||||52.7%| |0572|Subtree of Another Tree|[Go]({{< relref "/ChapterFour/0572.Subtree-of-Another-Tree.md" >}})|Easy||||44.4%| |0637|Average of Levels in Binary Tree|[Go]({{< relref "/ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md" >}})|Easy| O(n)| O(n)||64.5%| |0653|Two Sum IV - Input is a BST|[Go]({{< relref "/ChapterFour/0653.Two-Sum-IV---Input-is-a-BST.md" >}})|Easy||||56.1%| @@ -62,7 +62,7 @@ type: docs |1026|Maximum Difference Between Node and Ancestor|[Go]({{< relref "/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}})|Medium||||69.2%| |1028|Recover a Tree From Preorder Traversal|[Go]({{< relref "/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md" >}})|Hard||||70.7%| |1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||67.6%| -|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||67.8%| +|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||67.9%| |1145|Binary Tree Coloring Game|[Go]({{< relref "/ChapterFour/1145.Binary-Tree-Coloring-Game.md" >}})|Medium||||51.4%| |1302|Deepest Leaves Sum|[Go]({{< relref "/ChapterFour/1302.Deepest-Leaves-Sum.md" >}})|Medium||||84.1%| |1305|All Elements in Two Binary Search Trees|[Go]({{< relref "/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}})|Medium||||77.8%| diff --git a/website/content/menu/index.md b/website/content/menu/index.md index c80d2474..702101df 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -525,6 +525,7 @@ headless: true - [1200.Minimum-Absolute-Difference]({{< relref "/ChapterFour/1200.Minimum-Absolute-Difference.md" >}}) - [1201.Ugly-Number-III]({{< relref "/ChapterFour/1201.Ugly-Number-III.md" >}}) - [1202.Smallest-String-With-Swaps]({{< relref "/ChapterFour/1202.Smallest-String-With-Swaps.md" >}}) + - [1203.Sort-Items-by-Groups-Respecting-Dependencies]({{< relref "/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md" >}}) - [1207.Unique-Number-of-Occurrences]({{< relref "/ChapterFour/1207.Unique-Number-of-Occurrences.md" >}}) - [1208.Get-Equal-Substrings-Within-Budget]({{< relref "/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md" >}}) - [1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position]({{< relref "/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md" >}}) From 0ae1bb265562be304c5f6054ec9f2e4a10932958 Mon Sep 17 00:00:00 2001 From: YDZ Date: Tue, 19 Jan 2021 01:00:46 +0800 Subject: [PATCH 81/82] Add solution 1696 & ctl add build menu --- README.md | 208 +++++++++--------- ctl/label.go | 42 ++++ ctl/refresh.go | 1 + ctl/render.go | 104 ++++++++- ctl/template/menu.md | 9 + ctl/util/util.go | 28 ++- .../1696.Jump-Game-VI/1696. Jump Game VI.go | 53 +++++ .../1696. Jump Game VI_test.go | 53 +++++ leetcode/1696.Jump-Game-VI/README.md | 109 +++++++++ .../content/ChapterFour/0174.Dungeon-Game.md | 2 + .../ChapterFour/1695.Maximum-Erasure-Value.md | 7 +- .../content/ChapterFour/1696.Jump-Game-VI.md | 114 ++++++++++ website/content/ChapterTwo/Array.md | 12 +- website/content/ChapterTwo/Backtracking.md | 2 +- .../content/ChapterTwo/Binary_Indexed_Tree.md | 2 +- website/content/ChapterTwo/Binary_Search.md | 10 +- .../ChapterTwo/Breadth_First_Search.md | 4 +- .../content/ChapterTwo/Depth_First_Search.md | 4 +- .../content/ChapterTwo/Dynamic_Programming.md | 12 +- website/content/ChapterTwo/Hash_Table.md | 10 +- website/content/ChapterTwo/Linked_List.md | 2 +- website/content/ChapterTwo/Math.md | 2 +- website/content/ChapterTwo/Segment_Tree.md | 2 +- website/content/ChapterTwo/Sort.md | 8 +- website/content/ChapterTwo/String.md | 2 +- website/content/ChapterTwo/Tree.md | 2 +- website/content/ChapterTwo/Two_Pointers.md | 2 +- website/content/menu/index.md | 3 + 28 files changed, 658 insertions(+), 151 deletions(-) create mode 100644 ctl/template/menu.md create mode 100644 leetcode/1696.Jump-Game-VI/1696. Jump Game VI.go create mode 100644 leetcode/1696.Jump-Game-VI/1696. Jump Game VI_test.go create mode 100644 leetcode/1696.Jump-Game-VI/README.md create mode 100644 website/content/ChapterFour/1696.Jump-Game-VI.md diff --git a/README.md b/README.md index 9b420742..27468a88 100755 --- a/README.md +++ b/README.md @@ -126,15 +126,15 @@ | | Easy | Medium | Hard | Total | |:--------:|:--------:|:--------:|:--------:|:--------:| |Optimizing|39|44|15|98| -|Accepted|**250**|**315**|**95**|**660**| +|Accepted|**250**|**316**|**95**|**661**| |Total|459|903|367|1729| -|Perfection Rate|84.4%|86.0%|84.2%|85.2%| -|Completion Rate|54.5%|34.9%|25.9%|38.2%| +|Perfection Rate|84.4%|86.1%|84.2%|85.2%| +|Completion Rate|54.5%|35.0%|25.9%|38.2%| |------------|----------------------------|----------------------------|----------------------------|----------------------------| ## 二. 目录 -以下已经收录了 562 道题的题解,还有 11 道题在尝试优化到 beats 100% +以下已经收录了 563 道题的题解,还有 10 道题在尝试优化到 beats 100% | No. | Title | Solution | Acceptance | Difficulty | Frequency | |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| @@ -168,9 +168,9 @@ |0028|Implement strStr()|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0028.Implement-strStr())|35.1%|Easy|| |0029|Divide Two Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0029.Divide-Two-Integers)|16.6%|Medium|| |0030|Substring with Concatenation of All Words|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0030.Substring-with-Concatenation-of-All-Words)|26.0%|Hard|| -|0031|Next Permutation||33.2%|Medium|| +|0031|Next Permutation||33.3%|Medium|| |0032|Longest Valid Parentheses||29.1%|Hard|| -|0033|Search in Rotated Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0033.Search-in-Rotated-Sorted-Array)|35.6%|Medium|| +|0033|Search in Rotated Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0033.Search-in-Rotated-Sorted-Array)|35.7%|Medium|| |0034|Find First and Last Position of Element in Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array)|37.1%|Medium|| |0035|Search Insert Position|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0035.Search-Insert-Position)|42.8%|Easy|| |0036|Valid Sudoku|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0036.Valid-Sudoku)|50.2%|Medium|| @@ -180,7 +180,7 @@ |0040|Combination Sum II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0040.Combination-Sum-II)|49.8%|Medium|| |0041|First Missing Positive|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0041.First-Missing-Positive)|33.4%|Hard|| |0042|Trapping Rain Water|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0042.Trapping-Rain-Water)|50.8%|Hard|| -|0043|Multiply Strings||34.7%|Medium|| +|0043|Multiply Strings||34.8%|Medium|| |0044|Wildcard Matching||25.3%|Hard|| |0045|Jump Game II||31.3%|Hard|| |0046|Permutations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0046.Permutations)|66.1%|Medium|| @@ -212,7 +212,7 @@ |0072|Edit Distance||46.4%|Hard|| |0073|Set Matrix Zeroes||44.1%|Medium|| |0074|Search a 2D Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0074.Search-a-2D-Matrix)|37.4%|Medium|| -|0075|Sort Colors|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0075.Sort-Colors)|48.9%|Medium|| +|0075|Sort Colors|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0075.Sort-Colors)|49.0%|Medium|| |0076|Minimum Window Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0076.Minimum-Window-Substring)|35.7%|Hard|| |0077|Combinations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0077.Combinations)|56.9%|Medium|| |0078|Subsets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0078.Subsets)|64.5%|Medium|| @@ -280,7 +280,7 @@ |0140|Word Break II||34.3%|Hard|| |0141|Linked List Cycle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0141.Linked-List-Cycle)|42.2%|Easy|| |0142|Linked List Cycle II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0142.Linked-List-Cycle-II)|39.3%|Medium|| -|0143|Reorder List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0143.Reorder-List)|40.2%|Medium|| +|0143|Reorder List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0143.Reorder-List)|40.3%|Medium|| |0144|Binary Tree Preorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0144.Binary-Tree-Preorder-Traversal)|57.1%|Medium|| |0145|Binary Tree Postorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0145.Binary-Tree-Postorder-Traversal)|57.1%|Medium|| |0146|LRU Cache|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0146.LRU-Cache)|35.3%|Medium|| @@ -373,13 +373,13 @@ |0233|Number of Digit One||31.7%|Hard|| |0234|Palindrome Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0234.Palindrome-Linked-List)|40.2%|Easy|| |0235|Lowest Common Ancestor of a Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree)|51.4%|Easy|| -|0236|Lowest Common Ancestor of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree)|48.1%|Medium|| +|0236|Lowest Common Ancestor of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree)|48.2%|Medium|| |0237|Delete Node in a Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0237.Delete-Node-in-a-Linked-List)|66.3%|Easy|| |0238|Product of Array Except Self||61.2%|Medium|| |0239|Sliding Window Maximum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0239.Sliding-Window-Maximum)|44.5%|Hard|| |0240|Search a 2D Matrix II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0240.Search-a-2D-Matrix-II)|44.2%|Medium|| |0241|Different Ways to Add Parentheses||57.0%|Medium|| -|0242|Valid Anagram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0242.Valid-Anagram)|57.9%|Easy|| +|0242|Valid Anagram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0242.Valid-Anagram)|58.0%|Easy|| |0243|Shortest Word Distance||61.8%|Easy|| |0244|Shortest Word Distance II||53.6%|Medium|| |0245|Shortest Word Distance III||55.8%|Medium|| @@ -419,7 +419,7 @@ |0279|Perfect Squares||48.6%|Medium|| |0280|Wiggle Sort||64.5%|Medium|| |0281|Zigzag Iterator||59.2%|Medium|| -|0282|Expression Add Operators||36.6%|Hard|| +|0282|Expression Add Operators||36.5%|Hard|| |0283|Move Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0283.Move-Zeroes)|58.4%|Easy|| |0284|Peeking Iterator||47.4%|Medium|| |0285|Inorder Successor in BST||42.4%|Medium|| @@ -437,7 +437,7 @@ |0297|Serialize and Deserialize Binary Tree||49.4%|Hard|| |0298|Binary Tree Longest Consecutive Sequence||47.8%|Medium|| |0299|Bulls and Cows||44.3%|Medium|| -|0300|Longest Increasing Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0300.Longest-Increasing-Subsequence)|43.6%|Medium|| +|0300|Longest Increasing Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0300.Longest-Increasing-Subsequence)|43.7%|Medium|| |0301|Remove Invalid Parentheses||44.4%|Hard|| |0302|Smallest Rectangle Enclosing Black Pixels||52.3%|Hard|| |0303|Range Sum Query - Immutable|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0303.Range-Sum-Query---Immutable)|47.1%|Easy|| @@ -476,7 +476,7 @@ |0336|Palindrome Pairs||34.4%|Hard|| |0337|House Robber III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0337.House-Robber-III)|51.7%|Medium|| |0338|Counting Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0338.Counting-Bits)|70.2%|Medium|| -|0339|Nested List Weight Sum||76.0%|Easy|| +|0339|Nested List Weight Sum||76.1%|Easy|| |0340|Longest Substring with At Most K Distinct Characters||45.2%|Medium|| |0341|Flatten Nested List Iterator||54.2%|Medium|| |0342|Power of Four|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0342.Power-of-Four)|41.6%|Easy|| @@ -546,14 +546,14 @@ |0406|Queue Reconstruction by Height||68.1%|Medium|| |0407|Trapping Rain Water II||43.8%|Hard|| |0408|Valid Word Abbreviation||31.3%|Easy|| -|0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.2%|Easy|| +|0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.1%|Easy|| |0410|Split Array Largest Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0410.Split-Array-Largest-Sum)|46.1%|Hard|| |0411|Minimum Unique Word Abbreviation||37.0%|Hard|| |0412|Fizz Buzz|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0412.Fizz-Buzz)|63.5%|Easy|| |0413|Arithmetic Slices||58.5%|Medium|| |0414|Third Maximum Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0414.Third-Maximum-Number)|30.6%|Easy|| |0415|Add Strings||48.1%|Easy|| -|0416|Partition Equal Subset Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0416.Partition-Equal-Subset-Sum)|44.7%|Medium|| +|0416|Partition Equal Subset Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0416.Partition-Equal-Subset-Sum)|44.8%|Medium|| |0417|Pacific Atlantic Water Flow||42.3%|Medium|| |0418|Sentence Screen Fitting||33.0%|Medium|| |0419|Battleships in a Board||70.9%|Medium|| @@ -587,7 +587,7 @@ |0447|Number of Boomerangs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0447.Number-of-Boomerangs)|52.3%|Medium|| |0448|Find All Numbers Disappeared in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array)|56.1%|Easy|| |0449|Serialize and Deserialize BST||53.8%|Medium|| -|0450|Delete Node in a BST||45.1%|Medium|| +|0450|Delete Node in a BST||45.2%|Medium|| |0451|Sort Characters By Frequency|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0451.Sort-Characters-By-Frequency)|64.1%|Medium|| |0452|Minimum Number of Arrows to Burst Balloons||49.7%|Medium|| |0453|Minimum Moves to Equal Array Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0453.Minimum-Moves-to-Equal-Array-Elements)|50.7%|Easy|| @@ -634,7 +634,7 @@ |0494|Target Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0494.Target-Sum)|45.8%|Medium|| |0495|Teemo Attacking||56.1%|Medium|| |0496|Next Greater Element I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0496.Next-Greater-Element-I)|65.2%|Easy|| -|0497|Random Point in Non-overlapping Rectangles|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles)|39.0%|Medium|| +|0497|Random Point in Non-overlapping Rectangles|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles)|39.1%|Medium|| |0498|Diagonal Traverse|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0498.Diagonal-Traverse)|50.1%|Medium|| |0499|The Maze III||42.2%|Hard|| |0500|Keyboard Row|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0500.Keyboard-Row)|65.5%|Easy|| @@ -688,7 +688,7 @@ |0548|Split Array with Equal Sum||47.7%|Medium|| |0549|Binary Tree Longest Consecutive Sequence II||47.2%|Medium|| |0550|Game Play Analysis IV||46.0%|Medium|| -|0551|Student Attendance Record I||46.0%|Easy|| +|0551|Student Attendance Record I||46.1%|Easy|| |0552|Student Attendance Record II||37.2%|Hard|| |0553|Optimal Division||57.3%|Medium|| |0554|Brick Wall||50.6%|Medium|| @@ -697,7 +697,7 @@ |0557|Reverse Words in a String III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0557.Reverse-Words-in-a-String-III)|71.6%|Easy|| |0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.5%|Medium|| |0559|Maximum Depth of N-ary Tree||69.4%|Easy|| -|0560|Subarray Sum Equals K||43.9%|Medium|| +|0560|Subarray Sum Equals K||43.8%|Medium|| |0561|Array Partition I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0561.Array-Partition-I)|72.9%|Easy|| |0562|Longest Line of Consecutive One in Matrix||46.2%|Medium|| |0563|Binary Tree Tilt|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0563.Binary-Tree-Tilt)|52.7%|Easy|| @@ -778,7 +778,7 @@ |0638|Shopping Offers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0638.Shopping-Offers)|52.6%|Medium|| |0639|Decode Ways II||27.5%|Hard|| |0640|Solve the Equation||42.6%|Medium|| -|0641|Design Circular Deque||54.6%|Medium|| +|0641|Design Circular Deque||54.5%|Medium|| |0642|Design Search Autocomplete System||45.9%|Hard|| |0643|Maximum Average Subarray I||42.0%|Easy|| |0644|Maximum Average Subarray II||33.9%|Hard|| @@ -801,7 +801,7 @@ |0661|Image Smoother|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0661.Image-Smoother)|52.2%|Easy|| |0662|Maximum Width of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0662.Maximum-Width-of-Binary-Tree)|40.0%|Medium|| |0663|Equal Tree Partition||39.7%|Medium|| -|0664|Strange Printer||41.3%|Hard|| +|0664|Strange Printer||41.2%|Hard|| |0665|Non-decreasing Array||19.6%|Easy|| |0666|Path Sum IV||55.6%|Medium|| |0667|Beautiful Arrangement II||55.0%|Medium|| @@ -813,7 +813,7 @@ |0673|Number of Longest Increasing Subsequence||38.4%|Medium|| |0674|Longest Continuous Increasing Subsequence||46.0%|Easy|| |0675|Cut Off Trees for Golf Event||35.1%|Hard|| -|0676|Implement Magic Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0676.Implement-Magic-Dictionary)|55.1%|Medium|| +|0676|Implement Magic Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0676.Implement-Magic-Dictionary)|55.2%|Medium|| |0677|Map Sum Pairs||53.9%|Medium|| |0678|Valid Parenthesis String||31.5%|Medium|| |0679|24 Game||47.1%|Hard|| @@ -832,7 +832,7 @@ |0692|Top K Frequent Words||52.9%|Medium|| |0693|Binary Number with Alternating Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0693.Binary-Number-with-Alternating-Bits)|59.7%|Easy|| |0694|Number of Distinct Islands||57.4%|Medium|| -|0695|Max Area of Island|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0695.Max-Area-of-Island)|64.3%|Medium|| +|0695|Max Area of Island|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0695.Max-Area-of-Island)|64.4%|Medium|| |0696|Count Binary Substrings||57.3%|Easy|| |0697|Degree of an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0697.Degree-of-an-Array)|54.4%|Easy|| |0698|Partition to K Equal Sum Subsets||45.5%|Medium|| @@ -868,7 +868,7 @@ |0728|Self Dividing Numbers||75.3%|Easy|| |0729|My Calendar I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0729.My-Calendar-I)|53.1%|Medium|| |0730|Count Different Palindromic Subsequences||43.4%|Hard|| -|0731|My Calendar II||50.2%|Medium|| +|0731|My Calendar II||50.3%|Medium|| |0732|My Calendar III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0732.My-Calendar-III)|61.4%|Hard|| |0733|Flood Fill|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0733.Flood-Fill)|55.8%|Easy|| |0734|Sentence Similarity||42.3%|Easy|| @@ -967,7 +967,7 @@ |0827|Making A Large Island||47.1%|Hard|| |0828|Count Unique Characters of All Substrings of a Given String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String)|46.8%|Hard|| |0829|Consecutive Numbers Sum||39.3%|Hard|| -|0830|Positions of Large Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0830.Positions-of-Large-Groups)|50.2%|Easy|| +|0830|Positions of Large Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0830.Positions-of-Large-Groups)|50.3%|Easy|| |0831|Masking Personal Information||44.7%|Medium|| |0832|Flipping an Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0832.Flipping-an-Image)|77.9%|Easy|| |0833|Find And Replace in String||51.3%|Medium|| @@ -997,7 +997,7 @@ |0857|Minimum Cost to Hire K Workers||50.3%|Hard|| |0858|Mirror Reflection||59.5%|Medium|| |0859|Buddy Strings||29.6%|Easy|| -|0860|Lemonade Change||51.9%|Easy|| +|0860|Lemonade Change||51.8%|Easy|| |0861|Score After Flipping Matrix||73.4%|Medium|| |0862|Shortest Subarray with Sum at Least K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K)|25.1%|Hard|| |0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|57.5%|Medium|| @@ -1007,7 +1007,7 @@ |0867|Transpose Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0867.Transpose-Matrix)|62.2%|Easy|| |0868|Binary Gap||60.8%|Easy|| |0869|Reordered Power of 2||54.1%|Medium|| -|0870|Advantage Shuffle||46.7%|Medium|| +|0870|Advantage Shuffle||46.6%|Medium|| |0871|Minimum Number of Refueling Stops||32.1%|Hard|| |0872|Leaf-Similar Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0872.Leaf-Similar-Trees)|64.5%|Easy|| |0873|Length of Longest Fibonacci Subsequence||48.1%|Medium|| @@ -1023,7 +1023,7 @@ |0883|Projection Area of 3D Shapes||68.1%|Easy|| |0884|Uncommon Words from Two Sentences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0884.Uncommon-Words-from-Two-Sentences)|64.0%|Easy|| |0885|Spiral Matrix III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0885.Spiral-Matrix-III)|70.5%|Medium|| -|0886|Possible Bipartition||44.9%|Medium|| +|0886|Possible Bipartition||45.0%|Medium|| |0887|Super Egg Drop|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0887.Super-Egg-Drop)|27.0%|Hard|| |0888|Fair Candy Swap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0888.Fair-Candy-Swap)|58.8%|Easy|| |0889|Construct Binary Tree from Preorder and Postorder Traversal||67.3%|Medium|| @@ -1166,12 +1166,12 @@ |1026|Maximum Difference Between Node and Ancestor|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor)|69.2%|Medium|| |1027|Longest Arithmetic Subsequence||49.8%|Medium|| |1028|Recover a Tree From Preorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1028.Recover-a-Tree-From-Preorder-Traversal)|70.7%|Hard|| -|1029|Two City Scheduling||57.6%|Medium|| +|1029|Two City Scheduling||57.7%|Medium|| |1030|Matrix Cells in Distance Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1030.Matrix-Cells-in-Distance-Order)|66.9%|Easy|| |1031|Maximum Sum of Two Non-Overlapping Subarrays||58.8%|Medium|| |1032|Stream of Characters||48.6%|Hard|| |1033|Moving Stones Until Consecutive||43.0%|Easy|| -|1034|Coloring A Border||45.5%|Medium|| +|1034|Coloring A Border||45.4%|Medium|| |1035|Uncrossed Lines||56.0%|Medium|| |1036|Escape a Large Maze||34.8%|Hard|| |1037|Valid Boomerang|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1037.Valid-Boomerang)|37.9%|Easy|| @@ -1187,7 +1187,7 @@ |1047|Remove All Adjacent Duplicates In String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String)|70.3%|Easy|| |1048|Longest String Chain||55.3%|Medium|| |1049|Last Stone Weight II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II)|45.0%|Medium|| -|1050|Actors and Directors Who Cooperated At Least Three Times||72.1%|Easy|| +|1050|Actors and Directors Who Cooperated At Least Three Times||72.2%|Easy|| |1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.9%|Easy|| |1052|Grumpy Bookstore Owner|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1052.Grumpy-Bookstore-Owner)|55.7%|Medium|| |1053|Previous Permutation With One Swap||50.8%|Medium|| @@ -1196,7 +1196,7 @@ |1056|Confusing Number||47.1%|Easy|| |1057|Campus Bikes||57.6%|Medium|| |1058|Minimize Rounding Error to Meet Target||43.2%|Medium|| -|1059|All Paths from Source Lead to Destination||43.2%|Medium|| +|1059|All Paths from Source Lead to Destination||43.3%|Medium|| |1060|Missing Element in Sorted Array||54.7%|Medium|| |1061|Lexicographically Smallest Equivalent String||66.7%|Medium|| |1062|Longest Repeating Substring||58.0%|Medium|| @@ -1244,7 +1244,7 @@ |1104|Path In Zigzag Labelled Binary Tree||73.0%|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.1%|Hard|| -|1107|New Users Daily Count||45.7%|Medium|| +|1107|New Users Daily Count||45.8%|Medium|| |1108|Defanging an IP Address|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1108.Defanging-an-IP-Address)|88.5%|Easy|| |1109|Corporate Flight Bookings||54.2%|Medium|| |1110|Delete Nodes And Return Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1110.Delete-Nodes-And-Return-Forest)|67.6%|Medium|| @@ -1253,7 +1253,7 @@ |1113|Reported Posts||65.4%|Easy|| |1114|Print in Order||67.0%|Easy|| |1115|Print FooBar Alternately||59.1%|Medium|| -|1116|Print Zero Even Odd||57.6%|Medium|| +|1116|Print Zero Even Odd||57.7%|Medium|| |1117|Building H2O||53.2%|Medium|| |1118|Number of Days in a Month||57.5%|Easy|| |1119|Remove Vowels from a String||90.5%|Easy|| @@ -1289,23 +1289,23 @@ |1149|Article Views II||48.4%|Medium|| |1150|Check If a Number Is Majority Element in a Sorted Array||57.9%|Easy|| |1151|Minimum Swaps to Group All 1's Together||58.2%|Medium|| -|1152|Analyze User Website Visit Pattern||43.4%|Medium|| +|1152|Analyze User Website Visit Pattern||43.3%|Medium|| |1153|String Transforms Into Another String||36.0%|Hard|| |1154|Day of the Year|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1154.Day-of-the-Year)|49.3%|Easy|| -|1155|Number of Dice Rolls With Target Sum||47.5%|Medium|| +|1155|Number of Dice Rolls With Target Sum||47.6%|Medium|| |1156|Swap For Longest Repeated Character Substring||47.4%|Medium|| |1157|Online Majority Element In Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1157.Online-Majority-Element-In-Subarray)|39.5%|Hard|| |1158|Market Analysis I||63.5%|Medium|| |1159|Market Analysis II||55.1%|Hard|| |1160|Find Words That Can Be Formed by Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters)|67.5%|Easy|| -|1161|Maximum Level Sum of a Binary Tree||70.1%|Medium|| +|1161|Maximum Level Sum of a Binary Tree||70.0%|Medium|| |1162|As Far from Land as Possible||45.0%|Medium|| |1163|Last Substring in Lexicographical Order||36.3%|Hard|| |1164|Product Price at a Given Date||68.1%|Medium|| |1165|Single-Row Keyboard||84.8%|Easy|| |1166|Design File System||58.3%|Medium|| |1167|Minimum Cost to Connect Sticks||64.2%|Medium|| -|1168|Optimize Water Distribution in a Village||62.1%|Hard|| +|1168|Optimize Water Distribution in a Village||62.0%|Hard|| |1169|Invalid Transactions||31.5%|Medium|| |1170|Compare Strings by Frequency of the Smallest Character|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character)|59.5%|Easy|| |1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List)|41.4%|Medium|| @@ -1331,17 +1331,17 @@ |1191|K-Concatenation Maximum Sum||25.4%|Medium|| |1192|Critical Connections in a Network||49.9%|Hard|| |1193|Monthly Transactions I||69.1%|Medium|| -|1194|Tournament Winners||52.2%|Hard|| -|1195|Fizz Buzz Multithreaded||70.5%|Medium|| +|1194|Tournament Winners||52.1%|Hard|| +|1195|Fizz Buzz Multithreaded||70.4%|Medium|| |1196|How Many Apples Can You Put into the Basket||68.2%|Easy|| |1197|Minimum Knight Moves||37.1%|Medium|| |1198|Find Smallest Common Element in All Rows||75.2%|Medium|| |1199|Minimum Time to Build Blocks||38.4%|Hard|| -|1200|Minimum Absolute Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1200.Minimum-Absolute-Difference)|66.8%|Easy|| +|1200|Minimum Absolute Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1200.Minimum-Absolute-Difference)|66.9%|Easy|| |1201|Ugly Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1201.Ugly-Number-III)|26.3%|Medium|| |1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|48.4%|Medium|| |1203|Sort Items by Groups Respecting Dependencies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies)|49.1%|Hard|| -|1204|Last Person to Fit in the Elevator||71.5%|Medium|| +|1204|Last Person to Fit in the Elevator||71.4%|Medium|| |1205|Monthly Transactions II||45.9%|Medium|| |1206|Design Skiplist||59.0%|Hard|| |1207|Unique Number of Occurrences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1207.Unique-Number-of-Occurrences)|71.6%|Easy|| @@ -1372,7 +1372,7 @@ |1232|Check If It Is a Straight Line|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1232.Check-If-It-Is-a-Straight-Line)|43.8%|Easy|| |1233|Remove Sub-Folders from the Filesystem||61.7%|Medium|| |1234|Replace the Substring for Balanced String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1234.Replace-the-Substring-for-Balanced-String)|34.4%|Medium|| -|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|47.0%|Hard|| +|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|46.9%|Hard|| |1236|Web Crawler||64.5%|Medium|| |1237|Find Positive Integer Solution for a Given Equation||69.7%|Easy|| |1238|Circular Permutation in Binary Representation||65.8%|Medium|| @@ -1381,7 +1381,7 @@ |1241|Number of Comments per Post||67.5%|Easy|| |1242|Web Crawler Multithreaded||47.9%|Medium|| |1243|Array Transformation||50.3%|Easy|| -|1244|Design A Leaderboard||65.9%|Medium|| +|1244|Design A Leaderboard||65.8%|Medium|| |1245|Tree Diameter||61.2%|Medium|| |1246|Palindrome Removal||45.8%|Hard|| |1247|Minimum Swaps to Make Strings Equal||62.3%|Medium|| @@ -1431,10 +1431,10 @@ |1291|Sequential Digits||57.4%|Medium|| |1292|Maximum Side Length of a Square with Sum Less than or Equal to Threshold||50.5%|Medium|| |1293|Shortest Path in a Grid with Obstacles Elimination||42.9%|Hard|| -|1294|Weather Type in Each Country||66.1%|Easy|| +|1294|Weather Type in Each Country||66.2%|Easy|| |1295|Find Numbers with Even Number of Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits)|79.3%|Easy|| |1296|Divide Array in Sets of K Consecutive Numbers||55.3%|Medium|| -|1297|Maximum Number of Occurrences of a Substring||49.3%|Medium|| +|1297|Maximum Number of Occurrences of a Substring||49.2%|Medium|| |1298|Maximum Candies You Can Get from Boxes||59.6%|Hard|| |1299|Replace Elements with Greatest Element on Right Side|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side)|74.2%|Easy|| |1300|Sum of Mutated Array Closest to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target)|43.3%|Medium|| @@ -1443,7 +1443,7 @@ |1303|Find the Team Size||89.4%|Easy|| |1304|Find N Unique Integers Sum up to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero)|76.6%|Easy|| |1305|All Elements in Two Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1305.All-Elements-in-Two-Binary-Search-Trees)|77.8%|Medium|| -|1306|Jump Game III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1306.Jump-Game-III)|62.5%|Medium|| +|1306|Jump Game III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1306.Jump-Game-III)|62.6%|Medium|| |1307|Verbal Arithmetic Puzzle||37.1%|Hard|| |1308|Running Total for Different Genders||87.1%|Medium|| |1309|Decrypt String from Alphabet to Integer Mapping||77.2%|Easy|| @@ -1488,13 +1488,13 @@ |1348|Tweet Counts Per Frequency||34.0%|Medium|| |1349|Maximum Students Taking Exam||44.0%|Hard|| |1350|Students With Invalid Departments||90.6%|Easy|| -|1351|Count Negative Numbers in a Sorted Matrix||75.8%|Easy|| -|1352|Product of the Last K Numbers||43.8%|Medium|| +|1351|Count Negative Numbers in a Sorted Matrix||75.9%|Easy|| +|1352|Product of the Last K Numbers||43.9%|Medium|| |1353|Maximum Number of Events That Can Be Attended||30.1%|Medium|| |1354|Construct Target Array With Multiple Sums||31.3%|Hard|| -|1355|Activity Participants||74.1%|Medium|| +|1355|Activity Participants||74.2%|Medium|| |1356|Sort Integers by The Number of 1 Bits||69.6%|Easy|| -|1357|Apply Discount Every n Orders||66.5%|Medium|| +|1357|Apply Discount Every n Orders||66.6%|Medium|| |1358|Number of Substrings Containing All Three Characters||60.4%|Medium|| |1359|Count All Valid Pickup and Delivery Options||56.8%|Hard|| |1360|Number of Days Between Two Dates||46.9%|Easy|| @@ -1519,7 +1519,7 @@ |1379|Find a Corresponding Node of a Binary Tree in a Clone of That Tree||85.0%|Medium|| |1380|Lucky Numbers in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix)|70.8%|Easy|| |1381|Design a Stack With Increment Operation||75.8%|Medium|| -|1382|Balance a Binary Search Tree||76.0%|Medium|| +|1382|Balance a Binary Search Tree||76.1%|Medium|| |1383|Maximum Performance of a Team||35.2%|Hard|| |1384|Total Sales Amount by Year||64.4%|Hard|| |1385|Find the Distance Value Between Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays)|66.4%|Easy|| @@ -1539,7 +1539,7 @@ |1399|Count Largest Group||65.4%|Easy|| |1400|Construct K Palindrome Strings||62.8%|Medium|| |1401|Circle and Rectangle Overlapping||42.3%|Medium|| -|1402|Reducing Dishes||72.2%|Hard|| +|1402|Reducing Dishes||72.3%|Hard|| |1403|Minimum Subsequence in Non-Increasing Order||71.1%|Easy|| |1404|Number of Steps to Reduce a Number in Binary Representation to One||49.8%|Medium|| |1405|Longest Happy String||52.2%|Medium|| @@ -1552,7 +1552,7 @@ |1412|Find the Quiet Students in All Exams||65.5%|Hard|| |1413|Minimum Value to Get Positive Step by Step Sum||65.4%|Easy|| |1414|Find the Minimum Number of Fibonacci Numbers Whose Sum Is K||63.8%|Medium|| -|1415|The k-th Lexicographical String of All Happy Strings of Length n||70.1%|Medium|| +|1415|The k-th Lexicographical String of All Happy Strings of Length n||70.0%|Medium|| |1416|Restore The Array||36.3%|Hard|| |1417|Reformat The String||55.4%|Easy|| |1418|Display Table of Food Orders in a Restaurant||68.4%|Medium|| @@ -1561,7 +1561,7 @@ |1421|NPV Queries||81.9%|Medium|| |1422|Maximum Score After Splitting a String||56.0%|Easy|| |1423|Maximum Points You Can Obtain from Cards||46.4%|Medium|| -|1424|Diagonal Traverse II||45.5%|Medium|| +|1424|Diagonal Traverse II||45.6%|Medium|| |1425|Constrained Subsequence Sum||45.0%|Hard|| |1426|Counting Elements||59.0%|Easy|| |1427|Perform String Shifts||53.4%|Easy|| @@ -1569,20 +1569,20 @@ |1429|First Unique Number||49.1%|Medium|| |1430|Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree||45.1%|Medium|| |1431|Kids With the Greatest Number of Candies||88.5%|Easy|| -|1432|Max Difference You Can Get From Changing an Integer||42.8%|Medium|| -|1433|Check If a String Can Break Another String||67.0%|Medium|| -|1434|Number of Ways to Wear Different Hats to Each Other||39.2%|Hard|| +|1432|Max Difference You Can Get From Changing an Integer||42.9%|Medium|| +|1433|Check If a String Can Break Another String||66.9%|Medium|| +|1434|Number of Ways to Wear Different Hats to Each Other||39.1%|Hard|| |1435|Create a Session Bar Chart||77.8%|Easy|| |1436|Destination City||77.1%|Easy|| |1437|Check If All 1's Are at Least Length K Places Away||61.8%|Medium|| -|1438|Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit||44.0%|Medium|| +|1438|Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit||44.1%|Medium|| |1439|Find the Kth Smallest Sum of a Matrix With Sorted Rows||60.0%|Hard|| |1440|Evaluate Boolean Expression||74.6%|Medium|| |1441|Build an Array With Stack Operations||69.1%|Easy|| |1442|Count Triplets That Can Form Two Arrays of Equal XOR||71.0%|Medium|| |1443|Minimum Time to Collect All Apples in a Tree||54.6%|Medium|| |1444|Number of Ways of Cutting a Pizza||53.7%|Hard|| -|1445|Apples & Oranges||90.8%|Medium|| +|1445|Apples & Oranges||90.7%|Medium|| |1446|Consecutive Characters||61.1%|Easy|| |1447|Simplified Fractions||62.2%|Medium|| |1448|Count Good Nodes in Binary Tree||70.3%|Medium|| @@ -1631,7 +1631,7 @@ |1491|Average Salary Excluding the Minimum and Maximum Salary||68.3%|Easy|| |1492|The kth Factor of n||63.4%|Medium|| |1493|Longest Subarray of 1's After Deleting One Element||58.2%|Medium|| -|1494|Parallel Courses II||31.4%|Hard|| +|1494|Parallel Courses II||31.5%|Hard|| |1495|Friendly Movies Streamed Last Month||51.4%|Easy|| |1496|Path Crossing||55.5%|Easy|| |1497|Check If Array Pairs Are Divisible by k||40.5%|Medium|| @@ -1654,14 +1654,14 @@ |1514|Path with Maximum Probability||39.5%|Medium|| |1515|Best Position for a Service Centre||37.0%|Hard|| |1516|Move Sub-Tree of N-Ary Tree||62.7%|Hard|| -|1517|Find Users With Valid E-Mails||71.8%|Easy|| +|1517|Find Users With Valid E-Mails||71.7%|Easy|| |1518|Water Bottles||60.7%|Easy|| |1519|Number of Nodes in the Sub-Tree With the Same Label||36.9%|Medium|| |1520|Maximum Number of Non-Overlapping Substrings||36.1%|Hard|| |1521|Find a Value of a Mysterious Function Closest to Target||44.4%|Hard|| -|1522|Diameter of N-Ary Tree||68.8%|Medium|| +|1522|Diameter of N-Ary Tree||68.9%|Medium|| |1523|Count Odd Numbers in an Interval Range||55.0%|Easy|| -|1524|Number of Sub-arrays With Odd Sum||39.5%|Medium|| +|1524|Number of Sub-arrays With Odd Sum||39.6%|Medium|| |1525|Number of Good Ways to Split a String||66.7%|Medium|| |1526|Minimum Number of Increments on Subarrays to Form a Target Array||59.8%|Hard|| |1527|Patients With a Condition||74.9%|Easy|| @@ -1685,7 +1685,7 @@ |1545|Find Kth Bit in Nth Binary String||57.3%|Medium|| |1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||43.8%|Medium|| |1547|Minimum Cost to Cut a Stick||52.1%|Hard|| -|1548|The Most Similar Path in a Graph||53.9%|Hard|| +|1548|The Most Similar Path in a Graph||54.0%|Hard|| |1549|The Most Recent Orders for Each Product||66.2%|Medium|| |1550|Three Consecutive Odds||65.3%|Easy|| |1551|Minimum Operations to Make Array Equal||77.8%|Medium|| @@ -1700,7 +1700,7 @@ |1560|Most Visited Sector in a Circular Track||57.0%|Easy|| |1561|Maximum Number of Coins You Can Get||78.0%|Medium|| |1562|Find Latest Group of Size M||39.4%|Medium|| -|1563|Stone Game V||40.0%|Hard|| +|1563|Stone Game V||40.1%|Hard|| |1564|Put Boxes Into the Warehouse I||66.0%|Medium|| |1565|Unique Orders and Customers Per Month||83.5%|Easy|| |1566|Detect Pattern of Length M Repeated K or More Times||42.3%|Easy|| @@ -1723,7 +1723,7 @@ |1583|Count Unhappy Friends||53.8%|Medium|| |1584|Min Cost to Connect All Points||50.5%|Medium|| |1585|Check If String Is Transformable With Substring Sort Operations||48.1%|Hard|| -|1586|Binary Search Tree Iterator II||66.3%|Medium|| +|1586|Binary Search Tree Iterator II||66.4%|Medium|| |1587|Bank Account Summary II||90.3%|Easy|| |1588|Sum of All Odd Length Subarrays||82.0%|Easy|| |1589|Maximum Sum Obtained of Any Permutation||34.7%|Medium|| @@ -1751,11 +1751,11 @@ |1611|Minimum One Bit Operations to Make Integers Zero||57.1%|Hard|| |1612|Check If Two Expression Trees are Equivalent||69.9%|Medium|| |1613|Find the Missing IDs||72.4%|Medium|| -|1614|Maximum Nesting Depth of the Parentheses||83.5%|Easy|| +|1614|Maximum Nesting Depth of the Parentheses||83.4%|Easy|| |1615|Maximal Network Rank||51.7%|Medium|| |1616|Split Two Strings to Make Palindrome||36.4%|Medium|| |1617|Count Subtrees With Max Distance Between Cities||63.5%|Hard|| -|1618|Maximum Font to Fit a Sentence in a Screen||58.0%|Medium|| +|1618|Maximum Font to Fit a Sentence in a Screen||58.1%|Medium|| |1619|Mean of Array After Removing Some Elements||65.5%|Easy|| |1620|Coordinate With Maximum Network Quality||37.0%|Medium|| |1621|Number of Sets of K Non-Overlapping Line Segments||41.2%|Medium|| @@ -1766,7 +1766,7 @@ |1626|Best Team With No Conflicts||37.3%|Medium|| |1627|Graph Connectivity With Threshold||38.2%|Hard|| |1628|Design an Expression Tree With Evaluate Function||80.5%|Medium|| -|1629|Slowest Key||58.9%|Easy|| +|1629|Slowest Key||59.0%|Easy|| |1630|Arithmetic Subarrays||77.7%|Medium|| |1631|Path With Minimum Effort||43.5%|Medium|| |1632|Rank Transform of a Matrix||30.5%|Hard|| @@ -1774,36 +1774,36 @@ |1634|Add Two Polynomials Represented as Linked Lists||55.7%|Medium|| |1635|Hopper Company Queries I||56.0%|Hard|| |1636|Sort Array by Increasing Frequency||66.7%|Easy|| -|1637|Widest Vertical Area Between Two Points Containing No Points||83.8%|Medium|| +|1637|Widest Vertical Area Between Two Points Containing No Points||83.7%|Medium|| |1638|Count Substrings That Differ by One Character||68.1%|Medium|| |1639|Number of Ways to Form a Target String Given a Dictionary||39.3%|Hard|| -|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.2%|Easy|| -|1641|Count Sorted Vowel Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1641.Count-Sorted-Vowel-Strings)|77.7%|Medium|| +|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.1%|Easy|| +|1641|Count Sorted Vowel Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1641.Count-Sorted-Vowel-Strings)|77.6%|Medium|| |1642|Furthest Building You Can Reach||51.3%|Medium|| |1643|Kth Smallest Instructions||43.0%|Hard|| -|1644|Lowest Common Ancestor of a Binary Tree II||57.6%|Medium|| +|1644|Lowest Common Ancestor of a Binary Tree II||57.5%|Medium|| |1645|Hopper Company Queries II||41.2%|Hard|| |1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|53.7%|Easy|| |1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|53.8%|Medium|| |1648|Sell Diminishing-Valued Colored Balls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls)|30.9%|Medium|| -|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.2%|Hard|| +|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.1%|Hard|| |1650|Lowest Common Ancestor of a Binary Tree III||77.4%|Medium|| -|1651|Hopper Company Queries III||67.0%|Hard|| +|1651|Hopper Company Queries III||66.9%|Hard|| |1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.2%|Easy|| |1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.9%|Medium|| -|1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.3%|Medium|| +|1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.2%|Medium|| |1655|Distribute Repeating Integers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1655.Distribute-Repeating-Integers)|40.5%|Hard|| |1656|Design an Ordered Stream|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1656.Design-an-Ordered-Stream)|82.4%|Easy|| |1657|Determine if Two Strings Are Close|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1657.Determine-if-Two-Strings-Are-Close)|51.3%|Medium|| |1658|Minimum Operations to Reduce X to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero)|33.4%|Medium|| |1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|35.1%|Hard|| -|1660|Correct a Binary Tree||79.3%|Medium|| +|1660|Correct a Binary Tree||79.2%|Medium|| |1661|Average Time of Process per Machine||79.3%|Easy|| |1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|83.6%|Easy|| |1663|Smallest String With A Given Numeric Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value)|60.1%|Medium|| |1664|Ways to Make a Fair Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1664.Ways-to-Make-a-Fair-Array)|60.6%|Medium|| |1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|67.8%|Hard|| -|1666|Change the Root of a Binary Tree||68.6%|Medium|| +|1666|Change the Root of a Binary Tree||68.5%|Medium|| |1667|Fix Names in a Table||64.1%|Easy|| |1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.8%|Easy|| |1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.2%|Medium|| @@ -1811,12 +1811,12 @@ |1671|Minimum Number of Removals to Make Mountain Array||45.7%|Hard|| |1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.5%|Easy|| |1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|38.3%|Medium|| -|1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|34.6%|Medium|| +|1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|34.5%|Medium|| |1675|Minimize Deviation in Array||44.9%|Hard|| -|1676|Lowest Common Ancestor of a Binary Tree IV||77.9%|Medium|| +|1676|Lowest Common Ancestor of a Binary Tree IV||78.0%|Medium|| |1677|Product's Worth Over Invoices||74.7%|Easy|| -|1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.7%|Easy|| -|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|54.1%|Medium|| +|1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.6%|Easy|| +|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|54.9%|Medium|| |1680|Concatenation of Consecutive Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers)|45.1%|Medium|| |1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|35.0%|Hard|| |1682|Longest Palindromic Subsequence II||51.7%|Medium|| @@ -1829,14 +1829,14 @@ |1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.0%|Medium|| |1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|46.6%|Medium|| |1691|Maximum Height by Stacking Cuboids ||49.8%|Hard|| -|1692|Count Ways to Distribute Candies||62.2%|Hard|| +|1692|Count Ways to Distribute Candies||62.1%|Hard|| |1693|Daily Leads and Partners||90.9%|Easy|| |1694|Reformat Phone Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1694.Reformat-Phone-Number)|67.0%|Easy|| |1695|Maximum Erasure Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1695.Maximum-Erasure-Value)|49.5%|Medium|| -|1696|Jump Game VI||55.3%|Medium|| -|1697|Checking Existence of Edge Length Limited Paths||56.3%|Hard|| -|1698|Number of Distinct Substrings in a String||55.5%|Medium|| -|1699|Number of Calls Between Two Persons||86.2%|Medium|| +|1696|Jump Game VI|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1696.Jump-Game-VI)|55.3%|Medium|| +|1697|Checking Existence of Edge Length Limited Paths||56.4%|Hard|| +|1698|Number of Distinct Substrings in a String||55.6%|Medium|| +|1699|Number of Calls Between Two Persons||86.1%|Medium|| |1700|Number of Students Unable to Eat Lunch||70.1%|Easy|| |1701|Average Waiting Time||61.6%|Medium|| |1702|Maximum Binary String After Change||61.5%|Medium|| @@ -1845,28 +1845,28 @@ |1705|Maximum Number of Eaten Apples||42.3%|Medium|| |1706|Where Will the Ball Fall||58.4%|Medium|| |1707|Maximum XOR With an Element From Array||48.0%|Hard|| -|1708|Largest Subarray Length K||64.2%|Easy|| +|1708|Largest Subarray Length K||64.3%|Easy|| |1709|Biggest Window Between Visits||82.0%|Medium|| |1710|Maximum Units on a Truck||71.6%|Easy|| -|1711|Count Good Meals||25.5%|Medium|| -|1712|Ways to Split Array Into Three Subarrays||29.7%|Medium|| +|1711|Count Good Meals||25.6%|Medium|| +|1712|Ways to Split Array Into Three Subarrays||29.8%|Medium|| |1713|Minimum Operations to Make a Subsequence||45.5%|Hard|| |1714|Sum Of Special Evenly-Spaced Elements In Array||47.2%|Hard|| -|1715|Count Apples and Oranges||78.2%|Medium|| -|1716|Calculate Money in Leetcode Bank||69.5%|Easy|| -|1717|Maximum Score From Removing Substrings||38.0%|Medium|| +|1715|Count Apples and Oranges||78.3%|Medium|| +|1716|Calculate Money in Leetcode Bank||69.4%|Easy|| +|1717|Maximum Score From Removing Substrings||38.1%|Medium|| |1718|Construct the Lexicographically Largest Valid Sequence||43.1%|Medium|| -|1719|Number Of Ways To Reconstruct A Tree||39.9%|Hard|| +|1719|Number Of Ways To Reconstruct A Tree||39.7%|Hard|| |1720|Decode XORed Array||86.4%|Easy|| -|1721|Swapping Nodes in a Linked List||65.8%|Medium|| -|1722|Minimize Hamming Distance After Swap Operations||56.8%|Medium|| +|1721|Swapping Nodes in a Linked List||65.7%|Medium|| +|1722|Minimize Hamming Distance After Swap Operations||56.7%|Medium|| |1723|Find Minimum Time to Finish All Jobs||44.5%|Hard|| -|1724|Checking Existence of Edge Length Limited Paths II||58.2%|Hard|| -|1725|Number Of Rectangles That Can Form The Largest Square||77.4%|Easy|| -|1726|Tuple with Same Product||51.2%|Medium|| -|1727|Largest Submatrix With Rearrangements||54.8%|Medium|| -|1728|Cat and Mouse II||34.9%|Hard|| -|1729|Find Followers Count||70.2%|Easy|| +|1724|Checking Existence of Edge Length Limited Paths II||59.0%|Hard|| +|1725|Number Of Rectangles That Can Form The Largest Square||77.3%|Easy|| +|1726|Tuple with Same Product||51.7%|Medium|| +|1727|Largest Submatrix With Rearrangements||55.0%|Medium|| +|1728|Cat and Mouse II||36.2%|Hard|| +|1729|Find Followers Count||71.5%|Easy|| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------| ------------------------------------------------------------------ diff --git a/ctl/label.go b/ctl/label.go index 0ecccd80..112a721c 100644 --- a/ctl/label.go +++ b/ctl/label.go @@ -15,6 +15,7 @@ import ( var ( chapterOneFileOrder = []string{"_index", "Data_Structure", "Algorithm"} + chapterOneMenuOrder = []string{"_index", "#关于作者", "Data_Structure", "Algorithm"} chapterTwoFileOrder = []string{"_index", "Array", "String", "Two_Pointers", "Linked_List", "Stack", "Tree", "Dynamic_Programming", "Backtracking", "Depth_First_Search", "Breadth_First_Search", "Binary_Search", "Math", "Hash_Table", "Sort", "Bit_Manipulation", "Union_Find", "Sliding_Window", "Segment_Tree", "Binary_Indexed_Tree"} chapterThreeFileOrder = []string{"_index", "Segment_Tree", "UnionFind", "LRUCache", "LFUCache"} @@ -30,6 +31,47 @@ var ( //ErrInvalidLineCount is thrown when the user provided 0 (zero) as the value for number of lines to tail ErrInvalidLineCount = errors.New("You cannot tail zero lines.") + + chapterMap = map[string]map[string]string{ + "ChapterOne": { + "_index": "第一章 序章", + "#关于作者": "1.1 关于作者", + "Data_Structure": "1.2 数据结构知识", + "Algorithm": "1.3 算法知识", + }, + "ChapterTwo": { + "_index": "第二章 算法专题", + "Array": "2.01 Array", + "String": "2.02 String", + "Two_Pointers": "2.03 ✅ Two Pointers", + "Linked_List": "2.04 ✅ Linked List", + "Stack": "2.05 ✅ Stack", + "Tree": "2.06 Tree", + "Dynamic_Programming": "2.07 Dynamic Programming", + "Backtracking": "2.08 ✅ Backtracking", + "Depth_First_Search": "2.09 Depth First Search", + "Breadth_First_Search": "2.10 Breadth First Search", + "Binary_Search": "2.11 Binary Search", + "Math": "2.12 Math", + "Hash_Table": "2.13 Hash Table", + "Sort": "2.14 ✅ Sort", + "Bit_Manipulation": "2.15 ✅ Bit Manipulation", + "Union_Find": "2.16 ✅ Union Find", + "Sliding_Window": "2.17 ✅ Sliding Window", + "Segment_Tree": "2.18 ✅ Segment Tree", + "Binary_Indexed_Tree": "2.19 ✅ Binary Indexed Tree", + }, + "ChapterThree": { + "_index": "第三章 一些模板", + "Segment_Tree": "3.1 Segment Tree", + "UnionFind": "3.2 UnionFind", + "LRUCache": "3.3 LRUCache", + "LFUCache": "3.4 LFUCache", + }, + "ChapterFour": { + "_index": "第四章 Leetcode 题解", + }, + } ) func getChapterFourFileOrder() []string { diff --git a/ctl/refresh.go b/ctl/refresh.go index 2bc041d7..9db1784a 100644 --- a/ctl/refresh.go +++ b/ctl/refresh.go @@ -18,6 +18,7 @@ func newRefresh() *cobra.Command { } func refresh() { + buildBookMenu() delPreNext() buildREADME() buildChapterTwo(true) diff --git a/ctl/render.go b/ctl/render.go index 6745a54c..fe1f375b 100644 --- a/ctl/render.go +++ b/ctl/render.go @@ -33,6 +33,7 @@ func newBuildCommand() *cobra.Command { mc.AddCommand( newBuildREADME(), newBuildChapterTwo(), + newBuildMenu(), ) return mc } @@ -63,6 +64,19 @@ func newBuildChapterTwo() *cobra.Command { return cmd } +func newBuildMenu() *cobra.Command { + cmd := &cobra.Command{ + Use: "menu", + Short: "Build Menu commands", + Run: func(cmd *cobra.Command, args []string) { + buildBookMenu() + }, + } + // cmd.Flags().StringVar(&alias, "alias", "", "alias") + // cmd.Flags().StringVar(&appId, "appid", "", "appid") + return cmd +} + func buildREADME() { var ( problems []m.StatStatusPairs @@ -87,7 +101,7 @@ func buildREADME() { } mdrows := m.ConvertMdModelFromSsp(problems) sort.Sort(m.SortByQuestionID(mdrows)) - solutionIds, try := util.LoadSolutionsDir() + solutionIds, _, try := util.LoadSolutionsDir() m.GenerateMdRows(solutionIds, mdrows) info.EasyTotal, info.MediumTotal, info.HardTotal, info.OptimizingEasy, info.OptimizingMedium, info.OptimizingHard, optimizingIds = statisticalData(problemsMap, solutionIds) omdrows := m.ConvertMdModelFromIds(problemsMap, optimizingIds) @@ -166,7 +180,7 @@ func buildChapterTwo(internal bool) { questions = gr.Data.TopicTag.Questions mdrows := m.ConvertMdModelFromQuestions(questions) sort.Sort(m.SortByQuestionID(mdrows)) - solutionIds, _ := util.LoadSolutionsDir() + solutionIds, _, _ := util.LoadSolutionsDir() tl, err := loadMetaData(fmt.Sprintf("./meta/%v", chapterTwoFileName[index])) if err != nil { fmt.Printf("err = %v\n", err) @@ -247,3 +261,89 @@ func renderChapterTwo(filePath string, tls m.TagLists) ([]byte, error) { } } } + +func buildBookMenu() { + solutionIds, soName, _ := util.LoadSolutionsDir() + ch4Ids, _ := util.LoadChapterFourIds() + + needCopy := []string{} + for i := 0; i < len(solutionIds); i++ { + if util.BinarySearch(ch4Ids, solutionIds[i]) == -1 { + needCopy = append(needCopy, soName[i]) + } + } + if len(needCopy) > 0 { + fmt.Printf("有 %v 道题需要拷贝到第四章中\n", len(needCopy)) + for i := 0; i < len(needCopy); i++ { + util.CopyFile(fmt.Sprintf("../website/content/ChapterFour/%v.md", needCopy[i]), fmt.Sprintf("../leetcode/%v/README.md", needCopy[i])) + } + } else { + fmt.Printf("【第四章没有需要添加的题解,已经完整了】\n") + } + + // 按照模板重新渲染 Menu + res, err := renderBookMenu("./template/menu.md") + if err != nil { + fmt.Println(err) + return + } + util.WriteFile("../website/content/menu/index.md", res) + fmt.Println("generate Menu successful") +} + +func generateMenu() string { + res := "" + res += menuLine(chapterOneMenuOrder, "ChapterOne") + res += menuLine(chapterTwoFileOrder, "ChapterTwo") + res += menuLine(chapterThreeFileOrder, "ChapterThree") + res += menuLine(getChapterFourFileOrder(), "ChapterFour") + return res +} + +func menuLine(order []string, chapter string) string { + res := "" + for i := 0; i < len(order); i++ { + if i == 1 && chapter == "ChapterOne" { + res += fmt.Sprintf(" - [%v]({{< relref \"/%v/%v\" >}})\n", chapterMap[chapter][order[i]], chapter, order[i]) + continue + } + if i == 0 { + res += fmt.Sprintf("- [%v]({{< relref \"/%v/%v.md\" >}})\n", chapterMap[chapter][order[i]], chapter, order[i]) + } else { + if chapter == "ChapterFour" { + res += fmt.Sprintf(" - [%v]({{< relref \"/%v/%v.md\" >}})\n", order[i], chapter, order[i]) + } else { + res += fmt.Sprintf(" - [%v]({{< relref \"/%v/%v.md\" >}})\n", chapterMap[chapter][order[i]], chapter, order[i]) + } + } + } + return res +} + +func renderBookMenu(filePath string) ([]byte, error) { + f, err := os.OpenFile(filePath, os.O_RDONLY, 0644) + if err != nil { + return nil, err + } + defer f.Close() + reader, output := bufio.NewReader(f), []byte{} + + for { + line, _, err := reader.ReadLine() + if err != nil { + if err == io.EOF { + return output, nil + } + return nil, err + } + if ok, _ := regexp.Match("{{.BookMenu}}", line); ok { + reg := regexp.MustCompile("{{.BookMenu}}") + newByte := reg.ReplaceAll(line, []byte(generateMenu())) + output = append(output, newByte...) + output = append(output, []byte("\n")...) + } else { + output = append(output, line...) + output = append(output, []byte("\n")...) + } + } +} diff --git a/ctl/template/menu.md b/ctl/template/menu.md new file mode 100644 index 00000000..ed8c5180 --- /dev/null +++ b/ctl/template/menu.md @@ -0,0 +1,9 @@ +--- +headless: true +--- + +
+ +{{.BookMenu}} + +
diff --git a/ctl/util/util.go b/ctl/util/util.go index 63e34b29..21226991 100644 --- a/ctl/util/util.go +++ b/ctl/util/util.go @@ -13,12 +13,25 @@ import ( ) // LoadSolutionsDir define -func LoadSolutionsDir() ([]int, int) { - files, err := ioutil.ReadDir("../leetcode/") +func LoadSolutionsDir() ([]int, []string, int) { + solutionIds, soNames, total := loadFile("../leetcode/") + fmt.Printf("读取了 %v 道题的题解,当前目录下有 %v 个文件(可能包含 .DS_Store),目录中有 %v 道题在尝试中\n", len(solutionIds), total, total-len(solutionIds)) + return solutionIds, soNames, total - len(solutionIds) +} + +// LoadChapterFourIds define +func LoadChapterFourIds() ([]int, []string) { + solutionIds, soNames, _ := loadFile("../website/content/ChapterFour/") + fmt.Printf("读取了第四章 %v 道题的题解\n", len(solutionIds)) + return solutionIds, soNames +} + +func loadFile(path string) ([]int, []string, int) { + files, err := ioutil.ReadDir(path) if err != nil { fmt.Println(err) } - solutionIds := []int{} + solutionIds, soNames, solutionsMap := []int{}, []string{}, map[int]string{} for _, f := range files { if f.Name()[4] == '.' { tmp, err := strconv.Atoi(f.Name()[:4]) @@ -26,11 +39,16 @@ func LoadSolutionsDir() ([]int, int) { fmt.Println(err) } solutionIds = append(solutionIds, tmp) + solutionsMap[tmp] = f.Name() } } sort.Ints(solutionIds) - fmt.Printf("读取了 %v 道题的题解,当前目录下有 %v 个文件(可能包含 .DS_Store),目录中有 %v 道题在尝试中\n", len(solutionIds), len(files), len(files)-len(solutionIds)) - return solutionIds, len(files) - len(solutionIds) + for _, v := range solutionIds { + if name, ok := solutionsMap[v]; ok { + soNames = append(soNames, name) + } + } + return solutionIds, soNames, len(files) } // LoadChapterFourDir define diff --git a/leetcode/1696.Jump-Game-VI/1696. Jump Game VI.go b/leetcode/1696.Jump-Game-VI/1696. Jump Game VI.go new file mode 100644 index 00000000..b57b2500 --- /dev/null +++ b/leetcode/1696.Jump-Game-VI/1696. Jump Game VI.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "math" +) + +// 单调队列 +func maxResult(nums []int, k int) int { + dp := make([]int, len(nums)) + dp[0] = nums[0] + for i := 1; i < len(dp); i++ { + dp[i] = math.MinInt32 + } + window := make([]int, k) + for i := 1; i < len(nums); i++ { + dp[i] = nums[i] + dp[window[0]] + for len(window) > 0 && dp[window[len(window)-1]] <= dp[i] { + window = window[:len(window)-1] + } + for len(window) > 0 && i-k >= window[0] { + window = window[1:] + } + window = append(window, i) + } + return dp[len(nums)-1] +} + +// 超时 +func maxResult1(nums []int, k int) int { + dp := make([]int, len(nums)) + if k > len(nums) { + k = len(nums) + } + dp[0] = nums[0] + for i := 1; i < len(dp); i++ { + dp[i] = math.MinInt32 + } + for i := 1; i < len(nums); i++ { + left, tmp := max(0, i-k), math.MinInt32 + for j := left; j < i; j++ { + tmp = max(tmp, dp[j]) + } + dp[i] = nums[i] + tmp + } + return dp[len(nums)-1] +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} diff --git a/leetcode/1696.Jump-Game-VI/1696. Jump Game VI_test.go b/leetcode/1696.Jump-Game-VI/1696. Jump Game VI_test.go new file mode 100644 index 00000000..63a7dcc1 --- /dev/null +++ b/leetcode/1696.Jump-Game-VI/1696. Jump Game VI_test.go @@ -0,0 +1,53 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1690 struct { + para1690 + ans1690 +} + +// para 是参数 +// one 代表第一个参数 +type para1690 struct { + nums []int + k int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1690 struct { + one int +} + +func Test_Problem1690(t *testing.T) { + + qs := []question1690{ + + // { + // para1690{[]int{1, -1, -2, 4, -7, 3}, 2}, + // ans1690{7}, + // }, + + // { + // para1690{[]int{10, -5, -2, 4, 0, 3}, 3}, + // ans1690{17}, + // }, + + { + para1690{[]int{1, -5, -20, 4, -1, 3, -6, -3}, 2}, + ans1690{0}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1690------------------------\n") + + for _, q := range qs { + _, p := q.ans1690, q.para1690 + fmt.Printf("【input】:%v 【output】:%v\n", p, maxResult(p.nums, p.k)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1696.Jump-Game-VI/README.md b/leetcode/1696.Jump-Game-VI/README.md new file mode 100644 index 00000000..5a2ae245 --- /dev/null +++ b/leetcode/1696.Jump-Game-VI/README.md @@ -0,0 +1,109 @@ +# [1696. Jump Game VI](https://leetcode.com/problems/jump-game-vi/) + +## 题目 + +You are given a **0-indexed** integer array `nums` and an integer `k`. + +You are initially standing at index `0`. In one move, you can jump at most `k` steps forward without going outside the boundaries of the array. That is, you can jump from index `i` to any index in the range `[i + 1, min(n - 1, i + k)]` **inclusive**. + +You want to reach the last index of the array (index `n - 1`). Your **score** is the **sum** of all `nums[j]` for each index `j` you visited in the array. + +Return *the **maximum score** you can get*. + +**Example 1:** + +``` +Input: nums = [1,-1,-2,4,-7,3], k = 2 +Output: 7 +Explanation: You can choose your jumps forming the subsequence [1,-1,4,3] (underlined above). The sum is 7. + +``` + +**Example 2:** + +``` +Input: nums = [10,-5,-2,4,0,3], k = 3 +Output: 17 +Explanation: You can choose your jumps forming the subsequence [10,4,3] (underlined above). The sum is 17. + +``` + +**Example 3:** + +``` +Input: nums = [1,-5,-20,4,-1,3,-6,-3], k = 2 +Output: 0 + +``` + +**Constraints:** + +- `1 <= nums.length, k <= 10^5` +- `10^4 <= nums[i] <= 10^4` + +## 题目大意 + +给你一个下标从 0 开始的整数数组 nums 和一个整数 k 。一开始你在下标 0 处。每一步,你最多可以往前跳 k 步,但你不能跳出数组的边界。也就是说,你可以从下标 i 跳到 [i + 1, min(n - 1, i + k)] 包含 两个端点的任意位置。你的目标是到达数组最后一个位置(下标为 n - 1 ),你的 得分 为经过的所有数字之和。请你返回你能得到的 最大得分 。 + +## 解题思路 + +- 首先能想到的解题思路是动态规划。定义 `dp[i]` 为跳到第 `i` 个位子能获得的最大分数。题目要求的是 `dp[n-1]`,状态转移方程是:`dp[i] = nums[i] + max(dp[j]), max(0, i - k ) <= j < i`,这里需要注意 `j` 的下界,题目中说到不能跳到负数区间,所以左边界下界为 0 。求 `max(dp[j])` 需要遍历一次求得最大值,所以这个解法整体时间复杂度是 O((n - k) * k),但是提交以后提示超时了。 +- 分析一下超时原因。每次都要在 `[max(0, i - k ), i)` 区间内扫描找到最大值,下一轮的区间是 `[max(0, i - k + 1), i + 1)`,前后这两轮扫描的区间存在大量重合部分 `[max(0, i - k + 1), i)`,正是这部分反反复复的扫描导致算法低效。如何高效的在一个区间内找到最大值是本题的关键。利用单调队列可以完成此题。单调队列里面存一个区间内最大值的下标。这里单调队列有 2 个性质。性质一,队列的队首永远都是最大值,队列从大到小降序排列。如果来了一个比队首更大的值的下标,需要将单调队列清空,只存这个新的最大值的下标。性质二,队列的长度为 k。从队尾插入新值,并把队头的最大值“挤”出队首。拥有了这个单调队列以后,再进行 DP 状态转移,效率就很高了。每次只需取出队首的最大值即可。具体代码见下面。 + +## 代码 + +```go +package leetcode + +import ( + "math" +) + +// 单调队列 +func maxResult(nums []int, k int) int { + dp := make([]int, len(nums)) + dp[0] = nums[0] + for i := 1; i < len(dp); i++ { + dp[i] = math.MinInt32 + } + window := make([]int, k) + for i := 1; i < len(nums); i++ { + dp[i] = nums[i] + dp[window[0]] + for len(window) > 0 && dp[window[len(window)-1]] <= dp[i] { + window = window[:len(window)-1] + } + for len(window) > 0 && i-k >= window[0] { + window = window[1:] + } + window = append(window, i) + } + return dp[len(nums)-1] +} + +// 超时 +func maxResult1(nums []int, k int) int { + dp := make([]int, len(nums)) + if k > len(nums) { + k = len(nums) + } + dp[0] = nums[0] + for i := 1; i < len(dp); i++ { + dp[i] = math.MinInt32 + } + for i := 1; i < len(nums); i++ { + left, tmp := max(0, i-k), math.MinInt32 + for j := left; j < i; j++ { + tmp = max(tmp, dp[j]) + } + dp[i] = nums[i] + tmp + } + return dp[len(nums)-1] +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/0174.Dungeon-Game.md b/website/content/ChapterFour/0174.Dungeon-Game.md index a3260aeb..a198c0c2 100755 --- a/website/content/ChapterFour/0174.Dungeon-Game.md +++ b/website/content/ChapterFour/0174.Dungeon-Game.md @@ -42,6 +42,8 @@ For example, given the dungeon below, the initial health of the knight must be a - 在二维地图上给出每个格子扣血数,负数代表扣血,正数代表补血。左上角第一个格子是起点,右下角最后一个格子是终点。问骑士初始最少多少血才能走完迷宫,顺利营救位于终点的公主。需要注意的是,起点和终点都会对血量进行影响。每到一个格子,骑士的血都不能少于 1,一旦少于 1 点血,骑士就会死去。 - 这一题首先想到的解题思路是动态规划。从终点逆推回起点。`dp[i][j]` 代表骑士进入坐标为 `(i,j)` 的格子之前最少的血量值。 那么 `dp[m-1][n-1]` 应该同时满足两个条件,`dp[m-1][n-1] + dungeon[m-1][n-1] ≥ 1` 并且 `dp[m-1][n-1] ≥ 1`,由于这两个不等式的方向是相同的,取交集以后,起决定作用的是数轴最右边的数,即 `max(1-dungeon[m-1][n-1] , 1)`。算出 `dp[m-1][n-1]` 以后,接着可以推出 `dp[m-1][i]` 这一行和 `dp[i][n-1]` 这一列的值。因为骑士只能往右走和往下走。往回推,即只能往上走和往左走。到这里,DP 的初始条件都准备好了。那么状态转移方程是什么呢?分析一般的情况,`dp[i][j]` 这个值应该是和 `dp[i+1][j]` 和 `dp[i][j+1]` 这两者有关系。即 `dp[i][j]` 经过自己本格子的扣血以后,要能至少满足下一行和右一列格子血量的最少要求。并且自己的血量也应该 `≥1`。即需要满足下面这两组不等式。 + \begin{matrix} \left\{ \begin{array}{lr} dp[i][j] + dungeon[i][j] \geqslant dp[i+1][j] \\ dp[i][j] \geqslant 1 \end{array} \right. \end{matrix} + \begin{matrix} \left\{ \begin{array}{lr} dp[i][j] + dungeon[i][j] \geqslant dp[i][j+1] \\ dp[i][j] \geqslant 1 \end{array} \right. \end{matrix} ![](https://img.halfrost.com/Leetcode/leetcode_174_1.png) ![](https://img.halfrost.com/Leetcode/leetcode_174_2.png) 上面不等式中第一组不等式是满足下一行格子的最低血量要求,第二组不等式是满足右一列格子的最低血量要求。第一个式子化简即 `dp[i][j] = max(1, dp[i+1][j]-dungeon[i][j])`,第二个式子化简即 `dp[i][j] = max(1, dp[i][j+1]-dungeon[i][j])`。求得了这两种走法的最低血量值,从这两个值里面取最小,即是当前格子所需的最低血量,所以状态转移方程为 `dp[i][j] = min(max(1, dp[i][j+1]-dungeon[i][j]), max(1, dp[i+1][j]-dungeon[i][j]))`。DP 完成以后,`dp[0][0]` 中记录的就是骑士初始最低血量值。时间复杂度 O(m\*n),空间复杂度 O(m\*n)。 diff --git a/website/content/ChapterFour/1695.Maximum-Erasure-Value.md b/website/content/ChapterFour/1695.Maximum-Erasure-Value.md index e31251fa..890a6128 100644 --- a/website/content/ChapterFour/1695.Maximum-Erasure-Value.md +++ b/website/content/ChapterFour/1695.Maximum-Erasure-Value.md @@ -74,6 +74,9 @@ func max(a int, b int) int { ``` ----------------------------------------------- -

⬅️上一页

+---------------------------------------------- + diff --git a/website/content/ChapterFour/1696.Jump-Game-VI.md b/website/content/ChapterFour/1696.Jump-Game-VI.md new file mode 100644 index 00000000..9186a0f5 --- /dev/null +++ b/website/content/ChapterFour/1696.Jump-Game-VI.md @@ -0,0 +1,114 @@ +# [1696. Jump Game VI](https://leetcode.com/problems/jump-game-vi/) + +## 题目 + +You are given a **0-indexed** integer array `nums` and an integer `k`. + +You are initially standing at index `0`. In one move, you can jump at most `k` steps forward without going outside the boundaries of the array. That is, you can jump from index `i` to any index in the range `[i + 1, min(n - 1, i + k)]` **inclusive**. + +You want to reach the last index of the array (index `n - 1`). Your **score** is the **sum** of all `nums[j]` for each index `j` you visited in the array. + +Return *the **maximum score** you can get*. + +**Example 1:** + +``` +Input: nums = [1,-1,-2,4,-7,3], k = 2 +Output: 7 +Explanation: You can choose your jumps forming the subsequence [1,-1,4,3] (underlined above). The sum is 7. + +``` + +**Example 2:** + +``` +Input: nums = [10,-5,-2,4,0,3], k = 3 +Output: 17 +Explanation: You can choose your jumps forming the subsequence [10,4,3] (underlined above). The sum is 17. + +``` + +**Example 3:** + +``` +Input: nums = [1,-5,-20,4,-1,3,-6,-3], k = 2 +Output: 0 + +``` + +**Constraints:** + +- `1 <= nums.length, k <= 10^5` +- `10^4 <= nums[i] <= 10^4` + +## 题目大意 + +给你一个下标从 0 开始的整数数组 nums 和一个整数 k 。一开始你在下标 0 处。每一步,你最多可以往前跳 k 步,但你不能跳出数组的边界。也就是说,你可以从下标 i 跳到 [i + 1, min(n - 1, i + k)] 包含 两个端点的任意位置。你的目标是到达数组最后一个位置(下标为 n - 1 ),你的 得分 为经过的所有数字之和。请你返回你能得到的 最大得分 。 + +## 解题思路 + +- 首先能想到的解题思路是动态规划。定义 `dp[i]` 为跳到第 `i` 个位子能获得的最大分数。题目要求的是 `dp[n-1]`,状态转移方程是:`dp[i] = nums[i] + max(dp[j]), max(0, i - k ) <= j < i`,这里需要注意 `j` 的下界,题目中说到不能跳到负数区间,所以左边界下界为 0 。求 `max(dp[j])` 需要遍历一次求得最大值,所以这个解法整体时间复杂度是 O((n - k) * k),但是提交以后提示超时了。 +- 分析一下超时原因。每次都要在 `[max(0, i - k ), i)` 区间内扫描找到最大值,下一轮的区间是 `[max(0, i - k + 1), i + 1)`,前后这两轮扫描的区间存在大量重合部分 `[max(0, i - k + 1), i)`,正是这部分反反复复的扫描导致算法低效。如何高效的在一个区间内找到最大值是本题的关键。利用单调队列可以完成此题。单调队列里面存一个区间内最大值的下标。这里单调队列有 2 个性质。性质一,队列的队首永远都是最大值,队列从大到小降序排列。如果来了一个比队首更大的值的下标,需要将单调队列清空,只存这个新的最大值的下标。性质二,队列的长度为 k。从队尾插入新值,并把队头的最大值“挤”出队首。拥有了这个单调队列以后,再进行 DP 状态转移,效率就很高了。每次只需取出队首的最大值即可。具体代码见下面。 + +## 代码 + +```go +package leetcode + +import ( + "math" +) + +// 单调队列 +func maxResult(nums []int, k int) int { + dp := make([]int, len(nums)) + dp[0] = nums[0] + for i := 1; i < len(dp); i++ { + dp[i] = math.MinInt32 + } + window := make([]int, k) + for i := 1; i < len(nums); i++ { + dp[i] = nums[i] + dp[window[0]] + for len(window) > 0 && dp[window[len(window)-1]] <= dp[i] { + window = window[:len(window)-1] + } + for len(window) > 0 && i-k >= window[0] { + window = window[1:] + } + window = append(window, i) + } + return dp[len(nums)-1] +} + +// 超时 +func maxResult1(nums []int, k int) int { + dp := make([]int, len(nums)) + if k > len(nums) { + k = len(nums) + } + dp[0] = nums[0] + for i := 1; i < len(dp); i++ { + dp[i] = math.MinInt32 + } + for i := 1; i < len(nums); i++ { + left, tmp := max(0, i-k), math.MinInt32 + for j := left; j < i; j++ { + tmp = max(tmp, dp[j]) + } + dp[i] = nums[i] + tmp + } + return dp[len(nums)-1] +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} +``` + + +---------------------------------------------- +

⬅️上一页

+ diff --git a/website/content/ChapterTwo/Array.md b/website/content/ChapterTwo/Array.md index 82110657..f6ebc077 100644 --- a/website/content/ChapterTwo/Array.md +++ b/website/content/ChapterTwo/Array.md @@ -15,7 +15,7 @@ type: docs |0018|4Sum|[Go]({{< relref "/ChapterFour/0018.4Sum.md" >}})|Medium| O(n^3)| O(n^2)|❤️|34.6%| |0026|Remove Duplicates from Sorted Array|[Go]({{< relref "/ChapterFour/0026.Remove-Duplicates-from-Sorted-Array.md" >}})|Easy| O(n)| O(1)||46.3%| |0027|Remove Element|[Go]({{< relref "/ChapterFour/0027.Remove-Element.md" >}})|Easy| O(n)| O(1)||49.0%| -|0033|Search in Rotated Sorted Array|[Go]({{< relref "/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md" >}})|Medium||||35.6%| +|0033|Search in Rotated Sorted Array|[Go]({{< relref "/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md" >}})|Medium||||35.7%| |0034|Find First and Last Position of Element in Sorted Array|[Go]({{< relref "/ChapterFour/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array.md" >}})|Medium||||37.1%| |0035|Search Insert Position|[Go]({{< relref "/ChapterFour/0035.Search-Insert-Position.md" >}})|Easy||||42.8%| |0039|Combination Sum|[Go]({{< relref "/ChapterFour/0039.Combination-Sum.md" >}})|Medium| O(n log n)| O(n)||58.8%| @@ -34,7 +34,7 @@ type: docs |0064|Minimum Path Sum|[Go]({{< relref "/ChapterFour/0064.Minimum-Path-Sum.md" >}})|Medium| O(n^2)| O(n^2)||55.9%| |0066|Plus One|[Go]({{< relref "/ChapterFour/0066.Plus-One.md" >}})|Easy||||42.5%| |0074|Search a 2D Matrix|[Go]({{< relref "/ChapterFour/0074.Search-a-2D-Matrix.md" >}})|Medium||||37.4%| -|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|48.9%| +|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|49.0%| |0078|Subsets|[Go]({{< relref "/ChapterFour/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|64.5%| |0079|Word Search|[Go]({{< relref "/ChapterFour/0079.Word-Search.md" >}})|Medium| O(n^2)| O(n^2)|❤️|36.6%| |0080|Remove Duplicates from Sorted Array II|[Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})|Medium| O(n)| O(1||45.9%| @@ -77,7 +77,7 @@ type: docs |0605|Can Place Flowers|[Go]({{< relref "/ChapterFour/0605.Can-Place-Flowers.md" >}})|Easy||||31.9%| |0628|Maximum Product of Three Numbers|[Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})|Easy| O(n)| O(1)||47.0%| |0661|Image Smoother|[Go]({{< relref "/ChapterFour/0661.Image-Smoother.md" >}})|Easy||||52.2%| -|0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| +|0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.4%| |0697|Degree of an Array|[Go]({{< relref "/ChapterFour/0697.Degree-of-an-Array.md" >}})|Easy||||54.4%| |0713|Subarray Product Less Than K|[Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})|Medium| O(n)| O(1)||40.4%| |0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.9%| @@ -88,7 +88,7 @@ type: docs |0729|My Calendar I|[Go]({{< relref "/ChapterFour/0729.My-Calendar-I.md" >}})|Medium||||53.1%| |0746|Min Cost Climbing Stairs|[Go]({{< relref "/ChapterFour/0746.Min-Cost-Climbing-Stairs.md" >}})|Easy| O(n)| O(1)||50.9%| |0766|Toeplitz Matrix|[Go]({{< relref "/ChapterFour/0766.Toeplitz-Matrix.md" >}})|Easy| O(n)| O(1)||65.8%| -|0830|Positions of Large Groups|[Go]({{< relref "/ChapterFour/0830.Positions-of-Large-Groups.md" >}})|Easy||||50.2%| +|0830|Positions of Large Groups|[Go]({{< relref "/ChapterFour/0830.Positions-of-Large-Groups.md" >}})|Easy||||50.3%| |0832|Flipping an Image|[Go]({{< relref "/ChapterFour/0832.Flipping-an-Image.md" >}})|Easy||||77.9%| |0867|Transpose Matrix|[Go]({{< relref "/ChapterFour/0867.Transpose-Matrix.md" >}})|Easy| O(n)| O(1)||62.2%| |0888|Fair Candy Swap|[Go]({{< relref "/ChapterFour/0888.Fair-Candy-Swap.md" >}})|Easy||||58.8%| @@ -118,7 +118,7 @@ type: docs |1170|Compare Strings by Frequency of the Smallest Character|[Go]({{< relref "/ChapterFour/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md" >}})|Easy||||59.5%| |1184|Distance Between Bus Stops|[Go]({{< relref "/ChapterFour/1184.Distance-Between-Bus-Stops.md" >}})|Easy||||54.1%| |1185|Day of the Week|[Go]({{< relref "/ChapterFour/1185.Day-of-the-Week.md" >}})|Easy||||61.9%| -|1200|Minimum Absolute Difference|[Go]({{< relref "/ChapterFour/1200.Minimum-Absolute-Difference.md" >}})|Easy||||66.8%| +|1200|Minimum Absolute Difference|[Go]({{< relref "/ChapterFour/1200.Minimum-Absolute-Difference.md" >}})|Easy||||66.9%| |1202|Smallest String With Swaps|[Go]({{< relref "/ChapterFour/1202.Smallest-String-With-Swaps.md" >}})|Medium||||48.4%| |1208|Get Equal Substrings Within Budget|[Go]({{< relref "/ChapterFour/1208.Get-Equal-Substrings-Within-Budget.md" >}})|Medium||||43.6%| |1217|Minimum Cost to Move Chips to The Same Position|[Go]({{< relref "/ChapterFour/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md" >}})|Easy||||71.2%| @@ -141,7 +141,7 @@ type: docs |1480|Running Sum of 1d Array|[Go]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}})|Easy||||89.5%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| |1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.3%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.2%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.1%| |1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||53.7%| |1652|Defuse the Bomb|[Go]({{< relref "/ChapterFour/1652.Defuse-the-Bomb.md" >}})|Easy||||64.2%| |1656|Design an Ordered Stream|[Go]({{< relref "/ChapterFour/1656.Design-an-Ordered-Stream.md" >}})|Easy||||82.4%| diff --git a/website/content/ChapterTwo/Backtracking.md b/website/content/ChapterTwo/Backtracking.md index 746f23ee..bb044419 100644 --- a/website/content/ChapterTwo/Backtracking.md +++ b/website/content/ChapterTwo/Backtracking.md @@ -129,7 +129,7 @@ func updateMatrix_BFS(matrix [][]int) [][]int { |0980|Unique Paths III|[Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})|Hard| O(n log n)| O(n)||77.2%| |0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.0%| |1079|Letter Tile Possibilities|[Go]({{< relref "/ChapterFour/1079.Letter-Tile-Possibilities.md" >}})|Medium| O(n^2)| O(1)|❤️|75.8%| -|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.7%| +|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.6%| |1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.5%| |1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.1%| |1681|Minimum Incompatibility|[Go]({{< relref "/ChapterFour/1681.Minimum-Incompatibility.md" >}})|Hard||||35.0%| diff --git a/website/content/ChapterTwo/Binary_Indexed_Tree.md b/website/content/ChapterTwo/Binary_Indexed_Tree.md index 0efcc004..cd0507ba 100644 --- a/website/content/ChapterTwo/Binary_Indexed_Tree.md +++ b/website/content/ChapterTwo/Binary_Indexed_Tree.md @@ -14,7 +14,7 @@ type: docs |0315|Count of Smaller Numbers After Self|[Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})|Hard||||42.6%| |0327|Count of Range Sum|[Go]({{< relref "/ChapterFour/0327.Count-of-Range-Sum.md" >}})|Hard||||35.9%| |0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})|Hard||||26.6%| -|1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| +|1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.1%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Binary_Search.md b/website/content/ChapterTwo/Binary_Search.md index 1244690e..d58a4f4d 100644 --- a/website/content/ChapterTwo/Binary_Search.md +++ b/website/content/ChapterTwo/Binary_Search.md @@ -132,7 +132,7 @@ func peakIndexInMountainArray(A []int) int { |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | |0004|Median of Two Sorted Arrays|[Go]({{< relref "/ChapterFour/0004.Median-of-Two-Sorted-Arrays.md" >}})|Hard||||30.8%| |0029|Divide Two Integers|[Go]({{< relref "/ChapterFour/0029.Divide-Two-Integers.md" >}})|Medium||||16.6%| -|0033|Search in Rotated Sorted Array|[Go]({{< relref "/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md" >}})|Medium||||35.6%| +|0033|Search in Rotated Sorted Array|[Go]({{< relref "/ChapterFour/0033.Search-in-Rotated-Sorted-Array.md" >}})|Medium||||35.7%| |0034|Find First and Last Position of Element in Sorted Array|[Go]({{< relref "/ChapterFour/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array.md" >}})|Medium||||37.1%| |0035|Search Insert Position|[Go]({{< relref "/ChapterFour/0035.Search-Insert-Position.md" >}})|Easy||||42.8%| |0050|Pow(x, n)|[Go]({{< relref "/ChapterFour/0050.Powx-n.md" >}})|Medium| O(log n)| O(1)||30.8%| @@ -150,7 +150,7 @@ func peakIndexInMountainArray(A []int) int { |0240|Search a 2D Matrix II|[Go]({{< relref "/ChapterFour/0240.Search-a-2D-Matrix-II.md" >}})|Medium||||44.2%| |0275|H-Index II|[Go]({{< relref "/ChapterFour/0275.H-Index-II.md" >}})|Medium||||36.2%| |0287|Find the Duplicate Number|[Go]({{< relref "/ChapterFour/0287.Find-the-Duplicate-Number.md" >}})|Medium| O(n)| O(1)|❤️|57.2%| -|0300|Longest Increasing Subsequence|[Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})|Medium| O(n log n)| O(n)||43.6%| +|0300|Longest Increasing Subsequence|[Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})|Medium| O(n log n)| O(n)||43.7%| |0315|Count of Smaller Numbers After Self|[Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})|Hard||||42.6%| |0327|Count of Range Sum|[Go]({{< relref "/ChapterFour/0327.Count-of-Range-Sum.md" >}})|Hard||||35.9%| |0349|Intersection of Two Arrays|[Go]({{< relref "/ChapterFour/0349.Intersection-of-Two-Arrays.md" >}})|Easy| O(n)| O(n) ||64.4%| @@ -166,7 +166,7 @@ func peakIndexInMountainArray(A []int) int { |0475|Heaters|[Go]({{< relref "/ChapterFour/0475.Heaters.md" >}})|Medium||||33.5%| |0483|Smallest Good Base|[Go]({{< relref "/ChapterFour/0483.Smallest-Good-Base.md" >}})|Hard||||36.2%| |0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})|Hard||||26.6%| -|0497|Random Point in Non-overlapping Rectangles|[Go]({{< relref "/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md" >}})|Medium||||39.0%| +|0497|Random Point in Non-overlapping Rectangles|[Go]({{< relref "/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md" >}})|Medium||||39.1%| |0528|Random Pick with Weight|[Go]({{< relref "/ChapterFour/0528.Random-Pick-with-Weight.md" >}})|Medium||||44.5%| |0658|Find K Closest Elements|[Go]({{< relref "/ChapterFour/0658.Find-K-Closest-Elements.md" >}})|Medium||||41.8%| |0668|Kth Smallest Number in Multiplication Table|[Go]({{< relref "/ChapterFour/0668.Kth-Smallest-Number-in-Multiplication-Table.md" >}})|Hard||||47.7%| @@ -190,10 +190,10 @@ func peakIndexInMountainArray(A []int) int { |1111|Maximum Nesting Depth of Two Valid Parentheses Strings|[Go]({{< relref "/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md" >}})|Medium||||72.4%| |1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard||||39.5%| |1201|Ugly Number III|[Go]({{< relref "/ChapterFour/1201.Ugly-Number-III.md" >}})|Medium||||26.3%| -|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.0%| +|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| |1283|Find the Smallest Divisor Given a Threshold|[Go]({{< relref "/ChapterFour/1283.Find-the-Smallest-Divisor-Given-a-Threshold.md" >}})|Medium||||49.2%| |1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.3%| -|1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| +|1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.1%| |1658|Minimum Operations to Reduce X to Zero|[Go]({{< relref "/ChapterFour/1658.Minimum-Operations-to-Reduce-X-to-Zero.md" >}})|Medium||||33.4%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Breadth_First_Search.md b/website/content/ChapterTwo/Breadth_First_Search.md index 7c6033a6..d9585d60 100644 --- a/website/content/ChapterTwo/Breadth_First_Search.md +++ b/website/content/ChapterTwo/Breadth_First_Search.md @@ -29,8 +29,8 @@ type: docs |0863|All Nodes Distance K in Binary Tree|[Go]({{< relref "/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}})|Medium||||57.5%| |0864|Shortest Path to Get All Keys|[Go]({{< relref "/ChapterFour/0864.Shortest-Path-to-Get-All-Keys.md" >}})|Hard||||41.5%| |0993|Cousins in Binary Tree|[Go]({{< relref "/ChapterFour/0993.Cousins-in-Binary-Tree.md" >}})|Easy| O(n)| O(1)||52.2%| -|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.5%| -|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.3%| +|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.6%| +|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.2%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Depth_First_Search.md b/website/content/ChapterTwo/Depth_First_Search.md index 053f1690..87126deb 100644 --- a/website/content/ChapterTwo/Depth_First_Search.md +++ b/website/content/ChapterTwo/Depth_First_Search.md @@ -47,7 +47,7 @@ type: docs |0563|Binary Tree Tilt|[Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}})|Easy||||52.7%| |0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.6%| |0685|Redundant Connection II|[Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})|Hard||||32.9%| -|0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| +|0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.4%| |0721|Accounts Merge|[Go]({{< relref "/ChapterFour/0721.Accounts-Merge.md" >}})|Medium||||51.2%| |0733|Flood Fill|[Go]({{< relref "/ChapterFour/0733.Flood-Fill.md" >}})|Easy||||55.8%| |0753|Cracking the Safe|[Go]({{< relref "/ChapterFour/0753.Cracking-the-Safe.md" >}})|Hard||||52.0%| @@ -78,7 +78,7 @@ type: docs |1203|Sort Items by Groups Respecting Dependencies|[Go]({{< relref "/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md" >}})|Hard||||49.1%| |1254|Number of Closed Islands|[Go]({{< relref "/ChapterFour/1254.Number-of-Closed-Islands.md" >}})|Medium||||61.5%| |1302|Deepest Leaves Sum|[Go]({{< relref "/ChapterFour/1302.Deepest-Leaves-Sum.md" >}})|Medium||||84.1%| -|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.5%| +|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.6%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Dynamic_Programming.md b/website/content/ChapterTwo/Dynamic_Programming.md index 2b5fffa7..b45aa912 100644 --- a/website/content/ChapterTwo/Dynamic_Programming.md +++ b/website/content/ChapterTwo/Dynamic_Programming.md @@ -24,7 +24,7 @@ type: docs |0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0174.Dungeon-Game.md" >}})|Hard||||33.2%| |0198|House Robber|[Go]({{< relref "/ChapterFour/0198.House-Robber.md" >}})|Medium| O(n)| O(n)||42.7%| |0213|House Robber II|[Go]({{< relref "/ChapterFour/0213.House-Robber-II.md" >}})|Medium| O(n)| O(n)||37.4%| -|0300|Longest Increasing Subsequence|[Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})|Medium| O(n log n)| O(n)||43.6%| +|0300|Longest Increasing Subsequence|[Go]({{< relref "/ChapterFour/0300.Longest-Increasing-Subsequence.md" >}})|Medium| O(n log n)| O(n)||43.7%| |0303|Range Sum Query - Immutable|[Go]({{< relref "/ChapterFour/0303.Range-Sum-Query---Immutable.md" >}})|Easy||||47.1%| |0309|Best Time to Buy and Sell Stock with Cooldown|[Go]({{< relref "/ChapterFour/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md" >}})|Medium| O(n)| O(n)||48.0%| |0322|Coin Change|[Go]({{< relref "/ChapterFour/0322.Coin-Change.md" >}})|Medium| O(n)| O(n)||36.9%| @@ -35,8 +35,8 @@ type: docs |0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.8%| |0392|Is Subsequence|[Go]({{< relref "/ChapterFour/0392.Is-Subsequence.md" >}})|Easy| O(n)| O(1)||49.5%| |0410|Split Array Largest Sum|[Go]({{< relref "/ChapterFour/0410.Split-Array-Largest-Sum.md" >}})|Hard||||46.1%| -|0416|Partition Equal Subset Sum|[Go]({{< relref "/ChapterFour/0416.Partition-Equal-Subset-Sum.md" >}})|Medium| O(n^2)| O(n)||44.7%| -|0474|Ones and Zeroes|[Go]({{< relref "/ChapterFour/0474.Ones-and-Zeroes.md" >}})|Medium||||43.5%| +|0416|Partition Equal Subset Sum|[Go]({{< relref "/ChapterFour/0416.Partition-Equal-Subset-Sum.md" >}})|Medium| O(n^2)| O(n)||44.8%| +|0474|Ones and Zeroes|[Go]({{< relref "/ChapterFour/0474.Ones-and-Zeroes.md" >}})|Medium||||43.4%| |0494|Target Sum|[Go]({{< relref "/ChapterFour/0494.Target-Sum.md" >}})|Medium||||45.8%| |0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.6%| |0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.9%| @@ -52,9 +52,9 @@ type: docs |1049|Last Stone Weight II|[Go]({{< relref "/ChapterFour/1049.Last-Stone-Weight-II.md" >}})|Medium||||45.0%| |1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.5%| |1105|Filling Bookcase Shelves|[Go]({{< relref "/ChapterFour/1105.Filling-Bookcase-Shelves.md" >}})|Medium||||57.7%| -|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.0%| -|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.7%| -|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.3%| +|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| +|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.6%| +|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.2%| |1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.5%| |1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.1%| |1664|Ways to Make a Fair Array|[Go]({{< relref "/ChapterFour/1664.Ways-to-Make-a-Fair-Array.md" >}})|Medium||||60.6%| diff --git a/website/content/ChapterTwo/Hash_Table.md b/website/content/ChapterTwo/Hash_Table.md index 4286dd69..ba8d91c7 100644 --- a/website/content/ChapterTwo/Hash_Table.md +++ b/website/content/ChapterTwo/Hash_Table.md @@ -24,7 +24,7 @@ type: docs |0205|Isomorphic Strings|[Go]({{< relref "/ChapterFour/0205.Isomorphic-Strings.md" >}})|Easy| O(log n)| O(n)||40.4%| |0217|Contains Duplicate|[Go]({{< relref "/ChapterFour/0217.Contains-Duplicate.md" >}})|Easy| O(n)| O(n)||56.5%| |0219|Contains Duplicate II|[Go]({{< relref "/ChapterFour/0219.Contains-Duplicate-II.md" >}})|Easy| O(n)| O(n)||38.5%| -|0242|Valid Anagram|[Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})|Easy| O(n)| O(n) ||57.9%| +|0242|Valid Anagram|[Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})|Easy| O(n)| O(n) ||58.0%| |0274|H-Index|[Go]({{< relref "/ChapterFour/0274.H-Index.md" >}})|Medium| O(n)| O(n) ||36.3%| |0290|Word Pattern|[Go]({{< relref "/ChapterFour/0290.Word-Pattern.md" >}})|Easy| O(n)| O(n) ||38.3%| |0347|Top K Frequent Elements|[Go]({{< relref "/ChapterFour/0347.Top-K-Frequent-Elements.md" >}})|Medium| O(n)| O(n) ||62.2%| @@ -32,7 +32,7 @@ type: docs |0350|Intersection of Two Arrays II|[Go]({{< relref "/ChapterFour/0350.Intersection-of-Two-Arrays-II.md" >}})|Easy| O(n)| O(n) ||51.9%| |0387|First Unique Character in a String|[Go]({{< relref "/ChapterFour/0387.First-Unique-Character-in-a-String.md" >}})|Easy||||53.7%| |0389|Find the Difference|[Go]({{< relref "/ChapterFour/0389.Find-the-Difference.md" >}})|Easy||||57.7%| -|0409|Longest Palindrome|[Go]({{< relref "/ChapterFour/0409.Longest-Palindrome.md" >}})|Easy||||52.2%| +|0409|Longest Palindrome|[Go]({{< relref "/ChapterFour/0409.Longest-Palindrome.md" >}})|Easy||||52.1%| |0438|Find All Anagrams in a String|[Go]({{< relref "/ChapterFour/0438.Find-All-Anagrams-in-a-String.md" >}})|Medium| O(n)| O(1) ||44.7%| |0447|Number of Boomerangs|[Go]({{< relref "/ChapterFour/0447.Number-of-Boomerangs.md" >}})|Medium| O(n)| O(1) ||52.3%| |0451|Sort Characters By Frequency|[Go]({{< relref "/ChapterFour/0451.Sort-Characters-By-Frequency.md" >}})|Medium| O(n log n)| O(1) ||64.1%| @@ -46,7 +46,7 @@ type: docs |0632|Smallest Range Covering Elements from K Lists|[Go]({{< relref "/ChapterFour/0632.Smallest-Range-Covering-Elements-from-K-Lists.md" >}})|Hard||||53.9%| |0645|Set Mismatch|[Go]({{< relref "/ChapterFour/0645.Set-Mismatch.md" >}})|Easy||||42.4%| |0648|Replace Words|[Go]({{< relref "/ChapterFour/0648.Replace-Words.md" >}})|Medium| O(n)| O(n) ||58.2%| -|0676|Implement Magic Dictionary|[Go]({{< relref "/ChapterFour/0676.Implement-Magic-Dictionary.md" >}})|Medium| O(n)| O(n) ||55.1%| +|0676|Implement Magic Dictionary|[Go]({{< relref "/ChapterFour/0676.Implement-Magic-Dictionary.md" >}})|Medium| O(n)| O(n) ||55.2%| |0705|Design HashSet|[Go]({{< relref "/ChapterFour/0705.Design-HashSet.md" >}})|Easy||||64.6%| |0706|Design HashMap|[Go]({{< relref "/ChapterFour/0706.Design-HashMap.md" >}})|Easy||||62.6%| |0710|Random Pick with Blacklist|[Go]({{< relref "/ChapterFour/0710.Random-Pick-with-Blacklist.md" >}})|Hard| O(n)| O(n) ||32.7%| @@ -73,8 +73,8 @@ type: docs |1207|Unique Number of Occurrences|[Go]({{< relref "/ChapterFour/1207.Unique-Number-of-Occurrences.md" >}})|Easy||||71.6%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| |1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.3%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.2%| -|1679|Max Number of K-Sum Pairs|[Go]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}})|Medium||||54.1%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.1%| +|1679|Max Number of K-Sum Pairs|[Go]({{< relref "/ChapterFour/1679.Max-Number-of-K-Sum-Pairs.md" >}})|Medium||||54.9%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Linked_List.md b/website/content/ChapterTwo/Linked_List.md index 5bb57bb5..787e9ea0 100644 --- a/website/content/ChapterTwo/Linked_List.md +++ b/website/content/ChapterTwo/Linked_List.md @@ -36,7 +36,7 @@ type: docs |0109|Convert Sorted List to Binary Search Tree|[Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})|Medium| O(log n)| O(n)||49.8%| |0141|Linked List Cycle|[Go]({{< relref "/ChapterFour/0141.Linked-List-Cycle.md" >}})|Easy| O(n)| O(1)|❤️|42.2%| |0142|Linked List Cycle II|[Go]({{< relref "/ChapterFour/0142.Linked-List-Cycle-II.md" >}})|Medium| O(n)| O(1)|❤️|39.3%| -|0143|Reorder List|[Go]({{< relref "/ChapterFour/0143.Reorder-List.md" >}})|Medium| O(n)| O(1)|❤️|40.2%| +|0143|Reorder List|[Go]({{< relref "/ChapterFour/0143.Reorder-List.md" >}})|Medium| O(n)| O(1)|❤️|40.3%| |0147|Insertion Sort List|[Go]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}})|Medium| O(n)| O(1)|❤️|44.1%| |0148|Sort List|[Go]({{< relref "/ChapterFour/0148.Sort-List.md" >}})|Medium| O(n log n)| O(n)|❤️|45.8%| |0160|Intersection of Two Linked Lists|[Go]({{< relref "/ChapterFour/0160.Intersection-of-Two-Linked-Lists.md" >}})|Easy| O(n)| O(1)|❤️|42.7%| diff --git a/website/content/ChapterTwo/Math.md b/website/content/ChapterTwo/Math.md index f45a399f..071d24d0 100644 --- a/website/content/ChapterTwo/Math.md +++ b/website/content/ChapterTwo/Math.md @@ -75,7 +75,7 @@ type: docs |1281|Subtract the Product and Sum of Digits of an Integer|[Go]({{< relref "/ChapterFour/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer.md" >}})|Easy||||85.6%| |1317|Convert Integer to the Sum of Two No-Zero Integers|[Go]({{< relref "/ChapterFour/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers.md" >}})|Easy||||56.8%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| -|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.7%| +|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.6%| |1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%| |1680|Concatenation of Consecutive Binary Numbers|[Go]({{< relref "/ChapterFour/1680.Concatenation-of-Consecutive-Binary-Numbers.md" >}})|Medium||||45.1%| |1685|Sum of Absolute Differences in a Sorted Array|[Go]({{< relref "/ChapterFour/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md" >}})|Medium||||61.8%| diff --git a/website/content/ChapterTwo/Segment_Tree.md b/website/content/ChapterTwo/Segment_Tree.md index bc090d52..8de002b0 100644 --- a/website/content/ChapterTwo/Segment_Tree.md +++ b/website/content/ChapterTwo/Segment_Tree.md @@ -46,7 +46,7 @@ type: docs |0732|My Calendar III|[Go]({{< relref "/ChapterFour/0732.My-Calendar-III.md" >}})|Hard| O(log n)| O(n)|❤️|61.4%| |0850|Rectangle Area II|[Go]({{< relref "/ChapterFour/0850.Rectangle-Area-II.md" >}})|Hard| O(n log n)| O(n)|❤️|48.3%| |1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard| O(log n)| O(n)|❤️|39.5%| -|1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| +|1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.1%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Sort.md b/website/content/ChapterTwo/Sort.md index be71338c..82f00572 100644 --- a/website/content/ChapterTwo/Sort.md +++ b/website/content/ChapterTwo/Sort.md @@ -19,13 +19,13 @@ type: docs |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: | |0056|Merge Intervals|[Go]({{< relref "/ChapterFour/0056.Merge-Intervals.md" >}})|Medium| O(n log n)| O(log n)||40.7%| |0057|Insert Interval|[Go]({{< relref "/ChapterFour/0057.Insert-Interval.md" >}})|Medium| O(n)| O(1)||34.9%| -|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|48.9%| +|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|49.0%| |0147|Insertion Sort List|[Go]({{< relref "/ChapterFour/0147.Insertion-Sort-List.md" >}})|Medium| O(n)| O(1) |❤️|44.1%| |0148|Sort List|[Go]({{< relref "/ChapterFour/0148.Sort-List.md" >}})|Medium|O(n log n)| O(log n)|❤️|45.8%| |0164|Maximum Gap|[Go]({{< relref "/ChapterFour/0164.Maximum-Gap.md" >}})|Hard| O(n log n)| O(log n) |❤️|36.6%| |0179|Largest Number|[Go]({{< relref "/ChapterFour/0179.Largest-Number.md" >}})|Medium| O(n log n)| O(log n) |❤️|30.4%| |0220|Contains Duplicate III|[Go]({{< relref "/ChapterFour/0220.Contains-Duplicate-III.md" >}})|Medium| O(n log n)| O(1) |❤️|21.3%| -|0242|Valid Anagram|[Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})|Easy| O(n)| O(n) ||57.9%| +|0242|Valid Anagram|[Go]({{< relref "/ChapterFour/0242.Valid-Anagram.md" >}})|Easy| O(n)| O(n) ||58.0%| |0274|H-Index|[Go]({{< relref "/ChapterFour/0274.H-Index.md" >}})|Medium| O(n)| O(n) ||36.3%| |0315|Count of Smaller Numbers After Self|[Go]({{< relref "/ChapterFour/0315.Count-of-Smaller-Numbers-After-Self.md" >}})|Hard||||42.6%| |0324|Wiggle Sort II|[Go]({{< relref "/ChapterFour/0324.Wiggle-Sort-II.md" >}})|Medium| O(n)| O(n)|❤️|30.6%| @@ -44,9 +44,9 @@ type: docs |1030|Matrix Cells in Distance Order|[Go]({{< relref "/ChapterFour/1030.Matrix-Cells-in-Distance-Order.md" >}})|Easy| O(n^2)| O(1) ||66.9%| |1054|Distant Barcodes|[Go]({{< relref "/ChapterFour/1054.Distant-Barcodes.md" >}})|Medium| O(n log n)| O(log n) |❤️|44.2%| |1122|Relative Sort Array|[Go]({{< relref "/ChapterFour/1122.Relative-Sort-Array.md" >}})|Easy||||67.7%| -|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.0%| +|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| |1305|All Elements in Two Binary Search Trees|[Go]({{< relref "/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}})|Medium||||77.8%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.2%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.1%| |1647|Minimum Deletions to Make Character Frequencies Unique|[Go]({{< relref "/ChapterFour/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}})|Medium||||53.8%| |1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/String.md b/website/content/ChapterTwo/String.md index 0acea5cc..39a6d755 100644 --- a/website/content/ChapterTwo/String.md +++ b/website/content/ChapterTwo/String.md @@ -48,7 +48,7 @@ type: docs |1653|Minimum Deletions to Make String Balanced|[Go]({{< relref "/ChapterFour/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}})|Medium||||49.9%| |1662|Check If Two String Arrays are Equivalent|[Go]({{< relref "/ChapterFour/1662.Check-If-Two-String-Arrays-are-Equivalent.md" >}})|Easy||||83.6%| |1668|Maximum Repeating Substring|[Go]({{< relref "/ChapterFour/1668.Maximum-Repeating-Substring.md" >}})|Easy||||38.8%| -|1678|Goal Parser Interpretation|[Go]({{< relref "/ChapterFour/1678.Goal-Parser-Interpretation.md" >}})|Easy||||86.7%| +|1678|Goal Parser Interpretation|[Go]({{< relref "/ChapterFour/1678.Goal-Parser-Interpretation.md" >}})|Easy||||86.6%| |1684|Count the Number of Consistent Strings|[Go]({{< relref "/ChapterFour/1684.Count-the-Number-of-Consistent-Strings.md" >}})|Easy||||84.1%| |1694|Reformat Phone Number|[Go]({{< relref "/ChapterFour/1694.Reformat-Phone-Number.md" >}})|Easy||||67.0%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| diff --git a/website/content/ChapterTwo/Tree.md b/website/content/ChapterTwo/Tree.md index 0f20b8a7..0f1f1bfb 100644 --- a/website/content/ChapterTwo/Tree.md +++ b/website/content/ChapterTwo/Tree.md @@ -37,7 +37,7 @@ type: docs |0226|Invert Binary Tree|[Go]({{< relref "/ChapterFour/0226.Invert-Binary-Tree.md" >}})|Easy| O(n)| O(1)||66.6%| |0230|Kth Smallest Element in a BST|[Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}})|Medium| O(n)| O(1)||62.2%| |0235|Lowest Common Ancestor of a Binary Search Tree|[Go]({{< relref "/ChapterFour/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||51.4%| -|0236|Lowest Common Ancestor of a Binary Tree|[Go]({{< relref "/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md" >}})|Medium| O(n)| O(1)||48.1%| +|0236|Lowest Common Ancestor of a Binary Tree|[Go]({{< relref "/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md" >}})|Medium| O(n)| O(1)||48.2%| |0257|Binary Tree Paths|[Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})|Easy| O(n)| O(1)||53.2%| |0337|House Robber III|[Go]({{< relref "/ChapterFour/0337.House-Robber-III.md" >}})|Medium||||51.7%| |0404|Sum of Left Leaves|[Go]({{< relref "/ChapterFour/0404.Sum-of-Left-Leaves.md" >}})|Easy| O(n)| O(1)||52.2%| diff --git a/website/content/ChapterTwo/Two_Pointers.md b/website/content/ChapterTwo/Two_Pointers.md index 39c922b8..6b4a797c 100644 --- a/website/content/ChapterTwo/Two_Pointers.md +++ b/website/content/ChapterTwo/Two_Pointers.md @@ -43,7 +43,7 @@ type: docs |0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.0%| |0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|50.8%| |0061|Rotate List|[Go]({{< relref "/ChapterFour/0061.Rotate-List.md" >}})|Medium| O(n)| O(1)||31.6%| -|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|48.9%| +|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|49.0%| |0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|35.7%| |0080|Remove Duplicates from Sorted Array II|[Go]({{< relref "/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})|Medium| O(n)| O(1||45.9%| |0086|Partition List|[Go]({{< relref "/ChapterFour/0086.Partition-List.md" >}})|Medium| O(n)| O(1)|❤️|43.0%| diff --git a/website/content/menu/index.md b/website/content/menu/index.md index 702101df..b15fe806 100644 --- a/website/content/menu/index.md +++ b/website/content/menu/index.md @@ -596,4 +596,7 @@ headless: true - [1690.Stone-Game-VII]({{< relref "/ChapterFour/1690.Stone-Game-VII.md" >}}) - [1694.Reformat-Phone-Number]({{< relref "/ChapterFour/1694.Reformat-Phone-Number.md" >}}) - [1695.Maximum-Erasure-Value]({{< relref "/ChapterFour/1695.Maximum-Erasure-Value.md" >}}) + - [1696.Jump-Game-VI]({{< relref "/ChapterFour/1696.Jump-Game-VI.md" >}}) + +
From bfb9839828e37b4897d99b2e94f732e8b22b85a3 Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 20 Jan 2021 01:26:01 +0800 Subject: [PATCH 82/82] Use Katex in solution markdown --- .../125. Valid Palindrome.go | 3 - .../README.md | 6 +- .../ChapterFour/0125.Valid-Palindrome.md | 7 +- .../content/ChapterFour/0174.Dungeon-Game.md | 19 +++-- .../ChapterFour/0483.Smallest-Good-Base.md | 37 +++++----- ...image-Size-of-Factorial-Zeroes-Function.md | 37 ++++------ .../ChapterFour/0887.Super-Egg-Drop.md | 74 ++++++++----------- .../0920.Number-of-Music-Playlists.md | 6 +- ...umber-of-Submatrices-That-Sum-to-Target.md | 5 +- ...Items-by-Groups-Respecting-Dependencies.md | 6 +- ...8.Sell-Diminishing-Valued-Colored-Balls.md | 2 +- 11 files changed, 96 insertions(+), 106 deletions(-) diff --git a/leetcode/0125.Valid-Palindrome/125. Valid Palindrome.go b/leetcode/0125.Valid-Palindrome/125. Valid Palindrome.go index ce998bd5..6ccd9200 100644 --- a/leetcode/0125.Valid-Palindrome/125. Valid Palindrome.go +++ b/leetcode/0125.Valid-Palindrome/125. Valid Palindrome.go @@ -5,9 +5,7 @@ import ( ) func isPalindrome(s string) bool { - s = strings.ToLower(s) - i, j := 0, len(s)-1 for i < j { for i < j && !isChar(s[i]) { @@ -22,7 +20,6 @@ func isPalindrome(s string) bool { i++ j-- } - return true } diff --git a/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md index 3fec764b..3bbddd16 100644 --- a/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md +++ b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md @@ -14,7 +14,7 @@ Return any solution if there is more than one solution and return an **empty li **Example 1:** -![https://assets.leetcode.com/uploads/2019/09/11/1359_ex1.png](https://assets.leetcode.com/uploads/2019/09/11/1359_ex1.png) +![](https://assets.leetcode.com/uploads/2019/09/11/1359_ex1.png) ``` Input: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3,6],[],[],[]] @@ -56,11 +56,11 @@ Explanation: This is the same as example 1 except that 4 needs to be before 6 i - 读完题能确定这一题是拓扑排序。但是和单纯的拓扑排序有区别的是,同一小组内的项目需要彼此相邻。用 2 次拓扑排序即可解决。第一次拓扑排序排出组间的顺序,第二次拓扑排序排出组内的顺序。为了实现方便,用 map 给虚拟分组标记编号。如下图,将 3,4,6 三个任务打包到 0 号分组里面,将 2,5 两个任务打包到 1 号分组里面,其他任务单独各自为一组。组间的依赖是 6 号任务依赖 1 号任务。由于 6 号任务封装在 0 号分组里,所以 3 号分组依赖 0 号分组。先组间排序,确定分组顺序,再组内拓扑排序,排出最终顺序。 - ![https://img.halfrost.com/Leetcode/leetcode_1203_1.png](https://img.halfrost.com/Leetcode/leetcode_1203_1.png) + ![](https://img.halfrost.com/Leetcode/leetcode_1203_1.png) - 上面的解法可以 AC,但是时间太慢了。因为做了一些不必要的操作。有没有可能只用一次拓扑排序呢?将必须要在一起的结点统一依赖一个虚拟结点,例如下图中的虚拟结点 8 和 9 。3,4,6 都依赖 8 号任务,2 和 5 都依赖 9 号任务。1 号任务本来依赖 6 号任务,由于 6 由依赖 8 ,所以添加 1 依赖 8 的边。通过增加虚拟结点,增加了需要打包在一起结点的入度。构建出以上关系以后,按照入度为 0 的原则,依次进行 DFS。8 号和 9 号两个虚拟结点的入度都为 0 ,对它们进行 DFS,必定会使得与它关联的节点都被安排在一起,这样就满足了题意:同一小组的项目,排序后在列表中彼此相邻。一遍扫完,满足题意的顺序就排出来了。这个解法 beat 100%! - ![https://img.halfrost.com/Leetcode/leetcode_1203_2.png](https://img.halfrost.com/Leetcode/leetcode_1203_2.png) + ![](https://img.halfrost.com/Leetcode/leetcode_1203_2.png) ## 代码 diff --git a/website/content/ChapterFour/0125.Valid-Palindrome.md b/website/content/ChapterFour/0125.Valid-Palindrome.md index ec7f4908..bc19bb4d 100644 --- a/website/content/ChapterFour/0125.Valid-Palindrome.md +++ b/website/content/ChapterFour/0125.Valid-Palindrome.md @@ -34,13 +34,11 @@ For the purpose of this problem, we define empty string as valid palindrome. package leetcode import ( - "strings" + "strings" ) func isPalindrome(s string) bool { - - s = strings.ToLower(s) - + s = strings.ToLower(s) i, j := 0, len(s)-1 for i < j { for i < j && !isChar(s[i]) { @@ -55,7 +53,6 @@ func isPalindrome(s string) bool { i++ j-- } - return true } diff --git a/website/content/ChapterFour/0174.Dungeon-Game.md b/website/content/ChapterFour/0174.Dungeon-Game.md index a198c0c2..1c0edf33 100755 --- a/website/content/ChapterFour/0174.Dungeon-Game.md +++ b/website/content/ChapterFour/0174.Dungeon-Game.md @@ -41,11 +41,20 @@ For example, given the dungeon below, the initial health of the knight must be a ## 解题思路 - 在二维地图上给出每个格子扣血数,负数代表扣血,正数代表补血。左上角第一个格子是起点,右下角最后一个格子是终点。问骑士初始最少多少血才能走完迷宫,顺利营救位于终点的公主。需要注意的是,起点和终点都会对血量进行影响。每到一个格子,骑士的血都不能少于 1,一旦少于 1 点血,骑士就会死去。 -- 这一题首先想到的解题思路是动态规划。从终点逆推回起点。`dp[i][j]` 代表骑士进入坐标为 `(i,j)` 的格子之前最少的血量值。 那么 `dp[m-1][n-1]` 应该同时满足两个条件,`dp[m-1][n-1] + dungeon[m-1][n-1] ≥ 1` 并且 `dp[m-1][n-1] ≥ 1`,由于这两个不等式的方向是相同的,取交集以后,起决定作用的是数轴最右边的数,即 `max(1-dungeon[m-1][n-1] , 1)`。算出 `dp[m-1][n-1]` 以后,接着可以推出 `dp[m-1][i]` 这一行和 `dp[i][n-1]` 这一列的值。因为骑士只能往右走和往下走。往回推,即只能往上走和往左走。到这里,DP 的初始条件都准备好了。那么状态转移方程是什么呢?分析一般的情况,`dp[i][j]` 这个值应该是和 `dp[i+1][j]` 和 `dp[i][j+1]` 这两者有关系。即 `dp[i][j]` 经过自己本格子的扣血以后,要能至少满足下一行和右一列格子血量的最少要求。并且自己的血量也应该 `≥1`。即需要满足下面这两组不等式。 - \begin{matrix} \left\{ \begin{array}{lr} dp[i][j] + dungeon[i][j] \geqslant dp[i+1][j] \\ dp[i][j] \geqslant 1 \end{array} \right. \end{matrix} - \begin{matrix} \left\{ \begin{array}{lr} dp[i][j] + dungeon[i][j] \geqslant dp[i][j+1] \\ dp[i][j] \geqslant 1 \end{array} \right. \end{matrix} - ![](https://img.halfrost.com/Leetcode/leetcode_174_1.png) - ![](https://img.halfrost.com/Leetcode/leetcode_174_2.png) +- 这一题首先想到的解题思路是动态规划。从终点逆推回起点。`dp[i][j]` 代表骑士进入坐标为 `(i,j)` 的格子之前最少的血量值。 那么 `dp[m-1][n-1]` 应该同时满足两个条件,`dp[m-1][n-1] + dungeon[m-1][n-1] ≥ 1` 并且 `dp[m-1][n-1] ≥ 1`,由于这两个不等式的方向是相同的,取交集以后,起决定作用的是数轴最右边的数,即 `max(1-dungeon[m-1][n-1] , 1)`。算出 `dp[m-1][n-1]` 以后,接着可以推出 `dp[m-1][i]` 这一行和 `dp[i][n-1]` 这一列的值。因为骑士只能往右走和往下走。往回推,即只能往上走和往左走。到这里,DP 的初始条件都准备好了。那么状态转移方程是什么呢?分析一般的情况,`dp[i][j]` 这个值应该是和 `dp[i+1][j]` 和 `dp[i][j+1]` 这两者有关系。即 `dp[i][j]` 经过自己本格子的扣血以后,要能至少满足下一行和右一列格子血量的最少要求。并且自己的血量也应该 `≥1`。即需要满足下面这两组不等式。 + + {{< katex display >}} + \begin{matrix} \left\{ + \begin{array}{lr} + dp[i][j] + dungeon[i][j] \geqslant dp[i+1][j] \\ + dp[i][j] \geqslant 1 + \end{array} \right. + \end{matrix} + {{< /katex >}} + + {{< katex display >}} + \begin{matrix} \left\{ \begin{array}{lr} dp[i][j] + dungeon[i][j] \geqslant dp[i][j+1] \\ dp[i][j] \geqslant 1 \end{array} \right. \end{matrix} + {{< /katex >}} 上面不等式中第一组不等式是满足下一行格子的最低血量要求,第二组不等式是满足右一列格子的最低血量要求。第一个式子化简即 `dp[i][j] = max(1, dp[i+1][j]-dungeon[i][j])`,第二个式子化简即 `dp[i][j] = max(1, dp[i][j+1]-dungeon[i][j])`。求得了这两种走法的最低血量值,从这两个值里面取最小,即是当前格子所需的最低血量,所以状态转移方程为 `dp[i][j] = min(max(1, dp[i][j+1]-dungeon[i][j]), max(1, dp[i+1][j]-dungeon[i][j]))`。DP 完成以后,`dp[0][0]` 中记录的就是骑士初始最低血量值。时间复杂度 O(m\*n),空间复杂度 O(m\*n)。 - 这一题还可以用二分搜索来求解。骑士的血量取值范围一定是在 `[1,+∞)` 这个区间内。那么二分这个区间,每次二分的中间值,再用 dp 在地图中去判断是否能到达终点,如果能,就缩小搜索空间至 `[1,mid]`,否则搜索空间为 `[mid + 1,+∞)` 。时间复杂度 O(m\*n\* log math.MaxInt64),空间复杂度 O(m\*n)。 diff --git a/website/content/ChapterFour/0483.Smallest-Good-Base.md b/website/content/ChapterFour/0483.Smallest-Good-Base.md index bcfe0613..6ab60aef 100755 --- a/website/content/ChapterFour/0483.Smallest-Good-Base.md +++ b/website/content/ChapterFour/0483.Smallest-Good-Base.md @@ -51,46 +51,47 @@ Now given a string representing n, you should return the smallest good base of n - 给出一个数 n,要求找一个进制 k,使得数字 n 在 k 进制下每一位都是 1 。求最小的进制 k。 - 这一题等价于求最小的正整数 k,满足存在一个正整数 m 使得 -

- -

+{{< katex display >}} + \sum_{i=0}^{m} k^{i} = \frac{1-k^{m+1}}{1-k} = n +{{< /katex >}} - 这一题需要确定 k 和 m 两个数的值。m 和 k 是有关系的,确定了一个值,另外一个值也确定了。由 -

- -

+{{< katex display >}} + \frac{1-k^{m+1}}{1-k} = n \\ +{{< /katex >}} 可得: -

- -

+{{< katex display >}} + m = log_{k}(kn-n+1) - 1 < log_{k}(kn) = 1 + log_{k}n +{{< /katex >}} 根据题意,可以知道 k ≥2,m ≥1 ,所以有: -

- -

+{{< katex display >}} + 1 \leqslant m \leqslant log_{2}n +{{< /katex >}} 所以 m 的取值范围确定了。那么外层循环从 1 到 log n 遍历。找到一个最小的 k ,能满足: 可以用二分搜索来逼近找到最小的 k。先找到 k 的取值范围。由 -

- -

+{{< katex display >}} + \frac{1-k^{m+1}}{1-k} = n \\ +{{< /katex >}} 可得, -

- -

+{{< katex display >}} + k^{m+1} = nk-n+1 < nk\\ \Rightarrow k < \sqrt[m]{n} +{{< /katex >}} + 所以 k 的取值范围是 [2, n*(1/m) ]。再利用二分搜索逼近找到最小的 k 即为答案。 diff --git a/website/content/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md b/website/content/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md index 28bfeba4..e931f679 100755 --- a/website/content/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md +++ b/website/content/ChapterFour/0793.Preimage-Size-of-Factorial-Zeroes-Function.md @@ -41,27 +41,22 @@ f(x) 是 x! 末尾是0的数量。(回想一下 x! = 1 * 2 * 3 * ... * x - 给出一个数 K,要求有多少个 n 能使得 n!末尾 0 的个数等于 K。 - 这一题是基于第 172 题的逆过程加强版。第 172 题是给出 `n`,求得末尾 0 的个数。由第 172 题可以知道,`n!`末尾 0 的个数取决于因子 5 的个数。末尾可能有 `K` 个 0,那么 `n` 最多可以等于 `5 * K`,在 `[0, 5* K]` 区间内二分搜索,判断 `mid` 末尾 0 的个数,如果能找到 `K`,那么就范围 5,如果找不到这个 `K`,返回 0 。为什么答案取值只有 0 和 5 呢?因为当 `n` 增加 5 以后,因子 5 的个数又加一了,末尾又可以多 1 个或者多个 0(如果加 5 以后,有多个 5 的因子,例如 25,125,就有可能末尾增加多个 0)。所以有效的 `K` 值对应的 `n` 的范围区间就是 5 。反过来,无效的 `K` 值对应的 `n` 是 0。`K` 在 `5^n` 的分界线处会发生跳变,所有有些值取不到。例如,`n` 在 `[0,5)` 内取值,`K = 0`;`n` 在 `[5,10)` 内取值,`K = 1`;`n` 在 `[10,15)` 内取值,`K = 2`;`n` 在 `[15,20)` 内取值,`K = 3`;`n` 在 `[20,25)` 内取值,`K = 4`;`n` 在 `[25,30)` 内取值,`K = 6`,因为 25 提供了 2 个 5,也就提供了 2 个 0,所以 `K` 永远无法取值等于 5,即当 `K = 5` 时,找不到任何的 `n` 与之对应。 - 这一题也可以用数学的方法解题。见解法二。这个解法的灵感来自于:n!末尾 0 的个数等于 [1,n] 所有数的因子 5 的个数总和。其次此题的结果一定只有 0 和 5 (分析见上一种解法)。有了这两个结论以后,就可以用数学的方法推导了。首先 n 可以表示为 5 进制的形式 -

- -

- 上面式子中,所有有因子 5 的个数为: -

- -

- - 这个总数就即是 K。针对不同的 n,an 的通项公式不同,所以表示的 K 的系数也不同。cn 的通项公式呢? -

- -

-

- -

- - 由上面这个递推还能推出通项公式(不过这题不适用通项公式,是用递推公式更方便): -

- -

- 判断 K 是否能表示成两个数列的表示形式,等价于判断 K 是否能转化为以 Cn 为基的变进制数。到此,转化成类似第 483 题了。代码实现不难,见解法二。 +{{< katex display >}} +n = 5^{0} * a_{0} + 5^{1} * a_{1} + 5^{2} * a_{2} + ... + 5^{n} * a_{n}, (a_{n} < 5) +{{< /katex >}} + 上面式子中,所有有因子 5 的个数为: +{{< katex display >}} +K = \sum_{n=0}^{n} a_{n} * c_{n} +{{< /katex >}} + 这个总数就即是 K。针对不同的 n,an 的通项公式不同,所以表示的 K 的系数也不同。cn 的通项公式呢? +{{< katex display >}} +c_{n} = 5 * c_{n-1} + 1,c_{0} = 0 +{{< /katex >}} + 由上面这个递推还能推出通项公式(不过这题不适用通项公式,是用递推公式更方便): +{{< katex display >}} +c_{n} = \frac{5^{n} - 1 }{4} +{{< /katex >}} + 判断 K 是否能表示成两个数列的表示形式,等价于判断 K 是否能转化为以 Cn 为基的变进制数。到此,转化成类似第 483 题了。代码实现不难,见解法二。 ## 代码 diff --git a/website/content/ChapterFour/0887.Super-Egg-Drop.md b/website/content/ChapterFour/0887.Super-Egg-Drop.md index 486df343..d7508003 100755 --- a/website/content/ChapterFour/0887.Super-Egg-Drop.md +++ b/website/content/ChapterFour/0887.Super-Egg-Drop.md @@ -56,11 +56,10 @@ What is the minimum number of moves that you need to know with certainty what  - 给出 `K` 个鸡蛋,`N` 层楼,要求确定安全楼层 `F` 需要最小步数 `t`。 - 这一题是微软的经典面试题。拿到题最容易想到的是二分搜索。但是仔细分析以后会发现单纯的二分是不对的。不断的二分确实能找到最终安全的楼层,但是这里没有考虑到 `K` 个鸡蛋。鸡蛋数的限制会导致二分搜索无法找到最终楼层。题目要求要在保证能找到最终安全楼层的情况下,找到最小步数。所以单纯的二分搜索并不能解答这道题。 -- 这一题如果按照题意正向考虑,动态规划的状态转移方程是 `searchTime(K, N) = max( searchTime(K-1, X-1), searchTime(K, N-X) )`。其中 `X` 是丢鸡蛋的楼层。随着 `X` 从 `[1,N]`,都能计算出一个 `searchTime` 的值,在所有这 `N` 个值之中,取最小值就是本题的答案了。这个解法可以 AC 这道题。不过这个解法不细展开了。时间复杂度 `O(k*N^2)`。 -

- -

- +- 这一题如果按照题意正向考虑,动态规划的状态转移方程是 `searchTime(K, N) = max( searchTime(K-1, X-1), searchTime(K, N-X) )`。其中 `X` 是丢鸡蛋的楼层。随着 `X` 从 `[1,N]`,都能计算出一个 `searchTime` 的值,在所有这 `N` 个值之中,取最小值就是本题的答案了。这个解法可以 AC 这道题。不过这个解法不细展开了。时间复杂度 `O(k*N^2)`。 +{{< katex display >}} +dp(K,N) = MIN \begin{bmatrix} \, \, MAX(dp(K-1,X-1),dp(K,N-X))\, \, \end{bmatrix} ,1\leqslant x \leqslant N \\ +{{< /katex >}} - 换个角度来看这个问题,定义 `dp[k][m]` 代表 `K` 个鸡蛋,`M` 次移动能检查的最大楼层。考虑某一步 `t` 应该在哪一层丢鸡蛋呢?一个正确的选择是在 `dp[k-1][t-1] + 1` 层丢鸡蛋,结果分两种情况: 1. 如果鸡蛋碎了,我们首先排除了该层以上的所有楼层(不管这个楼有多高),而对于剩下的 `dp[k-1][t-1]` 层楼,我们一定能用 `k-1` 个鸡蛋在 `t-1` 步内求解。因此这种情况下,我们总共可以求解无限高的楼层。可见,这是一种非常好的情况,但并不总是发生。 2. 如果鸡蛋没碎,我们首先排除了该层以下的 `dp[k-1][t-1]` 层楼,此时我们还有 `k` 个蛋和 `t-1` 步,那么我们去该层以上的楼层继续测得 `dp[k][t-1]` 层楼。因此这种情况下,我们总共可以求解 `dp[k-1][t-1] + 1 + dp[k][t-1]` 层楼。 @@ -70,43 +69,34 @@ What is the minimum number of moves that you need to know with certainty what  2. 如果在更高的楼层丢鸡蛋,假设是第 `dp[k-1][t-1] + 2` 层丢鸡蛋,如果这次鸡蛋碎了,剩下 `k-1` 个鸡蛋和 `t-1` 步只能保证验证 `dp[k-1][t-1]` 的楼层,这里还剩**第** `dp[k-1][t-1]+ 1` 的楼层,不能保证最终一定能找到安全楼层了。 - 用反证法就能得出每一步都应该在第 `dp[k-1][t-1] + 1` 层丢鸡蛋。 - 这道题还可以用二分搜索来解答。回到上面分析的状态转移方程:`dp[k][m] = dp[k-1][m-1] + dp[k][m-1] + 1` 。用数学方法来解析这个递推关系。令 `f(t,k)` 为 `t` 和 `k` 的函数,题目所要求能测到最大楼层是 `N` 的最小步数,即要求出 `f(t,k) ≥ N` 时候的最小 `t`。由状态转移方程可以知道:`f(t,k) = f(t-1,k) + f(t-1,k-1) + 1`,当 `k = 1` 的时候,对应一个鸡蛋的情况,`f(t,1) = t`,当 `t = 1` 的时候,对应一步的情况,`f(1,k) = 1`。有状态转移方程得: -

- -

- -- 令 `g(t,k) = f(t,k) - f(t,k-1)`,可以得到: - -

- -

- -- 可以知道 `g(t,k)` 是一个杨辉三角,即二项式系数: - -

- -

- -- 利用裂项相消的方法: -

- -

- -- 于是可以得到: -

- -

- -- 其中: -

- -

- -- 于是针对每一项的二项式常数,都可以由前一项乘以一个分数得到下一项。 -

- -

- -- 利用二分搜索,不断的二分 `t`,直到逼近找到 `f(t,k) ≥ N` 时候最小的 `t`。时间复杂度 `O(K * log N)`,空间复杂度 `O(1)`。 +{{< katex display >}} +\begin{aligned} f(t,k) &= 1 + f(t-1,k-1) + f(t-1,k) \\ f(t,k-1) &= 1 + f(t-1,k-2) + f(t-1,k-1) \\ \end{aligned} +{{< /katex >}} + 令 `g(t,k) = f(t,k) - f(t,k-1)`,可以得到: +{{< katex display >}} +g(t,k) = g(t-1,k) + g(t-1,k-1) +{{< /katex >}} + 可以知道 `g(t,k)` 是一个杨辉三角,即二项式系数: +{{< katex display >}} +g(t,k) = \binom{t}{k+1} = C_{t}^{k+1} +{{< /katex >}} + 利用裂项相消的方法: +{{< katex display >}} +\begin{aligned} g(t,x) &= f(t,x) - f(t,x-1) \\ g(t,x-1) &= f(t,x-1) - f(t,x-2) \\ g(t,x-2) &= f(t,x-2) - f(t,x-3) \\ \begin{matrix} .\\ .\\ .\\ \end{matrix}\\ g(t,2) &= f(t,2) - f(t,1) \\ g(t,1) &= f(t,1) - f(t,0) \\ \end{aligned} +{{< /katex >}} + 于是可以得到: +{{< katex display >}} +\begin{aligned} f(t,k) &= \sum_{1}^{k}g(t,x) = \sum_{0}^{k} \binom{t}{x} \\ &= C_{t}^{0} + C_{t}^{1} + C_{t}^{2} + ... + C_{t}^{k} \\ \end{aligned} +{{< /katex >}} + 其中: +{{< katex display >}} +\begin{aligned} C_{t}^{k} \cdot \frac{n-k}{k+1} &= C_{t}^{k+1} \\ C_{t}^{k} &= C_{t}^{k-1} \cdot \frac{t-k+1}{k} \\ \end{aligned} +{{< /katex >}} + 于是针对每一项的二项式常数,都可以由前一项乘以一个分数得到下一项。 +{{< katex display >}} +\begin{aligned} C_{t}^{0} &= 1 \\ C_{t}^{1} &= C_{t}^{0} \cdot \frac{t-1+1}{1} \\ C_{t}^{2} &= C_{t}^{1} \cdot \frac{t-2+1}{2} \\ C_{t}^{3} &= C_{t}^{2} \cdot \frac{t-3+1}{3} \\ \begin{matrix} .\\ .\\ .\\ \end{matrix}\\ C_{t}^{k} &= C_{t}^{k-1} \cdot \frac{t-k+1}{k} \\ \end{aligned} +{{< /katex >}} + 利用二分搜索,不断的二分 `t`,直到逼近找到 `f(t,k) ≥ N` 时候最小的 `t`。时间复杂度 `O(K * log N)`,空间复杂度 `O(1)`。 diff --git a/website/content/ChapterFour/0920.Number-of-Music-Playlists.md b/website/content/ChapterFour/0920.Number-of-Music-Playlists.md index e339361e..cd023864 100755 --- a/website/content/ChapterFour/0920.Number-of-Music-Playlists.md +++ b/website/content/ChapterFour/0920.Number-of-Music-Playlists.md @@ -53,9 +53,9 @@ Return the number of possible playlists. **As the answer can be very large, ret - 简化抽象一下题意,给 N 个数,要求从这 N 个数里面组成一个长度为 L 的序列,并且相同元素的间隔不能小于 K 个数。问总共有多少组组成方法。 - 一拿到题,会觉得这一题是三维 DP,因为存在 3 个变量,但是实际考虑一下,可以降一维。我们先不考虑 K 的限制,只考虑 N 和 L。定义 `dp[i][j]` 代表播放列表里面有 `i` 首歌,其中包含 `j` 首不同的歌曲,那么题目要求的最终解存在 `dp[L][N]` 中。考虑 `dp[i][j]` 的递归公式,音乐列表当前需要组成 `i` 首歌,有 2 种方式可以得到,由 `i - 1` 首歌的列表中添加一首列表中**不存在**的新歌曲,或者由 `i - 1` 首歌的列表中添加一首列表中**已经存在**的歌曲。即,`dp[i][j]` 可以由 `dp[i - 1][j - 1]` 得到,也可以由 `dp[i - 1][j]` 得到。如果是第一种情况,添加一首新歌,那么新歌有 N - ( j - 1 ) 首,如果是第二种情况,添加一首已经存在的歌,歌有 j 首,所以状态转移方程是 `dp[i][j] = dp[i - 1][j - 1] * ( N - ( j - 1 ) ) + dp[i - 1][j] * j` 。但是这个方程是在不考虑 K 的限制条件下得到的,距离满足题意还差一步。接下来需要考虑加入 K 这个限制条件以后,状态转移方程该如何推导。 - 如果是添加一首新歌,是不受 K 限制的,所以 `dp[i - 1][j - 1] * ( N - ( j - 1 ) )` 这里不需要变化。如果是添加一首存在的歌曲,这个时候就会受到 K 的限制了。如果当前播放列表里面的歌曲有 `j` 首,并且 `j > K`,那么选择歌曲只能从 `j - K` 里面选,因为不能选择 `j - 1` 到 `j - k` 的这些歌,选择了就不满足重复的歌之间间隔不能小于 `K` 的限制条件了。那 j ≤ K 呢?这个时候一首歌都不能选,因为歌曲数都没有超过 K,当然不能再选择重复的歌曲。(选择了就再次不满足重复的歌之间间隔不能小于 `K` 的限制条件了)。经过上述分析,可以得到最终的状态转移方程: - -![](https://img.halfrost.com/Leetcode/leetcode_920.gif) - +{{< katex display >}} +dp[i][j]= \begin{matrix} \left\{ \begin{array}{lr} dp[i - 1][j - 1] * ( N - ( j - 1 ) ) + dp[i - 1][j] * ( j - k ) , & {j > k}\\ dp[i - 1][j - 1] * ( N - ( j - 1 ) ), & {j \leq k} \end{array} \right. \end{matrix} +{{< /katex >}} - 上面的式子可以合并简化成下面这个式子:`dp[i][j] = dp[i - 1][j - 1]*(N - (j - 1)) + dp[i-1][j]*max(j-K, 0)`,递归初始值 `dp[0][0] = 1`。 diff --git a/website/content/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md b/website/content/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md index 04875e8a..796e1700 100755 --- a/website/content/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md +++ b/website/content/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md @@ -53,8 +53,9 @@ Two submatrices `(x1, y1, x2, y2)` and `(x1', y1', x2', y2')` are different - 给出一个矩阵,要求在这个矩阵中找出子矩阵的和等于 target 的矩阵个数。 - 这一题读完题感觉是滑动窗口的二维版本。如果把它拍扁,在一维数组中,求连续的子数组和为 target,这样就很好做。如果这题不降维,纯暴力解是 O(n^6)。如何优化降低时间复杂度呢? - 联想到第 1 题 Two Sum 问题,可以把 2 个数求和的问题优化到 O(n)。这里也用类似的思想,用一个 map 来保存行方向上曾经出现过的累加和,相减就可以得到本行的和。这里可能读者会有疑惑,为什么不能每一行都单独保存呢?为什么一定要用累加和相减的方式来获取每一行的和呢?因为这一题要求子矩阵所有解,如果只单独保存每一行的和,只能求得小的子矩阵,子矩阵和子矩阵组成的大矩阵的情况会漏掉(当然再循环一遍,把子矩阵累加起来也可以,但是这样就多了一层循环了),例如子矩阵是 1*4 的,但是 2 个这样的子矩阵摞在一起形成 2 * 4 也能满足条件,如果不用累加和的办法,只单独存每一行的和,最终还要有组合的步骤。经过这样的优化,可以从 O(n^6) 优化到 O(n^4),能 AC 这道题,但是时间复杂度太高了。如何优化? -- 首先,子矩阵需要上下左右 4 个边界,4 个变量控制循环就需要 O(n^4),行和列的区间累加还需要 O(n^2)。行和列的区间累加可以通过 preSum 来解决。例如 `sum[i,j] = sum[j] - sum[i - 1]`,其中 sum[k] 中存的是从 0 到 K 的累加和: ![](https://img.halfrost.com/Leetcode/leetcode_1074.gif) - +- 首先,子矩阵需要上下左右 4 个边界,4 个变量控制循环就需要 O(n^4),行和列的区间累加还需要 O(n^2)。行和列的区间累加可以通过 preSum 来解决。例如 `sum[i,j] = sum[j] - sum[i - 1]`,其中 sum[k] 中存的是从 0 到 K 的累加和: {{< katex display >}} +\sum_{0}^{k} matrix[i] +{{< /katex >}} 那么一个区间内的累加和可以由这个区间的右边界减去区间左边界左边的那个累加和得到(由于是闭区间,所需要取左边界左边的和)。经过这样的处理,列方向的维度就被我们拍扁了。 - 再来看看行方向的和,现在每一列的和都可以通过区间相减的方法得到。那么这道题就变成了第 1 题 Two Sum 的问题了。Two Sum 问题只需要 O(n) 的时间复杂度求解,这一题由于是二维的,所以两个列的边界还需要循环,所以最终优化下来的时间复杂度是 O(n^3)。计算 presum 可以直接用原数组,所以空间复杂度只有一个 O(n) 的字典。 diff --git a/website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md b/website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md index 4e8cd26c..99193c75 100644 --- a/website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md +++ b/website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md @@ -14,7 +14,7 @@ Return any solution if there is more than one solution and return an **empty li **Example 1:** -![https://assets.leetcode.com/uploads/2019/09/11/1359_ex1.png](https://assets.leetcode.com/uploads/2019/09/11/1359_ex1.png) +![](https://assets.leetcode.com/uploads/2019/09/11/1359_ex1.png) ``` Input: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3,6],[],[],[]] @@ -56,11 +56,11 @@ Explanation: This is the same as example 1 except that 4 needs to be before 6 i - 读完题能确定这一题是拓扑排序。但是和单纯的拓扑排序有区别的是,同一小组内的项目需要彼此相邻。用 2 次拓扑排序即可解决。第一次拓扑排序排出组间的顺序,第二次拓扑排序排出组内的顺序。为了实现方便,用 map 给虚拟分组标记编号。如下图,将 3,4,6 三个任务打包到 0 号分组里面,将 2,5 两个任务打包到 1 号分组里面,其他任务单独各自为一组。组间的依赖是 6 号任务依赖 1 号任务。由于 6 号任务封装在 0 号分组里,所以 3 号分组依赖 0 号分组。先组间排序,确定分组顺序,再组内拓扑排序,排出最终顺序。 - ![https://img.halfrost.com/Leetcode/leetcode_1203_1.png](https://img.halfrost.com/Leetcode/leetcode_1203_1.png) + ![](https://img.halfrost.com/Leetcode/leetcode_1203_1.png) - 上面的解法可以 AC,但是时间太慢了。因为做了一些不必要的操作。有没有可能只用一次拓扑排序呢?将必须要在一起的结点统一依赖一个虚拟结点,例如下图中的虚拟结点 8 和 9 。3,4,6 都依赖 8 号任务,2 和 5 都依赖 9 号任务。1 号任务本来依赖 6 号任务,由于 6 由依赖 8 ,所以添加 1 依赖 8 的边。通过增加虚拟结点,增加了需要打包在一起结点的入度。构建出以上关系以后,按照入度为 0 的原则,依次进行 DFS。8 号和 9 号两个虚拟结点的入度都为 0 ,对它们进行 DFS,必定会使得与它关联的节点都被安排在一起,这样就满足了题意:同一小组的项目,排序后在列表中彼此相邻。一遍扫完,满足题意的顺序就排出来了。这个解法 beat 100%! - ![https://img.halfrost.com/Leetcode/leetcode_1203_2.png](https://img.halfrost.com/Leetcode/leetcode_1203_2.png) + ![](https://img.halfrost.com/Leetcode/leetcode_1203_2.png) ## 代码 diff --git a/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md b/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md index 1ee5fd26..f65f56cb 100644 --- a/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md +++ b/website/content/ChapterFour/1648.Sell-Diminishing-Valued-Colored-Balls.md @@ -76,7 +76,7 @@ Explanation: Sell the 1st color 1000000000 times for a total value of 5000000005 `thresholdValue` 越小,不等式左边的值越大,随着 `thresholdValue` 的增大,不等式左边的值越来越小,直到刚刚能小于等于 `orders`。求出了 `thresholdValue` 值以后,还需要再判断有多少值等于 `thresholdValue - 1` 值了。 - ![https://img.halfrost.com/Leetcode/leetcode_1648.png](https://img.halfrost.com/Leetcode/leetcode_1648.png) + ![](https://img.halfrost.com/Leetcode/leetcode_1648.png) - 还是举上面的例子,原始数组是 [2,3,3,4,5],`orders` = 4,我们可以求得 `thresholdValue` = 3 。`inventory[i]` > `thresholdValue` 的那部分 100% 的要取走,`thresholdValue` 就像一个水平面,突出水平面的那些都要拿走,每列的值按照等差数列求和公式计算即可。但是 `orders` - `thresholdValue` = 1,说明水平面以下还要拿走一个,即 `thresholdValue` 线下的虚线框里面的那 4 个球,还需要任意取走一个。最后总的结果是这 2 部分的总和,( ( 5 + 4 ) + 4 ) + 3 = 16 。