From d2f3c6389efecf3fdf612178c03a708d61dc1d7c Mon Sep 17 00:00:00 2001 From: Shuo Date: Mon, 18 May 2020 09:30:16 +0800 Subject: [PATCH] A: tidy --- README.md | 13 ++- problems/apples-oranges/README.md | 14 +++ problems/apples-oranges/mysql_schemas.sql | 10 +++ problems/consecutive-characters/README.md | 76 ++++++++++++++++ .../count-good-nodes-in-binary-tree/README.md | 64 +++++++++++++ problems/cousins-in-binary-tree/README.md | 18 ++-- .../README.md | 2 +- problems/find-the-town-judge/README.md | 65 ++++---------- .../README.md | 90 +++++++++++++++++++ problems/is-subsequence/README.md | 52 +++++------ .../README.md | 80 +++++++++++++++++ problems/npv-queries/README.md | 2 +- .../README.md | 83 +++++++++++++++++ .../README.md | 2 +- .../README.md | 70 +++++++++++++++ .../rearrange-words-in-a-sentence/README.md | 71 +++++++++++++++ problems/shortest-bridge/README.md | 46 +++------- problems/simplified-fractions/README.md | 64 +++++++++++++ .../README.md | 28 +++--- problems/valid-perfect-square/README.md | 29 +++--- problems/zuma-game/README.md | 4 +- tag/README.md | 12 +-- tag/array/README.md | 1 + tag/depth-first-search/README.md | 1 + tag/dynamic-programming/README.md | 1 + tag/geometry/README.md | 1 + tag/math/README.md | 1 + tag/sort/README.md | 2 + tag/string/README.md | 4 + tag/tags.json | 40 ++++----- tag/tree/README.md | 1 + 31 files changed, 763 insertions(+), 184 deletions(-) create mode 100644 problems/apples-oranges/README.md create mode 100644 problems/apples-oranges/mysql_schemas.sql create mode 100644 problems/consecutive-characters/README.md create mode 100644 problems/count-good-nodes-in-binary-tree/README.md create mode 100644 problems/form-largest-integer-with-digits-that-add-up-to-target/README.md create mode 100644 problems/maximum-number-of-darts-inside-of-a-circular-dartboard/README.md create mode 100644 problems/number-of-students-doing-homework-at-a-given-time/README.md create mode 100644 problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list/README.md create mode 100644 problems/rearrange-words-in-a-sentence/README.md create mode 100644 problems/simplified-fractions/README.md diff --git a/README.md b/README.md index 6a142e8f8..02b82d890 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,15 @@ LeetCode Problems' Solutions | # | Title | Solution | Difficulty | | :-: | - | - | :-: | +| 1453 | [Maximum Number of Darts Inside of a Circular Dartboard](https://leetcode.com/problems/maximum-number-of-darts-inside-of-a-circular-dartboard "圆形靶内的最大飞镖数量") | [Go](problems/maximum-number-of-darts-inside-of-a-circular-dartboard) | Hard | +| 1452 | [People Whose List of Favorite Companies Is Not a Subset of Another List](https://leetcode.com/problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list "收藏清单") | [Go](problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list) | Medium | +| 1451 | [Rearrange Words in a Sentence](https://leetcode.com/problems/rearrange-words-in-a-sentence "重新排列句子中的单词") | [Go](problems/rearrange-words-in-a-sentence) | Medium | +| 1450 | [Number of Students Doing Homework at a Given Time](https://leetcode.com/problems/number-of-students-doing-homework-at-a-given-time "在既定时间做作业的学生人数") | [Go](problems/number-of-students-doing-homework-at-a-given-time) | Easy | +| 1449 | [Form Largest Integer With Digits That Add up to Target](https://leetcode.com/problems/form-largest-integer-with-digits-that-add-up-to-target "数位成本和为目标值的最大数字") | [Go](problems/form-largest-integer-with-digits-that-add-up-to-target) | Hard | +| 1448 | [Count Good Nodes in Binary Tree](https://leetcode.com/problems/count-good-nodes-in-binary-tree "统计二叉树中好节点的数目") | [Go](problems/count-good-nodes-in-binary-tree) | Medium | +| 1447 | [Simplified Fractions](https://leetcode.com/problems/simplified-fractions "最简分数") | [Go](problems/simplified-fractions) | Medium | +| 1446 | [Consecutive Characters](https://leetcode.com/problems/consecutive-characters "连续字符") | [Go](problems/consecutive-characters) | Easy | +| 1445 | [Apples & Oranges](https://leetcode.com/problems/apples-oranges) 🔒 | [MySQL](problems/apples-oranges) | Medium | | 1444 | [Number of Ways of Cutting a Pizza](https://leetcode.com/problems/number-of-ways-of-cutting-a-pizza "切披萨的方案数") | [Go](problems/number-of-ways-of-cutting-a-pizza) | Hard | | 1443 | [Minimum Time to Collect All Apples in a Tree](https://leetcode.com/problems/minimum-time-to-collect-all-apples-in-a-tree "收集树上所有苹果的最少时间") | [Go](problems/minimum-time-to-collect-all-apples-in-a-tree) | Medium | | 1442 | [Count Triplets That Can Form Two Arrays of Equal XOR](https://leetcode.com/problems/count-triplets-that-can-form-two-arrays-of-equal-xor "形成两个异或相等数组的三元组数目") | [Go](problems/count-triplets-that-can-form-two-arrays-of-equal-xor) | Medium | @@ -85,7 +94,7 @@ LeetCode Problems' Solutions | 1424 | [Diagonal Traverse II](https://leetcode.com/problems/diagonal-traverse-ii "对角线遍历 II") | [Go](problems/diagonal-traverse-ii) | Medium | | 1423 | [Maximum Points You Can Obtain from Cards](https://leetcode.com/problems/maximum-points-you-can-obtain-from-cards "可获得的最大点数") | [Go](problems/maximum-points-you-can-obtain-from-cards) | Medium | | 1422 | [Maximum Score After Splitting a String](https://leetcode.com/problems/maximum-score-after-splitting-a-string "分割字符串的最大得分") | [Go](problems/maximum-score-after-splitting-a-string) | Easy | -| 1421 | [NPV Queries](https://leetcode.com/problems/npv-queries) 🔒 | [MySQL](problems/npv-queries) | Medium | +| 1421 | [NPV Queries](https://leetcode.com/problems/npv-queries "净现值查询") 🔒 | [MySQL](problems/npv-queries) | Medium | | 1420 | [Build Array Where You Can Find The Maximum Exactly K Comparisons](https://leetcode.com/problems/build-array-where-you-can-find-the-maximum-exactly-k-comparisons "生成数组") | [Go](problems/build-array-where-you-can-find-the-maximum-exactly-k-comparisons) | Hard | | 1419 | [Minimum Number of Frogs Croaking](https://leetcode.com/problems/minimum-number-of-frogs-croaking "数青蛙") | [Go](problems/minimum-number-of-frogs-croaking) | Medium | | 1418 | [Display Table of Food Orders in a Restaurant](https://leetcode.com/problems/display-table-of-food-orders-in-a-restaurant "点菜展示表") | [Go](problems/display-table-of-food-orders-in-a-restaurant) | Medium | @@ -94,7 +103,7 @@ LeetCode Problems' Solutions | 1415 | [The k-th Lexicographical String of All Happy Strings of Length n](https://leetcode.com/problems/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n "长度为 n 的开心字符串中字典序第 k 小的字符串") | [Go](problems/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n) | Medium | | 1414 | [Find the Minimum Number of Fibonacci Numbers Whose Sum Is K](https://leetcode.com/problems/find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k "和为 K 的最少斐波那契数字数目") | [Go](problems/find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k) | Medium | | 1413 | [Minimum Value to Get Positive Step by Step Sum](https://leetcode.com/problems/minimum-value-to-get-positive-step-by-step-sum "逐步求和得到正数的最小值") | [Go](problems/minimum-value-to-get-positive-step-by-step-sum) | Easy | -| 1412 | [Find the Quiet Students in All Exams](https://leetcode.com/problems/find-the-quiet-students-in-all-exams) 🔒 | [MySQL](problems/find-the-quiet-students-in-all-exams) | Hard | +| 1412 | [Find the Quiet Students in All Exams](https://leetcode.com/problems/find-the-quiet-students-in-all-exams "查找成绩处于中游的的学生") 🔒 | [MySQL](problems/find-the-quiet-students-in-all-exams) | Hard | | 1411 | [Number of Ways to Paint N × 3 Grid](https://leetcode.com/problems/number-of-ways-to-paint-n-3-grid "给 N x 3 网格图涂色的方案数") | [Go](problems/number-of-ways-to-paint-n-3-grid) | Hard | | 1410 | [HTML Entity Parser](https://leetcode.com/problems/html-entity-parser "HTML 实体解析器") | [Go](problems/html-entity-parser) | Medium | | 1409 | [Queries on a Permutation With Key](https://leetcode.com/problems/queries-on-a-permutation-with-key "查询带键的排列") | [Go](problems/queries-on-a-permutation-with-key) | Medium | diff --git a/problems/apples-oranges/README.md b/problems/apples-oranges/README.md new file mode 100644 index 000000000..b9963c64d --- /dev/null +++ b/problems/apples-oranges/README.md @@ -0,0 +1,14 @@ + + + + + + + +[< Previous](../number-of-ways-of-cutting-a-pizza "Number of Ways of Cutting a Pizza") +                 +[Next >](../consecutive-characters "Consecutive Characters") + +## [1445. Apples & Oranges (Medium)](https://leetcode.com/problems/apples-oranges "") + + diff --git a/problems/apples-oranges/mysql_schemas.sql b/problems/apples-oranges/mysql_schemas.sql new file mode 100644 index 000000000..426703feb --- /dev/null +++ b/problems/apples-oranges/mysql_schemas.sql @@ -0,0 +1,10 @@ +Create table If Not Exists Sales (sale_date date, fruit ENUM('apples', 'oranges'), sold_num int); +Truncate table Sales; +insert into Sales (sale_date, fruit, sold_num) values ('2020-05-01', 'apples', '10'); +insert into Sales (sale_date, fruit, sold_num) values ('2020-05-01', 'oranges', '8'); +insert into Sales (sale_date, fruit, sold_num) values ('2020-05-02', 'apples', '15'); +insert into Sales (sale_date, fruit, sold_num) values ('2020-05-02', 'oranges', '15'); +insert into Sales (sale_date, fruit, sold_num) values ('2020-05-03', 'apples', '20'); +insert into Sales (sale_date, fruit, sold_num) values ('2020-05-03', 'oranges', '0'); +insert into Sales (sale_date, fruit, sold_num) values ('2020-05-04', 'apples', '15'); +insert into Sales (sale_date, fruit, sold_num) values ('2020-05-04', 'oranges', '16'); diff --git a/problems/consecutive-characters/README.md b/problems/consecutive-characters/README.md new file mode 100644 index 000000000..4dc643039 --- /dev/null +++ b/problems/consecutive-characters/README.md @@ -0,0 +1,76 @@ + + + + + + + +[< Previous](../apples-oranges "Apples & Oranges") +                 +[Next >](../simplified-fractions "Simplified Fractions") + +## [1446. Consecutive Characters (Easy)](https://leetcode.com/problems/consecutive-characters "连续字符") + +

Given a string s, the power of the string is the maximum length of a non-empty substring that contains only one unique character.

+ +

Return the power of the string.

+ +

 

+

Example 1:

+ +
+Input: s = "leetcode"
+Output: 2
+Explanation: The substring "ee" is of length 2 with the character 'e' only.
+
+ +

Example 2:

+ +
+Input: s = "abbcccddddeeeeedcba"
+Output: 5
+Explanation: The substring "eeeee" is of length 5 with the character 'e' only.
+
+ +

Example 3:

+ +
+Input: s = "triplepillooooow"
+Output: 5
+
+ +

Example 4:

+ +
+Input: s = "hooraaaaaaaaaaay"
+Output: 11
+
+ +

Example 5:

+ +
+Input: s = "tourist"
+Output: 1
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[String](../../tag/string/README.md)] + +### Hints +
+Hint 1 +Keep an array power where power[i] is the maximum power of the i-th character. +
+ +
+Hint 2 +The answer is max(power[i]). +
diff --git a/problems/count-good-nodes-in-binary-tree/README.md b/problems/count-good-nodes-in-binary-tree/README.md new file mode 100644 index 000000000..29231eb0b --- /dev/null +++ b/problems/count-good-nodes-in-binary-tree/README.md @@ -0,0 +1,64 @@ + + + + + + + +[< Previous](../simplified-fractions "Simplified Fractions") +                 +[Next >](../form-largest-integer-with-digits-that-add-up-to-target "Form Largest Integer With Digits That Add up to Target") + +## [1448. Count Good Nodes in Binary Tree (Medium)](https://leetcode.com/problems/count-good-nodes-in-binary-tree "统计二叉树中好节点的数目") + +

Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X.

+ +

Return the number of good nodes in the binary tree.

+ +

 

+

Example 1:

+ +

+ +
+Input: root = [3,1,4,3,null,1,5]
+Output: 4
+Explanation: Nodes in blue are good.
+Root Node (3) is always a good node.
+Node 4 -> (3,4) is the maximum value in the path starting from the root.
+Node 5 -> (3,4,5) is the maximum value in the path
+Node 3 -> (3,1,3) is the maximum value in the path.
+ +

Example 2:

+ +

+ +
+Input: root = [3,3,null,4,2]
+Output: 3
+Explanation: Node 2 -> (3, 3, 2) is not good, because "3" is higher than it.
+ +

Example 3:

+ +
+Input: root = [1]
+Output: 1
+Explanation: Root is considered as good.
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Tree](../../tag/tree/README.md)] + [[Depth-first Search](../../tag/depth-first-search/README.md)] + +### Hints +
+Hint 1 +Use DFS (Depth First Search) to traverse the tree, and constantly keep track of the current path maximum. +
diff --git a/problems/cousins-in-binary-tree/README.md b/problems/cousins-in-binary-tree/README.md index b56db424b..47666787e 100644 --- a/problems/cousins-in-binary-tree/README.md +++ b/problems/cousins-in-binary-tree/README.md @@ -45,24 +45,18 @@
 Input: root = [1,2,3,null,4], x = 2, y = 3
-Output: false
- -

 

+Output: false + -

Note:

+

 

+

Constraints:

-
    +
- -
-
-
 
-
-
+ ### Related Topics [[Tree](../../tag/tree/README.md)] diff --git a/problems/find-the-quiet-students-in-all-exams/README.md b/problems/find-the-quiet-students-in-all-exams/README.md index c6be9f9ec..1bf21ead1 100644 --- a/problems/find-the-quiet-students-in-all-exams/README.md +++ b/problems/find-the-quiet-students-in-all-exams/README.md @@ -9,6 +9,6 @@                  [Next >](../minimum-value-to-get-positive-step-by-step-sum "Minimum Value to Get Positive Step by Step Sum") -## [1412. Find the Quiet Students in All Exams (Hard)](https://leetcode.com/problems/find-the-quiet-students-in-all-exams "") +## [1412. Find the Quiet Students in All Exams (Hard)](https://leetcode.com/problems/find-the-quiet-students-in-all-exams "查找成绩处于中游的的学生") diff --git a/problems/find-the-town-judge/README.md b/problems/find-the-town-judge/README.md index 89542cda9..a49a80b9f 100644 --- a/problems/find-the-town-judge/README.md +++ b/problems/find-the-town-judge/README.md @@ -26,60 +26,33 @@

If the town judge exists and can be identified, return the label of the town judge.  Otherwise, return -1.

 

-

Example 1:

- -
-Input: N = 2, trust = [[1,2]]
-Output: 2
-
- -
-

Example 2:

- -
-Input: N = 3, trust = [[1,3],[2,3]]
-Output: 3
+
Input: N = 2, trust = [[1,2]]
+Output: 2
+

Example 2:

+
Input: N = 3, trust = [[1,3],[2,3]]
+Output: 3
+

Example 3:

+
Input: N = 3, trust = [[1,3],[2,3],[3,1]]
+Output: -1
+

Example 4:

+
Input: N = 3, trust = [[1,2],[2,3]]
+Output: -1
+

Example 5:

+
Input: N = 4, trust = [[1,3],[1,4],[2,3],[2,4],[4,3]]
+Output: 3
 
- -
-

Example 3:

- -
-Input: N = 3, trust = [[1,3],[2,3],[3,1]]
-Output: -1
-
- -
-

Example 4:

- -
-Input: N = 3, trust = [[1,2],[2,3]]
-Output: -1
-
- -
-

Example 5:

- -
-Input: N = 4, trust = [[1,3],[1,4],[2,3],[2,4],[4,3]]
-Output: 3
-

 

-
-
-
-
- -

Note:

+

Constraints:

-
    +
+ ### Related Topics [[Graph](../../tag/graph/README.md)] diff --git a/problems/form-largest-integer-with-digits-that-add-up-to-target/README.md b/problems/form-largest-integer-with-digits-that-add-up-to-target/README.md new file mode 100644 index 000000000..448b78012 --- /dev/null +++ b/problems/form-largest-integer-with-digits-that-add-up-to-target/README.md @@ -0,0 +1,90 @@ + + + + + + + +[< Previous](../count-good-nodes-in-binary-tree "Count Good Nodes in Binary Tree") +                 +[Next >](../number-of-students-doing-homework-at-a-given-time "Number of Students Doing Homework at a Given Time") + +## [1449. Form Largest Integer With Digits That Add up to Target (Hard)](https://leetcode.com/problems/form-largest-integer-with-digits-that-add-up-to-target "数位成本和为目标值的最大数字") + +

Given an array of integers cost and an integer target. Return the maximum integer you can paint under the following rules:

+ + + +

Since the answer may be too large, return it as string.

+ +

If there is no way to paint any integer given the condition, return "0".

+ +

 

+

Example 1:

+ +
+Input: cost = [4,3,2,5,6,7,2,5,5], target = 9
+Output: "7772"
+Explanation:  The cost to paint the digit '7' is 2, and the digit '2' is 3. Then cost("7772") = 2*3+ 3*1 = 9. You could also paint "997", but "7772" is the largest number.
+Digit    cost
+  1  ->   4
+  2  ->   3
+  3  ->   2
+  4  ->   5
+  5  ->   6
+  6  ->   7
+  7  ->   2
+  8  ->   5
+  9  ->   5
+
+ +

Example 2:

+ +
+Input: cost = [7,6,5,5,5,6,8,7,8], target = 12
+Output: "85"
+Explanation: The cost to paint the digit '8' is 7, and the digit '5' is 5. Then cost("85") = 7 + 5 = 12.
+
+ +

Example 3:

+ +
+Input: cost = [2,4,6,2,4,6,4,4,4], target = 5
+Output: "0"
+Explanation: It's not possible to paint any integer with total cost equal to target.
+
+ +

Example 4:

+ +
+Input: cost = [6,10,15,40,40,40,40,40,40], target = 47
+Output: "32211"
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[String](../../tag/string/README.md)] + [[Dynamic Programming](../../tag/dynamic-programming/README.md)] + +### Hints +
+Hint 1 +Use dynamic programming to find the maximum digits to paint given a total cost. +
+ +
+Hint 2 +Build the largest number possible using this DP table. +
diff --git a/problems/is-subsequence/README.md b/problems/is-subsequence/README.md index 283334728..0155e185f 100644 --- a/problems/is-subsequence/README.md +++ b/problems/is-subsequence/README.md @@ -11,36 +11,32 @@ ## [392. Is Subsequence (Easy)](https://leetcode.com/problems/is-subsequence "判断子序列") -

-Given a string s and a string t, check if s is subsequence of t. -

- -

-You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, and s is a short string (<=100). -

- -

-A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "ace" is a subsequence of "abcde" while "aec" is not). -

- -

Example 1:
-s = "abc", t = "ahbgdc" -

-

-Return true. -

- -

Example 2:
-s = "axc", t = "ahbgdc" -

-

-Return false. -

+

Given a string s and a string t, check if s is subsequence of t.

-

Follow up:
-If there are lots of incoming S, say S1, S2, ... , Sk where k >= 1B, and you want to check one by one to see if T has its subsequence. In this scenario, how would you change your code?

+

A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "ace" is a subsequence of "abcde" while "aec" is not).

-

Credits:
Special thanks to @pbrother for adding this problem and creating all test cases.

+

Follow up:
+If there are lots of incoming S, say S1, S2, ... , Sk where k >= 1B, and you want to check one by one to see if T has its subsequence. In this scenario, how would you change your code?

+ +

Credits:
+Special thanks to @pbrother for adding this problem and creating all test cases.

+ +

 

+

Example 1:

+
Input: s = "abc", t = "ahbgdc"
+Output: true
+

Example 2:

+
Input: s = "axc", t = "ahbgdc"
+Output: false
+
+

 

+

Constraints:

+ + ### Related Topics [[Greedy](../../tag/greedy/README.md)] diff --git a/problems/maximum-number-of-darts-inside-of-a-circular-dartboard/README.md b/problems/maximum-number-of-darts-inside-of-a-circular-dartboard/README.md new file mode 100644 index 000000000..a6bd74524 --- /dev/null +++ b/problems/maximum-number-of-darts-inside-of-a-circular-dartboard/README.md @@ -0,0 +1,80 @@ + + + + + + + +[< Previous](../people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list "People Whose List of Favorite Companies Is Not a Subset of Another List") +                 +Next > + +## [1453. Maximum Number of Darts Inside of a Circular Dartboard (Hard)](https://leetcode.com/problems/maximum-number-of-darts-inside-of-a-circular-dartboard "圆形靶内的最大飞镖数量") + +

You have a very large square wall and a circular dartboard placed on the wall. You have been challenged to throw darts into the board blindfolded. Darts thrown at the wall are represented as an array of points on a 2D plane. 

+ +

Return the maximum number of points that are within or lie on any circular dartboard of radius r.

+ +

 

+

Example 1:

+ +

+ +
+Input: points = [[-2,0],[2,0],[0,2],[0,-2]], r = 2
+Output: 4
+Explanation: Circle dartboard with center in (0,0) and radius = 2 contain all points.
+
+ +

Example 2:

+ +

+ +
+Input: points = [[-3,0],[3,0],[2,6],[5,4],[0,9],[7,8]], r = 5
+Output: 5
+Explanation: Circle dartboard with center in (0,4) and radius = 5 contain all points except the point (7,8).
+
+ +

Example 3:

+ +
+Input: points = [[-2,0],[2,0],[0,2],[0,-2]], r = 1
+Output: 1
+
+ +

Example 4:

+ +
+Input: points = [[1,2],[3,5],[1,-1],[2,3],[4,1],[1,3]], r = 2
+Output: 4
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Geometry](../../tag/geometry/README.md)] + +### Hints +
+Hint 1 +If there is an optimal solution, you can always move the circle so that two points lie on the boundary of the circle. +
+ +
+Hint 2 +When the radius is fixed, you can find either 0 or 1 or 2 circles that pass two given points at the same time. +
+ +
+Hint 3 +Loop for each pair of points and find the center of the circle, after that count the number of points inside the circle. +
diff --git a/problems/npv-queries/README.md b/problems/npv-queries/README.md index add374f2c..91c34c7b9 100644 --- a/problems/npv-queries/README.md +++ b/problems/npv-queries/README.md @@ -9,6 +9,6 @@                  [Next >](../maximum-score-after-splitting-a-string "Maximum Score After Splitting a String") -## [1421. NPV Queries (Medium)](https://leetcode.com/problems/npv-queries "") +## [1421. NPV Queries (Medium)](https://leetcode.com/problems/npv-queries "净现值查询") diff --git a/problems/number-of-students-doing-homework-at-a-given-time/README.md b/problems/number-of-students-doing-homework-at-a-given-time/README.md new file mode 100644 index 000000000..549a039e0 --- /dev/null +++ b/problems/number-of-students-doing-homework-at-a-given-time/README.md @@ -0,0 +1,83 @@ + + + + + + + +[< Previous](../form-largest-integer-with-digits-that-add-up-to-target "Form Largest Integer With Digits That Add up to Target") +                 +[Next >](../rearrange-words-in-a-sentence "Rearrange Words in a Sentence") + +## [1450. Number of Students Doing Homework at a Given Time (Easy)](https://leetcode.com/problems/number-of-students-doing-homework-at-a-given-time "在既定时间做作业的学生人数") + +

Given two integer arrays startTime and endTime and given an integer queryTime.

+ +

The ith student started doing their homework at the time startTime[i] and finished it at time endTime[i].

+ +

Return the number of students doing their homework at time queryTime. More formally, return the number of students where queryTime lays in the interval [startTime[i], endTime[i]] inclusive.

+ +

 

+

Example 1:

+ +
+Input: startTime = [1,2,3], endTime = [3,2,7], queryTime = 4
+Output: 1
+Explanation: We have 3 students where:
+The first student started doing homework at time 1 and finished at time 3 and wasn't doing anything at time 4.
+The second student started doing homework at time 2 and finished at time 2 and also wasn't doing anything at time 4.
+The third student started doing homework at time 3 and finished at time 7 and was the only student doing homework at time 4.
+
+ +

Example 2:

+ +
+Input: startTime = [4], endTime = [4], queryTime = 4
+Output: 1
+Explanation: The only student was doing their homework at the queryTime.
+
+ +

Example 3:

+ +
+Input: startTime = [4], endTime = [4], queryTime = 5
+Output: 0
+
+ +

Example 4:

+ +
+Input: startTime = [1,1,1,1], endTime = [1,3,2,4], queryTime = 7
+Output: 0
+
+ +

Example 5:

+ +
+Input: startTime = [9,8,7,6,5,4,3,2,1], endTime = [10,10,10,10,10,10,10,10,10], queryTime = 5
+Output: 5
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Array](../../tag/array/README.md)] + +### Hints +
+Hint 1 +Imagine that startTime[i] and endTime[i] form an interval (i.e. [startTime[i], endTime[i]]). +
+ +
+Hint 2 +The answer is how many times the queryTime laid in those mentioned intervals. +
diff --git a/problems/number-of-ways-of-cutting-a-pizza/README.md b/problems/number-of-ways-of-cutting-a-pizza/README.md index cb88c5e62..0d831de8c 100644 --- a/problems/number-of-ways-of-cutting-a-pizza/README.md +++ b/problems/number-of-ways-of-cutting-a-pizza/README.md @@ -7,7 +7,7 @@ [< Previous](../minimum-time-to-collect-all-apples-in-a-tree "Minimum Time to Collect All Apples in a Tree")                  -Next > +[Next >](../apples-oranges "Apples & Oranges") ## [1444. Number of Ways of Cutting a Pizza (Hard)](https://leetcode.com/problems/number-of-ways-of-cutting-a-pizza "切披萨的方案数") diff --git a/problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list/README.md b/problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list/README.md new file mode 100644 index 000000000..9e3302460 --- /dev/null +++ b/problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list/README.md @@ -0,0 +1,70 @@ + + + + + + + +[< Previous](../rearrange-words-in-a-sentence "Rearrange Words in a Sentence") +                 +[Next >](../maximum-number-of-darts-inside-of-a-circular-dartboard "Maximum Number of Darts Inside of a Circular Dartboard") + +## [1452. People Whose List of Favorite Companies Is Not a Subset of Another List (Medium)](https://leetcode.com/problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list "收藏清单") + +

Given the array favoriteCompanies where favoriteCompanies[i] is the list of favorites companies for the ith person (indexed from 0).

+ +

Return the indices of people whose list of favorite companies is not a subset of any other list of favorites companies. You must return the indices in increasing order.

+ +

 

+

Example 1:

+ +
+Input: favoriteCompanies = [["leetcode","google","facebook"],["google","microsoft"],["google","facebook"],["google"],["amazon"]]
+Output: [0,1,4] 
+Explanation: 
+Person with index=2 has favoriteCompanies[2]=["google","facebook"] which is a subset of favoriteCompanies[0]=["leetcode","google","facebook"] corresponding to the person with index 0. 
+Person with index=3 has favoriteCompanies[3]=["google"] which is a subset of favoriteCompanies[0]=["leetcode","google","facebook"] and favoriteCompanies[1]=["google","microsoft"]. 
+Other lists of favorite companies are not a subset of another list, therefore, the answer is [0,1,4].
+
+ +

Example 2:

+ +
+Input: favoriteCompanies = [["leetcode","google","facebook"],["leetcode","amazon"],["facebook","google"]]
+Output: [0,1] 
+Explanation: In this case favoriteCompanies[2]=["facebook","google"] is a subset of favoriteCompanies[0]=["leetcode","google","facebook"], therefore, the answer is [0,1].
+
+ +

Example 3:

+ +
+Input: favoriteCompanies = [["leetcode"],["google"],["facebook"],["amazon"]]
+Output: [0,1,2,3]
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Sort](../../tag/sort/README.md)] + [[String](../../tag/string/README.md)] + +### Hints +
+Hint 1 +Use hashing to convert company names in numbers and then for each list check if this is a subset of any other list. +
+ +
+Hint 2 +In order to check if a list is a subset of another list, use two pointers technique to get a linear solution for this task. The total complexity will be O(n^2 * m) where n is the number of lists and m is the maximum number of elements in a list. +
diff --git a/problems/rearrange-words-in-a-sentence/README.md b/problems/rearrange-words-in-a-sentence/README.md new file mode 100644 index 000000000..2abdf219e --- /dev/null +++ b/problems/rearrange-words-in-a-sentence/README.md @@ -0,0 +1,71 @@ + + + + + + + +[< Previous](../number-of-students-doing-homework-at-a-given-time "Number of Students Doing Homework at a Given Time") +                 +[Next >](../people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list "People Whose List of Favorite Companies Is Not a Subset of Another List") + +## [1451. Rearrange Words in a Sentence (Medium)](https://leetcode.com/problems/rearrange-words-in-a-sentence "重新排列句子中的单词") + +

Given a sentence text (A sentence is a string of space-separated words) in the following format:

+ + + +

Your task is to rearrange the words in text such that all words are rearranged in an increasing order of their lengths. If two words have the same length, arrange them in their original order.

+ +

Return the new text following the format shown above.

+ +

 

+

Example 1:

+ +
+Input: text = "Leetcode is cool"
+Output: "Is cool leetcode"
+Explanation: There are 3 words, "Leetcode" of length 8, "is" of length 2 and "cool" of length 4.
+Output is ordered by length and the new first word starts with capital letter.
+
+ +

Example 2:

+ +
+Input: text = "Keep calm and code on"
+Output: "On and keep calm code"
+Explanation: Output is ordered as follows:
+"On" 2 letters.
+"and" 3 letters.
+"keep" 4 letters in case of tie order by position in original text.
+"calm" 4 letters.
+"code" 4 letters.
+
+ +

Example 3:

+ +
+Input: text = "To be or not to be"
+Output: "To be or to be not"
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Sort](../../tag/sort/README.md)] + [[String](../../tag/string/README.md)] + +### Hints +
+Hint 1 +Store each word and their relative position. Then, sort them by length of words in case of tie by their original order. +
diff --git a/problems/shortest-bridge/README.md b/problems/shortest-bridge/README.md index 48adaccaa..9c4479453 100644 --- a/problems/shortest-bridge/README.md +++ b/problems/shortest-bridge/README.md @@ -18,45 +18,23 @@

Return the smallest number of 0s that must be flipped.  (It is guaranteed that the answer is at least 1.)

 

-

Example 1:

- -
-Input: [[0,1],[1,0]]
-Output: 1
-
- -
-

Example 2:

- -
-Input: [[0,1,0],[0,0,0],[0,0,1]]
-Output: 2
+
Input: A = [[0,1],[1,0]]
+Output: 1
+

Example 2:

+
Input: A = [[0,1,0],[0,0,0],[0,0,1]]
+Output: 2
+

Example 3:

+
Input: A = [[1,1,1,1,1],[1,0,0,0,1],[1,0,1,0,1],[1,0,0,0,1],[1,1,1,1,1]]
+Output: 1
 
- -
-

Example 3:

- -
-Input: [[1,1,1,1,1],[1,0,0,0,1],[1,0,1,0,1],[1,0,0,0,1],[1,1,1,1,1]]
-Output: 1
-

 

-
-
+

Constraints:

-

Note:

- -
    -
  1. 1 <= A.length = A[0].length <= 100
  2. +
- -
-
-
 
-
-
+ ### Related Topics [[Depth-first Search](../../tag/depth-first-search/README.md)] diff --git a/problems/simplified-fractions/README.md b/problems/simplified-fractions/README.md new file mode 100644 index 000000000..eb7856621 --- /dev/null +++ b/problems/simplified-fractions/README.md @@ -0,0 +1,64 @@ + + + + + + + +[< Previous](../consecutive-characters "Consecutive Characters") +                 +[Next >](../count-good-nodes-in-binary-tree "Count Good Nodes in Binary Tree") + +## [1447. Simplified Fractions (Medium)](https://leetcode.com/problems/simplified-fractions "最简分数") + +

Given an integer n, return a list of all simplified fractions between 0 and 1 (exclusive) such that the denominator is less-than-or-equal-to n. The fractions can be in any order.

+ +

 

+

Example 1:

+ +
+Input: n = 2
+Output: ["1/2"]
+Explanation: "1/2" is the only unique fraction with a denominator less-than-or-equal-to 2.
+ +

Example 2:

+ +
+Input: n = 3
+Output: ["1/2","1/3","2/3"]
+
+ +

Example 3:

+ +
+Input: n = 4
+Output: ["1/2","1/3","1/4","2/3","3/4"]
+Explanation: "2/4" is not a simplified fraction because it can be simplified to "1/2".
+ +

Example 4:

+ +
+Input: n = 1
+Output: []
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Math](../../tag/math/README.md)] + +### Hints +
+Hint 1 +A fraction is fully simplified if there is no integer that divides cleanly into the numerator and denominator. +
+ +
+Hint 2 +In other words the greatest common divisor of the numerator and the denominator of a simplified fraction is 1. +
diff --git a/problems/single-element-in-a-sorted-array/README.md b/problems/single-element-in-a-sorted-array/README.md index 72e0941e2..b76ff4d35 100644 --- a/problems/single-element-in-a-sorted-array/README.md +++ b/problems/single-element-in-a-sorted-array/README.md @@ -13,22 +13,20 @@

You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once. Find this single element that appears only once.

-

 

- -

Example 1:

- -
-Input: [1,1,2,3,3,4,4,8,8]
-Output: 2
-
+

Follow up: Your solution should run in O(log n) time and O(1) space.

-

Example 2:

- -
-Input: [3,3,7,7,10,11,11]
-Output: 10
+

 

+

Example 1:

+
Input: nums = [1,1,2,3,3,4,4,8,8]
+Output: 2
+

Example 2:

+
Input: nums = [3,3,7,7,10,11,11]
+Output: 10
 
-

 

+

Constraints:

-

Note: Your solution should run in O(log n) time and O(1) space.

+ diff --git a/problems/valid-perfect-square/README.md b/problems/valid-perfect-square/README.md index 599552df1..0ba60992e 100644 --- a/problems/valid-perfect-square/README.md +++ b/problems/valid-perfect-square/README.md @@ -11,27 +11,24 @@ ## [367. Valid Perfect Square (Easy)](https://leetcode.com/problems/valid-perfect-square "有效的完全平方数") -

Given a positive integer num, write a function which returns True if num is a perfect square else False.

+

Given a positive integer num, write a function which returns True if num is a perfect square else False.

-

Note: Do not use any built-in library function such as sqrt.

+

Follow up: Do not use any built-in library function such as sqrt.

+

 

Example 1:

- -
-
-Input: 16
-Output: true
+
Input: num = 16
+Output: true
+

Example 2:

+
Input: num = 14
+Output: false
 
+

 

+

Constraints:

-
-

Example 2:

- -
-Input: 14
-Output: false
-
-
-
+ ### Related Topics [[Math](../../tag/math/README.md)] diff --git a/problems/zuma-game/README.md b/problems/zuma-game/README.md index 03e93ae42..1508f7e9c 100644 --- a/problems/zuma-game/README.md +++ b/problems/zuma-game/README.md @@ -55,8 +55,8 @@ diff --git a/tag/README.md b/tag/README.md index 854b8235f..3653effbd 100644 --- a/tag/README.md +++ b/tag/README.md @@ -10,20 +10,20 @@ | # | Topic | 话题 | | # | Topic | 话题 | | :-: | - | :-: | - | :-: | - | :-: | | 1 | [Array](array/README.md) | [数组](https://openset.github.io/tags/array/) | | 2 | [Dynamic Programming](dynamic-programming/README.md) | [动态规划](https://openset.github.io/tags/dynamic-programming/) | -| 3 | [Math](math/README.md) | [数学](https://openset.github.io/tags/math/) | | 4 | [String](string/README.md) | [字符串](https://openset.github.io/tags/string/) | -| 5 | [Tree](tree/README.md) | [树](https://openset.github.io/tags/tree/) | | 6 | [Hash Table](hash-table/README.md) | [哈希表](https://openset.github.io/tags/hash-table/) | -| 7 | [Depth-first Search](depth-first-search/README.md) | [深度优先搜索](https://openset.github.io/tags/depth-first-search/) | | 8 | [Binary Search](binary-search/README.md) | [二分查找](https://openset.github.io/tags/binary-search/) | +| 3 | [String](string/README.md) | [字符串](https://openset.github.io/tags/string/) | | 4 | [Math](math/README.md) | [数学](https://openset.github.io/tags/math/) | +| 5 | [Tree](tree/README.md) | [树](https://openset.github.io/tags/tree/) | | 6 | [Depth-first Search](depth-first-search/README.md) | [深度优先搜索](https://openset.github.io/tags/depth-first-search/) | +| 7 | [Hash Table](hash-table/README.md) | [哈希表](https://openset.github.io/tags/hash-table/) | | 8 | [Binary Search](binary-search/README.md) | [二分查找](https://openset.github.io/tags/binary-search/) | | 9 | [Greedy](greedy/README.md) | [贪心算法](https://openset.github.io/tags/greedy/) | | 10 | [Breadth-first Search](breadth-first-search/README.md) | [广度优先搜索](https://openset.github.io/tags/breadth-first-search/) | | 11 | [Two Pointers](two-pointers/README.md) | [双指针](https://openset.github.io/tags/two-pointers/) | | 12 | [Stack](stack/README.md) | [栈](https://openset.github.io/tags/stack/) | -| 13 | [Backtracking](backtracking/README.md) | [回溯算法](https://openset.github.io/tags/backtracking/) | | 14 | [Design](design/README.md) | [设计](https://openset.github.io/tags/design/) | -| 15 | [Sort](sort/README.md) | [排序](https://openset.github.io/tags/sort/) | | 16 | [Bit Manipulation](bit-manipulation/README.md) | [位运算](https://openset.github.io/tags/bit-manipulation/) | +| 13 | [Backtracking](backtracking/README.md) | [回溯算法](https://openset.github.io/tags/backtracking/) | | 14 | [Sort](sort/README.md) | [排序](https://openset.github.io/tags/sort/) | +| 15 | [Design](design/README.md) | [设计](https://openset.github.io/tags/design/) | | 16 | [Bit Manipulation](bit-manipulation/README.md) | [位运算](https://openset.github.io/tags/bit-manipulation/) | | 17 | [Graph](graph/README.md) | [图](https://openset.github.io/tags/graph/) | | 18 | [Linked List](linked-list/README.md) | [链表](https://openset.github.io/tags/linked-list/) | | 19 | [Heap](heap/README.md) | [堆](https://openset.github.io/tags/heap/) | | 20 | [Union Find](union-find/README.md) | [并查集](https://openset.github.io/tags/union-find/) | | 21 | [Sliding Window](sliding-window/README.md) | [Sliding Window](https://openset.github.io/tags/sliding-window/) | | 22 | [Divide and Conquer](divide-and-conquer/README.md) | [分治算法](https://openset.github.io/tags/divide-and-conquer/) | | 23 | [Trie](trie/README.md) | [字典树](https://openset.github.io/tags/trie/) | | 24 | [Recursion](recursion/README.md) | [递归](https://openset.github.io/tags/recursion/) | | 25 | [Segment Tree](segment-tree/README.md) | [线段树](https://openset.github.io/tags/segment-tree/) | | 26 | [Ordered Map](ordered-map/README.md) | [Ordered Map](https://openset.github.io/tags/ordered-map/) | | 27 | [Queue](queue/README.md) | [队列](https://openset.github.io/tags/queue/) | | 28 | [Minimax](minimax/README.md) | [极小化极大](https://openset.github.io/tags/minimax/) | -| 29 | [Binary Indexed Tree](binary-indexed-tree/README.md) | [树状数组](https://openset.github.io/tags/binary-indexed-tree/) | | 30 | [Geometry](geometry/README.md) | [几何](https://openset.github.io/tags/geometry/) | +| 29 | [Geometry](geometry/README.md) | [几何](https://openset.github.io/tags/geometry/) | | 30 | [Binary Indexed Tree](binary-indexed-tree/README.md) | [树状数组](https://openset.github.io/tags/binary-indexed-tree/) | | 31 | [Line Sweep](line-sweep/README.md) | [Line Sweep](https://openset.github.io/tags/line-sweep/) | | 32 | [Random](random/README.md) | [Random](https://openset.github.io/tags/random/) | | 33 | [Topological Sort](topological-sort/README.md) | [拓扑排序](https://openset.github.io/tags/topological-sort/) | | 34 | [Brainteaser](brainteaser/README.md) | [脑筋急转弯](https://openset.github.io/tags/brainteaser/) | | 35 | [Binary Search Tree](binary-search-tree/README.md) | [二叉搜索树](https://openset.github.io/tags/binary-search-tree/) | | 36 | [Rejection Sampling](rejection-sampling/README.md) | [Rejection Sampling](https://openset.github.io/tags/rejection-sampling/) | diff --git a/tag/array/README.md b/tag/array/README.md index 17127a0a3..b311be9fb 100644 --- a/tag/array/README.md +++ b/tag/array/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1450 | [在既定时间做作业的学生人数](../../problems/number-of-students-doing-homework-at-a-given-time) | [[数组](../array/README.md)] | Easy | | 1442 | [形成两个异或相等数组的三元组数目](../../problems/count-triplets-that-can-form-two-arrays-of-equal-xor) | [[位运算](../bit-manipulation/README.md)] [[数组](../array/README.md)] [[数学](../math/README.md)] | Medium | | 1438 | [绝对差不超过限制的最长连续子数组](../../problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit) | [[数组](../array/README.md)] [[Sliding Window](../sliding-window/README.md)] | Medium | | 1437 | [是否所有 1 都至少相隔 k 个元素](../../problems/check-if-all-1s-are-at-least-length-k-places-away) | [[数组](../array/README.md)] | Medium | diff --git a/tag/depth-first-search/README.md b/tag/depth-first-search/README.md index ff73b6891..e025264a9 100644 --- a/tag/depth-first-search/README.md +++ b/tag/depth-first-search/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1448 | [统计二叉树中好节点的数目](../../problems/count-good-nodes-in-binary-tree) | [[树](../tree/README.md)] [[深度优先搜索](../depth-first-search/README.md)] | Medium | | 1443 | [收集树上所有苹果的最少时间](../../problems/minimum-time-to-collect-all-apples-in-a-tree) | [[树](../tree/README.md)] [[深度优先搜索](../depth-first-search/README.md)] | Medium | | 1391 | [检查网格中是否存在有效路径](../../problems/check-if-there-is-a-valid-path-in-a-grid) | [[深度优先搜索](../depth-first-search/README.md)] [[广度优先搜索](../breadth-first-search/README.md)] | Medium | | 1377 | [T 秒后青蛙的位置](../../problems/frog-position-after-t-seconds) | [[深度优先搜索](../depth-first-search/README.md)] | Hard | diff --git a/tag/dynamic-programming/README.md b/tag/dynamic-programming/README.md index 89963f0ca..db2bd32a3 100644 --- a/tag/dynamic-programming/README.md +++ b/tag/dynamic-programming/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1449 | [数位成本和为目标值的最大数字](../../problems/form-largest-integer-with-digits-that-add-up-to-target) | [[字符串](../string/README.md)] [[动态规划](../dynamic-programming/README.md)] | Hard | | 1444 | [切披萨的方案数](../../problems/number-of-ways-of-cutting-a-pizza) | [[动态规划](../dynamic-programming/README.md)] | Hard | | 1434 | [每个人戴不同帽子的方案数](../../problems/number-of-ways-to-wear-different-hats-to-each-other) | [[位运算](../bit-manipulation/README.md)] [[动态规划](../dynamic-programming/README.md)] | Hard | | 1425 | [带限制的子序列和](../../problems/constrained-subsequence-sum) | [[动态规划](../dynamic-programming/README.md)] | Hard | diff --git a/tag/geometry/README.md b/tag/geometry/README.md index 1a0038d3e..6cdb8d902 100644 --- a/tag/geometry/README.md +++ b/tag/geometry/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1453 | [圆形靶内的最大飞镖数量](../../problems/maximum-number-of-darts-inside-of-a-circular-dartboard) | [[几何](../geometry/README.md)] | Hard | | 1401 | [圆和矩形是否有重叠](../../problems/circle-and-rectangle-overlapping) | [[几何](../geometry/README.md)] | Medium | | 1266 | [访问所有点的最小时间](../../problems/minimum-time-visiting-all-points) | [[几何](../geometry/README.md)] [[数组](../array/README.md)] | Easy | | 1232 | [缀点成线](../../problems/check-if-it-is-a-straight-line) | [[几何](../geometry/README.md)] [[数组](../array/README.md)] [[数学](../math/README.md)] | Easy | diff --git a/tag/math/README.md b/tag/math/README.md index 8e62d08dc..b8042189d 100644 --- a/tag/math/README.md +++ b/tag/math/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1447 | [最简分数](../../problems/simplified-fractions) | [[数学](../math/README.md)] | Medium | | 1442 | [形成两个异或相等数组的三元组数目](../../problems/count-triplets-that-can-form-two-arrays-of-equal-xor) | [[位运算](../bit-manipulation/README.md)] [[数组](../array/README.md)] [[数学](../math/README.md)] | Medium | | 1427 | [Perform String Shifts](../../problems/perform-string-shifts) 🔒 | [[数组](../array/README.md)] [[数学](../math/README.md)] | Easy | | 1390 | [四因数](../../problems/four-divisors) | [[数学](../math/README.md)] | Medium | diff --git a/tag/sort/README.md b/tag/sort/README.md index bc64cd5ac..ffdc26b64 100644 --- a/tag/sort/README.md +++ b/tag/sort/README.md @@ -9,6 +9,8 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1452 | [收藏清单](../../problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list) | [[排序](../sort/README.md)] [[字符串](../string/README.md)] | Medium | +| 1451 | [重新排列句子中的单词](../../problems/rearrange-words-in-a-sentence) | [[排序](../sort/README.md)] [[字符串](../string/README.md)] | Medium | | 1424 | [对角线遍历 II](../../problems/diagonal-traverse-ii) | [[排序](../sort/README.md)] [[数组](../array/README.md)] | Medium | | 1403 | [非递增顺序的最小子序列](../../problems/minimum-subsequence-in-non-increasing-order) | [[贪心算法](../greedy/README.md)] [[排序](../sort/README.md)] | Easy | | 1387 | [将整数按权重排序](../../problems/sort-integers-by-the-power-value) | [[排序](../sort/README.md)] [[图](../graph/README.md)] | Medium | diff --git a/tag/string/README.md b/tag/string/README.md index 50dcda9dc..04c8d34cd 100644 --- a/tag/string/README.md +++ b/tag/string/README.md @@ -9,6 +9,10 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1452 | [收藏清单](../../problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list) | [[排序](../sort/README.md)] [[字符串](../string/README.md)] | Medium | +| 1451 | [重新排列句子中的单词](../../problems/rearrange-words-in-a-sentence) | [[排序](../sort/README.md)] [[字符串](../string/README.md)] | Medium | +| 1449 | [数位成本和为目标值的最大数字](../../problems/form-largest-integer-with-digits-that-add-up-to-target) | [[字符串](../string/README.md)] [[动态规划](../dynamic-programming/README.md)] | Hard | +| 1446 | [连续字符](../../problems/consecutive-characters) | [[字符串](../string/README.md)] | Easy | | 1436 | [旅行终点站](../../problems/destination-city) | [[字符串](../string/README.md)] | Easy | | 1433 | [检查一个字符串是否可以打破另一个字符串](../../problems/check-if-a-string-can-break-another-string) | [[贪心算法](../greedy/README.md)] [[字符串](../string/README.md)] | Medium | | 1432 | [改变一个整数能得到的最大差值](../../problems/max-difference-you-can-get-from-changing-an-integer) | [[字符串](../string/README.md)] | Medium | diff --git a/tag/tags.json b/tag/tags.json index 1f0b44a86..8981e1c12 100644 --- a/tag/tags.json +++ b/tag/tags.json @@ -9,31 +9,31 @@ "Slug": "dynamic-programming", "TranslatedName": "动态规划" }, - { - "Name": "Math", - "Slug": "math", - "TranslatedName": "数学" - }, { "Name": "String", "Slug": "string", "TranslatedName": "字符串" }, + { + "Name": "Math", + "Slug": "math", + "TranslatedName": "数学" + }, { "Name": "Tree", "Slug": "tree", "TranslatedName": "树" }, - { - "Name": "Hash Table", - "Slug": "hash-table", - "TranslatedName": "哈希表" - }, { "Name": "Depth-first Search", "Slug": "depth-first-search", "TranslatedName": "深度优先搜索" }, + { + "Name": "Hash Table", + "Slug": "hash-table", + "TranslatedName": "哈希表" + }, { "Name": "Binary Search", "Slug": "binary-search", @@ -64,16 +64,16 @@ "Slug": "backtracking", "TranslatedName": "回溯算法" }, - { - "Name": "Design", - "Slug": "design", - "TranslatedName": "设计" - }, { "Name": "Sort", "Slug": "sort", "TranslatedName": "排序" }, + { + "Name": "Design", + "Slug": "design", + "TranslatedName": "设计" + }, { "Name": "Bit Manipulation", "Slug": "bit-manipulation", @@ -139,16 +139,16 @@ "Slug": "minimax", "TranslatedName": "极小化极大" }, - { - "Name": "Binary Indexed Tree", - "Slug": "binary-indexed-tree", - "TranslatedName": "树状数组" - }, { "Name": "Geometry", "Slug": "geometry", "TranslatedName": "几何" }, + { + "Name": "Binary Indexed Tree", + "Slug": "binary-indexed-tree", + "TranslatedName": "树状数组" + }, { "Name": "Line Sweep", "Slug": "line-sweep", diff --git a/tag/tree/README.md b/tag/tree/README.md index ec6576c36..ee49bf21c 100644 --- a/tag/tree/README.md +++ b/tag/tree/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1448 | [统计二叉树中好节点的数目](../../problems/count-good-nodes-in-binary-tree) | [[树](../tree/README.md)] [[深度优先搜索](../depth-first-search/README.md)] | Medium | | 1443 | [收集树上所有苹果的最少时间](../../problems/minimum-time-to-collect-all-apples-in-a-tree) | [[树](../tree/README.md)] [[深度优先搜索](../depth-first-search/README.md)] | Medium | | 1430 | [Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree](../../problems/check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree) 🔒 | [[树](../tree/README.md)] | Medium | | 1379 | [找出克隆二叉树中的相同节点](../../problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree) | [[树](../tree/README.md)] | Medium |