diff --git a/README.md b/README.md
index baa87e8c0..b5cba202a 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,26 @@ LeetCode Problems' Solutions
| # | Title | Solution | Difficulty |
| :-: | - | - | :-: |
+| 1074 | [Number of Submatrices That Sum to Target](https://leetcode.com/problems/number-of-submatrices-that-sum-to-target "元素和为目标值的子矩阵数量") | [Go](https://github.com/openset/leetcode/tree/master/problems/number-of-submatrices-that-sum-to-target) | Hard |
+| 1073 | [Adding Two Negabinary Numbers](https://leetcode.com/problems/adding-two-negabinary-numbers "负二进制数相加") | [Go](https://github.com/openset/leetcode/tree/master/problems/adding-two-negabinary-numbers) | Medium |
+| 1072 | [Flip Columns For Maximum Number of Equal Rows](https://leetcode.com/problems/flip-columns-for-maximum-number-of-equal-rows "按列翻转得到最大值等行数") | [Go](https://github.com/openset/leetcode/tree/master/problems/flip-columns-for-maximum-number-of-equal-rows) | Medium |
+| 1071 | [Greatest Common Divisor of Strings](https://leetcode.com/problems/greatest-common-divisor-of-strings "字符串的最大公因子") | [Go](https://github.com/openset/leetcode/tree/master/problems/greatest-common-divisor-of-strings) | Easy |
+| 1070 | [Product Sales Analysis III](https://leetcode.com/problems/product-sales-analysis-iii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-iii) | Medium |
+| 1069 | [Product Sales Analysis II](https://leetcode.com/problems/product-sales-analysis-ii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-ii) | Easy |
+| 1068 | [Product Sales Analysis I](https://leetcode.com/problems/product-sales-analysis-i) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-i) | Easy |
+| 1067 | [Digit Count in Range](https://leetcode.com/problems/digit-count-in-range "范围内的数字计数") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/digit-count-in-range) | Hard |
+| 1066 | [Campus Bikes II](https://leetcode.com/problems/campus-bikes-ii "校园自行车分配 II") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/campus-bikes-ii) | Medium |
+| 1065 | [Index Pairs of a String](https://leetcode.com/problems/index-pairs-of-a-string "字符串的索引对") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/index-pairs-of-a-string) | Easy |
+| 1064 | [Fixed Point](https://leetcode.com/problems/fixed-point "不动点") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/fixed-point) | Easy |
+| 1063 | [Number of Valid Subarrays](https://leetcode.com/problems/number-of-valid-subarrays "有效子数组的数目") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/number-of-valid-subarrays) | Hard |
+| 1062 | [Longest Repeating Substring](https://leetcode.com/problems/longest-repeating-substring "最长重复子串") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-repeating-substring) | Medium |
+| 1061 | [Lexicographically Smallest Equivalent String](https://leetcode.com/problems/lexicographically-smallest-equivalent-string "按字典序排列最小的等效字符串") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/lexicographically-smallest-equivalent-string) | Medium |
+| 1060 | [Missing Element in Sorted Array](https://leetcode.com/problems/missing-element-in-sorted-array "有序数组中的缺失元素") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/missing-element-in-sorted-array) | Medium |
+| 1059 | [All Paths from Source Lead to Destination](https://leetcode.com/problems/all-paths-from-source-lead-to-destination "从始点到终点的所有路径") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/all-paths-from-source-lead-to-destination) | Medium |
+| 1058 | [Minimize Rounding Error to Meet Target](https://leetcode.com/problems/minimize-rounding-error-to-meet-target "最小化舍入误差以满足目标") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/minimize-rounding-error-to-meet-target) | Medium |
+| 1057 | [Campus Bikes](https://leetcode.com/problems/campus-bikes "校园自行车分配") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/campus-bikes) | Medium |
+| 1056 | [Confusing Number](https://leetcode.com/problems/confusing-number "易混淆数") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/confusing-number) | Easy |
+| 1055 | [Shortest Way to Form String](https://leetcode.com/problems/shortest-way-to-form-string "形成字符串的最短路径") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/shortest-way-to-form-string) | Medium |
| 1054 | [Distant Barcodes](https://leetcode.com/problems/distant-barcodes "距离相等的条形码") | [Go](https://github.com/openset/leetcode/tree/master/problems/distant-barcodes) | Medium |
| 1053 | [Previous Permutation With One Swap](https://leetcode.com/problems/previous-permutation-with-one-swap "交换一次的先前排列") | [Go](https://github.com/openset/leetcode/tree/master/problems/previous-permutation-with-one-swap) | Medium |
| 1052 | [Grumpy Bookstore Owner](https://leetcode.com/problems/grumpy-bookstore-owner "爱生气的书店老板") | [Go](https://github.com/openset/leetcode/tree/master/problems/grumpy-bookstore-owner) | Medium |
diff --git a/problems/adding-two-negabinary-numbers/README.md b/problems/adding-two-negabinary-numbers/README.md
new file mode 100644
index 000000000..855564538
--- /dev/null
+++ b/problems/adding-two-negabinary-numbers/README.md
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/flip-columns-for-maximum-number-of-equal-rows "Flip Columns For Maximum Number of Equal Rows") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/number-of-submatrices-that-sum-to-target "Number of Submatrices That Sum to Target")
+
+## 1073. Adding Two Negabinary Numbers (Medium)
+
+
Given two numbers arr1
and arr2
in base -2, return the result of adding them together.
+
+Each number is given in array format: as an array of 0s and 1s, from most significant bit to least significant bit. For example, arr = [1,1,0,1]
represents the number (-2)^3 + (-2)^2 + (-2)^0 = -3
. A number arr
in array format is also guaranteed to have no leading zeros: either arr == [0]
or arr[0] == 1
.
+
+Return the result of adding arr1
and arr2
in the same format: as an array of 0s and 1s with no leading zeros.
+
+
+
+Example 1:
+
+
+Input: arr1 = [1,1,1,1,1], arr2 = [1,0,1]
+Output: [1,0,0,0,0]
+Explanation: arr1 represents 11, arr2 represents 5, the output represents 16.
+
+
+
+
+Note:
+
+
+ 1 <= arr1.length <= 1000
+ 1 <= arr2.length <= 1000
+ arr1
and arr2
have no leading zeros
+ arr1[i]
is 0
or 1
+ arr2[i]
is 0
or 1
+
diff --git a/problems/all-paths-from-source-lead-to-destination/README.md b/problems/all-paths-from-source-lead-to-destination/README.md
new file mode 100644
index 000000000..c14b8a939
--- /dev/null
+++ b/problems/all-paths-from-source-lead-to-destination/README.md
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/minimize-rounding-error-to-meet-target "Minimize Rounding Error to Meet Target") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/missing-element-in-sorted-array "Missing Element in Sorted Array")
+
+## 1059. All Paths from Source Lead to Destination (Medium)
+
+
+
+### Related Topics
+ [[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
+ [[Graph](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)]
+
+### Hints
+
+Hint 1
+What if we can reach to a cycle from the source node?
+
+
+
+Hint 2
+Then the answer will be false, because we eventually get trapped in the cycle forever.
+
+
+
+Hint 3
+What if the we can't reach to a cycle from the source node? Then we need to ensure that from all visited nodes from source the unique node with indegree = 0 is the destination node.
+
diff --git a/problems/campus-bikes-ii/README.md b/problems/campus-bikes-ii/README.md
new file mode 100644
index 000000000..24572a183
--- /dev/null
+++ b/problems/campus-bikes-ii/README.md
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/index-pairs-of-a-string "Index Pairs of a String") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/digit-count-in-range "Digit Count in Range")
+
+## 1066. Campus Bikes II (Medium)
+
+
+
+### Related Topics
+ [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
+ [[Backtracking](https://github.com/openset/leetcode/tree/master/tag/backtracking/README.md)]
+
+### Similar Questions
+ 1. [Campus Bikes](https://github.com/openset/leetcode/tree/master/problems/campus-bikes) (Medium)
+
+### Hints
+
+Hint 1
+Model the problem with a dp(pos, mask) where pos represents the current bike to be assigned and mask the set of available workers.
+
diff --git a/problems/campus-bikes/README.md b/problems/campus-bikes/README.md
new file mode 100644
index 000000000..62d5faddb
--- /dev/null
+++ b/problems/campus-bikes/README.md
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/confusing-number "Confusing Number") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/minimize-rounding-error-to-meet-target "Minimize Rounding Error to Meet Target")
+
+## 1057. Campus Bikes (Medium)
+
+
+
+### Related Topics
+ [[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]
+ [[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]
+
+### Similar Questions
+ 1. [Campus Bikes II](https://github.com/openset/leetcode/tree/master/problems/campus-bikes-ii) (Medium)
+
+### Hints
+
+Hint 1
+Sort the elements by distance then in case of tie, sort them by the index of the worker, and if there still ties sort then by the index of the bike.Follow up: Can you do this in less than O(nlogn) time, where n is the total number of pairs between workers and bikes?.
+
+
+
+Hint 2
+Loop the sorted elements and match each pair of worker and bike if the given worker and bike where not used.
+
diff --git a/problems/confusing-number/README.md b/problems/confusing-number/README.md
new file mode 100644
index 000000000..307c3ed2d
--- /dev/null
+++ b/problems/confusing-number/README.md
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/shortest-way-to-form-string "Shortest Way to Form String") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/campus-bikes "Campus Bikes")
+
+## 1056. Confusing Number (Easy)
+
+
+
+### Related Topics
+ [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
+
+### Similar Questions
+ 1. [Strobogrammatic Number](https://github.com/openset/leetcode/tree/master/problems/strobogrammatic-number) (Easy)
+
+### Hints
+
+Hint 1
+Reverse each digit with their corresponding new digit if an invalid digit is found the return -1. After reversing the digits just compare the reversed number with the original number.
+
diff --git a/problems/digit-count-in-range/README.md b/problems/digit-count-in-range/README.md
new file mode 100644
index 000000000..5d4c0ebb2
--- /dev/null
+++ b/problems/digit-count-in-range/README.md
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/campus-bikes-ii "Campus Bikes II") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-i "Product Sales Analysis I")
+
+## 1067. Digit Count in Range (Hard)
+
+
+
+### Related Topics
+ [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
+ [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
+
+### Similar Questions
+ 1. [Number of Digit One](https://github.com/openset/leetcode/tree/master/problems/number-of-digit-one) (Hard)
+
+### Hints
+
+Hint 1
+Define a function f(x) to get the requested sum from 1 to x. So the answer will be f(hi) - f(lo - 1)
+
+
+
+Hint 2
+In order to solve f(x) we need to do a DP over digits approach.
+
diff --git a/problems/distant-barcodes/README.md b/problems/distant-barcodes/README.md
index a90e7ab5d..26ea0c16b 100644
--- a/problems/distant-barcodes/README.md
+++ b/problems/distant-barcodes/README.md
@@ -7,7 +7,7 @@
[< Previous](https://github.com/openset/leetcode/tree/master/problems/previous-permutation-with-one-swap "Previous Permutation With One Swap") -Next>
+[Next>](https://github.com/openset/leetcode/tree/master/problems/shortest-way-to-form-string "Shortest Way to Form String")
## 1054. Distant Barcodes (Medium)
diff --git a/problems/exclusive-time-of-functions/README.md b/problems/exclusive-time-of-functions/README.md
index 4c0d51e9b..cac600267 100644
--- a/problems/exclusive-time-of-functions/README.md
+++ b/problems/exclusive-time-of-functions/README.md
@@ -11,13 +11,15 @@
## 636. Exclusive Time of Functions (Medium)
-On a single threaded CPU, we execute some functions. Each function has a unique id between 0
and N-1
.
+On a single threaded CPU, we execute some functions. Each function has a unique id between 0
and N-1
.
We store logs in timestamp order that describe when a function is entered or exited.
-Each log is a string with this format: "{function_id}:{"start" | "end"}:{timestamp}"
. For example, "0:start:3"
means the function with id 0
started at the beginning of timestamp 3
. "1:end:2"
means the function with id 1
ended at the end of timestamp 2
.
+Each log is a string with this format: "{function_id}:{"start" | "end"}:{timestamp}"
. For example, "0:start:3"
means the function with id 0
started at the beginning of timestamp 3
. "1:end:2"
means the function with id 1
ended at the end of timestamp 2
.
-A function's exclusive time is the number of units of time spent in this function. Note that this does not include any recursive calls to child functions.
+A function's exclusive time is the number of units of time spent in this function. Note that this does not include any recursive calls to child functions.
+
+The CPU is single threaded which means that only one function is being executed at a given time unit.
Return the exclusive time of each function, sorted by their function id.
diff --git a/problems/fixed-point/README.md b/problems/fixed-point/README.md
new file mode 100644
index 000000000..af6f70b5e
--- /dev/null
+++ b/problems/fixed-point/README.md
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/number-of-valid-subarrays "Number of Valid Subarrays") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/index-pairs-of-a-string "Index Pairs of a String")
+
+## 1064. Fixed Point (Easy)
+
+
+
+### Related Topics
+ [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
+ [[Binary Search](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)]
+
+### Hints
+
+Hint 1
+Loop over the array and check the first index i such A[i] == i
+
diff --git a/problems/flip-columns-for-maximum-number-of-equal-rows/README.md b/problems/flip-columns-for-maximum-number-of-equal-rows/README.md
new file mode 100644
index 000000000..f5c24ff26
--- /dev/null
+++ b/problems/flip-columns-for-maximum-number-of-equal-rows/README.md
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/greatest-common-divisor-of-strings "Greatest Common Divisor of Strings") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/adding-two-negabinary-numbers "Adding Two Negabinary Numbers")
+
+## 1072. Flip Columns For Maximum Number of Equal Rows (Medium)
+
+Given a matrix
consisting of 0s and 1s, we may choose any number of columns in the matrix and flip every cell in that column. Flipping a cell changes the value of that cell from 0 to 1 or from 1 to 0.
+
+Return the maximum number of rows that have all values equal after some number of flips.
+
+
+
+
+
+
+
+
Example 1:
+
+
+Input: [[0,1],[1,1]]
+Output: 1
+Explanation: After flipping no values, 1 row has all values equal.
+
+
+
+
Example 2:
+
+
+Input: [[0,1],[1,0]]
+Output: 2
+Explanation: After flipping values in the first column, both rows have equal values.
+
+
+
+
Example 3:
+
+
+Input: [[0,0,0],[0,0,1],[1,1,0]]
+Output: 2
+Explanation: After flipping values in the first two columns, the last two rows have equal values.
+
+
+
+
+
Note:
+
+
+ 1 <= matrix.length <= 300
+ 1 <= matrix[i].length <= 300
+ - All
matrix[i].length
's are equal
+ matrix[i][j]
is 0
or 1
+
+
+
+
diff --git a/problems/greatest-common-divisor-of-strings/README.md b/problems/greatest-common-divisor-of-strings/README.md
new file mode 100644
index 000000000..afc06914b
--- /dev/null
+++ b/problems/greatest-common-divisor-of-strings/README.md
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-iii "Product Sales Analysis III") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/flip-columns-for-maximum-number-of-equal-rows "Flip Columns For Maximum Number of Equal Rows")
+
+## 1071. Greatest Common Divisor of Strings (Easy)
+
+For strings S
and T
, we say "T
divides S
" if and only if S = T + ... + T
(T
concatenated with itself 1 or more times)
+
+Return the largest string X
such that X
divides str1 and X
divides str2.
+
+
+
+Example 1:
+
+
+Input: str1 = "ABCABC", str2 = "ABC"
+Output: "ABC"
+
+
+Example 2:
+
+
+Input: str1 = "ABABAB", str2 = "ABAB"
+Output: "AB"
+
+
+Example 3:
+
+
+Input: str1 = "LEET", str2 = "CODE"
+Output: ""
+
+
+
+
+Note:
+
+
+ 1 <= str1.length <= 1000
+ 1 <= str2.length <= 1000
+ str1[i]
and str2[i]
are English uppercase letters.
+
diff --git a/problems/index-pairs-of-a-string/README.md b/problems/index-pairs-of-a-string/README.md
new file mode 100644
index 000000000..308237faf
--- /dev/null
+++ b/problems/index-pairs-of-a-string/README.md
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/fixed-point "Fixed Point") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/campus-bikes-ii "Campus Bikes II")
+
+## 1065. Index Pairs of a String (Easy)
+
+
+
+### Related Topics
+ [[String](https://github.com/openset/leetcode/tree/master/tag/string/README.md)]
+ [[Trie](https://github.com/openset/leetcode/tree/master/tag/trie/README.md)]
+
+### Hints
+
+Hint 1
+For each string of the set, look for matches and store those matches indices.
+
diff --git a/problems/lexicographically-smallest-equivalent-string/README.md b/problems/lexicographically-smallest-equivalent-string/README.md
new file mode 100644
index 000000000..1580f6f1a
--- /dev/null
+++ b/problems/lexicographically-smallest-equivalent-string/README.md
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/missing-element-in-sorted-array "Missing Element in Sorted Array") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/longest-repeating-substring "Longest Repeating Substring")
+
+## 1061. Lexicographically Smallest Equivalent String (Medium)
+
+
+
+### Related Topics
+ [[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
+ [[Union Find](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)]
+
+### Hints
+
+Hint 1
+Model these equalities as edges of a graph.
+
+
+
+Hint 2
+Group each connected component of the graph and assign each node of this component to the node with the lowest lexicographically character.
+
+
+
+Hint 3
+Finally convert the string with the precalculated information.
+
diff --git a/problems/longest-repeating-substring/README.md b/problems/longest-repeating-substring/README.md
new file mode 100644
index 000000000..e67ebd76e
--- /dev/null
+++ b/problems/longest-repeating-substring/README.md
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/lexicographically-smallest-equivalent-string "Lexicographically Smallest Equivalent String") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/number-of-valid-subarrays "Number of Valid Subarrays")
+
+## 1062. Longest Repeating Substring (Medium)
+
+
+
+### Related Topics
+ [[String](https://github.com/openset/leetcode/tree/master/tag/string/README.md)]
+
+### Hints
+
+Hint 1
+Generate all substrings in O(N^2) time with hashing.
+
+
+
+Hint 2
+Choose those hashing of strings with the largest length.
+
diff --git a/problems/minimize-rounding-error-to-meet-target/README.md b/problems/minimize-rounding-error-to-meet-target/README.md
new file mode 100644
index 000000000..1d5c1b236
--- /dev/null
+++ b/problems/minimize-rounding-error-to-meet-target/README.md
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/campus-bikes "Campus Bikes") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/all-paths-from-source-lead-to-destination "All Paths from Source Lead to Destination")
+
+## 1058. Minimize Rounding Error to Meet Target (Medium)
+
+
+
+### Related Topics
+ [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
+ [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
+ [[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]
+
+### Hints
+
+Hint 1
+If we have integer values in the array then we just need to subtract the target those integer values, so we reduced the problem.
+
+
+
+Hint 2
+Similarly if we have non integer values we have two options to put them flor(value) or ceil(value) = floor(value) + 1, so the idea is to just subtract floor(value).
+
+
+
+Hint 3
+Now the problem is different for each position we can sum just add 0 or 1 in order to sum the target, minimizing the deltas. This can be solved with DP.
+
diff --git a/problems/missing-element-in-sorted-array/README.md b/problems/missing-element-in-sorted-array/README.md
new file mode 100644
index 000000000..7b82fc673
--- /dev/null
+++ b/problems/missing-element-in-sorted-array/README.md
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/all-paths-from-source-lead-to-destination "All Paths from Source Lead to Destination") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/lexicographically-smallest-equivalent-string "Lexicographically Smallest Equivalent String")
+
+## 1060. Missing Element in Sorted Array (Medium)
+
+
+
+### Related Topics
+ [[Binary Search](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)]
+
+### Hints
+
+Hint 1
+First define a function f(x) that counts the number of missing elements until x.
+
+
+
+Hint 2
+Then use binary search with the given function f(x) to find the kth missing element.
+
diff --git a/problems/network-delay-time/README.md b/problems/network-delay-time/README.md
index c911096bc..47050f018 100644
--- a/problems/network-delay-time/README.md
+++ b/problems/network-delay-time/README.md
@@ -17,6 +17,19 @@
Now, we send a signal from a certain node K
. How long will it take for all nodes to receive the signal? If it is impossible, return -1
.
+
+
+Example 1:
+
+
+
+
+Input: times = [[2,1,1],[2,3,1],[3,4,1]], N = 4, K = 2
+Output: 2
+
+
+
+
Note:
@@ -26,8 +39,6 @@
- All edges
times[i] = (u, v, w)
will have 1 <= u, v <= N
and 0 <= w <= 100
.
-
-
### Related Topics
[[Heap](https://github.com/openset/leetcode/tree/master/tag/heap/README.md)]
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
diff --git a/problems/number-of-digit-one/README.md b/problems/number-of-digit-one/README.md
index 62719a3cf..c80d2820d 100644
--- a/problems/number-of-digit-one/README.md
+++ b/problems/number-of-digit-one/README.md
@@ -26,6 +26,7 @@
### Similar Questions
1. [Factorial Trailing Zeroes](https://github.com/openset/leetcode/tree/master/problems/factorial-trailing-zeroes) (Easy)
+ 1. [Digit Count in Range](https://github.com/openset/leetcode/tree/master/problems/digit-count-in-range) (Hard)
### Hints
diff --git a/problems/number-of-submatrices-that-sum-to-target/README.md b/problems/number-of-submatrices-that-sum-to-target/README.md
new file mode 100644
index 000000000..4795cd447
--- /dev/null
+++ b/problems/number-of-submatrices-that-sum-to-target/README.md
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/adding-two-negabinary-numbers "Adding Two Negabinary Numbers") + +Next>
+
+## 1074. Number of Submatrices That Sum to Target (Hard)
+
+Given a matrix
, and a target
, return the number of non-empty submatrices that sum to target.
+
+A submatrix x1, y1, x2, y2
is the set of all cells matrix[x][y]
with x1 <= x <= x2
and y1 <= y <= y2
.
+
+Two submatrices (x1, y1, x2, y2)
and (x1', y1', x2', y2')
are different if they have some coordinate that is different: for example, if x1 != x1'
.
+
+
+
+Example 1:
+
+
+Input: matrix = [[0,1,0],[1,1,1],[0,1,0]], target = 0
+Output: 4
+Explanation: The four 1x1 submatrices that only contain 0.
+
+
+
+
Example 2:
+
+
+Input: matrix = [[1,-1],[-1,1]], target = 0
+Output: 5
+Explanation: The two 1x2 submatrices, plus the two 2x1 submatrices, plus the 2x2 submatrix.
+
+
+
+
+
+Note:
+
+
+ 1 <= matrix.length <= 300
+ 1 <= matrix[0].length <= 300
+ -1000 <= matrix[i] <= 1000
+ -10^8 <= target <= 10^8
+
diff --git a/problems/number-of-valid-subarrays/README.md b/problems/number-of-valid-subarrays/README.md
new file mode 100644
index 000000000..a9a2e9317
--- /dev/null
+++ b/problems/number-of-valid-subarrays/README.md
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/longest-repeating-substring "Longest Repeating Substring") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/fixed-point "Fixed Point")
+
+## 1063. Number of Valid Subarrays (Hard)
+
+
+
+### Related Topics
+ [[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
+
+### Hints
+
+Hint 1
+Given a data structure that answers queries of the type to find the minimum in a range of an array (Range minimum query (RMQ) sparse table) in O(1) time. How can you solve this problem?
+
+
+
+Hint 2
+For each starting index do a binary search with an RMQ to find the ending possible position.
+
diff --git a/problems/product-sales-analysis-i/README.md b/problems/product-sales-analysis-i/README.md
new file mode 100644
index 000000000..743139ad0
--- /dev/null
+++ b/problems/product-sales-analysis-i/README.md
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/digit-count-in-range "Digit Count in Range") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-ii "Product Sales Analysis II")
+
+## 1068. Product Sales Analysis I (Easy)
+
+
diff --git a/problems/product-sales-analysis-i/mysql_schemas.sql b/problems/product-sales-analysis-i/mysql_schemas.sql
new file mode 100644
index 000000000..592f4f5a9
--- /dev/null
+++ b/problems/product-sales-analysis-i/mysql_schemas.sql
@@ -0,0 +1,10 @@
+Create table Sales (sale_id int, product_id int, year int, quantity int, price int);
+Create table Product (product_id int, product_name varchar(10));
+Truncate table Sales;
+insert into Sales (sale_id, product_id, year, quantity, price) values ('1', '100', '2008', '10', '5000');
+insert into Sales (sale_id, product_id, year, quantity, price) values ('2', '100', '2009', '12', '5000');
+insert into Sales (sale_id, product_id, year, quantity, price) values ('7', '200', '2011', '15', '9000');
+Truncate table Product;
+insert into Product (product_id, product_name) values ('100', 'Nokia');
+insert into Product (product_id, product_name) values ('200', 'Apple');
+insert into Product (product_id, product_name) values ('300', 'Samsung');
diff --git a/problems/product-sales-analysis-i/product_sales_analysis_i.sql b/problems/product-sales-analysis-i/product_sales_analysis_i.sql
new file mode 100644
index 000000000..bae62cf19
--- /dev/null
+++ b/problems/product-sales-analysis-i/product_sales_analysis_i.sql
@@ -0,0 +1 @@
+# Write your MySQL query statement below
diff --git a/problems/product-sales-analysis-ii/README.md b/problems/product-sales-analysis-ii/README.md
new file mode 100644
index 000000000..824b640e8
--- /dev/null
+++ b/problems/product-sales-analysis-ii/README.md
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-i "Product Sales Analysis I") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-iii "Product Sales Analysis III")
+
+## 1069. Product Sales Analysis II (Easy)
+
+
diff --git a/problems/product-sales-analysis-ii/mysql_schemas.sql b/problems/product-sales-analysis-ii/mysql_schemas.sql
new file mode 100644
index 000000000..592f4f5a9
--- /dev/null
+++ b/problems/product-sales-analysis-ii/mysql_schemas.sql
@@ -0,0 +1,10 @@
+Create table Sales (sale_id int, product_id int, year int, quantity int, price int);
+Create table Product (product_id int, product_name varchar(10));
+Truncate table Sales;
+insert into Sales (sale_id, product_id, year, quantity, price) values ('1', '100', '2008', '10', '5000');
+insert into Sales (sale_id, product_id, year, quantity, price) values ('2', '100', '2009', '12', '5000');
+insert into Sales (sale_id, product_id, year, quantity, price) values ('7', '200', '2011', '15', '9000');
+Truncate table Product;
+insert into Product (product_id, product_name) values ('100', 'Nokia');
+insert into Product (product_id, product_name) values ('200', 'Apple');
+insert into Product (product_id, product_name) values ('300', 'Samsung');
diff --git a/problems/product-sales-analysis-ii/product_sales_analysis_ii.sql b/problems/product-sales-analysis-ii/product_sales_analysis_ii.sql
new file mode 100644
index 000000000..bae62cf19
--- /dev/null
+++ b/problems/product-sales-analysis-ii/product_sales_analysis_ii.sql
@@ -0,0 +1 @@
+# Write your MySQL query statement below
diff --git a/problems/product-sales-analysis-iii/README.md b/problems/product-sales-analysis-iii/README.md
new file mode 100644
index 000000000..d8f2ce34b
--- /dev/null
+++ b/problems/product-sales-analysis-iii/README.md
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-ii "Product Sales Analysis II") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/greatest-common-divisor-of-strings "Greatest Common Divisor of Strings")
+
+## 1070. Product Sales Analysis III (Medium)
+
+
diff --git a/problems/product-sales-analysis-iii/mysql_schemas.sql b/problems/product-sales-analysis-iii/mysql_schemas.sql
new file mode 100644
index 000000000..592f4f5a9
--- /dev/null
+++ b/problems/product-sales-analysis-iii/mysql_schemas.sql
@@ -0,0 +1,10 @@
+Create table Sales (sale_id int, product_id int, year int, quantity int, price int);
+Create table Product (product_id int, product_name varchar(10));
+Truncate table Sales;
+insert into Sales (sale_id, product_id, year, quantity, price) values ('1', '100', '2008', '10', '5000');
+insert into Sales (sale_id, product_id, year, quantity, price) values ('2', '100', '2009', '12', '5000');
+insert into Sales (sale_id, product_id, year, quantity, price) values ('7', '200', '2011', '15', '9000');
+Truncate table Product;
+insert into Product (product_id, product_name) values ('100', 'Nokia');
+insert into Product (product_id, product_name) values ('200', 'Apple');
+insert into Product (product_id, product_name) values ('300', 'Samsung');
diff --git a/problems/product-sales-analysis-iii/product_sales_analysis_iii.sql b/problems/product-sales-analysis-iii/product_sales_analysis_iii.sql
new file mode 100644
index 000000000..bae62cf19
--- /dev/null
+++ b/problems/product-sales-analysis-iii/product_sales_analysis_iii.sql
@@ -0,0 +1 @@
+# Write your MySQL query statement below
diff --git a/problems/second-minimum-node-in-a-binary-tree/README.md b/problems/second-minimum-node-in-a-binary-tree/README.md
index 9c83f8fbf..f44edd3dc 100644
--- a/problems/second-minimum-node-in-a-binary-tree/README.md
+++ b/problems/second-minimum-node-in-a-binary-tree/README.md
@@ -11,7 +11,7 @@
## 671. Second Minimum Node In a Binary Tree (Easy)
-Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two
or zero
sub-node. If the node has two sub-nodes, then this node's value is the smaller value among its two sub-nodes.
+Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two
or zero
sub-node. If the node has two sub-nodes, then this node's value is the smaller value among its two sub-nodes. More formally, the property root.val = min(root.left.val, root.right.val)
always holds.
Given such a binary tree, you need to output the second minimum value in the set made of all the nodes' value in the whole tree.
diff --git a/problems/shortest-way-to-form-string/README.md b/problems/shortest-way-to-form-string/README.md
new file mode 100644
index 000000000..b5303610a
--- /dev/null
+++ b/problems/shortest-way-to-form-string/README.md
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/distant-barcodes "Distant Barcodes") + +[Next>](https://github.com/openset/leetcode/tree/master/problems/confusing-number "Confusing Number")
+
+## 1055. Shortest Way to Form String (Medium)
+
+
+
+### Related Topics
+ [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
+ [[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]
+
+### Similar Questions
+ 1. [Is Subsequence](https://github.com/openset/leetcode/tree/master/problems/is-subsequence) (Medium)
+
+### Hints
+
+Hint 1
+Which conditions have to been met in order to be impossible to form the target string?
+
+
+
+Hint 2
+If there exists a character in the target string which doesn't exist in the source string then it will be impossible to form the target string.
+
+
+
+Hint 3
+Assuming we are in the case which is possible to form the target string, how can we assure the minimum number of used subsequences of source?
+
+
+
+Hint 4
+For each used subsequence try to match the leftmost character of the current subsequence with the leftmost character of the target string, if they match then erase both character otherwise erase just the subsequence character whenever the current subsequence gets empty, reset it to a new copy of subsequence and increment the count, do this until the target sequence gets empty. Finally return the count.
+