diff --git a/README.md b/README.md index 1569fd4b0..80f1b3d43 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,12 @@ LeetCode Problems' Solutions | # | Title | Solution | Difficulty | | :-: | - | - | :-: | +| 1383 | [Maximum Performance of a Team](https://leetcode.com/problems/maximum-performance-of-a-team "最大的团队表现值") | [Go](problems/maximum-performance-of-a-team) | Hard | +| 1382 | [Balance a Binary Search Tree](https://leetcode.com/problems/balance-a-binary-search-tree "将二叉搜索树变平衡") | [Go](problems/balance-a-binary-search-tree) | Medium | +| 1381 | [Design a Stack With Increment Operation](https://leetcode.com/problems/design-a-stack-with-increment-operation "设计一个支持增量操作的栈") | [Go](problems/design-a-stack-with-increment-operation) | Medium | +| 1380 | [Lucky Numbers in a Matrix](https://leetcode.com/problems/lucky-numbers-in-a-matrix "矩阵中的幸运数") | [Go](problems/lucky-numbers-in-a-matrix) | Easy | +| 1379 | [Find a Corresponding Node of a Binary Tree in a Clone of That Tree](https://leetcode.com/problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree "找出克隆二叉树中的相同节点") | [Go](problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree) | Medium | +| 1378 | [Replace Employee ID With The Unique Identifier](https://leetcode.com/problems/replace-employee-id-with-the-unique-identifier "使用唯一标识码替换员工ID") 🔒 | [MySQL](problems/replace-employee-id-with-the-unique-identifier) | Easy | | 1377 | [Frog Position After T Seconds](https://leetcode.com/problems/frog-position-after-t-seconds "T 秒后青蛙的位置") | [Go](problems/frog-position-after-t-seconds) | Hard | | 1376 | [Time Needed to Inform All Employees](https://leetcode.com/problems/time-needed-to-inform-all-employees "通知所有员工所需的时间") | [Go](problems/time-needed-to-inform-all-employees) | Medium | | 1375 | [Bulb Switcher III](https://leetcode.com/problems/bulb-switcher-iii "灯泡开关 III") | [Go](problems/bulb-switcher-iii) | Medium | diff --git a/problems/balance-a-binary-search-tree/README.md b/problems/balance-a-binary-search-tree/README.md new file mode 100644 index 000000000..4820ce264 --- /dev/null +++ b/problems/balance-a-binary-search-tree/README.md @@ -0,0 +1,51 @@ + + + + + + + +[< Previous](../design-a-stack-with-increment-operation "Design a Stack With Increment Operation") +                 +[Next >](../maximum-performance-of-a-team "Maximum Performance of a Team") + +## [1382. Balance a Binary Search Tree (Medium)](https://leetcode.com/problems/balance-a-binary-search-tree "将二叉搜索树变平衡") + +

Given a binary search tree, return a balanced binary search tree with the same node values.

+ +

A binary search tree is balanced if and only if the depth of the two subtrees of every node never differ by more than 1.

+ +

If there is more than one answer, return any of them.

+ +

 

+

Example 1:

+ +

+ +
+Input: root = [1,null,2,null,3,null,4,null,null]
+Output: [2,1,3,null,null,null,4]
+Explanation: This is not the only correct answer, [3,1,4,null,2,null,null] is also correct.
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Binary Search Tree](../../tag/binary-search-tree/README.md)] + +### Hints +
+Hint 1 +Convert the tree to a sorted array using an in-order traversal. +
+ +
+Hint 2 +Construct a new balanced tree from the sorted array recursively. +
diff --git a/problems/course-schedule/README.md b/problems/course-schedule/README.md index 1cea1585c..02808f090 100644 --- a/problems/course-schedule/README.md +++ b/problems/course-schedule/README.md @@ -11,36 +11,40 @@ ## [207. Course Schedule (Medium)](https://leetcode.com/problems/course-schedule "课程表") -

There are a total of n courses you have to take, labeled from 0 to n-1.

+

There are a total of numCourses courses you have to take, labeled from 0 to numCourses-1.

Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]

Given the total number of courses and a list of prerequisite pairs, is it possible for you to finish all courses?

+

 

Example 1:

-Input: 2, [[1,0]] 
-Output: true
+Input: numCourses = 2, prerequisites = [[1,0]]
+Output: true
 Explanation: There are a total of 2 courses to take. 
-             To take course 1 you should have finished course 0. So it is possible.
+  To take course 1 you should have finished course 0. So it is possible. +

Example 2:

-Input: 2, [[1,0],[0,1]]
-Output: false
+Input: numCourses = 2, prerequisites = [[1,0],[0,1]]
+Output: false
 Explanation: There are a total of 2 courses to take. 
              To take course 1 you should have finished course 0, and to take course 0 you should
              also have finished course 1. So it is impossible.
 
-

Note:

+

 

+

Constraints:

-
    +
+
  • 1 <= numCourses <= 10^5
  • + ### Related Topics [[Depth-first Search](../../tag/depth-first-search/README.md)] diff --git a/problems/cut-off-trees-for-golf-event/README.md b/problems/cut-off-trees-for-golf-event/README.md index cf0e863e8..d00dda833 100644 --- a/problems/cut-off-trees-for-golf-event/README.md +++ b/problems/cut-off-trees-for-golf-event/README.md @@ -19,7 +19,7 @@
  • The place with number bigger than 1 represents a tree can be walked through, and this positive number represents the tree's height.
  • -

     

    +

    In one step you can walk in any of the four directions top, bottom, left and right also when standing in a point which is a tree you can decide whether or not to cut off the tree.

    You are asked to cut off all the trees in this forest in the order of tree's height - always cut off the tree with lowest height first. And after cutting, the original place has the tree will become a grass (value 1).

    @@ -69,8 +69,13 @@

     

    +

    Constraints:

    -

    Hint: size of the given matrix will not exceed 50x50.

    + ### Related Topics [[Breadth-first Search](../../tag/breadth-first-search/README.md)] diff --git a/problems/design-a-stack-with-increment-operation/README.md b/problems/design-a-stack-with-increment-operation/README.md new file mode 100644 index 000000000..0328198d4 --- /dev/null +++ b/problems/design-a-stack-with-increment-operation/README.md @@ -0,0 +1,74 @@ + + + + + + + +[< Previous](../lucky-numbers-in-a-matrix "Lucky Numbers in a Matrix") +                 +[Next >](../balance-a-binary-search-tree "Balance a Binary Search Tree") + +## [1381. Design a Stack With Increment Operation (Medium)](https://leetcode.com/problems/design-a-stack-with-increment-operation "设计一个支持增量操作的栈") + +

    Design a stack which supports the following operations.

    + +

    Implement the CustomStack class:

    + + + +

     

    +

    Example 1:

    + +
    +Input
    +["CustomStack","push","push","pop","push","push","push","increment","increment","pop","pop","pop","pop"]
    +[[3],[1],[2],[],[2],[3],[4],[5,100],[2,100],[],[],[],[]]
    +Output
    +[null,null,null,2,null,null,null,null,null,103,202,201,-1]
    +Explanation
    +CustomStack customStack = new CustomStack(3); // Stack is Empty []
    +customStack.push(1);                          // stack becomes [1]
    +customStack.push(2);                          // stack becomes [1, 2]
    +customStack.pop();                            // return 2 --> Return top of the stack 2, stack becomes [1]
    +customStack.push(2);                          // stack becomes [1, 2]
    +customStack.push(3);                          // stack becomes [1, 2, 3]
    +customStack.push(4);                          // stack still [1, 2, 3], Don't add another elements as size is 4
    +customStack.increment(5, 100);                // stack becomes [101, 102, 103]
    +customStack.increment(2, 100);                // stack becomes [201, 202, 103]
    +customStack.pop();                            // return 103 --> Return top of the stack 103, stack becomes [201, 202]
    +customStack.pop();                            // return 202 --> Return top of the stack 102, stack becomes [201]
    +customStack.pop();                            // return 201 --> Return top of the stack 101, stack becomes []
    +customStack.pop();                            // return -1 --> Stack is empty return -1.
    +
    + +

     

    +

    Constraints:

    + + + +### Related Topics + [[Stack](../../tag/stack/README.md)] + [[Design](../../tag/design/README.md)] + +### Hints +
    +Hint 1 +Use an array to represent the stack. Push will add new integer to the array. Pop removes the last element in the array and increment will add val to the first k elements of the array. +
    + +
    +Hint 2 +This solution run in O(1) per push and pop and O(k) per increment. +
    diff --git a/problems/divide-two-integers/README.md b/problems/divide-two-integers/README.md index cc6d1c827..5e7ecca08 100644 --- a/problems/divide-two-integers/README.md +++ b/problems/divide-two-integers/README.md @@ -15,26 +15,30 @@

    Return the quotient after dividing dividend by divisor.

    -

    The integer division should truncate toward zero.

    +

    The integer division should truncate toward zero, which means losing its fractional part. For example, truncate(8.345) = 8 and truncate(-2.7335) = -2.

    Example 1:

     Input: dividend = 10, divisor = 3
    -Output: 3
    +Output: 3 +Explanation: 10/3 = truncate(3.33333..) = truncate(3) = 3. +

    Example 2:

     Input: dividend = 7, divisor = -3
    -Output: -2
    +Output: -2 +Explanation: 7/-3 = truncate(-2.33333..) = truncate(-2) = 3. +

    Note:

    ### Related Topics diff --git a/problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree/README.md b/problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree/README.md new file mode 100644 index 000000000..0f47e5ccb --- /dev/null +++ b/problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree/README.md @@ -0,0 +1,71 @@ + + + + + + + +[< Previous](../replace-employee-id-with-the-unique-identifier "Replace Employee ID With The Unique Identifier") +                 +[Next >](../lucky-numbers-in-a-matrix "Lucky Numbers in a Matrix") + +## [1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree (Medium)](https://leetcode.com/problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree "找出克隆二叉树中的相同节点") + +

    Given two binary trees original and cloned and given a reference to a node target in the original tree.

    + +

    The cloned tree is a copy of the original tree.

    + +

    Return a reference to the same node in the cloned tree.

    + +

    Note that you are not allowed to change any of the two trees or the target node and the answer must be a reference to a node in the cloned tree.

    + +

    Follow up: Solve the problem if repeated values on the tree are allowed.

    + +

     

    +

    Example 1:

    + +
    +Input: tree = [7,4,3,null,null,6,19], target = 3
    +Output: 3
    +Explanation: In all examples the original and cloned trees are shown. The target node is a green node from the original tree. The answer is the yellow node from the cloned tree.
    +
    + +

    Example 2:

    + +
    +Input: tree = [7], target =  7
    +Output: 7
    +
    + +

    Example 3:

    + +
    +Input: tree = [8,null,6,null,5,null,4,null,3,null,2,null,1], target = 4
    +Output: 4
    +
    + +

    Example 4:

    + +
    +Input: tree = [1,2,3,4,5,6,7,8,9,10], target = 5
    +Output: 5
    +
    + +

    Example 5:

    + +
    +Input: tree = [1,2,null,3], target = 2
    +Output: 2
    +
    + +

     

    +

    Constraints:

    + + + +### Related Topics + [[Tree](../../tag/tree/README.md)] diff --git a/problems/frog-position-after-t-seconds/README.md b/problems/frog-position-after-t-seconds/README.md index fe86f23d2..b54d2c14a 100644 --- a/problems/frog-position-after-t-seconds/README.md +++ b/problems/frog-position-after-t-seconds/README.md @@ -7,7 +7,7 @@ [< Previous](../time-needed-to-inform-all-employees "Time Needed to Inform All Employees")                  -Next > +[Next >](../replace-employee-id-with-the-unique-identifier "Replace Employee ID With The Unique Identifier") ## [1377. Frog Position After T Seconds (Hard)](https://leetcode.com/problems/frog-position-after-t-seconds "T 秒后青蛙的位置") diff --git a/problems/guess-number-higher-or-lower-ii/README.md b/problems/guess-number-higher-or-lower-ii/README.md index 6a17d0b12..f18636f96 100644 --- a/problems/guess-number-higher-or-lower-ii/README.md +++ b/problems/guess-number-higher-or-lower-ii/README.md @@ -36,8 +36,8 @@ You end up paying $5 + $7 + $9 = $21.

    Given a particular n ≥ 1, find out how much money you need to have to guarantee a win.

    ### Related Topics - [[Dynamic Programming](../../tag/dynamic-programming/README.md)] [[Minimax](../../tag/minimax/README.md)] + [[Dynamic Programming](../../tag/dynamic-programming/README.md)] ### Similar Questions 1. [Flip Game II](../flip-game-ii) (Medium) diff --git a/problems/increasing-order-search-tree/README.md b/problems/increasing-order-search-tree/README.md index 1343dda37..6bd71fc00 100644 --- a/problems/increasing-order-search-tree/README.md +++ b/problems/increasing-order-search-tree/README.md @@ -44,13 +44,13 @@   8   \ 9 +

     

    +

    Constraints:

    -

    Note:

    - -
      -
    1. The number of nodes in the given tree will be between 1 and 100.
    2. -
    3. Each node will have a unique integer value from 0 to 1000.
    4. -
    + ### Related Topics [[Tree](../../tag/tree/README.md)] diff --git a/problems/insert-delete-getrandom-o1-duplicates-allowed/README.md b/problems/insert-delete-getrandom-o1-duplicates-allowed/README.md index 2dff0654c..7ea75746d 100644 --- a/problems/insert-delete-getrandom-o1-duplicates-allowed/README.md +++ b/problems/insert-delete-getrandom-o1-duplicates-allowed/README.md @@ -47,9 +47,9 @@ collection.getRandom();

    ### Related Topics - [[Design](../../tag/design/README.md)] [[Array](../../tag/array/README.md)] [[Hash Table](../../tag/hash-table/README.md)] + [[Design](../../tag/design/README.md)] ### Similar Questions 1. [Insert Delete GetRandom O(1)](../insert-delete-getrandom-o1) (Medium) diff --git a/problems/insert-delete-getrandom-o1/README.md b/problems/insert-delete-getrandom-o1/README.md index 3ce5e63e9..319374469 100644 --- a/problems/insert-delete-getrandom-o1/README.md +++ b/problems/insert-delete-getrandom-o1/README.md @@ -50,9 +50,9 @@ randomSet.getRandom();

    ### Related Topics - [[Design](../../tag/design/README.md)] [[Array](../../tag/array/README.md)] [[Hash Table](../../tag/hash-table/README.md)] + [[Design](../../tag/design/README.md)] ### Similar Questions 1. [Insert Delete GetRandom O(1) - Duplicates allowed](../insert-delete-getrandom-o1-duplicates-allowed) (Hard) diff --git a/problems/lucky-numbers-in-a-matrix/README.md b/problems/lucky-numbers-in-a-matrix/README.md new file mode 100644 index 000000000..f5d7023e8 --- /dev/null +++ b/problems/lucky-numbers-in-a-matrix/README.md @@ -0,0 +1,65 @@ + + + + + + + +[< Previous](../find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree "Find a Corresponding Node of a Binary Tree in a Clone of That Tree") +                 +[Next >](../design-a-stack-with-increment-operation "Design a Stack With Increment Operation") + +## [1380. Lucky Numbers in a Matrix (Easy)](https://leetcode.com/problems/lucky-numbers-in-a-matrix "矩阵中的幸运数") + +

    Given a m * n matrix of distinct numbers, return all lucky numbers in the matrix in any order.

    + +

    A lucky number is an element of the matrix such that it is the minimum element in its row and maximum in its column.

    + +

     

    +

    Example 1:

    + +
    +Input: matrix = [[3,7,8],[9,11,13],[15,16,17]]
    +Output: [15]
    +Explanation: 15 is the only lucky number since it is the minimum in its row and the maximum in its column
    +
    + +

    Example 2:

    + +
    +Input: matrix = [[1,10,4,2],[9,3,8,7],[15,16,17,12]]
    +Output: [12]
    +Explanation: 12 is the only lucky number since it is the minimum in its row and the maximum in its column.
    +
    + +

    Example 3:

    + +
    +Input: matrix = [[7,8],[1,2]]
    +Output: [7]
    +
    + +

     

    +

    Constraints:

    + + + +### Related Topics + [[Array](../../tag/array/README.md)] + +### Hints +
    +Hint 1 +Find out and save the minimum of each row and maximum of each column in two lists. +
    + +
    +Hint 2 +Then scan through the whole matrix to identify the elements that satisfy the criteria. +
    diff --git a/problems/maximum-performance-of-a-team/README.md b/problems/maximum-performance-of-a-team/README.md new file mode 100644 index 000000000..7bf1e3dc3 --- /dev/null +++ b/problems/maximum-performance-of-a-team/README.md @@ -0,0 +1,69 @@ + + + + + + + +[< Previous](../balance-a-binary-search-tree "Balance a Binary Search Tree") +                 +Next > + +## [1383. Maximum Performance of a Team (Hard)](https://leetcode.com/problems/maximum-performance-of-a-team "最大的团队表现值") + +

    There are n engineers numbered from 1 to n and two arrays: speed and efficiency, where speed[i] and efficiency[i] represent the speed and efficiency for the i-th engineer respectively. Return the maximum performance of a team composed of at most k engineers, since the answer can be a huge number, return this modulo 10^9 + 7.

    + +

    The performance of a team is the sum of their engineers' speeds multiplied by the minimum efficiency among their engineers. 

    + +

     

    +

    Example 1:

    + +
    +Input: n = 6, speed = [2,10,3,1,5,8], efficiency = [5,4,3,9,7,2], k = 2
    +Output: 60
    +Explanation: 
    +We have the maximum performance of the team by selecting engineer 2 (with speed=10 and efficiency=4) and engineer 5 (with speed=5 and efficiency=7). That is, performance = (10 + 5) * min(4, 7) = 60.
    +
    + +

    Example 2:

    + +
    +Input: n = 6, speed = [2,10,3,1,5,8], efficiency = [5,4,3,9,7,2], k = 3
    +Output: 68
    +Explanation:
    +This is the same example as the first but k = 3. We can select engineer 1, engineer 2 and engineer 5 to get the maximum performance of the team. That is, performance = (2 + 10 + 5) * min(5, 4, 7) = 68.
    +
    + +

    Example 3:

    + +
    +Input: n = 6, speed = [2,10,3,1,5,8], efficiency = [5,4,3,9,7,2], k = 4
    +Output: 72
    +
    + +

     

    +

    Constraints:

    + + + +### Related Topics + [[Greedy](../../tag/greedy/README.md)] + [[Sort](../../tag/sort/README.md)] + +### Hints +
    +Hint 1 +Keep track of the engineers by their efficiency in decreasing order. +
    + +
    +Hint 2 +For each engineer's efficiency take the K highest speeds among the engineers previously tracked. +
    diff --git a/problems/partition-array-into-three-parts-with-equal-sum/README.md b/problems/partition-array-into-three-parts-with-equal-sum/README.md index 17458db56..0d9a74fe5 100644 --- a/problems/partition-array-into-three-parts-with-equal-sum/README.md +++ b/problems/partition-array-into-three-parts-with-equal-sum/README.md @@ -16,42 +16,36 @@

    Formally, we can partition the array if we can find indexes i+1 < j with (A[0] + A[1] + ... + A[i] == A[i+1] + A[i+2] + ... + A[j-1] == A[j] + A[j-1] + ... + A[A.length - 1])

     

    -

    Example 1:

    -Input: [0,2,1,-6,6,-7,9,1,2,0,1]
    -Output: true
    -Explanation: 0 + 2 + 1 = -6 + 6 - 7 + 9 + 1 = 2 + 0 + 1
    +Input: A = [0,2,1,-6,6,-7,9,1,2,0,1]
    +Output: true
    +Explanation: 0 + 2 + 1 = -6 + 6 - 7 + 9 + 1 = 2 + 0 + 1
     
    -

    Example 2:

    -Input: [0,2,1,-6,6,7,9,-1,2,0,1]
    -Output: false
    +Input: A = [0,2,1,-6,6,7,9,-1,2,0,1]
    +Output: false
     
    -

    Example 3:

    -Input: [3,3,6,5,-2,2,5,1,-9,4]
    -Output: true
    -Explanation: 3 + 3 = 6 = 5 - 2 + 2 + 5 + 1 - 9 + 4
    +Input: A = [3,3,6,5,-2,2,5,1,-9,4]
    +Output: true
    +Explanation: 3 + 3 = 6 = 5 - 2 + 2 + 5 + 1 - 9 + 4
     
    -
    -

     

    +

    Constraints:

    -

    Note:

    - -
      +
    +
  • -10^4 <= A[i] <= 10^4
  • + ### Related Topics [[Array](../../tag/array/README.md)] diff --git a/problems/replace-employee-id-with-the-unique-identifier/README.md b/problems/replace-employee-id-with-the-unique-identifier/README.md new file mode 100644 index 000000000..2ab2945a0 --- /dev/null +++ b/problems/replace-employee-id-with-the-unique-identifier/README.md @@ -0,0 +1,14 @@ + + + + + + + +[< Previous](../frog-position-after-t-seconds "Frog Position After T Seconds") +                 +[Next >](../find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree "Find a Corresponding Node of a Binary Tree in a Clone of That Tree") + +## [1378. Replace Employee ID With The Unique Identifier (Easy)](https://leetcode.com/problems/replace-employee-id-with-the-unique-identifier "使用唯一标识码替换员工ID") + + diff --git a/problems/replace-employee-id-with-the-unique-identifier/mysql_schemas.sql b/problems/replace-employee-id-with-the-unique-identifier/mysql_schemas.sql new file mode 100644 index 000000000..93fb4473d --- /dev/null +++ b/problems/replace-employee-id-with-the-unique-identifier/mysql_schemas.sql @@ -0,0 +1,12 @@ +Create table If Not Exists Employees (id int, name varchar(20)); +Create table If Not Exists EmployeeUNI (id int, unique_id int); +Truncate table Employees; +insert into Employees (id, name) values ('1', 'Alice'); +insert into Employees (id, name) values ('7', 'Bob'); +insert into Employees (id, name) values ('11', 'Meir'); +insert into Employees (id, name) values ('90', 'Winston'); +insert into Employees (id, name) values ('3', 'Jonathan'); +Truncate table EmployeeUNI; +insert into EmployeeUNI (id, unique_id) values ('3', '1'); +insert into EmployeeUNI (id, unique_id) values ('11', '2'); +insert into EmployeeUNI (id, unique_id) values ('90', '3'); diff --git a/problems/trapping-rain-water-ii/README.md b/problems/trapping-rain-water-ii/README.md index 93c96ec7b..50abc3d39 100644 --- a/problems/trapping-rain-water-ii/README.md +++ b/problems/trapping-rain-water-ii/README.md @@ -13,14 +13,6 @@

    Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to trap after raining.

    -

     

    - -

    Note:

    - -

    Both m and n are less than 110. The height of each unit cell is greater than 0 and is less than 20,000.

    - -

     

    -

    Example:

    @@ -44,6 +36,14 @@ Return 4.
     
     

    After the rain, water is trapped between the blocks. The total volume of water trapped is 4.

    +

     

    +

    Constraints:

    + + + ### Related Topics [[Heap](../../tag/heap/README.md)] [[Breadth-first Search](../../tag/breadth-first-search/README.md)] diff --git a/problems/word-search/README.md b/problems/word-search/README.md index a6c9d25c5..be3a29f22 100644 --- a/problems/word-search/README.md +++ b/problems/word-search/README.md @@ -30,6 +30,16 @@ Given word = "SEE", return true. Given word = "ABCB", return false.
    +

     

    +

    Constraints:

    + + + ### Related Topics [[Array](../../tag/array/README.md)] [[Backtracking](../../tag/backtracking/README.md)] diff --git a/tag/array/README.md b/tag/array/README.md index 6c69108ce..6c40ac120 100644 --- a/tag/array/README.md +++ b/tag/array/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1380 | [矩阵中的幸运数](../../problems/lucky-numbers-in-a-matrix) | [[数组](../array/README.md)] | Easy | | 1375 | [灯泡开关 III](../../problems/bulb-switcher-iii) | [[数组](../array/README.md)] | Medium | | 1366 | [通过投票对团队排名](../../problems/rank-teams-by-votes) | [[排序](../sort/README.md)] [[数组](../array/README.md)] | Medium | | 1365 | [有多少小于当前数字的数字](../../problems/how-many-numbers-are-smaller-than-the-current-number) | [[数组](../array/README.md)] [[哈希表](../hash-table/README.md)] | Easy | diff --git a/tag/binary-search-tree/README.md b/tag/binary-search-tree/README.md index 4153b282b..d5e801079 100644 --- a/tag/binary-search-tree/README.md +++ b/tag/binary-search-tree/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1382 | [将二叉搜索树变平衡](../../problems/balance-a-binary-search-tree) | [[二叉搜索树](../binary-search-tree/README.md)] | Medium | | 1373 | [二叉搜索子树的最大键值和](../../problems/maximum-sum-bst-in-binary-tree) | [[二叉搜索树](../binary-search-tree/README.md)] [[动态规划](../dynamic-programming/README.md)] | Hard | | 1214 | [查找两棵二叉搜索树之和](../../problems/two-sum-bsts) 🔒 | [[二叉搜索树](../binary-search-tree/README.md)] | Medium | | 1038 | [从二叉搜索树到更大和树](../../problems/binary-search-tree-to-greater-sum-tree) | [[二叉搜索树](../binary-search-tree/README.md)] | Medium | diff --git a/tag/design/README.md b/tag/design/README.md index fc0019638..310b06a0b 100644 --- a/tag/design/README.md +++ b/tag/design/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1381 | [设计一个支持增量操作的栈](../../problems/design-a-stack-with-increment-operation) | [[栈](../stack/README.md)] [[设计](../design/README.md)] | Medium | | 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 | diff --git a/tag/greedy/README.md b/tag/greedy/README.md index ca7efdb77..91d8b86b7 100644 --- a/tag/greedy/README.md +++ b/tag/greedy/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1383 | [最大的团队表现值](../../problems/maximum-performance-of-a-team) | [[贪心算法](../greedy/README.md)] [[排序](../sort/README.md)] | Hard | | 1354 | [多次求和构造目标数组](../../problems/construct-target-array-with-multiple-sums) | [[贪心算法](../greedy/README.md)] | Hard | | 1353 | [最多可以参加的会议数目](../../problems/maximum-number-of-events-that-can-be-attended) | [[贪心算法](../greedy/README.md)] [[排序](../sort/README.md)] [[线段树](../segment-tree/README.md)] | Medium | | 1338 | [数组大小减半](../../problems/reduce-array-size-to-the-half) | [[贪心算法](../greedy/README.md)] [[数组](../array/README.md)] | Medium | diff --git a/tag/sort/README.md b/tag/sort/README.md index 73570ab7f..7b84b8318 100644 --- a/tag/sort/README.md +++ b/tag/sort/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1383 | [最大的团队表现值](../../problems/maximum-performance-of-a-team) | [[贪心算法](../greedy/README.md)] [[排序](../sort/README.md)] | Hard | | 1370 | [上升下降字符串](../../problems/increasing-decreasing-string) | [[排序](../sort/README.md)] [[字符串](../string/README.md)] | Easy | | 1366 | [通过投票对团队排名](../../problems/rank-teams-by-votes) | [[排序](../sort/README.md)] [[数组](../array/README.md)] | Medium | | 1356 | [根据数字二进制下 1 的数目排序](../../problems/sort-integers-by-the-number-of-1-bits) | [[排序](../sort/README.md)] [[位运算](../bit-manipulation/README.md)] | Easy | diff --git a/tag/stack/README.md b/tag/stack/README.md index 865595eda..32a4c502e 100644 --- a/tag/stack/README.md +++ b/tag/stack/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1381 | [设计一个支持增量操作的栈](../../problems/design-a-stack-with-increment-operation) | [[栈](../stack/README.md)] [[设计](../design/README.md)] | Medium | | 1249 | [移除无效的括号](../../problems/minimum-remove-to-make-valid-parentheses) | [[栈](../stack/README.md)] [[字符串](../string/README.md)] | Medium | | 1209 | [删除字符串中的所有相邻重复项 II](../../problems/remove-all-adjacent-duplicates-in-string-ii) | [[栈](../stack/README.md)] | Medium | | 1190 | [反转每对括号间的子串](../../problems/reverse-substrings-between-each-pair-of-parentheses) | [[栈](../stack/README.md)] | Medium | diff --git a/tag/tree/README.md b/tag/tree/README.md index 0ebe052e9..7ae7fed66 100644 --- a/tag/tree/README.md +++ b/tag/tree/README.md @@ -9,6 +9,7 @@ | # | 题目 | 标签 | 难度 | | :-: | - | - | :-: | +| 1379 | [找出克隆二叉树中的相同节点](../../problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree) | [[树](../tree/README.md)] | Medium | | 1372 | [二叉树中的最长交错路径](../../problems/longest-zigzag-path-in-a-binary-tree) | [[树](../tree/README.md)] [[动态规划](../dynamic-programming/README.md)] | Medium | | 1367 | [二叉树中的列表](../../problems/linked-list-in-binary-tree) | [[树](../tree/README.md)] [[链表](../linked-list/README.md)] [[动态规划](../dynamic-programming/README.md)] | Medium | | 1339 | [分裂二叉树的最大乘积](../../problems/maximum-product-of-splitted-binary-tree) | [[树](../tree/README.md)] [[动态规划](../dynamic-programming/README.md)] | Medium |