From 3ae2e64724b5ec7cad0b9e4de373c9a03b16c7b6 Mon Sep 17 00:00:00 2001
From: openset
Date: Sun, 16 Jun 2019 12:45:06 +0800
Subject: [PATCH] Add: new
---
README.md | 11 +++
problems/add-digits/README.md | 1 +
problems/binary-tree-cameras/README.md | 2 +-
.../README.md | 2 +-
problems/confusing-number-ii/README.md | 70 +++++++++++++++++
problems/decode-string/README.md | 1 +
problems/duplicate-zeros/README.md | 45 +++++++++++
problems/encode-and-decode-tinyurl/README.md | 2 +-
.../find-bottom-left-tree-value/README.md | 2 +-
problems/high-five/README.md | 35 +++++++++
.../inorder-successor-in-bst-ii/README.md | 2 +-
problems/k-closest-points-to-origin/README.md | 2 +-
problems/largest-perimeter-triangle/README.md | 2 +-
problems/largest-values-from-labels/README.md | 75 +++++++++++++++++++
problems/letter-case-permutation/README.md | 1 +
problems/lonely-pixel-ii/README.md | 2 +-
problems/minimum-area-rectangle-ii/README.md | 2 +-
problems/odd-even-jump/README.md | 2 +-
problems/pancake-sorting/README.md | 2 +-
problems/sales-analysis-i/README.md | 14 ++++
problems/sales-analysis-i/mysql_schemas.sql | 11 +++
.../sales-analysis-i/sales_analysis_i.sql | 1 +
problems/sales-analysis-ii/README.md | 14 ++++
problems/sales-analysis-ii/mysql_schemas.sql | 11 +++
.../sales-analysis-ii/sales_analysis_ii.sql | 1 +
problems/sales-analysis-iii/README.md | 14 ++++
problems/sales-analysis-iii/mysql_schemas.sql | 11 +++
.../sales-analysis-iii/sales_analysis_iii.sql | 1 +
.../shortest-common-supersequence/README.md | 38 ++++++++++
.../shortest-path-in-binary-matrix/README.md | 51 +++++++++++++
.../README.md | 2 +-
.../student-attendance-record-i/README.md | 2 +-
.../README.md | 72 ++++++++++++++++++
readme/301-600.md | 6 +-
34 files changed, 496 insertions(+), 14 deletions(-)
create mode 100644 problems/confusing-number-ii/README.md
create mode 100644 problems/duplicate-zeros/README.md
create mode 100644 problems/high-five/README.md
create mode 100644 problems/largest-values-from-labels/README.md
create mode 100644 problems/sales-analysis-i/README.md
create mode 100644 problems/sales-analysis-i/mysql_schemas.sql
create mode 100644 problems/sales-analysis-i/sales_analysis_i.sql
create mode 100644 problems/sales-analysis-ii/README.md
create mode 100644 problems/sales-analysis-ii/mysql_schemas.sql
create mode 100644 problems/sales-analysis-ii/sales_analysis_ii.sql
create mode 100644 problems/sales-analysis-iii/README.md
create mode 100644 problems/sales-analysis-iii/mysql_schemas.sql
create mode 100644 problems/sales-analysis-iii/sales_analysis_iii.sql
create mode 100644 problems/shortest-common-supersequence/README.md
create mode 100644 problems/shortest-path-in-binary-matrix/README.md
create mode 100644 problems/sum-of-digits-in-the-minimum-number/README.md
diff --git a/README.md b/README.md
index 81f6ca902..5481d0fbb 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,17 @@ LeetCode Problems' Solutions
| # | Title | Solution | Difficulty |
| :-: | - | - | :-: |
+| 1092 | [Shortest Common Supersequence](https://leetcode.com/problems/shortest-common-supersequence "最短公共超序列") | [Go](https://github.com/openset/leetcode/tree/master/problems/shortest-common-supersequence) | Hard |
+| 1091 | [Shortest Path in Binary Matrix](https://leetcode.com/problems/shortest-path-in-binary-matrix "二进制矩阵中的最短路径") | [Go](https://github.com/openset/leetcode/tree/master/problems/shortest-path-in-binary-matrix) | Medium |
+| 1090 | [Largest Values From Labels](https://leetcode.com/problems/largest-values-from-labels "受标签影响的最大值") | [Go](https://github.com/openset/leetcode/tree/master/problems/largest-values-from-labels) | Medium |
+| 1089 | [Duplicate Zeros](https://leetcode.com/problems/duplicate-zeros "复写零") | [Go](https://github.com/openset/leetcode/tree/master/problems/duplicate-zeros) | Easy |
+| 1088 | [Confusing Number II](https://leetcode.com/problems/confusing-number-ii "易混淆数 II") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/confusing-number-ii) | Hard |
+| 1087 | [Brace Expansion](https://leetcode.com/problems/brace-expansion "字母切换") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/brace-expansion) | Medium |
+| 1086 | [High Five](https://leetcode.com/problems/high-five "前五科的均分") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/high-five) | Easy |
+| 1085 | [Sum of Digits in the Minimum Number](https://leetcode.com/problems/sum-of-digits-in-the-minimum-number "最小元素各数位之和") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/sum-of-digits-in-the-minimum-number) | Easy |
+| 1084 | [Sales Analysis III](https://leetcode.com/problems/sales-analysis-iii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-iii) | Easy |
+| 1083 | [Sales Analysis II](https://leetcode.com/problems/sales-analysis-ii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-ii) | Easy |
+| 1082 | [Sales Analysis I](https://leetcode.com/problems/sales-analysis-i) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-i) | Easy |
| 1081 | [Smallest Subsequence of Distinct Characters](https://leetcode.com/problems/smallest-subsequence-of-distinct-characters "不同字符的最小子序列") | [Go](https://github.com/openset/leetcode/tree/master/problems/smallest-subsequence-of-distinct-characters) | Medium |
| 1080 | [Insufficient Nodes in Root to Leaf Paths](https://leetcode.com/problems/insufficient-nodes-in-root-to-leaf-paths "根到叶路径上的不足节点") | [Go](https://github.com/openset/leetcode/tree/master/problems/insufficient-nodes-in-root-to-leaf-paths) | Medium |
| 1079 | [Letter Tile Possibilities](https://leetcode.com/problems/letter-tile-possibilities "活字印刷") | [Go](https://github.com/openset/leetcode/tree/master/problems/letter-tile-possibilities) | Medium |
diff --git a/problems/add-digits/README.md b/problems/add-digits/README.md
index 49f7b21a5..49236de06 100644
--- a/problems/add-digits/README.md
+++ b/problems/add-digits/README.md
@@ -30,6 +30,7 @@ Could you do it without any loop/recursion in O(1) runtime?
### Similar Questions
1. [Happy Number](https://github.com/openset/leetcode/tree/master/problems/happy-number) (Easy)
+ 1. [Sum of Digits in the Minimum Number](https://github.com/openset/leetcode/tree/master/problems/sum-of-digits-in-the-minimum-number) (Easy)
### Hints
diff --git a/problems/binary-tree-cameras/README.md b/problems/binary-tree-cameras/README.md
index 1e81aa72b..4e6a03482 100644
--- a/problems/binary-tree-cameras/README.md
+++ b/problems/binary-tree-cameras/README.md
@@ -48,9 +48,9 @@
### Related Topics
- [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
+ [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
### Similar Questions
1. [Distribute Coins in Binary Tree](https://github.com/openset/leetcode/tree/master/problems/distribute-coins-in-binary-tree) (Medium)
diff --git a/problems/binary-tree-longest-consecutive-sequence-ii/README.md b/problems/binary-tree-longest-consecutive-sequence-ii/README.md
index dbbe6ddea..9c018c20d 100644
--- a/problems/binary-tree-longest-consecutive-sequence-ii/README.md
+++ b/problems/binary-tree-longest-consecutive-sequence-ii/README.md
@@ -7,7 +7,7 @@
[< Previous](https://github.com/openset/leetcode/tree/master/problems/split-array-with-equal-sum "Split Array with Equal Sum")
-[Next >](https://github.com/openset/leetcode/tree/master/problems/student-attendance-record-i "Student Attendance Record I")
+[Next >](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-iv "Game Play Analysis IV")
## 549. Binary Tree Longest Consecutive Sequence II (Medium)
diff --git a/problems/confusing-number-ii/README.md b/problems/confusing-number-ii/README.md
new file mode 100644
index 000000000..845b1fd2c
--- /dev/null
+++ b/problems/confusing-number-ii/README.md
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/brace-expansion "Brace Expansion")
+
+[Next >](https://github.com/openset/leetcode/tree/master/problems/duplicate-zeros "Duplicate Zeros")
+
+## 1088. Confusing Number II (Hard)
+
+We can rotate digits by 180 degrees to form new digits. When 0, 1, 6, 8, 9 are rotated 180 degrees, they become 0, 1, 9, 8, 6 respectively. When 2, 3, 4, 5 and 7 are rotated 180 degrees, they become invalid.
+
+A confusing number is a number that when rotated 180 degrees becomes a different number with each digit valid.(Note that the rotated number can be greater than the original number.)
+
+Given a positive integer N
, return the number of confusing numbers between 1
and N
inclusive.
+
+
+
+Example 1:
+
+
+Input: 20
+Output: 6
+Explanation:
+The confusing numbers are [6,9,10,16,18,19].
+6 converts to 9.
+9 converts to 6.
+10 converts to 01 which is just 1.
+16 converts to 91.
+18 converts to 81.
+19 converts to 61.
+
+
+Example 2:
+
+
+Input: 100
+Output: 19
+Explanation:
+The confusing numbers are [6,9,10,16,18,19,60,61,66,68,80,81,86,89,90,91,98,99,100].
+
+
+
+
+Note:
+
+
+ 1 <= N <= 10^9
+
+
+### Related Topics
+ [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
+ [[Backtracking](https://github.com/openset/leetcode/tree/master/tag/backtracking/README.md)]
+
+### Similar Questions
+ 1. [Confusing Number](https://github.com/openset/leetcode/tree/master/problems/confusing-number) (Easy)
+
+### Hints
+
+Hint 1
+Which set of digits have the valid numbers?
+
+
+
+Hint 2
+Only 0, 1, 6, 8, 9 are the valid set of digits, do a backtracking to generate all the numbers containing this digits and check they are valid.
+
diff --git a/problems/decode-string/README.md b/problems/decode-string/README.md
index 830bd382b..8ebc88b6c 100644
--- a/problems/decode-string/README.md
+++ b/problems/decode-string/README.md
@@ -38,3 +38,4 @@ s = "2[abc]3[cd]ef", return "abcabccdcdcdef".
### Similar Questions
1. [Encode String with Shortest Length](https://github.com/openset/leetcode/tree/master/problems/encode-string-with-shortest-length) (Hard)
1. [Number of Atoms](https://github.com/openset/leetcode/tree/master/problems/number-of-atoms) (Hard)
+ 1. [Permutation of Letters](https://github.com/openset/leetcode/tree/master/problems/permutation-of-letters) (Medium)
diff --git a/problems/duplicate-zeros/README.md b/problems/duplicate-zeros/README.md
new file mode 100644
index 000000000..0f00388f8
--- /dev/null
+++ b/problems/duplicate-zeros/README.md
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/confusing-number-ii "Confusing Number II")
+
+[Next >](https://github.com/openset/leetcode/tree/master/problems/largest-values-from-labels "Largest Values From Labels")
+
+## 1089. Duplicate Zeros (Easy)
+
+Given a fixed length array arr
of integers, duplicate each occurrence of zero, shifting the remaining elements to the right.
+
+Note that elements beyond the length of the original array are not written.
+
+Do the above modifications to the input array in place, do not return anything from your function.
+
+
+
+Example 1:
+
+
+Input: [1,0,2,3,0,4,5,0]
+Output: null
+Explanation: After calling your function, the input array is modified to: [1,0,0,2,3,0,0,4]
+
+
+Example 2:
+
+
+Input: [1,2,3]
+Output: null
+Explanation: After calling your function, the input array is modified to: [1,2,3]
+
+
+
+
+Note:
+
+
+ 1 <= arr.length <= 10000
+ 0 <= arr[i] <= 9
+
diff --git a/problems/encode-and-decode-tinyurl/README.md b/problems/encode-and-decode-tinyurl/README.md
index 464caed4a..28ed43246 100644
--- a/problems/encode-and-decode-tinyurl/README.md
+++ b/problems/encode-and-decode-tinyurl/README.md
@@ -5,7 +5,7 @@
-[< Previous](https://github.com/openset/leetcode/tree/master/problems/lonely-pixel-ii "Lonely Pixel II")
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-iii "Game Play Analysis III")
[Next >](https://github.com/openset/leetcode/tree/master/problems/construct-binary-tree-from-string "Construct Binary Tree from String")
diff --git a/problems/find-bottom-left-tree-value/README.md b/problems/find-bottom-left-tree-value/README.md
index 1a98ddb95..4bdb69a6b 100644
--- a/problems/find-bottom-left-tree-value/README.md
+++ b/problems/find-bottom-left-tree-value/README.md
@@ -5,7 +5,7 @@
-[< Previous](https://github.com/openset/leetcode/tree/master/problems/inorder-successor-in-bst-ii "Inorder Successor in BST II")
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-ii "Game Play Analysis II")
[Next >](https://github.com/openset/leetcode/tree/master/problems/freedom-trail "Freedom Trail")
diff --git a/problems/high-five/README.md b/problems/high-five/README.md
new file mode 100644
index 000000000..b2beae86d
--- /dev/null
+++ b/problems/high-five/README.md
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/sum-of-digits-in-the-minimum-number "Sum of Digits in the Minimum Number")
+
+[Next >](https://github.com/openset/leetcode/tree/master/problems/brace-expansion "Brace Expansion")
+
+## 1086. High Five (Easy)
+
+
+
+### Related Topics
+ [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
+ [[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]
+ [[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]
+
+### Hints
+
+Hint 1
+How can we solve the problem if we have just one student?
+
+
+
+Hint 2
+Given an student sort their grades and get the top 5 average.
+
+
+
+Hint 3
+Generalize the idea to do it for many students.
+
diff --git a/problems/inorder-successor-in-bst-ii/README.md b/problems/inorder-successor-in-bst-ii/README.md
index 6e79f3f10..cf124ff9f 100644
--- a/problems/inorder-successor-in-bst-ii/README.md
+++ b/problems/inorder-successor-in-bst-ii/README.md
@@ -7,7 +7,7 @@
[< Previous](https://github.com/openset/leetcode/tree/master/problems/fibonacci-number "Fibonacci Number")
-[Next >](https://github.com/openset/leetcode/tree/master/problems/find-bottom-left-tree-value "Find Bottom Left Tree Value")
+[Next >](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-i "Game Play Analysis I")
## 510. Inorder Successor in BST II (Medium)
diff --git a/problems/k-closest-points-to-origin/README.md b/problems/k-closest-points-to-origin/README.md
index 0e1028f07..d423eb105 100644
--- a/problems/k-closest-points-to-origin/README.md
+++ b/problems/k-closest-points-to-origin/README.md
@@ -54,9 +54,9 @@ We only want the closest K = 1 points from the origin, so the answer is just [[-
### Related Topics
- [[Divide and Conquer](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md)]
[[Heap](https://github.com/openset/leetcode/tree/master/tag/heap/README.md)]
[[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]
+ [[Divide and Conquer](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md)]
### Similar Questions
1. [Kth Largest Element in an Array](https://github.com/openset/leetcode/tree/master/problems/kth-largest-element-in-an-array) (Medium)
diff --git a/problems/largest-perimeter-triangle/README.md b/problems/largest-perimeter-triangle/README.md
index a1897ed3c..6b9c41450 100644
--- a/problems/largest-perimeter-triangle/README.md
+++ b/problems/largest-perimeter-triangle/README.md
@@ -66,8 +66,8 @@
### Related Topics
- [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
[[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]
+ [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
### Similar Questions
1. [Largest Triangle Area](https://github.com/openset/leetcode/tree/master/problems/largest-triangle-area) (Easy)
diff --git a/problems/largest-values-from-labels/README.md b/problems/largest-values-from-labels/README.md
new file mode 100644
index 000000000..f1255a230
--- /dev/null
+++ b/problems/largest-values-from-labels/README.md
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/duplicate-zeros "Duplicate Zeros")
+
+[Next >](https://github.com/openset/leetcode/tree/master/problems/shortest-path-in-binary-matrix "Shortest Path in Binary Matrix")
+
+## 1090. Largest Values From Labels (Medium)
+
+We have a set of items: the i
-th item has value values[i]
and label labels[i]
.
+
+Then, we choose a subset S
of these items, such that:
+
+
+ |S| <= num_wanted
+ - For every label
L
, the number of items in S
with label L
is <= use_limit
.
+
+
+Return the largest possible sum of the subset S
.
+
+
+
+
+
Example 1:
+
+
+Input: values = [5,4,3,2,1], labels = [1,1,2,2,3], num_wanted
= 3, use_limit = 1
+Output: 9
+Explanation: The subset chosen is the first, third, and fifth item.
+
+
+
+
Example 2:
+
+
+Input: values = [5,4,3,2,1], labels = [1,3,3,3,2], num_wanted
= 3, use_limit = 2
+Output: 12
+Explanation: The subset chosen is the first, second, and third item.
+
+
+
+
Example 3:
+
+
+Input: values = [9,8,8,7,6], labels = [0,0,0,1,1], num_wanted
= 3, use_limit = 1
+Output: 16
+Explanation: The subset chosen is the first and fourth item.
+
+
+
+
Example 4:
+
+
+Input: values = [9,8,8,7,6], labels = [0,0,0,1,1], num_wanted
= 3, use_limit = 2
+Output: 24
+Explanation: The subset chosen is the first, second, and fourth item.
+
+
+
+
+
Note:
+
+
+ 1 <= values.length == labels.length <= 20000
+ 0 <= values[i], labels[i] <= 20000
+ 1 <= num_wanted, use_limit <= values.length
+
+
+
+
+
diff --git a/problems/letter-case-permutation/README.md b/problems/letter-case-permutation/README.md
index 930e01fad..aa390fb42 100644
--- a/problems/letter-case-permutation/README.md
+++ b/problems/letter-case-permutation/README.md
@@ -38,3 +38,4 @@
### Similar Questions
1. [Subsets](https://github.com/openset/leetcode/tree/master/problems/subsets) (Medium)
+ 1. [Permutation of Letters](https://github.com/openset/leetcode/tree/master/problems/permutation-of-letters) (Medium)
diff --git a/problems/lonely-pixel-ii/README.md b/problems/lonely-pixel-ii/README.md
index e96b3873e..ec1ba6837 100644
--- a/problems/lonely-pixel-ii/README.md
+++ b/problems/lonely-pixel-ii/README.md
@@ -7,7 +7,7 @@
[< Previous](https://github.com/openset/leetcode/tree/master/problems/k-diff-pairs-in-an-array "K-diff Pairs in an Array")
-[Next >](https://github.com/openset/leetcode/tree/master/problems/encode-and-decode-tinyurl "Encode and Decode TinyURL")
+[Next >](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-iii "Game Play Analysis III")
## 533. Lonely Pixel II (Medium)
diff --git a/problems/minimum-area-rectangle-ii/README.md b/problems/minimum-area-rectangle-ii/README.md
index 57e85b2bf..2ba67b0bc 100644
--- a/problems/minimum-area-rectangle-ii/README.md
+++ b/problems/minimum-area-rectangle-ii/README.md
@@ -76,5 +76,5 @@
### Related Topics
- [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
[[Geometry](https://github.com/openset/leetcode/tree/master/tag/geometry/README.md)]
+ [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
diff --git a/problems/odd-even-jump/README.md b/problems/odd-even-jump/README.md
index 31d4ede3b..cbccfdebc 100644
--- a/problems/odd-even-jump/README.md
+++ b/problems/odd-even-jump/README.md
@@ -87,6 +87,6 @@ We can reach the end from starting indexes 1, 2, and 4.
### Related Topics
- [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
+ [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
[[Ordered Map](https://github.com/openset/leetcode/tree/master/tag/ordered-map/README.md)]
diff --git a/problems/pancake-sorting/README.md b/problems/pancake-sorting/README.md
index 6d4792788..1989fc477 100644
--- a/problems/pancake-sorting/README.md
+++ b/problems/pancake-sorting/README.md
@@ -52,5 +52,5 @@ Note that other answers, such as [3, 3], would also be accepted.
### Related Topics
- [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
[[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]
+ [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
diff --git a/problems/sales-analysis-i/README.md b/problems/sales-analysis-i/README.md
new file mode 100644
index 000000000..c6c3c0f6a
--- /dev/null
+++ b/problems/sales-analysis-i/README.md
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/smallest-subsequence-of-distinct-characters "Smallest Subsequence of Distinct Characters")
+
+[Next >](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-ii "Sales Analysis II")
+
+## 1082. Sales Analysis I (Easy)
+
+
diff --git a/problems/sales-analysis-i/mysql_schemas.sql b/problems/sales-analysis-i/mysql_schemas.sql
new file mode 100644
index 000000000..501c5e913
--- /dev/null
+++ b/problems/sales-analysis-i/mysql_schemas.sql
@@ -0,0 +1,11 @@
+Create table If Not Exists Product (product_id int, product_name varchar(10), unit_price int);
+Create table If Not Exists Sales (seller_id int, product_id int, buyer_id int, sale_date date, quantity int, price int);
+Truncate table Product;
+insert into Product (product_id, product_name, unit_price) values ('1', 'S8', '1000');
+insert into Product (product_id, product_name, unit_price) values ('2', 'G4', '800');
+insert into Product (product_id, product_name, unit_price) values ('3', 'iPhone', '1400');
+Truncate table Sales;
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('1', '1', '1', '2019-01-21', '2', '2000');
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('1', '2', '2', '2019-02-17', '1', '800');
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('2', '2', '3', '2019-06-02', '1', '800');
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('3', '3', '4', '2019-05-13', '2', '2800');
diff --git a/problems/sales-analysis-i/sales_analysis_i.sql b/problems/sales-analysis-i/sales_analysis_i.sql
new file mode 100644
index 000000000..bae62cf19
--- /dev/null
+++ b/problems/sales-analysis-i/sales_analysis_i.sql
@@ -0,0 +1 @@
+# Write your MySQL query statement below
diff --git a/problems/sales-analysis-ii/README.md b/problems/sales-analysis-ii/README.md
new file mode 100644
index 000000000..85ea8663b
--- /dev/null
+++ b/problems/sales-analysis-ii/README.md
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-i "Sales Analysis I")
+
+[Next >](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-iii "Sales Analysis III")
+
+## 1083. Sales Analysis II (Easy)
+
+
diff --git a/problems/sales-analysis-ii/mysql_schemas.sql b/problems/sales-analysis-ii/mysql_schemas.sql
new file mode 100644
index 000000000..18cbd6647
--- /dev/null
+++ b/problems/sales-analysis-ii/mysql_schemas.sql
@@ -0,0 +1,11 @@
+Create table If Not Exists Product (product_id int, product_name varchar(10), unit_price int);
+Create table If Not Exists Sales (seller_id int, product_id int, buyer_id int, sale_date date, quantity int, price int);
+Truncate table Product;
+insert into Product (product_id, product_name, unit_price) values ('1', 'S8', '1000');
+insert into Product (product_id, product_name, unit_price) values ('2', 'G4', '800');
+insert into Product (product_id, product_name, unit_price) values ('3', 'iPhone', '1400');
+Truncate table Sales;
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('1', '1', '1', '2019-01-21', '2', '2000');
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('1', '2', '2', '2019-02-17', '1', '800');
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('2', '1', '3', '2019-06-02', '1', '800');
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('3', '3', '3', '2019-05-13', '2', '2800');
diff --git a/problems/sales-analysis-ii/sales_analysis_ii.sql b/problems/sales-analysis-ii/sales_analysis_ii.sql
new file mode 100644
index 000000000..bae62cf19
--- /dev/null
+++ b/problems/sales-analysis-ii/sales_analysis_ii.sql
@@ -0,0 +1 @@
+# Write your MySQL query statement below
diff --git a/problems/sales-analysis-iii/README.md b/problems/sales-analysis-iii/README.md
new file mode 100644
index 000000000..6e3e34ed8
--- /dev/null
+++ b/problems/sales-analysis-iii/README.md
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-ii "Sales Analysis II")
+
+[Next >](https://github.com/openset/leetcode/tree/master/problems/sum-of-digits-in-the-minimum-number "Sum of Digits in the Minimum Number")
+
+## 1084. Sales Analysis III (Easy)
+
+
diff --git a/problems/sales-analysis-iii/mysql_schemas.sql b/problems/sales-analysis-iii/mysql_schemas.sql
new file mode 100644
index 000000000..501c5e913
--- /dev/null
+++ b/problems/sales-analysis-iii/mysql_schemas.sql
@@ -0,0 +1,11 @@
+Create table If Not Exists Product (product_id int, product_name varchar(10), unit_price int);
+Create table If Not Exists Sales (seller_id int, product_id int, buyer_id int, sale_date date, quantity int, price int);
+Truncate table Product;
+insert into Product (product_id, product_name, unit_price) values ('1', 'S8', '1000');
+insert into Product (product_id, product_name, unit_price) values ('2', 'G4', '800');
+insert into Product (product_id, product_name, unit_price) values ('3', 'iPhone', '1400');
+Truncate table Sales;
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('1', '1', '1', '2019-01-21', '2', '2000');
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('1', '2', '2', '2019-02-17', '1', '800');
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('2', '2', '3', '2019-06-02', '1', '800');
+insert into Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) values ('3', '3', '4', '2019-05-13', '2', '2800');
diff --git a/problems/sales-analysis-iii/sales_analysis_iii.sql b/problems/sales-analysis-iii/sales_analysis_iii.sql
new file mode 100644
index 000000000..bae62cf19
--- /dev/null
+++ b/problems/sales-analysis-iii/sales_analysis_iii.sql
@@ -0,0 +1 @@
+# Write your MySQL query statement below
diff --git a/problems/shortest-common-supersequence/README.md b/problems/shortest-common-supersequence/README.md
new file mode 100644
index 000000000..2b73f982e
--- /dev/null
+++ b/problems/shortest-common-supersequence/README.md
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/shortest-path-in-binary-matrix "Shortest Path in Binary Matrix")
+
+Next >
+
+## 1092. Shortest Common Supersequence (Hard)
+
+Given two strings str1
and str2
, return the shortest string that has both str1
and str2
as subsequences. If multiple answers exist, you may return any of them.
+
+(A string S is a subsequence of string T if deleting some number of characters from T (possibly 0, and the characters are chosen anywhere from T) results in the string S.)
+
+
+
+Example 1:
+
+
+Input: str1 = "abac", str2 = "cab"
+Output: "cabac"
+Explanation:
+str1 = "abac" is a substring of "cabac" because we can delete the first "c".
+str2 = "cab" is a substring of "cabac" because we can delete the last "ac".
+The answer provided is the shortest such string that satisfies these properties.
+
+
+
+
+Note:
+
+
+ 1 <= str1.length, str2.length <= 1000
+ str1
and str2
consist of lowercase English letters.
+
diff --git a/problems/shortest-path-in-binary-matrix/README.md b/problems/shortest-path-in-binary-matrix/README.md
new file mode 100644
index 000000000..27926c7ed
--- /dev/null
+++ b/problems/shortest-path-in-binary-matrix/README.md
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/largest-values-from-labels "Largest Values From Labels")
+
+[Next >](https://github.com/openset/leetcode/tree/master/problems/shortest-common-supersequence "Shortest Common Supersequence")
+
+## 1091. Shortest Path in Binary Matrix (Medium)
+
+In an N by N square grid, each cell is either empty (0) or blocked (1).
+
+A clear path from top-left to bottom-right has length k
if and only if it is composed of cells C_1, C_2, ..., C_k
such that:
+
+
+ - Adjacent cells
C_i
and C_{i+1}
are connected 8-directionally (ie., they are different and share an edge or corner)
+ C_1
is at location (0, 0)
(ie. has value grid[0][0]
)
+ C_k
is at location (N-1, N-1)
(ie. has value grid[N-1][N-1]
)
+ - If
C_i
is located at (r, c)
, then grid[r][c]
is empty (ie. grid[r][c] == 0
).
+
+
+Return the length of the shortest such clear path from top-left to bottom-right. If such a path does not exist, return -1.
+
+
+
+Example 1:
+
+
+Input: [[0,1],[1,0]]
+Output: 2
+
+
+
+
Example 2:
+
+
+Input: [[0,0,0],[1,1,0],[1,1,0]]
+Output: 4
+
+
+
+
+Note:
+
+
+ 1 <= grid.length == grid[0].length <= 100
+ grid[i][j]
is 0
or 1
+
diff --git a/problems/smallest-subsequence-of-distinct-characters/README.md b/problems/smallest-subsequence-of-distinct-characters/README.md
index 5648ee1ac..816885d5c 100644
--- a/problems/smallest-subsequence-of-distinct-characters/README.md
+++ b/problems/smallest-subsequence-of-distinct-characters/README.md
@@ -7,7 +7,7 @@
[< Previous](https://github.com/openset/leetcode/tree/master/problems/insufficient-nodes-in-root-to-leaf-paths "Insufficient Nodes in Root to Leaf Paths")
-Next >
+[Next >](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-i "Sales Analysis I")
## 1081. Smallest Subsequence of Distinct Characters (Medium)
diff --git a/problems/student-attendance-record-i/README.md b/problems/student-attendance-record-i/README.md
index 4d198cd9b..6e9d6d9d5 100644
--- a/problems/student-attendance-record-i/README.md
+++ b/problems/student-attendance-record-i/README.md
@@ -5,7 +5,7 @@
-[< Previous](https://github.com/openset/leetcode/tree/master/problems/binary-tree-longest-consecutive-sequence-ii "Binary Tree Longest Consecutive Sequence II")
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-iv "Game Play Analysis IV")
[Next >](https://github.com/openset/leetcode/tree/master/problems/student-attendance-record-ii "Student Attendance Record II")
diff --git a/problems/sum-of-digits-in-the-minimum-number/README.md b/problems/sum-of-digits-in-the-minimum-number/README.md
new file mode 100644
index 000000000..ba960c024
--- /dev/null
+++ b/problems/sum-of-digits-in-the-minimum-number/README.md
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+[< Previous](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-iii "Sales Analysis III")
+
+[Next >](https://github.com/openset/leetcode/tree/master/problems/high-five "High Five")
+
+## 1085. Sum of Digits in the Minimum Number (Easy)
+
+Given an array A
of positive integers, let S
be the sum of the digits of the minimal element of A
.
+
+Return 0 if S
is odd, otherwise return 1.
+
+
+
+Example 1:
+
+
+Input: [34,23,1,24,75,33,54,8]
+Output: 0
+Explanation:
+The minimal element is 1, and the sum of those digits is S = 1 which is odd, so the answer is 0.
+
+
+Example 2:
+
+
+Input: [99,77,33,66,55]
+Output: 1
+Explanation:
+The minimal element is 33, and the sum of those digits is S = 3 + 3 = 6 which is even, so the answer is 1.
+
+
+
+
+Note:
+
+
+ 1 <= A.length <= 100
+ 1 <= A[i].length <= 100
+
+
+### Related Topics
+ [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
+
+### Similar Questions
+ 1. [Add Digits](https://github.com/openset/leetcode/tree/master/problems/add-digits) (Easy)
+
+### Hints
+
+Hint 1
+How to find the minimum number in an array?
+
+
+
+Hint 2
+Loop over the array and compare each one of the numbers.
+
+
+
+Hint 3
+How to find the sum of digits?
+
+
+
+Hint 4
+Divide the number consecutively and get their remainder modulus 10. Sum those remainders and return the answer as the problem asks.
+
diff --git a/readme/301-600.md b/readme/301-600.md
index 9420df3fb..7e699fd7f 100644
--- a/readme/301-600.md
+++ b/readme/301-600.md
@@ -180,7 +180,7 @@ LeetCode Problems' Solutions
| 424 | [Longest Repeating Character Replacement](https://leetcode.com/problems/longest-repeating-character-replacement "替换后的最长重复字符") | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-repeating-character-replacement) | Medium |
| 425 | [Word Squares](https://leetcode.com/problems/word-squares "单词方块") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/word-squares) | Hard |
| 426 | [Convert Binary Search Tree to Sorted Doubly Linked List](https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list "将二叉搜索树转化为排序的双向链表") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/convert-binary-search-tree-to-sorted-doubly-linked-list) | Medium |
-| 427 | [Construct Quad Tree](https://leetcode.com/problems/construct-quad-tree "建立四叉树") | [Go](https://github.com/openset/leetcode/tree/master/problems/construct-quad-tree) | Easy |
+| 427 | [Construct Quad Tree](https://leetcode.com/problems/construct-quad-tree "建立四叉树") | [Go](https://github.com/openset/leetcode/tree/master/problems/construct-quad-tree) | Medium |
| 428 | [Serialize and Deserialize N-ary Tree](https://leetcode.com/problems/serialize-and-deserialize-n-ary-tree "序列化和反序列化 N 叉树") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/serialize-and-deserialize-n-ary-tree) | Hard |
| 429 | [N-ary Tree Level Order Traversal](https://leetcode.com/problems/n-ary-tree-level-order-traversal "N叉树的层序遍历") | [Go](https://github.com/openset/leetcode/tree/master/problems/n-ary-tree-level-order-traversal) | Easy |
| 430 | [Flatten a Multilevel Doubly Linked List](https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list "扁平化多级双向链表") | [Go](https://github.com/openset/leetcode/tree/master/problems/flatten-a-multilevel-doubly-linked-list) | Medium |
@@ -264,6 +264,8 @@ LeetCode Problems' Solutions
| 508 | [Most Frequent Subtree Sum](https://leetcode.com/problems/most-frequent-subtree-sum "出现次数最多的子树元素和") | [Go](https://github.com/openset/leetcode/tree/master/problems/most-frequent-subtree-sum) | Medium |
| 509 | [Fibonacci Number](https://leetcode.com/problems/fibonacci-number "斐波那契数") | [Go](https://github.com/openset/leetcode/tree/master/problems/fibonacci-number) | Easy |
| 510 | [Inorder Successor in BST II](https://leetcode.com/problems/inorder-successor-in-bst-ii "二叉搜索树中的中序后继 II") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/inorder-successor-in-bst-ii) | Medium |
+| 511 | [Game Play Analysis I](https://leetcode.com/problems/game-play-analysis-i) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-i) | Easy |
+| 512 | [Game Play Analysis II](https://leetcode.com/problems/game-play-analysis-ii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-ii) | Easy |
| 513 | [Find Bottom Left Tree Value](https://leetcode.com/problems/find-bottom-left-tree-value "找树左下角的值") | [Go](https://github.com/openset/leetcode/tree/master/problems/find-bottom-left-tree-value) | Medium |
| 514 | [Freedom Trail](https://leetcode.com/problems/freedom-trail "自由之路") | [Go](https://github.com/openset/leetcode/tree/master/problems/freedom-trail) | Hard |
| 515 | [Find Largest Value in Each Tree Row](https://leetcode.com/problems/find-largest-value-in-each-tree-row "在每个树行中找最大值") | [Go](https://github.com/openset/leetcode/tree/master/problems/find-largest-value-in-each-tree-row) | Medium |
@@ -285,6 +287,7 @@ LeetCode Problems' Solutions
| 531 | [Lonely Pixel I](https://leetcode.com/problems/lonely-pixel-i "孤独像素 I") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/lonely-pixel-i) | Medium |
| 532 | [K-diff Pairs in an Array](https://leetcode.com/problems/k-diff-pairs-in-an-array "数组中的K-diff数对") | [Go](https://github.com/openset/leetcode/tree/master/problems/k-diff-pairs-in-an-array) | Easy |
| 533 | [Lonely Pixel II](https://leetcode.com/problems/lonely-pixel-ii "孤独像素 II") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/lonely-pixel-ii) | Medium |
+| 534 | [Game Play Analysis III](https://leetcode.com/problems/game-play-analysis-iii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-iii) | Medium |
| 535 | [Encode and Decode TinyURL](https://leetcode.com/problems/encode-and-decode-tinyurl "TinyURL 的加密与解密") | [Go](https://github.com/openset/leetcode/tree/master/problems/encode-and-decode-tinyurl) | Medium |
| 536 | [Construct Binary Tree from String](https://leetcode.com/problems/construct-binary-tree-from-string "从字符串生成二叉树") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/construct-binary-tree-from-string) | Medium |
| 537 | [Complex Number Multiplication](https://leetcode.com/problems/complex-number-multiplication "复数乘法") | [Go](https://github.com/openset/leetcode/tree/master/problems/complex-number-multiplication) | Medium |
@@ -300,6 +303,7 @@ LeetCode Problems' Solutions
| 547 | [Friend Circles](https://leetcode.com/problems/friend-circles "朋友圈") | [Go](https://github.com/openset/leetcode/tree/master/problems/friend-circles) | Medium |
| 548 | [Split Array with Equal Sum](https://leetcode.com/problems/split-array-with-equal-sum "将数组分割成和相等的子数组") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/split-array-with-equal-sum) | Medium |
| 549 | [Binary Tree Longest Consecutive Sequence II](https://leetcode.com/problems/binary-tree-longest-consecutive-sequence-ii "二叉树中最长的连续序列") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/binary-tree-longest-consecutive-sequence-ii) | Medium |
+| 550 | [Game Play Analysis IV](https://leetcode.com/problems/game-play-analysis-iv) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-iv) | Medium |
| 551 | [Student Attendance Record I](https://leetcode.com/problems/student-attendance-record-i "学生出勤记录 I") | [Go](https://github.com/openset/leetcode/tree/master/problems/student-attendance-record-i) | Easy |
| 552 | [Student Attendance Record II](https://leetcode.com/problems/student-attendance-record-ii "学生出勤记录 II") | [Go](https://github.com/openset/leetcode/tree/master/problems/student-attendance-record-ii) | Hard |
| 553 | [Optimal Division](https://leetcode.com/problems/optimal-division "最优除法") | [Go](https://github.com/openset/leetcode/tree/master/problems/optimal-division) | Medium |