From 7569133ebc851220bfa21818098eb527b91e8ec1 Mon Sep 17 00:00:00 2001 From: Shuo Date: Tue, 25 Feb 2020 11:04:47 +0800 Subject: [PATCH] Add: new --- README.md | 9 ++ problems/activity-participants/README.md | 14 +++ .../activity-participants/mysql_schemas.sql | 13 +++ .../apply-discount-every-n-orders/README.md | 77 ++++++++++++ .../cheapest-flights-within-k-stops/README.md | 2 +- problems/closest-divisors/README.md | 60 ++++++++++ problems/consecutive-numbers-sum/README.md | 2 +- problems/construct-quad-tree/README.md | 96 ++++++++++++--- .../README.md | 2 +- .../README.md | 61 ++++++++++ .../README.md | 55 +++++++++ .../README.md | 2 +- problems/largest-multiple-of-three/README.md | 81 +++++++++++++ .../README.md | 110 ++++++++++++++++++ problems/making-a-large-island/README.md | 2 +- .../maximum-depth-of-n-ary-tree/README.md | 2 +- .../README.md | 52 +++++++++ .../README.md | 62 ++++++++++ .../README.md | 2 +- .../reverse-words-in-a-string-iii/README.md | 2 +- .../README.md | 81 +++++++++++++ problems/validate-binary-tree-nodes/README.md | 78 +++++++++++++ readme/301-600.md | 2 +- readme/601-900.md | 2 +- tag/bit-manipulation/README.md | 1 + tag/design/README.md | 1 + tag/dynamic-programming/README.md | 2 + tag/graph/README.md | 1 + tag/math/README.md | 3 + tag/sort/README.md | 1 + tag/string/README.md | 1 + tag/two-pointers/README.md | 2 +- 32 files changed, 855 insertions(+), 26 deletions(-) create mode 100644 problems/activity-participants/README.md create mode 100644 problems/activity-participants/mysql_schemas.sql create mode 100644 problems/apply-discount-every-n-orders/README.md create mode 100644 problems/closest-divisors/README.md create mode 100644 problems/count-all-valid-pickup-and-delivery-options/README.md create mode 100644 problems/count-unique-characters-of-all-substrings-of-a-given-string/README.md create mode 100644 problems/largest-multiple-of-three/README.md create mode 100644 problems/logical-or-of-two-binary-grids-represented-as-quad-trees/README.md create mode 100644 problems/number-of-days-between-two-dates/README.md create mode 100644 problems/number-of-substrings-containing-all-three-characters/README.md create mode 100644 problems/sort-integers-by-the-number-of-1-bits/README.md create mode 100644 problems/validate-binary-tree-nodes/README.md diff --git a/README.md b/README.md index c849b280b..ee918bcdc 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,15 @@ LeetCode Problems' Solutions | # | Title | Solution | Difficulty | | :-: | - | - | :-: | +| 1363 | [Largest Multiple of Three](https://leetcode.com/problems/largest-multiple-of-three "形成三的最大倍数") | [Go](problems/largest-multiple-of-three) | Hard | +| 1362 | [Closest Divisors](https://leetcode.com/problems/closest-divisors "最接近的因数") | [Go](problems/closest-divisors) | Medium | +| 1361 | [Validate Binary Tree Nodes](https://leetcode.com/problems/validate-binary-tree-nodes "验证二叉树") | [Go](problems/validate-binary-tree-nodes) | Medium | +| 1360 | [Number of Days Between Two Dates](https://leetcode.com/problems/number-of-days-between-two-dates "日期之间隔几天") | [Go](problems/number-of-days-between-two-dates) | Easy | +| 1359 | [Count All Valid Pickup and Delivery Options](https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options "有效的快递序列数目") | [Go](problems/count-all-valid-pickup-and-delivery-options) | Hard | +| 1358 | [Number of Substrings Containing All Three Characters](https://leetcode.com/problems/number-of-substrings-containing-all-three-characters "包含所有三种字符的子字符串数目") | [Go](problems/number-of-substrings-containing-all-three-characters) | Medium | +| 1357 | [Apply Discount Every n Orders](https://leetcode.com/problems/apply-discount-every-n-orders "每隔 n 个顾客打折") | [Go](problems/apply-discount-every-n-orders) | Medium | +| 1356 | [Sort Integers by The Number of 1 Bits](https://leetcode.com/problems/sort-integers-by-the-number-of-1-bits "根据数字二进制下 1 的数目排序") | [Go](problems/sort-integers-by-the-number-of-1-bits) | Easy | +| 1355 | [Activity Participants](https://leetcode.com/problems/activity-participants) 🔒 | [MySQL](problems/activity-participants) | Medium | | 1354 | [Construct Target Array With Multiple Sums](https://leetcode.com/problems/construct-target-array-with-multiple-sums "多次求和构造目标数组") | [Go](problems/construct-target-array-with-multiple-sums) | Hard | | 1353 | [Maximum Number of Events That Can Be Attended](https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended "最多可以参加的会议数目") | [Go](problems/maximum-number-of-events-that-can-be-attended) | Medium | | 1352 | [Product of the Last K Numbers](https://leetcode.com/problems/product-of-the-last-k-numbers "最后 K 个数的乘积") | [Go](problems/product-of-the-last-k-numbers) | Medium | diff --git a/problems/activity-participants/README.md b/problems/activity-participants/README.md new file mode 100644 index 000000000..47c6a14fb --- /dev/null +++ b/problems/activity-participants/README.md @@ -0,0 +1,14 @@ + + + + + + + +[< Previous](../construct-target-array-with-multiple-sums "Construct Target Array With Multiple Sums") +                 +[Next >](../sort-integers-by-the-number-of-1-bits "Sort Integers by The Number of 1 Bits") + +## [1355. Activity Participants (Medium)](https://leetcode.com/problems/activity-participants "") + + diff --git a/problems/activity-participants/mysql_schemas.sql b/problems/activity-participants/mysql_schemas.sql new file mode 100644 index 000000000..161ef2e28 --- /dev/null +++ b/problems/activity-participants/mysql_schemas.sql @@ -0,0 +1,13 @@ +Create table If Not Exists Friends (id int, name varchar(30), activity varchar(30)); +Create table If Not Exists Activities (id int, name varchar(30)); +Truncate table Friends; +insert into Friends (id, name, activity) values ('1', 'Jonathan D.', 'Eating'); +insert into Friends (id, name, activity) values ('2', 'Jade W.', 'Singing'); +insert into Friends (id, name, activity) values ('3', 'Victor J.', 'Singing'); +insert into Friends (id, name, activity) values ('4', 'Elvis Q.', 'Eating'); +insert into Friends (id, name, activity) values ('5', 'Daniel A.', 'Eating'); +insert into Friends (id, name, activity) values ('6', 'Bob B.', 'Horse Riding'); +Truncate table Activities; +insert into Activities (id, name) values ('1', 'Eating'); +insert into Activities (id, name) values ('2', 'Singing'); +insert into Activities (id, name) values ('3', 'Horse Riding'); diff --git a/problems/apply-discount-every-n-orders/README.md b/problems/apply-discount-every-n-orders/README.md new file mode 100644 index 000000000..44802160d --- /dev/null +++ b/problems/apply-discount-every-n-orders/README.md @@ -0,0 +1,77 @@ + + + + + + + +[< Previous](../sort-integers-by-the-number-of-1-bits "Sort Integers by The Number of 1 Bits") +                 +[Next >](../number-of-substrings-containing-all-three-characters "Number of Substrings Containing All Three Characters") + +## [1357. Apply Discount Every n Orders (Medium)](https://leetcode.com/problems/apply-discount-every-n-orders "每隔 n 个顾客打折") + +

There is a sale in a supermarket, there will be a discount every n customer.
+There are some products in the supermarket where the id of the i-th product is products[i] and the price per unit of this product is prices[i].
+The system will count the number of customers and when the n-th customer arrive he/she will have a discount on the bill. (i.e if the cost is x the new cost is x - (discount * x) / 100). Then the system will start counting customers again.
+The customer orders a certain amount of each product where product[i] is the id of the i-th product the customer ordered and amount[i] is the number of units the customer ordered of that product.

+ +

Implement the Cashier class:

+ + + +

 

+

Example 1:

+ +
+Input
+["Cashier","getBill","getBill","getBill","getBill","getBill","getBill","getBill"]
+[[3,50,[1,2,3,4,5,6,7],[100,200,300,400,300,200,100]],[[1,2],[1,2]],[[3,7],[10,10]],[[1,2,3,4,5,6,7],[1,1,1,1,1,1,1]],[[4],[10]],[[7,3],[10,10]],[[7,5,3,1,6,4,2],[10,10,10,9,9,9,7]],[[2,3,5],[5,3,2]]]
+Output
+[null,500.0,4000.0,800.0,4000.0,4000.0,7350.0,2500.0]
+Explanation
+Cashier cashier = new Cashier(3,50,[1,2,3,4,5,6,7],[100,200,300,400,300,200,100]);
+cashier.getBill([1,2],[1,2]);                        // return 500.0, bill = 1 * 100 + 2 * 200 = 500.
+cashier.getBill([3,7],[10,10]);                      // return 4000.0
+cashier.getBill([1,2,3,4,5,6,7],[1,1,1,1,1,1,1]);    // return 800.0, The bill was 1600.0 but as this is the third customer, he has a discount of 50% which means his bill is only 1600 - 1600 * (50 / 100) = 800.
+cashier.getBill([4],[10]);                           // return 4000.0
+cashier.getBill([7,3],[10,10]);                      // return 4000.0
+cashier.getBill([7,5,3,1,6,4,2],[10,10,10,9,9,9,7]); // return 7350.0, Bill was 14700.0 but as the system counted three more customers, he will have a 50% discount and the bill becomes 7350.0
+cashier.getBill([2,3,5],[5,3,2]);                    // return 2500.0
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Design](../../tag/design/README.md)] + +### Hints +
+Hint 1 +Keep track of the count of the customers. +
+ +
+Hint 2 +Check if the count of the customers is divisible by n then apply the discount formula. +
diff --git a/problems/cheapest-flights-within-k-stops/README.md b/problems/cheapest-flights-within-k-stops/README.md index cba708f69..8d003d2d7 100644 --- a/problems/cheapest-flights-within-k-stops/README.md +++ b/problems/cheapest-flights-within-k-stops/README.md @@ -11,7 +11,7 @@ ## [787. Cheapest Flights Within K Stops (Medium)](https://leetcode.com/problems/cheapest-flights-within-k-stops "K 站中转内最便宜的航班") -

There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w.

+

There are n cities connected by m flights. Each flight starts from city u and arrives at v with a price w.

Now given all the cities and flights, together with starting city src and the destination dst, your task is to find the cheapest price from src to dst with up to k stops. If there is no such route, output -1.

diff --git a/problems/closest-divisors/README.md b/problems/closest-divisors/README.md new file mode 100644 index 000000000..85e11e737 --- /dev/null +++ b/problems/closest-divisors/README.md @@ -0,0 +1,60 @@ + + + + + + + +[< Previous](../validate-binary-tree-nodes "Validate Binary Tree Nodes") +                 +[Next >](../largest-multiple-of-three "Largest Multiple of Three") + +## [1362. Closest Divisors (Medium)](https://leetcode.com/problems/closest-divisors "最接近的因数") + +

Given an integer num, find the closest two integers in absolute difference whose product equals num + 1 or num + 2.

+ +

Return the two integers in any order.

+ +

 

+

Example 1:

+ +
+Input: num = 8
+Output: [3,3]
+Explanation: For num + 1 = 9, the closest divisors are 3 & 3, for num + 2 = 10, the closest divisors are 2 & 5, hence 3 & 3 is chosen.
+
+ +

Example 2:

+ +
+Input: num = 123
+Output: [5,25]
+
+ +

Example 3:

+ +
+Input: num = 999
+Output: [40,25]
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Math](../../tag/math/README.md)] + +### Hints +
+Hint 1 +Find the divisors of n+1 and n+2. +
+ +
+Hint 2 +To find the divisors of a number, you only need to iterate to the square root of that number. +
diff --git a/problems/consecutive-numbers-sum/README.md b/problems/consecutive-numbers-sum/README.md index d8a56e19e..919abaae0 100644 --- a/problems/consecutive-numbers-sum/README.md +++ b/problems/consecutive-numbers-sum/README.md @@ -5,7 +5,7 @@ -[< Previous](../unique-letter-string "Unique Letter String") +[< Previous](../count-unique-characters-of-all-substrings-of-a-given-string "Count Unique Characters of All Substrings of a Given String")                  [Next >](../positions-of-large-groups "Positions of Large Groups") diff --git a/problems/construct-quad-tree/README.md b/problems/construct-quad-tree/README.md index 85ea30cfc..9384b2ea8 100644 --- a/problems/construct-quad-tree/README.md +++ b/problems/construct-quad-tree/README.md @@ -11,31 +11,97 @@ ## [427. Construct Quad Tree (Medium)](https://leetcode.com/problems/construct-quad-tree "建立四叉树") -

We want to use quad trees to store an N x N boolean grid. Each cell in the grid can only be true or false. The root node represents the whole grid. For each node, it will be subdivided into four children nodes until the values in the region it represents are all the same.

+

Given a n * n matrix grid of 0's and 1's only. We want to represent the grid with a Quad-Tree.

-

Each node has another two boolean attributes : isLeaf and val. isLeaf is true if and only if the node is a leaf node. The val attribute for a leaf node contains the value of the region it represents.

+

Return the root of the Quad-Tree representing the grid.

-

Your task is to use a quad tree to represent a given grid. The following example may help you understand the problem better:

+

Notice that you can assign the value of a node to True or False when isLeaf is False, and both are accepted in the answer.

-

Given the 8 x 8 grid below, we want to construct the corresponding quad tree:

+

A Quad-Tree is a tree data structure in which each internal node has exactly four children. Besides, each node has two attributes:

-

+ -

It can be divided according to the definition above:

+
+class Node {
+    public boolean val;
+    public boolean isLeaf;
+    public Node topLeft;
+    public Node topRight;
+    public Node bottomLeft;
+    public Node bottomRight;
+}
-

+

We can construct a Quad-Tree from a two-dimensional area using the following steps:

+ +
    +
  1. If the current grid has the same value (i.e all 1's or all 0's) set isLeaf True and set val to the value of the grid and set the four children to Null and stop.
  2. +
  3. If the current grid has different values, set isLeaf to False and set val to any value and divide the current grid into four sub-grids as shown in the photo.
  4. +
  5. Recurse for each of the children with the proper sub-grid.
  6. +
+ +

If you want to know more about the Quad-Tree, you can refer to the wiki.

+ +

Quad-Tree format:

+ +

The output represents the serialized format of a Quad-Tree using level order traversal, where null signifies a path terminator where no node exists below.

+ +

It is very similar to the serialization of the binary tree. The only difference is that the node is represented as a list [isLeaf, val].

+ +

If the value of isLeaf or val is True we represent it as 1 in the list [isLeaf, val] and if the value of isLeaf or val is False we represent it as 0.

 

+

Example 1:

+ +
+Input: grid = [[0,1],[1,0]]
+Output: [[0,1],[1,0],[1,1],[1,1],[1,0]]
+Explanation: The explanation of this example is shown below:
+Notice that 0 represnts False and 1 represents True in the photo representing the Quad-Tree.
+
+
-

The corresponding quad tree should be as following, where each node is represented as a (isLeaf, val) pair.

+

Example 2:

-

For the non-leaf nodes, val can be arbitrary, so it is represented as *.

+

-

+
+Input: grid = [[1,1,1,1,0,0,0,0],[1,1,1,1,0,0,0,0],[1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1],[1,1,1,1,0,0,0,0],[1,1,1,1,0,0,0,0],[1,1,1,1,0,0,0,0],[1,1,1,1,0,0,0,0]]
+Output: [[0,1],[1,1],[0,1],[1,1],[1,0],null,null,null,null,[1,0],[1,0],[1,1],[1,1]]
+Explanation: All values in the grid are not the same. We divide the grid into four sub-grids.
+The topLeft, bottomLeft and bottomRight each has the same value.
+The topRight have different values so we divide it into 4 sub-grids where each has the same value.
+Explanation is shown in the photo below:
+
+
-

Note:

+

Example 3:

-
    -
  1. N is less than 1000 and guaranteened to be a power of 2.
  2. -
  3. If you want to know more about the quad tree, you can refer to its wiki.
  4. -
+
+Input: grid = [[1,1],[1,1]]
+Output: [[1,1]]
+
+ +

Example 4:

+ +
+Input: grid = [[0]]
+Output: [[1,0]]
+
+ +

Example 5:

+ +
+Input: grid = [[1,1,0,0],[1,1,0,0],[0,0,1,1],[0,0,1,1]]
+Output: [[0,1],[1,1],[1,0],[1,0],[1,1]]
+
+ +

 

+

Constraints:

+ + diff --git a/problems/construct-target-array-with-multiple-sums/README.md b/problems/construct-target-array-with-multiple-sums/README.md index 2367ddbea..08f6155d4 100644 --- a/problems/construct-target-array-with-multiple-sums/README.md +++ b/problems/construct-target-array-with-multiple-sums/README.md @@ -7,7 +7,7 @@ [< Previous](../maximum-number-of-events-that-can-be-attended "Maximum Number of Events That Can Be Attended")                  -Next > +[Next >](../activity-participants "Activity Participants") ## [1354. Construct Target Array With Multiple Sums (Hard)](https://leetcode.com/problems/construct-target-array-with-multiple-sums "多次求和构造目标数组") diff --git a/problems/count-all-valid-pickup-and-delivery-options/README.md b/problems/count-all-valid-pickup-and-delivery-options/README.md new file mode 100644 index 000000000..664cb1b10 --- /dev/null +++ b/problems/count-all-valid-pickup-and-delivery-options/README.md @@ -0,0 +1,61 @@ + + + + + + + +[< Previous](../number-of-substrings-containing-all-three-characters "Number of Substrings Containing All Three Characters") +                 +[Next >](../number-of-days-between-two-dates "Number of Days Between Two Dates") + +## [1359. Count All Valid Pickup and Delivery Options (Hard)](https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options "有效的快递序列数目") + +

Given n orders, each order consist in pickup and delivery services. 

+ +

Count all valid pickup/delivery possible sequences such that delivery(i) is always after of pickup(i). 

+ +

Since the answer may be too large, return it modulo 10^9 + 7.

+ +

 

+

Example 1:

+ +
+Input: n = 1
+Output: 1
+Explanation: Unique order (P1, D1), Delivery 1 always is after of Pickup 1.
+
+ +

Example 2:

+ +
+Input: n = 2
+Output: 6
+Explanation: All possible orders: 
+(P1,P2,D1,D2), (P1,P2,D2,D1), (P1,D1,P2,D2), (P2,P1,D1,D2), (P2,P1,D2,D1) and (P2,D2,P1,D1).
+This is an invalid order (P1,D2,P2,D1) because Pickup 2 is after of Delivery 2.
+
+ +

Example 3:

+ +
+Input: n = 3
+Output: 90
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Math](../../tag/math/README.md)] + [[Dynamic Programming](../../tag/dynamic-programming/README.md)] + +### Hints +
+Hint 1 +Use the permutation and combination theory to add one (P, D) pair each time until n pairs. +
diff --git a/problems/count-unique-characters-of-all-substrings-of-a-given-string/README.md b/problems/count-unique-characters-of-all-substrings-of-a-given-string/README.md new file mode 100644 index 000000000..99c7db690 --- /dev/null +++ b/problems/count-unique-characters-of-all-substrings-of-a-given-string/README.md @@ -0,0 +1,55 @@ + + + + + + + +[< Previous](../making-a-large-island "Making A Large Island") +                 +[Next >](../consecutive-numbers-sum "Consecutive Numbers Sum") + +## [828. Count Unique Characters of All Substrings of a Given String (Hard)](https://leetcode.com/problems/count-unique-characters-of-all-substrings-of-a-given-string "独特字符串") + +

Let's define a function countUniqueChars(s) that returns the number of unique characters on s, for example if s = "LEETCODE" then "L", "T","C","O","D" are the unique characters since they appear only once in s, therefore countUniqueChars(s) = 5.
+
+On this problem given a string s we need to return the sum of countUniqueChars(t) where t is a substring of s. Notice that some substrings can be repeated so on this case you have to count the repeated ones too.

+ +

Since the answer can be very large, return the answer modulo 10 ^ 9 + 7.

+ +

 

+

Example 1:

+ +
+Input: s = "ABC"
+Output: 10
+Explanation: All possible substrings are: "A","B","C","AB","BC" and "ABC".
+Evey substring is composed with only unique letters.
+Sum of lengths of all substring is 1 + 1 + 1 + 2 + 2 + 3 = 10
+
+ +

Example 2:

+ +
+Input: s = "ABA"
+Output: 8
+Explanation: The same as example 1, except countUniqueChars("ABA") = 1.
+
+ +

Example 3:

+ +
+Input: s = "LEETCODE"
+Output: 92
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Two Pointers](../../tag/two-pointers/README.md)] diff --git a/problems/decompress-run-length-encoded-list/README.md b/problems/decompress-run-length-encoded-list/README.md index 36b9dd8a3..4040e2fcb 100644 --- a/problems/decompress-run-length-encoded-list/README.md +++ b/problems/decompress-run-length-encoded-list/README.md @@ -25,7 +25,7 @@ Output: [2,4,4,4] Explanation: The first pair [1,2] means we have freq = 1 and val = 2 so we generate the array [2]. The second pair [3,4] means we have freq = 3 and val = 4 so we generate [4,4,4]. -At the end the concatenation [2] + [4,4,4,4] is [2,4,4,4]. +At the end the concatenation [2] + [4,4,4] is [2,4,4,4].

 

diff --git a/problems/largest-multiple-of-three/README.md b/problems/largest-multiple-of-three/README.md new file mode 100644 index 000000000..c32499e8f --- /dev/null +++ b/problems/largest-multiple-of-three/README.md @@ -0,0 +1,81 @@ + + + + + + + +[< Previous](../closest-divisors "Closest Divisors") +                 +Next > + +## [1363. Largest Multiple of Three (Hard)](https://leetcode.com/problems/largest-multiple-of-three "形成三的最大倍数") + +

Given an integer array of digits, return the largest multiple of three that can be formed by concatenating some of the given digits in any order.

+ +

Since the answer may not fit in an integer data type, return the answer as a string.

+ +

If there is no answer return an empty string.

+ +

 

+

Example 1:

+ +
+Input: digits = [8,1,9]
+Output: "981"
+
+ +

Example 2:

+ +
+Input: digits = [8,6,7,1,0]
+Output: "8760"
+
+ +

Example 3:

+ +
+Input: digits = [1]
+Output: ""
+
+ +

Example 4:

+ +
+Input: digits = [0,0,0,0,0,0]
+Output: "0"
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Math](../../tag/math/README.md)] + [[Dynamic Programming](../../tag/dynamic-programming/README.md)] + +### Hints +
+Hint 1 +A number is a multiple of three if and only if its sum of digits is a multiple of three. +
+ +
+Hint 2 +Use dynamic programming. +
+ +
+Hint 3 +To find the maximum number, try to maximize the number of digits of the number. +
+ +
+Hint 4 +Sort the digits in descending order to find the maximum number. +
diff --git a/problems/logical-or-of-two-binary-grids-represented-as-quad-trees/README.md b/problems/logical-or-of-two-binary-grids-represented-as-quad-trees/README.md new file mode 100644 index 000000000..b1e9e6126 --- /dev/null +++ b/problems/logical-or-of-two-binary-grids-represented-as-quad-trees/README.md @@ -0,0 +1,110 @@ + + + + + + + +[< Previous](../reverse-words-in-a-string-iii "Reverse Words in a String III") +                 +[Next >](../maximum-depth-of-n-ary-tree "Maximum Depth of N-ary Tree") + +## [558. Logical OR of Two Binary Grids Represented as Quad-Trees (Medium)](https://leetcode.com/problems/logical-or-of-two-binary-grids-represented-as-quad-trees "四叉树交集") + +

A Binary Matrix is a matrix in which all the elements are either 0 or 1.

+ +

Given quadTree1 and quadTree2. quadTree1 represents a n * n binary matrix and quadTree2 represents another n * n binary matrix. 

+ +

Return a Quad-Tree representing the n * n binary matrix which is the result of logical bitwise OR of the two binary matrixes represented by quadTree1 and quadTree2.

+ +

Notice that you can assign the value of a node to True or False when isLeaf is False, and both are accepted in the answer.

+ +

A Quad-Tree is a tree data structure in which each internal node has exactly four children. Besides, each node has two attributes:

+ + + +
+class Node {
+    public boolean val;
+    public boolean isLeaf;
+    public Node topLeft;
+    public Node topRight;
+    public Node bottomLeft;
+    public Node bottomRight;
+}
+ +

We can construct a Quad-Tree from a two-dimensional area using the following steps:

+ +
    +
  1. If the current grid has the same value (i.e all 1's or all 0's) set isLeaf True and set val to the value of the grid and set the four children to Null and stop.
  2. +
  3. If the current grid has different values, set isLeaf to False and set val to any value and divide the current grid into four sub-grids as shown in the photo.
  4. +
  5. Recurse for each of the children with the proper sub-grid.
  6. +
+ +

If you want to know more about the Quad-Tree, you can refer to the wiki.

+ +

Quad-Tree format:

+ +

The input/output represents the serialized format of a Quad-Tree using level order traversal, where null signifies a path terminator where no node exists below.

+ +

It is very similar to the serialization of the binary tree. The only difference is that the node is represented as a list [isLeaf, val].

+ +

If the value of isLeaf or val is True we represent it as 1 in the list [isLeaf, val] and if the value of isLeaf or val is False we represent it as 0.

+ +

 

+

Example 1:

+ +
+Input: quadTree1 = [[0,1],[1,1],[1,1],[1,0],[1,0]]
+, quadTree2 = [[0,1],[1,1],[0,1],[1,1],[1,0],null,null,null,null,[1,0],[1,0],[1,1],[1,1]]
+Output: [[0,0],[1,1],[1,1],[1,1],[1,0]]
+Explanation: quadTree1 and quadTree2 are shown above. You can see the binary matrix which is represented by each Quad-Tree.
+If we apply logical bitwise OR on the two binary matrices we get the binary matrix below which is represented by the result Quad-Tree.
+Notice that the binary matrices shown are only for illustration, you don't have to construct the binary matrix to get the result tree.
+
+
+ +

Example 2:

+ +
+Input: quadTree1 = [[1,0]]
+, quadTree2 = [[1,0]]
+Output: [[1,0]]
+Explanation: Each tree represents a binary matrix of size 1*1. Each matrix contains only zero.
+The resulting matrix is of size 1*1 with also zero.
+
+ +

Example 3:

+ +
+Input: quadTree1 = [[0,0],[1,0],[1,0],[1,1],[1,1]]
+, quadTree2 = [[0,0],[1,1],[1,1],[1,0],[1,1]]
+Output: [[1,1]]
+
+ +

Example 4:

+ +
+Input: quadTree1 = [[0,0],[1,1],[1,0],[1,1],[1,1]]
+, quadTree2 = [[0,0],[1,1],[0,1],[1,1],[1,1],null,null,null,null,[1,1],[1,0],[1,0],[1,1]]
+Output: [[0,0],[1,1],[0,1],[1,1],[1,1],null,null,null,null,[1,1],[1,0],[1,0],[1,1]]
+
+ +

Example 5:

+ +
+Input: quadTree1 = [[0,1],[1,0],[0,1],[1,1],[1,0],null,null,null,null,[1,0],[1,0],[1,1],[1,1]]
+, quadTree2 = [[0,1],[0,1],[1,0],[1,1],[1,0],[1,0],[1,0],[1,1],[1,1]]
+Output: [[0,0],[0,1],[0,1],[1,1],[1,0],[1,0],[1,0],[1,1],[1,1],[1,0],[1,0],[1,1],[1,1]]
+
+ +

 

+

Constraints:

+ + diff --git a/problems/making-a-large-island/README.md b/problems/making-a-large-island/README.md index 539b82767..927a173d4 100644 --- a/problems/making-a-large-island/README.md +++ b/problems/making-a-large-island/README.md @@ -7,7 +7,7 @@ [< Previous](../most-profit-assigning-work "Most Profit Assigning Work")                  -[Next >](../unique-letter-string "Unique Letter String") +[Next >](../count-unique-characters-of-all-substrings-of-a-given-string "Count Unique Characters of All Substrings of a Given String") ## [827. Making A Large Island (Hard)](https://leetcode.com/problems/making-a-large-island "最大人工岛") diff --git a/problems/maximum-depth-of-n-ary-tree/README.md b/problems/maximum-depth-of-n-ary-tree/README.md index 3f997bd6d..676d323a5 100644 --- a/problems/maximum-depth-of-n-ary-tree/README.md +++ b/problems/maximum-depth-of-n-ary-tree/README.md @@ -5,7 +5,7 @@ -[< Previous](../quad-tree-intersection "Quad Tree Intersection") +[< Previous](../logical-or-of-two-binary-grids-represented-as-quad-trees "Logical OR of Two Binary Grids Represented as Quad-Trees")                  [Next >](../subarray-sum-equals-k "Subarray Sum Equals K") diff --git a/problems/number-of-days-between-two-dates/README.md b/problems/number-of-days-between-two-dates/README.md new file mode 100644 index 000000000..ebc0d0775 --- /dev/null +++ b/problems/number-of-days-between-two-dates/README.md @@ -0,0 +1,52 @@ + + + + + + + +[< Previous](../count-all-valid-pickup-and-delivery-options "Count All Valid Pickup and Delivery Options") +                 +[Next >](../validate-binary-tree-nodes "Validate Binary Tree Nodes") + +## [1360. Number of Days Between Two Dates (Easy)](https://leetcode.com/problems/number-of-days-between-two-dates "日期之间隔几天") + +

Write a program to count the number of days between two dates.

+ +

The two dates are given as strings, their format is YYYY-MM-DD as shown in the examples.

+ +

 

+

Example 1:

+
Input: date1 = "2019-06-29", date2 = "2019-06-30"
+Output: 1
+

Example 2:

+
Input: date1 = "2020-01-15", date2 = "2019-12-31"
+Output: 15
+
+

 

+

Constraints:

+ + + +### Hints +
+Hint 1 +Create a function f(date) that counts the number of days from 1900-01-01 to date. How can we calculate the answer ? +
+ +
+Hint 2 +The answer is just |f(date1) - f(date2)|. +
+ +
+Hint 3 +How to construct f(date) ? +
+ +
+Hint 4 +For each year from 1900 to year - 1 sum up 365 or 366 in case of leap years. Then sum up for each month the number of days, consider the case when the current year is leap, finally sum up the days. +
diff --git a/problems/number-of-substrings-containing-all-three-characters/README.md b/problems/number-of-substrings-containing-all-three-characters/README.md new file mode 100644 index 000000000..2dffce2c5 --- /dev/null +++ b/problems/number-of-substrings-containing-all-three-characters/README.md @@ -0,0 +1,62 @@ + + + + + + + +[< Previous](../apply-discount-every-n-orders "Apply Discount Every n Orders") +                 +[Next >](../count-all-valid-pickup-and-delivery-options "Count All Valid Pickup and Delivery Options") + +## [1358. Number of Substrings Containing All Three Characters (Medium)](https://leetcode.com/problems/number-of-substrings-containing-all-three-characters "包含所有三种字符的子字符串数目") + +

Given a string s consisting only of characters a, b and c.

+ +

Return the number of substrings containing at least one occurrence of all these characters a, b and c.

+ +

 

+

Example 1:

+ +
+Input: s = "abcabc"
+Output: 10
+Explanation: The substrings containing at least one occurrence of the characters ab and c are "abc", "abca", "abcab", "abcabc", "bca", "bcab", "bcabc", "cab", "cabc" and "abc" (again). 
+
+ +

Example 2:

+ +
+Input: s = "aaacb"
+Output: 3
+Explanation: The substrings containing at least one occurrence of the characters ab and c are "aaacb", "aacb" and "acb". 
+
+ +

Example 3:

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

 

+

Constraints:

+ + + +### Related Topics + [[String](../../tag/string/README.md)] + +### Hints +
+Hint 1 +For each position we simply need to find the first occurrence of a/b/c on or after this position. +
+ +
+Hint 2 +So we can pre-compute three link-list of indices of each a, b, and c. +
diff --git a/problems/rearrange-string-k-distance-apart/README.md b/problems/rearrange-string-k-distance-apart/README.md index 8ab0f8b6e..210352a9b 100644 --- a/problems/rearrange-string-k-distance-apart/README.md +++ b/problems/rearrange-string-k-distance-apart/README.md @@ -43,9 +43,9 @@ ### Related Topics + [[Hash Table](../../tag/hash-table/README.md)] [[Heap](../../tag/heap/README.md)] [[Greedy](../../tag/greedy/README.md)] - [[Hash Table](../../tag/hash-table/README.md)] ### Similar Questions 1. [Task Scheduler](../task-scheduler) (Medium) diff --git a/problems/reverse-words-in-a-string-iii/README.md b/problems/reverse-words-in-a-string-iii/README.md index 2060c20a6..8076b5b6d 100644 --- a/problems/reverse-words-in-a-string-iii/README.md +++ b/problems/reverse-words-in-a-string-iii/README.md @@ -7,7 +7,7 @@ [< Previous](../next-greater-element-iii "Next Greater Element III")                  -[Next >](../quad-tree-intersection "Quad Tree Intersection") +[Next >](../logical-or-of-two-binary-grids-represented-as-quad-trees "Logical OR of Two Binary Grids Represented as Quad-Trees") ## [557. Reverse Words in a String III (Easy)](https://leetcode.com/problems/reverse-words-in-a-string-iii "反转字符串中的单词 III") diff --git a/problems/sort-integers-by-the-number-of-1-bits/README.md b/problems/sort-integers-by-the-number-of-1-bits/README.md new file mode 100644 index 000000000..b53b087bb --- /dev/null +++ b/problems/sort-integers-by-the-number-of-1-bits/README.md @@ -0,0 +1,81 @@ + + + + + + + +[< Previous](../activity-participants "Activity Participants") +                 +[Next >](../apply-discount-every-n-orders "Apply Discount Every n Orders") + +## [1356. Sort Integers by The Number of 1 Bits (Easy)](https://leetcode.com/problems/sort-integers-by-the-number-of-1-bits "根据数字二进制下 1 的数目排序") + +

Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order.

+ +

Return the sorted array.

+ +

 

+

Example 1:

+ +
+Input: arr = [0,1,2,3,4,5,6,7,8]
+Output: [0,1,2,4,8,3,5,6,7]
+Explantion: [0] is the only integer with 0 bits.
+[1,2,4,8] all have 1 bit.
+[3,5,6] have 2 bits.
+[7] has 3 bits.
+The sorted array by bits is [0,1,2,4,8,3,5,6,7]
+
+ +

Example 2:

+ +
+Input: arr = [1024,512,256,128,64,32,16,8,4,2,1]
+Output: [1,2,4,8,16,32,64,128,256,512,1024]
+Explantion: All integers have 1 bit in the binary representation, you should just sort them in ascending order.
+
+ +

Example 3:

+ +
+Input: arr = [10000,10000]
+Output: [10000,10000]
+
+ +

Example 4:

+ +
+Input: arr = [2,3,5,7,11,13,17,19]
+Output: [2,3,5,17,7,11,13,19]
+
+ +

Example 5:

+ +
+Input: arr = [10,100,1000,10000]
+Output: [10,100,10000,1000]
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Sort](../../tag/sort/README.md)] + [[Bit Manipulation](../../tag/bit-manipulation/README.md)] + +### Hints +
+Hint 1 +Simulate the problem. Count the number of 1's in the binary representation of each integer. +
+ +
+Hint 2 +Sort by the number of 1's ascending and by the value in case of tie. +
diff --git a/problems/validate-binary-tree-nodes/README.md b/problems/validate-binary-tree-nodes/README.md new file mode 100644 index 000000000..fe4ac2367 --- /dev/null +++ b/problems/validate-binary-tree-nodes/README.md @@ -0,0 +1,78 @@ + + + + + + + +[< Previous](../number-of-days-between-two-dates "Number of Days Between Two Dates") +                 +[Next >](../closest-divisors "Closest Divisors") + +## [1361. Validate Binary Tree Nodes (Medium)](https://leetcode.com/problems/validate-binary-tree-nodes "验证二叉树") + +

You have n binary tree nodes numbered from 0 to n - 1 where node i has two children leftChild[i] and rightChild[i], return true if and only if all the given nodes form exactly one valid binary tree.

+ +

If node i has no left child then leftChild[i] will equal -1, similarly for the right child.

+ +

Note that the nodes have no values and that we only use the node numbers in this problem.

+ +

 

+

Example 1:

+ +

+ +
+Input: n = 4, leftChild = [1,-1,3,-1], rightChild = [2,-1,-1,-1]
+Output: true
+
+ +

Example 2:

+ +

+ +
+Input: n = 4, leftChild = [1,-1,3,-1], rightChild = [2,3,-1,-1]
+Output: false
+
+ +

Example 3:

+ +

+ +
+Input: n = 2, leftChild = [1,0], rightChild = [-1,-1]
+Output: false
+
+ +

Example 4:

+ +

+ +
+Input: n = 6, leftChild = [1,-1,-1,4,-1,-1], rightChild = [2,-1,-1,5,-1,-1]
+Output: false
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Graph](../../tag/graph/README.md)] + +### Hints +
+Hint 1 +Find the parent of each node. +
+ +
+Hint 2 +A valid tree must have nodes with only one parent and exactly one node with no parent. +
diff --git a/readme/301-600.md b/readme/301-600.md index 0baddcda9..114f9523c 100644 --- a/readme/301-600.md +++ b/readme/301-600.md @@ -319,7 +319,7 @@ LeetCode Problems' Solutions | 555 | [Split Concatenated Strings](https://leetcode.com/problems/split-concatenated-strings "分割连接字符串") 🔒 | [Go](../problems/split-concatenated-strings) | Medium | | 556 | [Next Greater Element III](https://leetcode.com/problems/next-greater-element-iii "下一个更大元素 III") | [Go](../problems/next-greater-element-iii) | Medium | | 557 | [Reverse Words in a String III](https://leetcode.com/problems/reverse-words-in-a-string-iii "反转字符串中的单词 III") | [Go](../problems/reverse-words-in-a-string-iii) | Easy | -| 558 | [Quad Tree Intersection](https://leetcode.com/problems/quad-tree-intersection "四叉树交集") | [Go](../problems/quad-tree-intersection) | Easy | +| 558 | [Logical OR of Two Binary Grids Represented as Quad-Trees](https://leetcode.com/problems/logical-or-of-two-binary-grids-represented-as-quad-trees "四叉树交集") | [Go](../problems/logical-or-of-two-binary-grids-represented-as-quad-trees) | Medium | | 559 | [Maximum Depth of N-ary Tree](https://leetcode.com/problems/maximum-depth-of-n-ary-tree "N叉树的最大深度") | [Go](../problems/maximum-depth-of-n-ary-tree) | Easy | | 560 | [Subarray Sum Equals K](https://leetcode.com/problems/subarray-sum-equals-k "和为K的子数组") | [Go](../problems/subarray-sum-equals-k) | Medium | | 561 | [Array Partition I](https://leetcode.com/problems/array-partition-i "数组拆分 I") | [Go](../problems/array-partition-i) | Easy | diff --git a/readme/601-900.md b/readme/601-900.md index b9e0660fa..78115c110 100644 --- a/readme/601-900.md +++ b/readme/601-900.md @@ -289,7 +289,7 @@ LeetCode Problems' Solutions | 825 | [Friends Of Appropriate Ages](https://leetcode.com/problems/friends-of-appropriate-ages "适龄的朋友") | [Go](../problems/friends-of-appropriate-ages) | Medium | | 826 | [Most Profit Assigning Work](https://leetcode.com/problems/most-profit-assigning-work "安排工作以达到最大收益") | [Go](../problems/most-profit-assigning-work) | Medium | | 827 | [Making A Large Island](https://leetcode.com/problems/making-a-large-island "最大人工岛") | [Go](../problems/making-a-large-island) | Hard | -| 828 | [Unique Letter String](https://leetcode.com/problems/unique-letter-string "独特字符串") | [Go](../problems/unique-letter-string) | Hard | +| 828 | [Count Unique Characters of All Substrings of a Given String](https://leetcode.com/problems/count-unique-characters-of-all-substrings-of-a-given-string "独特字符串") | [Go](../problems/count-unique-characters-of-all-substrings-of-a-given-string) | Hard | | 829 | [Consecutive Numbers Sum](https://leetcode.com/problems/consecutive-numbers-sum "连续整数求和") | [Go](../problems/consecutive-numbers-sum) | Hard | | 830 | [Positions of Large Groups](https://leetcode.com/problems/positions-of-large-groups "较大分组的位置") | [Go](../problems/positions-of-large-groups) | Easy | | 831 | [Masking Personal Information](https://leetcode.com/problems/masking-personal-information "隐藏个人信息") | [Go](../problems/masking-personal-information) | Medium | diff --git a/tag/bit-manipulation/README.md b/tag/bit-manipulation/README.md index 9b9b4004c..1c8caef90 100644 --- a/tag/bit-manipulation/README.md +++ b/tag/bit-manipulation/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1356 | [根据数字二进制下 1 的数目排序](../../problems/sort-integers-by-the-number-of-1-bits) | [[排序](../sort/README.md)] [[位运算](../bit-manipulation/README.md)] | Easy | | 1342 | [将数字变成 0 的操作次数](../../problems/number-of-steps-to-reduce-a-number-to-zero) | [[位运算](../bit-manipulation/README.md)] | Easy | | 1318 | [或运算的最小翻转次数](../../problems/minimum-flips-to-make-a-or-b-equal-to-c) | [[位运算](../bit-manipulation/README.md)] | Medium | | 1310 | [子数组异或查询](../../problems/xor-queries-of-a-subarray) | [[位运算](../bit-manipulation/README.md)] | Medium | diff --git a/tag/design/README.md b/tag/design/README.md index 91b34835c..fc0019638 100644 --- a/tag/design/README.md +++ b/tag/design/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1357 | [每隔 n 个顾客打折](../../problems/apply-discount-every-n-orders) | [[设计](../design/README.md)] | Medium | | 1352 | [最后 K 个数的乘积](../../problems/product-of-the-last-k-numbers) | [[设计](../design/README.md)] [[数组](../array/README.md)] | Medium | | 1348 | [推文计数](../../problems/tweet-counts-per-frequency) | [[设计](../design/README.md)] | Medium | | 1286 | [字母组合迭代器](../../problems/iterator-for-combination) | [[设计](../design/README.md)] [[回溯算法](../backtracking/README.md)] | Medium | diff --git a/tag/dynamic-programming/README.md b/tag/dynamic-programming/README.md index da437ed7f..e9291e5a1 100644 --- a/tag/dynamic-programming/README.md +++ b/tag/dynamic-programming/README.md @@ -9,6 +9,8 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1363 | [形成三的最大倍数](../../problems/largest-multiple-of-three) | [[数学](../math/README.md)] [[动态规划](../dynamic-programming/README.md)] | Hard | +| 1359 | [有效的快递序列数目](../../problems/count-all-valid-pickup-and-delivery-options) | [[数学](../math/README.md)] [[动态规划](../dynamic-programming/README.md)] | Hard | | 1349 | [参加考试的最大学生数](../../problems/maximum-students-taking-exam) | [[动态规划](../dynamic-programming/README.md)] | Hard | | 1340 | [跳跃游戏 V](../../problems/jump-game-v) | [[动态规划](../dynamic-programming/README.md)] | Hard | | 1339 | [分裂二叉树的最大乘积](../../problems/maximum-product-of-splitted-binary-tree) | [[树](../tree/README.md)] [[动态规划](../dynamic-programming/README.md)] | Medium | diff --git a/tag/graph/README.md b/tag/graph/README.md index 46ae8c5ba..906283e0a 100644 --- a/tag/graph/README.md +++ b/tag/graph/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1361 | [验证二叉树](../../problems/validate-binary-tree-nodes) | [[图](../graph/README.md)] | Medium | | 1334 | [阈值距离内邻居最少的城市](../../problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance) | [[图](../graph/README.md)] | Medium | | 1306 | [跳跃游戏 III](../../problems/jump-game-iii) | [[广度优先搜索](../breadth-first-search/README.md)] [[图](../graph/README.md)] | Medium | | 1267 | [统计参与通信的服务器](../../problems/count-servers-that-communicate) | [[图](../graph/README.md)] [[数组](../array/README.md)] | Medium | diff --git a/tag/math/README.md b/tag/math/README.md index 980532490..99ef5fd37 100644 --- a/tag/math/README.md +++ b/tag/math/README.md @@ -9,6 +9,9 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1363 | [形成三的最大倍数](../../problems/largest-multiple-of-three) | [[数学](../math/README.md)] [[动态规划](../dynamic-programming/README.md)] | Hard | +| 1362 | [最接近的因数](../../problems/closest-divisors) | [[数学](../math/README.md)] | Medium | +| 1359 | [有效的快递序列数目](../../problems/count-all-valid-pickup-and-delivery-options) | [[数学](../math/README.md)] [[动态规划](../dynamic-programming/README.md)] | Hard | | 1344 | [时钟指针的夹角](../../problems/angle-between-hands-of-a-clock) | [[数学](../math/README.md)] | Medium | | 1330 | [翻转子数组得到最大的数组值](../../problems/reverse-subarray-to-maximize-array-value) | [[数组](../array/README.md)] [[数学](../math/README.md)] | Hard | | 1323 | [6 和 9 组成的最大数字](../../problems/maximum-69-number) | [[数学](../math/README.md)] | Easy | diff --git a/tag/sort/README.md b/tag/sort/README.md index 1948cedb1..6880ce48e 100644 --- a/tag/sort/README.md +++ b/tag/sort/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1356 | [根据数字二进制下 1 的数目排序](../../problems/sort-integers-by-the-number-of-1-bits) | [[排序](../sort/README.md)] [[位运算](../bit-manipulation/README.md)] | Easy | | 1353 | [最多可以参加的会议数目](../../problems/maximum-number-of-events-that-can-be-attended) | [[贪心算法](../greedy/README.md)] [[排序](../sort/README.md)] [[线段树](../segment-tree/README.md)] | Medium | | 1333 | [餐厅过滤器](../../problems/filter-restaurants-by-vegan-friendly-price-and-distance) | [[排序](../sort/README.md)] [[数组](../array/README.md)] | Medium | | 1329 | [将矩阵按对角线排序](../../problems/sort-the-matrix-diagonally) | [[排序](../sort/README.md)] [[数组](../array/README.md)] | Medium | diff --git a/tag/string/README.md b/tag/string/README.md index a50d6891a..42e39f2bd 100644 --- a/tag/string/README.md +++ b/tag/string/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1358 | [包含所有三种字符的子字符串数目](../../problems/number-of-substrings-containing-all-three-characters) | [[字符串](../string/README.md)] | Medium | | 1347 | [制造字母异位词的最小步骤数](../../problems/minimum-number-of-steps-to-make-two-strings-anagram) | [[字符串](../string/README.md)] | Medium | | 1332 | [删除回文子序列](../../problems/remove-palindromic-subsequences) | [[字符串](../string/README.md)] | Easy | | 1328 | [破坏回文串](../../problems/break-a-palindrome) | [[字符串](../string/README.md)] | Medium | diff --git a/tag/two-pointers/README.md b/tag/two-pointers/README.md index 99b86e534..dcd4ad618 100644 --- a/tag/two-pointers/README.md +++ b/tag/two-pointers/README.md @@ -25,7 +25,7 @@ | 845 | [数组中的最长山脉](../../problems/longest-mountain-in-array) | [[双指针](../two-pointers/README.md)] | Medium | | 844 | [比较含退格的字符串](../../problems/backspace-string-compare) | [[栈](../stack/README.md)] [[双指针](../two-pointers/README.md)] | Easy | | 838 | [推多米诺](../../problems/push-dominoes) | [[双指针](../two-pointers/README.md)] [[动态规划](../dynamic-programming/README.md)] | Medium | -| 828 | [独特字符串](../../problems/unique-letter-string) | [[双指针](../two-pointers/README.md)] | Hard | +| 828 | [独特字符串](../../problems/count-unique-characters-of-all-substrings-of-a-given-string) | [[双指针](../two-pointers/README.md)] | Hard | | 826 | [安排工作以达到最大收益](../../problems/most-profit-assigning-work) | [[双指针](../two-pointers/README.md)] | Medium | | 763 | [划分字母区间](../../problems/partition-labels) | [[贪心算法](../greedy/README.md)] [[双指针](../two-pointers/README.md)] | Medium | | 723 | [粉碎糖果](../../problems/candy-crush) 🔒 | [[数组](../array/README.md)] [[双指针](../two-pointers/README.md)] | Medium |