From 43d9b4b6884e4011cae9276edb699f8866c2d2ce Mon Sep 17 00:00:00 2001 From: Shuo Date: Thu, 2 Jan 2020 11:23:35 +0800 Subject: [PATCH] Add: new --- README.md | 11 ++++++----- problems/count-and-say/README.md | 2 +- .../README.md | 2 +- .../mysql_schemas.sql | 10 +++++----- problems/immediate-food-delivery-ii/README.md | 2 +- .../README.md | 2 +- problems/reported-posts/README.md | 2 +- .../README.md | 17 +++++++++++++++++ .../mysql_schemas.sql | 11 +++++++++++ problems/verbal-arithmetic-puzzle/README.md | 2 +- problems/weather-type-in-each-country/README.md | 2 +- readme/1-300.md | 2 +- tag/string/README.md | 2 +- 13 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 problems/running-total-for-different-genders/README.md create mode 100644 problems/running-total-for-different-genders/mysql_schemas.sql diff --git a/README.md b/README.md index 8f6b96da4..4bd1b7abc 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ LeetCode Problems' Solutions | # | Title | Solution | Difficulty | | :-: | - | - | :-: | +| 1308 | [Running Total for Different Genders](https://leetcode.com/problems/running-total-for-different-genders) 🔒 | [MySQL](problems/running-total-for-different-genders) | Medium | | 1307 | [Verbal Arithmetic Puzzle](https://leetcode.com/problems/verbal-arithmetic-puzzle "口算难题") | [Go](problems/verbal-arithmetic-puzzle) | Hard | | 1306 | [Jump Game III](https://leetcode.com/problems/jump-game-iii "跳跃游戏 III") | [Go](problems/jump-game-iii) | Medium | | 1305 | [All Elements in Two Binary Search Trees](https://leetcode.com/problems/all-elements-in-two-binary-search-trees "两棵二叉搜索树中的所有元素") | [Go](problems/all-elements-in-two-binary-search-trees) | Medium | @@ -75,7 +76,7 @@ LeetCode Problems' Solutions | 1297 | [Maximum Number of Occurrences of a Substring](https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring "子串的最大出现次数") | [Go](problems/maximum-number-of-occurrences-of-a-substring) | Medium | | 1296 | [Divide Array in Sets of K Consecutive Numbers](https://leetcode.com/problems/divide-array-in-sets-of-k-consecutive-numbers "划分数组为连续数字的集合") | [Go](problems/divide-array-in-sets-of-k-consecutive-numbers) | Medium | | 1295 | [Find Numbers with Even Number of Digits](https://leetcode.com/problems/find-numbers-with-even-number-of-digits "统计位数为偶数的数字") | [Go](problems/find-numbers-with-even-number-of-digits) | Easy | -| 1294 | [Weather Type in Each Country](https://leetcode.com/problems/weather-type-in-each-country) 🔒 | [MySQL](problems/weather-type-in-each-country) | Easy | +| 1294 | [Weather Type in Each Country](https://leetcode.com/problems/weather-type-in-each-country "不同国家的天气类型") 🔒 | [MySQL](problems/weather-type-in-each-country) | Easy | | 1293 | [Shortest Path in a Grid with Obstacles Elimination](https://leetcode.com/problems/shortest-path-in-a-grid-with-obstacles-elimination "网格中的最短路径") | [Go](problems/shortest-path-in-a-grid-with-obstacles-elimination) | Hard | | 1292 | [Maximum Side Length of a Square with Sum Less than or Equal to Threshold](https://leetcode.com/problems/maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold "元素和小于等于阈值的正方形的最大边长") | [Go](problems/maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold) | Medium | | 1291 | [Sequential Digits](https://leetcode.com/problems/sequential-digits "顺次数") | [Go](problems/sequential-digits) | Medium | @@ -84,7 +85,7 @@ LeetCode Problems' Solutions | 1288 | [Remove Covered Intervals](https://leetcode.com/problems/remove-covered-intervals "删除被覆盖区间") | [Go](problems/remove-covered-intervals) | Medium | | 1287 | [Element Appearing More Than 25% In Sorted Array](https://leetcode.com/problems/element-appearing-more-than-25-in-sorted-array "有序数组中出现次数超过25%的元素") | [Go](problems/element-appearing-more-than-25-in-sorted-array) | Easy | | 1286 | [Iterator for Combination](https://leetcode.com/problems/iterator-for-combination "字母组合迭代器") | [Go](problems/iterator-for-combination) | Medium | -| 1285 | [Find the Start and End Number of Continuous Ranges](https://leetcode.com/problems/find-the-start-and-end-number-of-continuous-ranges) 🔒 | [MySQL](problems/find-the-start-and-end-number-of-continuous-ranges) | Medium | +| 1285 | [Find the Start and End Number of Continuous Ranges](https://leetcode.com/problems/find-the-start-and-end-number-of-continuous-ranges "找到连续区间的开始和结束数字") 🔒 | [MySQL](problems/find-the-start-and-end-number-of-continuous-ranges) | Medium | | 1284 | [Minimum Number of Flips to Convert Binary Matrix to Zero Matrix](https://leetcode.com/problems/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix "转化为全零矩阵的最少反转次数") | [Go](problems/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix) | Hard | | 1283 | [Find the Smallest Divisor Given a Threshold](https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold "使结果不超过阈值的最小除数") | [Go](problems/find-the-smallest-divisor-given-a-threshold) | Medium | | 1282 | [Group the People Given the Group Size They Belong To](https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to "用户分组") | [Go](problems/group-the-people-given-the-group-size-they-belong-to) | Medium | @@ -104,7 +105,7 @@ LeetCode Problems' Solutions | 1268 | [Search Suggestions System](https://leetcode.com/problems/search-suggestions-system "搜索推荐系统") | [Go](problems/search-suggestions-system) | Medium | | 1267 | [Count Servers that Communicate](https://leetcode.com/problems/count-servers-that-communicate "统计参与通信的服务器") | [Go](problems/count-servers-that-communicate) | Medium | | 1266 | [Minimum Time Visiting All Points](https://leetcode.com/problems/minimum-time-visiting-all-points "访问所有点的最小时间") | [Go](problems/minimum-time-visiting-all-points) | Easy | -| 1265 | [Print Immutable Linked List in Reverse](https://leetcode.com/problems/print-immutable-linked-list-in-reverse) 🔒 | [Go](problems/print-immutable-linked-list-in-reverse) | Medium | +| 1265 | [Print Immutable Linked List in Reverse](https://leetcode.com/problems/print-immutable-linked-list-in-reverse "逆序打印不可变链表") 🔒 | [Go](problems/print-immutable-linked-list-in-reverse) | Medium | | 1264 | [Page Recommendations](https://leetcode.com/problems/page-recommendations) 🔒 | [MySQL](problems/page-recommendations) | Medium | | 1263 | [Minimum Moves to Move a Box to Their Target Location](https://leetcode.com/problems/minimum-moves-to-move-a-box-to-their-target-location "推箱子") | [Go](problems/minimum-moves-to-move-a-box-to-their-target-location) | Hard | | 1262 | [Greatest Sum Divisible by Three](https://leetcode.com/problems/greatest-sum-divisible-by-three "可被三整除的最大和") | [Go](problems/greatest-sum-divisible-by-three) | Medium | @@ -195,7 +196,7 @@ LeetCode Problems' Solutions | 1177 | [Can Make Palindrome from Substring](https://leetcode.com/problems/can-make-palindrome-from-substring "构建回文串检测") | [Go](problems/can-make-palindrome-from-substring) | Medium | | 1176 | [Diet Plan Performance](https://leetcode.com/problems/diet-plan-performance "健身计划评估") 🔒 | [Go](problems/diet-plan-performance) | Easy | | 1175 | [Prime Arrangements](https://leetcode.com/problems/prime-arrangements "质数排列") | [Go](problems/prime-arrangements) | Easy | -| 1174 | [Immediate Food Delivery II](https://leetcode.com/problems/immediate-food-delivery-ii) 🔒 | [MySQL](problems/immediate-food-delivery-ii) | Medium | +| 1174 | [Immediate Food Delivery II](https://leetcode.com/problems/immediate-food-delivery-ii "即时食物配送 II") 🔒 | [MySQL](problems/immediate-food-delivery-ii) | Medium | | 1173 | [Immediate Food Delivery I](https://leetcode.com/problems/immediate-food-delivery-i "即时食物配送 I") 🔒 | [MySQL](problems/immediate-food-delivery-i) | Easy | | 1172 | [Dinner Plate Stacks](https://leetcode.com/problems/dinner-plate-stacks "餐盘栈") | [Go](problems/dinner-plate-stacks) | Hard | | 1171 | [Remove Zero Sum Consecutive Nodes from Linked List](https://leetcode.com/problems/remove-zero-sum-consecutive-nodes-from-linked-list "从链表中删去总和值为零的连续节点") | [Go](problems/remove-zero-sum-consecutive-nodes-from-linked-list) | Medium | @@ -256,7 +257,7 @@ LeetCode Problems' Solutions | 1116 | [Print Zero Even Odd](https://leetcode.com/problems/print-zero-even-odd "打印零与奇偶数") | [Go](problems/print-zero-even-odd) | Medium | | 1115 | [Print FooBar Alternately](https://leetcode.com/problems/print-foobar-alternately "交替打印FooBar") | [Go](problems/print-foobar-alternately) | Medium | | 1114 | [Print in Order](https://leetcode.com/problems/print-in-order "按序打印") | [Go](problems/print-in-order) | Easy | -| 1113 | [Reported Posts](https://leetcode.com/problems/reported-posts) 🔒 | [MySQL](problems/reported-posts) | Easy | +| 1113 | [Reported Posts](https://leetcode.com/problems/reported-posts "报告的记录") 🔒 | [MySQL](problems/reported-posts) | Easy | | 1112 | [Highest Grade For Each Student](https://leetcode.com/problems/highest-grade-for-each-student "每位学生的最高成绩") 🔒 | [MySQL](problems/highest-grade-for-each-student) | Medium | | 1111 | [Maximum Nesting Depth of Two Valid Parentheses Strings](https://leetcode.com/problems/maximum-nesting-depth-of-two-valid-parentheses-strings "有效括号的嵌套深度") | [Go](problems/maximum-nesting-depth-of-two-valid-parentheses-strings) | Medium | | 1110 | [Delete Nodes And Return Forest](https://leetcode.com/problems/delete-nodes-and-return-forest "删点成林") | [Go](problems/delete-nodes-and-return-forest) | Medium | diff --git a/problems/count-and-say/README.md b/problems/count-and-say/README.md index 518a90528..9d287b488 100644 --- a/problems/count-and-say/README.md +++ b/problems/count-and-say/README.md @@ -9,7 +9,7 @@                  [Next >](../combination-sum "Combination Sum") -## [38. Count and Say (Easy)](https://leetcode.com/problems/count-and-say "报数") +## [38. Count and Say (Easy)](https://leetcode.com/problems/count-and-say "外观数列")

The count-and-say sequence is the sequence of integers with the first five terms as following:

diff --git a/problems/find-the-start-and-end-number-of-continuous-ranges/README.md b/problems/find-the-start-and-end-number-of-continuous-ranges/README.md index cdc2150a3..cc874b923 100644 --- a/problems/find-the-start-and-end-number-of-continuous-ranges/README.md +++ b/problems/find-the-start-and-end-number-of-continuous-ranges/README.md @@ -9,7 +9,7 @@                  [Next >](../iterator-for-combination "Iterator for Combination") -## [1285. Find the Start and End Number of Continuous Ranges (Medium)](https://leetcode.com/problems/find-the-start-and-end-number-of-continuous-ranges "") +## [1285. Find the Start and End Number of Continuous Ranges (Medium)](https://leetcode.com/problems/find-the-start-and-end-number-of-continuous-ranges "找到连续区间的开始和结束数字")

Table: Logs

diff --git a/problems/get-highest-answer-rate-question/mysql_schemas.sql b/problems/get-highest-answer-rate-question/mysql_schemas.sql
index 4e5af2a5d..ce07f2d2a 100644
--- a/problems/get-highest-answer-rate-question/mysql_schemas.sql
+++ b/problems/get-highest-answer-rate-question/mysql_schemas.sql
@@ -1,6 +1,6 @@
-Create table If Not Exists survey_log (uid int, action varchar(255), question_id int, answer_id int, q_num int, timestamp int);
+Create table If Not Exists survey_log (id int, action varchar(255), question_id int, answer_id int, q_num int, timestamp int);
 Truncate table survey_log;
-insert into survey_log (uid, action, question_id, answer_id, q_num, timestamp) values ('5', 'show', '285', 'None', '1', '123');
-insert into survey_log (uid, action, question_id, answer_id, q_num, timestamp) values ('5', 'answer', '285', '124124', '1', '124');
-insert into survey_log (uid, action, question_id, answer_id, q_num, timestamp) values ('5', 'show', '369', 'None', '2', '125');
-insert into survey_log (uid, action, question_id, answer_id, q_num, timestamp) values ('5', 'skip', '369', 'None', '2', '126');
+insert into survey_log (id, action, question_id, answer_id, q_num, timestamp) values ('5', 'show', '285', 'None', '1', '123');
+insert into survey_log (id, action, question_id, answer_id, q_num, timestamp) values ('5', 'answer', '285', '124124', '1', '124');
+insert into survey_log (id, action, question_id, answer_id, q_num, timestamp) values ('5', 'show', '369', 'None', '2', '125');
+insert into survey_log (id, action, question_id, answer_id, q_num, timestamp) values ('5', 'skip', '369', 'None', '2', '126');
diff --git a/problems/immediate-food-delivery-ii/README.md b/problems/immediate-food-delivery-ii/README.md
index f2fc1fc9d..a860cff02 100644
--- a/problems/immediate-food-delivery-ii/README.md
+++ b/problems/immediate-food-delivery-ii/README.md
@@ -9,7 +9,7 @@
                 
 [Next >](../prime-arrangements "Prime Arrangements")
 
-## [1174. Immediate Food Delivery II (Medium)](https://leetcode.com/problems/immediate-food-delivery-ii "")
+## [1174. Immediate Food Delivery II (Medium)](https://leetcode.com/problems/immediate-food-delivery-ii "即时食物配送 II")
 
 

Table: Delivery

diff --git a/problems/print-immutable-linked-list-in-reverse/README.md b/problems/print-immutable-linked-list-in-reverse/README.md index 61bb8638d..74fabefa4 100644 --- a/problems/print-immutable-linked-list-in-reverse/README.md +++ b/problems/print-immutable-linked-list-in-reverse/README.md @@ -9,7 +9,7 @@                  [Next >](../minimum-time-visiting-all-points "Minimum Time Visiting All Points") -## [1265. Print Immutable Linked List in Reverse (Medium)](https://leetcode.com/problems/print-immutable-linked-list-in-reverse "") +## [1265. Print Immutable Linked List in Reverse (Medium)](https://leetcode.com/problems/print-immutable-linked-list-in-reverse "逆序打印不可变链表") You are given an immutable linked list, print out all values of each node in reverse with the help of the following interface: diff --git a/problems/reported-posts/README.md b/problems/reported-posts/README.md index 28d60a6a0..029c248ed 100644 --- a/problems/reported-posts/README.md +++ b/problems/reported-posts/README.md @@ -9,7 +9,7 @@                  [Next >](../print-in-order "Print in Order") -## [1113. Reported Posts (Easy)](https://leetcode.com/problems/reported-posts "") +## [1113. Reported Posts (Easy)](https://leetcode.com/problems/reported-posts "报告的记录")

Table: Actions

diff --git a/problems/running-total-for-different-genders/README.md b/problems/running-total-for-different-genders/README.md new file mode 100644 index 000000000..3e33c9da3 --- /dev/null +++ b/problems/running-total-for-different-genders/README.md @@ -0,0 +1,17 @@ + + + + + + + +[< Previous](../verbal-arithmetic-puzzle "Verbal Arithmetic Puzzle") +                 +Next > + +## [1308. Running Total for Different Genders (Medium)](https://leetcode.com/problems/running-total-for-different-genders "") + + + +### Similar Questions + 1. [Last Person to Fit in the Elevator](../last-person-to-fit-in-the-elevator) (Medium) diff --git a/problems/running-total-for-different-genders/mysql_schemas.sql b/problems/running-total-for-different-genders/mysql_schemas.sql new file mode 100644 index 000000000..365fc0407 --- /dev/null +++ b/problems/running-total-for-different-genders/mysql_schemas.sql @@ -0,0 +1,11 @@ +Create table If Not Exists Scores (player_name varchar(20), gender varchar(1), day date, score_points int); +Truncate table Scores; +insert into Scores (player_name, gender, day, score_points) values ('Aron', 'F', '2020-01-01', '17'); +insert into Scores (player_name, gender, day, score_points) values ('Alice', 'F', '2020-01-07', '23'); +insert into Scores (player_name, gender, day, score_points) values ('Bajrang', 'M', '2020-01-07', '7'); +insert into Scores (player_name, gender, day, score_points) values ('Khali', 'M', '2019-12-25', '11'); +insert into Scores (player_name, gender, day, score_points) values ('Slaman', 'M', '2019-12-30', '13'); +insert into Scores (player_name, gender, day, score_points) values ('Joe', 'M', '2019-12-31', '3'); +insert into Scores (player_name, gender, day, score_points) values ('Jose', 'M', '2019-12-18', '2'); +insert into Scores (player_name, gender, day, score_points) values ('Priya', 'F', '2019-12-31', '23'); +insert into Scores (player_name, gender, day, score_points) values ('Priyanka', 'F', '2019-12-30', '17'); diff --git a/problems/verbal-arithmetic-puzzle/README.md b/problems/verbal-arithmetic-puzzle/README.md index 5ded4692a..eaf4fc394 100644 --- a/problems/verbal-arithmetic-puzzle/README.md +++ b/problems/verbal-arithmetic-puzzle/README.md @@ -7,7 +7,7 @@ [< Previous](../jump-game-iii "Jump Game III")                  -Next > +[Next >](../running-total-for-different-genders "Running Total for Different Genders") ## [1307. Verbal Arithmetic Puzzle (Hard)](https://leetcode.com/problems/verbal-arithmetic-puzzle "口算难题") diff --git a/problems/weather-type-in-each-country/README.md b/problems/weather-type-in-each-country/README.md index b9bbc9ae6..5af755cf5 100644 --- a/problems/weather-type-in-each-country/README.md +++ b/problems/weather-type-in-each-country/README.md @@ -9,7 +9,7 @@                  [Next >](../find-numbers-with-even-number-of-digits "Find Numbers with Even Number of Digits") -## [1294. Weather Type in Each Country (Easy)](https://leetcode.com/problems/weather-type-in-each-country "") +## [1294. Weather Type in Each Country (Easy)](https://leetcode.com/problems/weather-type-in-each-country "不同国家的天气类型")

Table: Countries

diff --git a/readme/1-300.md b/readme/1-300.md
index 15fc094b0..bd56c5321 100644
--- a/readme/1-300.md
+++ b/readme/1-300.md
@@ -99,7 +99,7 @@ LeetCode Problems' Solutions
 | 35 | [Search Insert Position](https://leetcode.com/problems/search-insert-position "搜索插入位置") | [Go](../problems/search-insert-position) | Easy |
 | 36 | [Valid Sudoku](https://leetcode.com/problems/valid-sudoku "有效的数独") | [Go](../problems/valid-sudoku) | Medium |
 | 37 | [Sudoku Solver](https://leetcode.com/problems/sudoku-solver "解数独") | [Go](../problems/sudoku-solver) | Hard |
-| 38 | [Count and Say](https://leetcode.com/problems/count-and-say "报数") | [Go](../problems/count-and-say) | Easy |
+| 38 | [Count and Say](https://leetcode.com/problems/count-and-say "外观数列") | [Go](../problems/count-and-say) | Easy |
 | 39 | [Combination Sum](https://leetcode.com/problems/combination-sum "组合总和") | [Go](../problems/combination-sum) | Medium |
 | 40 | [Combination Sum II](https://leetcode.com/problems/combination-sum-ii "组合总和 II") | [Go](../problems/combination-sum-ii) | Medium |
 | 41 | [First Missing Positive](https://leetcode.com/problems/first-missing-positive "缺失的第一个正数") | [Go](../problems/first-missing-positive) | Hard |
diff --git a/tag/string/README.md b/tag/string/README.md
index 20203a6eb..9389598b0 100644
--- a/tag/string/README.md
+++ b/tag/string/README.md
@@ -145,7 +145,7 @@
 | 49 | [字母异位词分组](../../problems/group-anagrams) | [[哈希表](../hash-table/README.md)] [[字符串](../string/README.md)]  | Medium |
 | 44 | [通配符匹配](../../problems/wildcard-matching) | [[贪心算法](../greedy/README.md)] [[字符串](../string/README.md)] [[动态规划](../dynamic-programming/README.md)] [[回溯算法](../backtracking/README.md)]  | Hard |
 | 43 | [字符串相乘](../../problems/multiply-strings) | [[数学](../math/README.md)] [[字符串](../string/README.md)]  | Medium |
-| 38 | [报数](../../problems/count-and-say) | [[字符串](../string/README.md)]  | Easy |
+| 38 | [外观数列](../../problems/count-and-say) | [[字符串](../string/README.md)]  | Easy |
 | 32 | [最长有效括号](../../problems/longest-valid-parentheses) | [[字符串](../string/README.md)] [[动态规划](../dynamic-programming/README.md)]  | Hard |
 | 30 | [串联所有单词的子串](../../problems/substring-with-concatenation-of-all-words) | [[哈希表](../hash-table/README.md)] [[双指针](../two-pointers/README.md)] [[字符串](../string/README.md)]  | Hard |
 | 28 | [实现 strStr()](../../problems/implement-strstr) | [[双指针](../two-pointers/README.md)] [[字符串](../string/README.md)]  | Easy |