diff --git a/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/README.md b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/README.md index 3b5e1802365b2..1dcab35257041 100644 --- a/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/README.md +++ b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/README.md @@ -60,6 +60,8 @@ +DFS。 + ### **Python3** @@ -67,7 +69,22 @@ ```python - +# Definition for a binary tree node. +# class TreeNode: +# def __init__(self, val=0, left=None, right=None): +# self.val = val +# self.left = left +# self.right = right +class Solution: + def isValidSequence(self, root: TreeNode, arr: List[int]) -> bool: + def dfs(root, u): + if root is None or root.val != arr[u]: + return False + if u == len(arr) - 1: + return root.left is None and root.right is None + return dfs(root.left, u + 1) or dfs(root.right, u + 1) + + return dfs(root, 0) ``` ### **Java** @@ -75,7 +92,93 @@ ```java +/** + * Definition for a binary tree node. + * public class TreeNode { + * int val; + * TreeNode left; + * TreeNode right; + * TreeNode() {} + * TreeNode(int val) { this.val = val; } + * TreeNode(int val, TreeNode left, TreeNode right) { + * this.val = val; + * this.left = left; + * this.right = right; + * } + * } + */ +class Solution { + private int[] arr; + + public boolean isValidSequence(TreeNode root, int[] arr) { + this.arr = arr; + return dfs(root, 0); + } + + private boolean dfs(TreeNode root, int u) { + if (root == null || root.val != arr[u]) { + return false; + } + if (u == arr.length - 1) { + return root.left == null && root.right == null; + } + return dfs(root.left, u + 1) || dfs(root.right, u + 1); + } +} +``` + +### **C++** + +```cpp +/** + * Definition for a binary tree node. + * struct TreeNode { + * int val; + * TreeNode *left; + * TreeNode *right; + * TreeNode() : val(0), left(nullptr), right(nullptr) {} + * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} + * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} + * }; + */ +class Solution { +public: + bool isValidSequence(TreeNode* root, vector& arr) { + return dfs(root, arr, 0); + } + + bool dfs(TreeNode* root, vector& arr, int u) { + if (!root || root->val != arr[u]) return false; + if (u == arr.size() - 1) return !root->left && !root->right; + return dfs(root->left, arr, u + 1) || dfs(root->right, arr, u + 1); + } +}; +``` +### **Go** + +```go +/** + * Definition for a binary tree node. + * type TreeNode struct { + * Val int + * Left *TreeNode + * Right *TreeNode + * } + */ +func isValidSequence(root *TreeNode, arr []int) bool { + var dfs func(root *TreeNode, u int) bool + dfs = func(root *TreeNode, u int) bool { + if root == nil || root.Val != arr[u] { + return false + } + if u == len(arr)-1 { + return root.Left == nil && root.Right == nil + } + return dfs(root.Left, u+1) || dfs(root.Right, u+1) + } + return dfs(root, 0) +} ``` ### **...** diff --git a/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/README_EN.md b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/README_EN.md index 69b1145a59500..8bee25a9f02e1 100644 --- a/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/README_EN.md +++ b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/README_EN.md @@ -54,18 +54,121 @@ Other valid sequences are: ## Solutions +DFS. + ### **Python3** ```python - +# Definition for a binary tree node. +# class TreeNode: +# def __init__(self, val=0, left=None, right=None): +# self.val = val +# self.left = left +# self.right = right +class Solution: + def isValidSequence(self, root: TreeNode, arr: List[int]) -> bool: + def dfs(root, u): + if root is None or root.val != arr[u]: + return False + if u == len(arr) - 1: + return root.left is None and root.right is None + return dfs(root.left, u + 1) or dfs(root.right, u + 1) + + return dfs(root, 0) ``` ### **Java** ```java +/** + * Definition for a binary tree node. + * public class TreeNode { + * int val; + * TreeNode left; + * TreeNode right; + * TreeNode() {} + * TreeNode(int val) { this.val = val; } + * TreeNode(int val, TreeNode left, TreeNode right) { + * this.val = val; + * this.left = left; + * this.right = right; + * } + * } + */ +class Solution { + private int[] arr; + + public boolean isValidSequence(TreeNode root, int[] arr) { + this.arr = arr; + return dfs(root, 0); + } + + private boolean dfs(TreeNode root, int u) { + if (root == null || root.val != arr[u]) { + return false; + } + if (u == arr.length - 1) { + return root.left == null && root.right == null; + } + return dfs(root.left, u + 1) || dfs(root.right, u + 1); + } +} +``` + +### **C++** + +```cpp +/** + * Definition for a binary tree node. + * struct TreeNode { + * int val; + * TreeNode *left; + * TreeNode *right; + * TreeNode() : val(0), left(nullptr), right(nullptr) {} + * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} + * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} + * }; + */ +class Solution { +public: + bool isValidSequence(TreeNode* root, vector& arr) { + return dfs(root, arr, 0); + } + + bool dfs(TreeNode* root, vector& arr, int u) { + if (!root || root->val != arr[u]) return false; + if (u == arr.size() - 1) return !root->left && !root->right; + return dfs(root->left, arr, u + 1) || dfs(root->right, arr, u + 1); + } +}; +``` +### **Go** + +```go +/** + * Definition for a binary tree node. + * type TreeNode struct { + * Val int + * Left *TreeNode + * Right *TreeNode + * } + */ +func isValidSequence(root *TreeNode, arr []int) bool { + var dfs func(root *TreeNode, u int) bool + dfs = func(root *TreeNode, u int) bool { + if root == nil || root.Val != arr[u] { + return false + } + if u == len(arr)-1 { + return root.Left == nil && root.Right == nil + } + return dfs(root.Left, u+1) || dfs(root.Right, u+1) + } + return dfs(root, 0) +} ``` ### **...** diff --git a/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.cpp b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.cpp new file mode 100644 index 0000000000000..788669cac1b0a --- /dev/null +++ b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.cpp @@ -0,0 +1,23 @@ +/** + * Definition for a binary tree node. + * struct TreeNode { + * int val; + * TreeNode *left; + * TreeNode *right; + * TreeNode() : val(0), left(nullptr), right(nullptr) {} + * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} + * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} + * }; + */ +class Solution { +public: + bool isValidSequence(TreeNode* root, vector& arr) { + return dfs(root, arr, 0); + } + + bool dfs(TreeNode* root, vector& arr, int u) { + if (!root || root->val != arr[u]) return false; + if (u == arr.size() - 1) return !root->left && !root->right; + return dfs(root->left, arr, u + 1) || dfs(root->right, arr, u + 1); + } +}; \ No newline at end of file diff --git a/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.go b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.go new file mode 100644 index 0000000000000..c28575311b723 --- /dev/null +++ b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.go @@ -0,0 +1,21 @@ +/** + * Definition for a binary tree node. + * type TreeNode struct { + * Val int + * Left *TreeNode + * Right *TreeNode + * } + */ +func isValidSequence(root *TreeNode, arr []int) bool { + var dfs func(root *TreeNode, u int) bool + dfs = func(root *TreeNode, u int) bool { + if root == nil || root.Val != arr[u] { + return false + } + if u == len(arr)-1 { + return root.Left == nil && root.Right == nil + } + return dfs(root.Left, u+1) || dfs(root.Right, u+1) + } + return dfs(root, 0) +} \ No newline at end of file diff --git a/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.java b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.java new file mode 100644 index 0000000000000..1a3e847f580c5 --- /dev/null +++ b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.java @@ -0,0 +1,33 @@ +/** + * Definition for a binary tree node. + * public class TreeNode { + * int val; + * TreeNode left; + * TreeNode right; + * TreeNode() {} + * TreeNode(int val) { this.val = val; } + * TreeNode(int val, TreeNode left, TreeNode right) { + * this.val = val; + * this.left = left; + * this.right = right; + * } + * } + */ +class Solution { + private int[] arr; + + public boolean isValidSequence(TreeNode root, int[] arr) { + this.arr = arr; + return dfs(root, 0); + } + + private boolean dfs(TreeNode root, int u) { + if (root == null || root.val != arr[u]) { + return false; + } + if (u == arr.length - 1) { + return root.left == null && root.right == null; + } + return dfs(root.left, u + 1) || dfs(root.right, u + 1); + } +} \ No newline at end of file diff --git a/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.py b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.py new file mode 100644 index 0000000000000..f753726063011 --- /dev/null +++ b/solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.py @@ -0,0 +1,16 @@ +# Definition for a binary tree node. +# class TreeNode: +# def __init__(self, val=0, left=None, right=None): +# self.val = val +# self.left = left +# self.right = right +class Solution: + def isValidSequence(self, root: TreeNode, arr: List[int]) -> bool: + def dfs(root, u): + if root is None or root.val != arr[u]: + return False + if u == len(arr) - 1: + return root.left is None and root.right is None + return dfs(root.left, u + 1) or dfs(root.right, u + 1) + + return dfs(root, 0) diff --git a/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/README.md b/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/README.md new file mode 100644 index 0000000000000..7647231cd5a79 --- /dev/null +++ b/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/README.md @@ -0,0 +1,88 @@ +# [2128. Remove All Ones With Row and Column Flips](https://leetcode-cn.com/problems/remove-all-ones-with-row-and-column-flips) + +[English Version](/solution/2100-2199/2128.Remove%20All%20Ones%20With%20Row%20and%20Column%20Flips/README_EN.md) + +## 题目描述 + + + +

You are given an m x n binary matrix grid.

+ +

In one operation, you can choose any row or column and flip each value in that row or column (i.e., changing all 0's to 1's, and all 1's to 0's).

+ +

Return true if it is possible to remove all 1's from grid using any number of operations or false otherwise.

+ +

 

+

Example 1:

+ +
+Input: grid = [[0,1,0],[1,0,1],[0,1,0]]
+Output: true
+Explanation: One possible way to remove all 1's from grid is to:
+- Flip the middle row
+- Flip the middle column
+
+ +

Example 2:

+ +
+Input: grid = [[1,1,0],[0,0,0],[0,0,0]]
+Output: false
+Explanation: It is impossible to remove all 1's from grid.
+
+ +

Example 3:

+ +
+Input: grid = [[0]]
+Output: true
+Explanation: There are no 1's in grid.
+
+ +

 

+

Constraints:

+ +
    +
  • m == grid.length
  • +
  • n == grid[i].length
  • +
  • 1 <= m, n <= 300
  • +
  • grid[i][j] is either 0 or 1.
  • +
+ +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **TypeScript** + + + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/README_EN.md b/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/README_EN.md new file mode 100644 index 0000000000000..9a66ecfcceded --- /dev/null +++ b/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/README_EN.md @@ -0,0 +1,79 @@ +# [2128. Remove All Ones With Row and Column Flips](https://leetcode.com/problems/remove-all-ones-with-row-and-column-flips) + +[中文文档](/solution/2100-2199/2128.Remove%20All%20Ones%20With%20Row%20and%20Column%20Flips/README.md) + +## Description + +

You are given an m x n binary matrix grid.

+ +

In one operation, you can choose any row or column and flip each value in that row or column (i.e., changing all 0's to 1's, and all 1's to 0's).

+ +

Return true if it is possible to remove all 1's from grid using any number of operations or false otherwise.

+ +

 

+

Example 1:

+ +
+Input: grid = [[0,1,0],[1,0,1],[0,1,0]]
+Output: true
+Explanation: One possible way to remove all 1's from grid is to:
+- Flip the middle row
+- Flip the middle column
+
+ +

Example 2:

+ +
+Input: grid = [[1,1,0],[0,0,0],[0,0,0]]
+Output: false
+Explanation: It is impossible to remove all 1's from grid.
+
+ +

Example 3:

+ +
+Input: grid = [[0]]
+Output: true
+Explanation: There are no 1's in grid.
+
+ +

 

+

Constraints:

+ +
    +
  • m == grid.length
  • +
  • n == grid[i].length
  • +
  • 1 <= m, n <= 300
  • +
  • grid[i][j] is either 0 or 1.
  • +
+ + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **TypeScript** + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/images/image-20220103181204-7.png b/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/images/image-20220103181204-7.png new file mode 100644 index 0000000000000..8b0c69be83fc1 Binary files /dev/null and b/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/images/image-20220103181204-7.png differ diff --git a/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/images/image-20220103181224-8.png b/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/images/image-20220103181224-8.png new file mode 100644 index 0000000000000..6c9b94d7093ba Binary files /dev/null and b/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/images/image-20220103181224-8.png differ diff --git a/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/images/image-20220103191300-1.png b/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/images/image-20220103191300-1.png new file mode 100644 index 0000000000000..78f3a706c7a97 Binary files /dev/null and b/solution/2100-2199/2128.Remove All Ones With Row and Column Flips/images/image-20220103191300-1.png differ diff --git a/solution/2100-2199/2129.Capitalize the Title/README.md b/solution/2100-2199/2129.Capitalize the Title/README.md new file mode 100644 index 0000000000000..f964d2d96943d --- /dev/null +++ b/solution/2100-2199/2129.Capitalize the Title/README.md @@ -0,0 +1,92 @@ +# [2129. 将标题首字母大写](https://leetcode-cn.com/problems/capitalize-the-title) + +[English Version](/solution/2100-2199/2129.Capitalize%20the%20Title/README_EN.md) + +## 题目描述 + + + +

给你一个字符串 title ,它由单个空格连接一个或多个单词组成,每个单词都只包含英文字母。请你按以下规则将每个单词的首字母 大写 :

+ +
    +
  • 如果单词的长度为 1 或者 2 ,所有字母变成小写。
  • +
  • 否则,将单词首字母大写,剩余字母变成小写。
  • +
+ +

请你返回 大写后 的 title 。

+ +

 

+ +

示例 1:

+ +
输入:title = "capiTalIze tHe titLe"
+输出:"Capitalize The Title"
+解释:
+由于所有单词的长度都至少为 3 ,将每个单词首字母大写,剩余字母变为小写。
+
+ +

示例 2:

+ +
输入:title = "First leTTeR of EACH Word"
+输出:"First Letter of Each Word"
+解释:
+单词 "of" 长度为 2 ,所以它保持完全小写。
+其他单词长度都至少为 3 ,所以其他单词首字母大写,剩余字母小写。
+
+ +

示例 3:

+ +
输入:title = "i lOve leetcode"
+输出:"i Love Leetcode"
+解释:
+单词 "i" 长度为 1 ,所以它保留小写。
+其他单词长度都至少为 3 ,所以其他单词首字母大写,剩余字母小写。
+
+ +

 

+ +

提示:

+ +
    +
  • 1 <= title.length <= 100
  • +
  • title 由单个空格隔开的单词组成,且不含有任何前导或后缀空格。
  • +
  • 每个单词由大写和小写英文字母组成,且都是 非空 的。
  • +
+ +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **TypeScript** + + + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2129.Capitalize the Title/README_EN.md b/solution/2100-2199/2129.Capitalize the Title/README_EN.md new file mode 100644 index 0000000000000..bce5b4a895574 --- /dev/null +++ b/solution/2100-2199/2129.Capitalize the Title/README_EN.md @@ -0,0 +1,83 @@ +# [2129. Capitalize the Title](https://leetcode.com/problems/capitalize-the-title) + +[中文文档](/solution/2100-2199/2129.Capitalize%20the%20Title/README.md) + +## Description + +

You are given a string title consisting of one or more words separated by a single space, where each word consists of English letters. Capitalize the string by changing the capitalization of each word such that:

+ +
    +
  • If the length of the word is 1 or 2 letters, change all letters to lowercase.
  • +
  • Otherwise, change the first letter to uppercase and the remaining letters to lowercase.
  • +
+ +

Return the capitalized title.

+ +

 

+

Example 1:

+ +
+Input: title = "capiTalIze tHe titLe"
+Output: "Capitalize The Title"
+Explanation:
+Since all the words have a length of at least 3, the first letter of each word is uppercase, and the remaining letters are lowercase.
+
+ +

Example 2:

+ +
+Input: title = "First leTTeR of EACH Word"
+Output: "First Letter of Each Word"
+Explanation:
+The word "of" has length 2, so it is all lowercase.
+The remaining words have a length of at least 3, so the first letter of each remaining word is uppercase, and the remaining letters are lowercase.
+
+ +

Example 3:

+ +
+Input: title = "i lOve leetcode"
+Output: "i Love Leetcode"
+Explanation:
+The word "i" has length 1, so it is lowercase.
+The remaining words have a length of at least 3, so the first letter of each remaining word is uppercase, and the remaining letters are lowercase.
+
+ +

 

+

Constraints:

+ +
    +
  • 1 <= title.length <= 100
  • +
  • title consists of words separated by a single space without any leading or trailing spaces.
  • +
  • Each word consists of uppercase and lowercase English letters and is non-empty.
  • +
+ +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **TypeScript** + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/README.md b/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/README.md new file mode 100644 index 0000000000000..a660318d23a75 --- /dev/null +++ b/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/README.md @@ -0,0 +1,101 @@ +# [2130. 链表最大孪生和](https://leetcode-cn.com/problems/maximum-twin-sum-of-a-linked-list) + +[English Version](/solution/2100-2199/2130.Maximum%20Twin%20Sum%20of%20a%20Linked%20List/README_EN.md) + +## 题目描述 + + + +

在一个大小为 n 且 n 为 偶数 的链表中,对于 0 <= i <= (n / 2) - 1 的 i ,第 i 个节点(下标从 0 开始)的孪生节点为第 (n-1-i) 个节点 。

+ +
    +
  • 比方说,n = 4 那么节点 0 是节点 3 的孪生节点,节点 1 是节点 2 的孪生节点。这是长度为 n = 4 的链表中所有的孪生节点。
  • +
+ +

孪生和 定义为一个节点和它孪生节点两者值之和。

+ +

给你一个长度为偶数的链表的头节点 head ,请你返回链表的 最大孪生和 。

+ +

 

+ +

示例 1:

+ +

+ +
输入:head = [5,4,2,1]
+输出:6
+解释:
+节点 0 和节点 1 分别是节点 3 和 2 的孪生节点。孪生和都为 6 。
+链表中没有其他孪生节点。
+所以,链表的最大孪生和是 6 。
+
+ +

示例 2:

+ +

+ +
输入:head = [4,2,2,3]
+输出:7
+解释:
+链表中的孪生节点为:
+- 节点 0 是节点 3 的孪生节点,孪生和为 4 + 3 = 7 。
+- 节点 1 是节点 2 的孪生节点,孪生和为 2 + 2 = 4 。
+所以,最大孪生和为 max(7, 4) = 7 。
+
+ +

示例 3:

+ +

+ +
输入:head = [1,100000]
+输出:100001
+解释:
+链表中只有一对孪生节点,孪生和为 1 + 100000 = 100001 。
+
+ +

 

+ +

提示:

+ +
    +
  • 链表的节点数目是 [2, 105] 中的 偶数 。
  • +
  • 1 <= Node.val <= 105
  • +
+ +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **TypeScript** + + + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/README_EN.md b/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/README_EN.md new file mode 100644 index 0000000000000..cfd6ff0ec9149 --- /dev/null +++ b/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/README_EN.md @@ -0,0 +1,86 @@ +# [2130. Maximum Twin Sum of a Linked List](https://leetcode.com/problems/maximum-twin-sum-of-a-linked-list) + +[中文文档](/solution/2100-2199/2130.Maximum%20Twin%20Sum%20of%20a%20Linked%20List/README.md) + +## Description + +

In a linked list of size n, where n is even, the ith node (0-indexed) of the linked list is known as the twin of the (n-1-i)th node, if 0 <= i <= (n / 2) - 1.

+ +
    +
  • For example, if n = 4, then node 0 is the twin of node 3, and node 1 is the twin of node 2. These are the only nodes with twins for n = 4.
  • +
+ +

The twin sum is defined as the sum of a node and its twin.

+ +

Given the head of a linked list with even length, return the maximum twin sum of the linked list.

+ +

 

+

Example 1:

+ +
+Input: head = [5,4,2,1]
+Output: 6
+Explanation:
+Nodes 0 and 1 are the twins of nodes 3 and 2, respectively. All have twin sum = 6.
+There are no other nodes with twins in the linked list.
+Thus, the maximum twin sum of the linked list is 6. 
+
+ +

Example 2:

+ +
+Input: head = [4,2,2,3]
+Output: 7
+Explanation:
+The nodes with twins present in this linked list are:
+- Node 0 is the twin of node 3 having a twin sum of 4 + 3 = 7.
+- Node 1 is the twin of node 2 having a twin sum of 2 + 2 = 4.
+Thus, the maximum twin sum of the linked list is max(7, 4) = 7. 
+
+ +

Example 3:

+ +
+Input: head = [1,100000]
+Output: 100001
+Explanation:
+There is only one node with a twin in the linked list having twin sum of 1 + 100000 = 100001.
+
+ +

 

+

Constraints:

+ +
    +
  • The number of nodes in the list is an even integer in the range [2, 105].
  • +
  • 1 <= Node.val <= 105
  • +
+ +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **TypeScript** + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/images/eg1drawio.png b/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/images/eg1drawio.png new file mode 100644 index 0000000000000..49780bc571219 Binary files /dev/null and b/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/images/eg1drawio.png differ diff --git a/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/images/eg2drawio.png b/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/images/eg2drawio.png new file mode 100644 index 0000000000000..b4c3bc5638712 Binary files /dev/null and b/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/images/eg2drawio.png differ diff --git a/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/images/eg3drawio.png b/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/images/eg3drawio.png new file mode 100644 index 0000000000000..8944be568e7c2 Binary files /dev/null and b/solution/2100-2199/2130.Maximum Twin Sum of a Linked List/images/eg3drawio.png differ diff --git a/solution/2100-2199/2131.Longest Palindrome by Concatenating Two Letter Words/README.md b/solution/2100-2199/2131.Longest Palindrome by Concatenating Two Letter Words/README.md new file mode 100644 index 0000000000000..5941dd6390d71 --- /dev/null +++ b/solution/2100-2199/2131.Longest Palindrome by Concatenating Two Letter Words/README.md @@ -0,0 +1,88 @@ +# [2131. 连接两字母单词得到的最长回文串](https://leetcode-cn.com/problems/longest-palindrome-by-concatenating-two-letter-words) + +[English Version](/solution/2100-2199/2131.Longest%20Palindrome%20by%20Concatenating%20Two%20Letter%20Words/README_EN.md) + +## 题目描述 + + + +

给你一个字符串数组 words 。words 中每个元素都是一个包含 两个 小写英文字母的单词。

+ +

请你从 words 中选择一些元素并按 任意顺序 连接它们,并得到一个 尽可能长的回文串 。每个元素 至多 只能使用一次。

+ +

请你返回你能得到的最长回文串的 长度 。如果没办法得到任何一个回文串,请你返回 0 。

+ +

回文串 指的是从前往后和从后往前读一样的字符串。

+ +

 

+ +

示例 1:

+ +
输入:words = ["lc","cl","gg"]
+输出:6
+解释:一个最长的回文串为 "lc" + "gg" + "cl" = "lcggcl" ,长度为 6 。
+"clgglc" 是另一个可以得到的最长回文串。
+
+ +

示例 2:

+ +
输入:words = ["ab","ty","yt","lc","cl","ab"]
+输出:8
+解释:最长回文串是 "ty" + "lc" + "cl" + "yt" = "tylcclyt" ,长度为 8 。
+"lcyttycl" 是另一个可以得到的最长回文串。
+
+ +

示例 3:

+ +
输入:words = ["cc","ll","xx"]
+输出:2
+解释:最长回文串是 "cc" ,长度为 2 。
+"ll" 是另一个可以得到的最长回文串。"xx" 也是。
+ +

 

+ +

提示:

+ +
    +
  • 1 <= words.length <= 105
  • +
  • words[i].length == 2
  • +
  • words[i] 仅包含小写英文字母。
  • +
+ +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **TypeScript** + + + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2131.Longest Palindrome by Concatenating Two Letter Words/README_EN.md b/solution/2100-2199/2131.Longest Palindrome by Concatenating Two Letter Words/README_EN.md new file mode 100644 index 0000000000000..ff620fb4134fc --- /dev/null +++ b/solution/2100-2199/2131.Longest Palindrome by Concatenating Two Letter Words/README_EN.md @@ -0,0 +1,80 @@ +# [2131. Longest Palindrome by Concatenating Two Letter Words](https://leetcode.com/problems/longest-palindrome-by-concatenating-two-letter-words) + +[中文文档](/solution/2100-2199/2131.Longest%20Palindrome%20by%20Concatenating%20Two%20Letter%20Words/README.md) + +## Description + +

You are given an array of strings words. Each element of words consists of two lowercase English letters.

+ +

Create the longest possible palindrome by selecting some elements from words and concatenating them in any order. Each element can be selected at most once.

+ +

Return the length of the longest palindrome that you can create. If it is impossible to create any palindrome, return 0.

+ +

A palindrome is a string that reads the same forward and backward.

+ +

 

+

Example 1:

+ +
+Input: words = ["lc","cl","gg"]
+Output: 6
+Explanation: One longest palindrome is "lc" + "gg" + "cl" = "lcggcl", of length 6.
+Note that "clgglc" is another longest palindrome that can be created.
+
+ +

Example 2:

+ +
+Input: words = ["ab","ty","yt","lc","cl","ab"]
+Output: 8
+Explanation: One longest palindrome is "ty" + "lc" + "cl" + "yt" = "tylcclyt", of length 8.
+Note that "lcyttycl" is another longest palindrome that can be created.
+
+ +

Example 3:

+ +
+Input: words = ["cc","ll","xx"]
+Output: 2
+Explanation: One longest palindrome is "cc", of length 2.
+Note that "ll" is another longest palindrome that can be created, and so is "xx".
+
+ +

 

+

Constraints:

+ +
    +
  • 1 <= words.length <= 105
  • +
  • words[i].length == 2
  • +
  • words[i] consists of lowercase English letters.
  • +
+ +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **TypeScript** + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2132.Stamping the Grid/README.md b/solution/2100-2199/2132.Stamping the Grid/README.md new file mode 100644 index 0000000000000..90da0df82c575 --- /dev/null +++ b/solution/2100-2199/2132.Stamping the Grid/README.md @@ -0,0 +1,93 @@ +# [2132. 用邮票贴满网格图](https://leetcode-cn.com/problems/stamping-the-grid) + +[English Version](/solution/2100-2199/2132.Stamping%20the%20Grid/README_EN.md) + +## 题目描述 + + + +

给你一个 m x n 的二进制矩阵 grid ,每个格子要么为 0 (空)要么为 1 (被占据)。

+ +

给你邮票的尺寸为 stampHeight x stampWidth 。我们想将邮票贴进二进制矩阵中,且满足以下 限制 和 要求 :

+ +
    +
  1. 覆盖所有  格子。
  2. +
  3. 不覆盖任何 被占据 的格子。
  4. +
  5. 我们可以放入任意数目的邮票。
  6. +
  7. 邮票可以相互有 重叠 部分。
  8. +
  9. 邮票不允许 旋转 。
  10. +
  11. 邮票必须完全在矩阵  。
  12. +
+ +

如果在满足上述要求的前提下,可以放入邮票,请返回 true ,否则返回 false 。

+ +

 

+ +

示例 1:

+ +

+ +
输入:grid = [[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0]], stampHeight = 4, stampWidth = 3
+输出:true
+解释:我们放入两个有重叠部分的邮票(图中标号为 1 和 2),它们能覆盖所有与空格子。
+
+ +

示例 2:

+ +

+ +
输入:grid = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]], stampHeight = 2, stampWidth = 2 
+输出:false 
+解释:没办法放入邮票覆盖所有的空格子,且邮票不超出网格图以外。
+
+ +

 

+ +

提示:

+ +
    +
  • m == grid.length
  • +
  • n == grid[r].length
  • +
  • 1 <= m, n <= 105
  • +
  • 1 <= m * n <= 2 * 105
  • +
  • grid[r][c] 要么是 0 ,要么是 1
  • +
  • 1 <= stampHeight, stampWidth <= 105
  • +
+ +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **TypeScript** + + + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2132.Stamping the Grid/README_EN.md b/solution/2100-2199/2132.Stamping the Grid/README_EN.md new file mode 100644 index 0000000000000..dbd51d67a4b4f --- /dev/null +++ b/solution/2100-2199/2132.Stamping the Grid/README_EN.md @@ -0,0 +1,80 @@ +# [2132. Stamping the Grid](https://leetcode.com/problems/stamping-the-grid) + +[中文文档](/solution/2100-2199/2132.Stamping%20the%20Grid/README.md) + +## Description + +

You are given an m x n binary matrix grid where each cell is either 0 (empty) or 1 (occupied).

+ +

You are then given stamps of size stampHeight x stampWidth. We want to fit the stamps such that they follow the given restrictions and requirements:

+ +
    +
  1. Cover all the empty cells.
  2. +
  3. Do not cover any of the occupied cells.
  4. +
  5. We can put as many stamps as we want.
  6. +
  7. Stamps can overlap with each other.
  8. +
  9. Stamps are not allowed to be rotated.
  10. +
  11. Stamps must stay completely inside the grid.
  12. +
+ +

Return true if it is possible to fit the stamps while following the given restrictions and requirements. Otherwise, return false.

+ +

 

+

Example 1:

+ +
+Input: grid = [[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0]], stampHeight = 4, stampWidth = 3
+Output: true
+Explanation: We have two overlapping stamps (labeled 1 and 2 in the image) that are able to cover all the empty cells.
+
+ +

Example 2:

+ +
+Input: grid = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]], stampHeight = 2, stampWidth = 2 
+Output: false 
+Explanation: There is no way to fit the stamps onto all the empty cells without the stamps going outside the grid.
+
+ +

 

+

Constraints:

+ +
    +
  • m == grid.length
  • +
  • n == grid[r].length
  • +
  • 1 <= m, n <= 105
  • +
  • 1 <= m * n <= 2 * 105
  • +
  • grid[r][c] is either 0 or 1.
  • +
  • 1 <= stampHeight, stampWidth <= 105
  • +
+ + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **TypeScript** + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2132.Stamping the Grid/images/ex1.png b/solution/2100-2199/2132.Stamping the Grid/images/ex1.png new file mode 100644 index 0000000000000..56fd6029008fc Binary files /dev/null and b/solution/2100-2199/2132.Stamping the Grid/images/ex1.png differ diff --git a/solution/2100-2199/2132.Stamping the Grid/images/ex2.png b/solution/2100-2199/2132.Stamping the Grid/images/ex2.png new file mode 100644 index 0000000000000..763402ec6f8a6 Binary files /dev/null and b/solution/2100-2199/2132.Stamping the Grid/images/ex2.png differ diff --git a/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/README.md b/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/README.md new file mode 100644 index 0000000000000..2290f97bb3022 --- /dev/null +++ b/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/README.md @@ -0,0 +1,83 @@ +# [2133. 检查是否每一行每一列都包含全部整数](https://leetcode-cn.com/problems/check-if-every-row-and-column-contains-all-numbers) + +[English Version](/solution/2100-2199/2133.Check%20if%20Every%20Row%20and%20Column%20Contains%20All%20Numbers/README_EN.md) + +## 题目描述 + + + +

对一个大小为 n x n 的矩阵而言,如果其每一行和每一列都包含从 1n全部 整数(含 1n),则认为该矩阵是一个 有效 矩阵。

+ +

给你一个大小为 n x n 的整数矩阵 matrix ,请你判断矩阵是否为一个有效矩阵:如果是,返回 true ;否则,返回 false

+ +

 

+ +

示例 1:

+ +

+ +
+输入:matrix = [[1,2,3],[3,1,2],[2,3,1]]
+输出:true
+解释:在此例中,n = 3 ,每一行和每一列都包含数字 1、2、3 。
+因此,返回 true 。
+
+ +

示例 2:

+ +

+ +
+输入:matrix = [[1,1,1],[1,2,3],[1,2,3]]
+输出:false
+解释:在此例中,n = 3 ,但第一行和第一列不包含数字 2 和 3 。
+因此,返回 false 。
+
+ +

 

+ +

提示:

+ +
    +
  • n == matrix.length == matrix[i].length
  • +
  • 1 <= n <= 100
  • +
  • 1 <= matrix[i][j] <= n
  • +
+ +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **TypeScript** + + + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/README_EN.md b/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/README_EN.md new file mode 100644 index 0000000000000..8825d0e683181 --- /dev/null +++ b/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/README_EN.md @@ -0,0 +1,68 @@ +# [2133. Check if Every Row and Column Contains All Numbers](https://leetcode.com/problems/check-if-every-row-and-column-contains-all-numbers) + +[中文文档](/solution/2100-2199/2133.Check%20if%20Every%20Row%20and%20Column%20Contains%20All%20Numbers/README.md) + +## Description + +

An n x n matrix is valid if every row and every column contains all the integers from 1 to n (inclusive).

+ +

Given an n x n integer matrix matrix, return true if the matrix is valid. Otherwise, return false.

+ +

 

+

Example 1:

+ +
+Input: matrix = [[1,2,3],[3,1,2],[2,3,1]]
+Output: true
+Explanation: In this case, n = 3, and every row and column contains the numbers 1, 2, and 3.
+Hence, we return true.
+
+ +

Example 2:

+ +
+Input: matrix = [[1,1,1],[1,2,3],[1,2,3]]
+Output: false
+Explanation: In this case, n = 3, but the first row and the first column do not contain the numbers 2 or 3.
+Hence, we return false.
+
+ +

 

+

Constraints:

+ +
    +
  • n == matrix.length == matrix[i].length
  • +
  • 1 <= n <= 100
  • +
  • 1 <= matrix[i][j] <= n
  • +
+ + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **TypeScript** + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/images/example1drawio.png b/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/images/example1drawio.png new file mode 100644 index 0000000000000..9c195e180f1bd Binary files /dev/null and b/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/images/example1drawio.png differ diff --git a/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/images/example2drawio.png b/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/images/example2drawio.png new file mode 100644 index 0000000000000..290df1332ac42 Binary files /dev/null and b/solution/2100-2199/2133.Check if Every Row and Column Contains All Numbers/images/example2drawio.png differ diff --git a/solution/2100-2199/2134.Minimum Swaps to Group All 1's Together II/README.md b/solution/2100-2199/2134.Minimum Swaps to Group All 1's Together II/README.md new file mode 100644 index 0000000000000..4db249ef4c904 --- /dev/null +++ b/solution/2100-2199/2134.Minimum Swaps to Group All 1's Together II/README.md @@ -0,0 +1,92 @@ +# [2134. 最少交换次数来组合所有的 1 II](https://leetcode-cn.com/problems/minimum-swaps-to-group-all-1s-together-ii) + +[English Version](/solution/2100-2199/2134.Minimum%20Swaps%20to%20Group%20All%201%27s%20Together%20II/README_EN.md) + +## 题目描述 + + + +

交换 定义为选中一个数组中的两个 互不相同 的位置并交换二者的值。

+ +

环形 数组是一个数组,可以认为 第一个 元素和 最后一个 元素 相邻

+ +

给你一个 二进制环形 数组 nums ,返回在 任意位置 将数组中的所有 1 聚集在一起需要的最少交换次数。

+ +

 

+ +

示例 1:

+ +
输入:nums = [0,1,0,1,1,0,0]
+输出:1
+解释:这里列出一些能够将所有 1 聚集在一起的方案:
+[0,0,1,1,1,0,0] 交换 1 次。
+[0,1,1,1,0,0,0] 交换 1 次。
+[1,1,0,0,0,0,1] 交换 2 次(利用数组的环形特性)。
+无法在交换 0 次的情况下将数组中的所有 1 聚集在一起。
+因此,需要的最少交换次数为 1 。
+
+ +

示例 2:

+ +
输入:nums = [0,1,1,1,0,0,1,1,0]
+输出:2
+解释:这里列出一些能够将所有 1 聚集在一起的方案:
+[1,1,1,0,0,0,0,1,1] 交换 2 次(利用数组的环形特性)。
+[1,1,1,1,1,0,0,0,0] 交换 2 次。
+无法在交换 0 次或 1 次的情况下将数组中的所有 1 聚集在一起。
+因此,需要的最少交换次数为 2 。
+
+ +

示例 3:

+ +
输入:nums = [1,1,0,0,1]
+输出:0
+解释:得益于数组的环形特性,所有的 1 已经聚集在一起。
+因此,需要的最少交换次数为 0 。
+ +

 

+ +

提示:

+ +
    +
  • 1 <= nums.length <= 105
  • +
  • nums[i]0 或者 1
  • +
+ +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **TypeScript** + + + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2134.Minimum Swaps to Group All 1's Together II/README_EN.md b/solution/2100-2199/2134.Minimum Swaps to Group All 1's Together II/README_EN.md new file mode 100644 index 0000000000000..1b69a77fff7b8 --- /dev/null +++ b/solution/2100-2199/2134.Minimum Swaps to Group All 1's Together II/README_EN.md @@ -0,0 +1,84 @@ +# [2134. Minimum Swaps to Group All 1's Together II](https://leetcode.com/problems/minimum-swaps-to-group-all-1s-together-ii) + +[中文文档](/solution/2100-2199/2134.Minimum%20Swaps%20to%20Group%20All%201%27s%20Together%20II/README.md) + +## Description + +

A swap is defined as taking two distinct positions in an array and swapping the values in them.

+ +

A circular array is defined as an array where we consider the first element and the last element to be adjacent.

+ +

Given a binary circular array nums, return the minimum number of swaps required to group all 1's present in the array together at any location.

+ +

 

+

Example 1:

+ +
+Input: nums = [0,1,0,1,1,0,0]
+Output: 1
+Explanation: Here are a few of the ways to group all the 1's together:
+[0,0,1,1,1,0,0] using 1 swap.
+[0,1,1,1,0,0,0] using 1 swap.
+[1,1,0,0,0,0,1] using 2 swaps (using the circular property of the array).
+There is no way to group all 1's together with 0 swaps.
+Thus, the minimum number of swaps required is 1.
+
+ +

Example 2:

+ +
+Input: nums = [0,1,1,1,0,0,1,1,0]
+Output: 2
+Explanation: Here are a few of the ways to group all the 1's together:
+[1,1,1,0,0,0,0,1,1] using 2 swaps (using the circular property of the array).
+[1,1,1,1,1,0,0,0,0] using 2 swaps.
+There is no way to group all 1's together with 0 or 1 swaps.
+Thus, the minimum number of swaps required is 2.
+
+ +

Example 3:

+ +
+Input: nums = [1,1,0,0,1]
+Output: 0
+Explanation: All the 1's are already grouped together due to the circular property of the array.
+Thus, the minimum number of swaps required is 0.
+
+ +

 

+

Constraints:

+ +
    +
  • 1 <= nums.length <= 105
  • +
  • nums[i] is either 0 or 1.
  • +
+ +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **TypeScript** + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2135.Count Words Obtained After Adding a Letter/README.md b/solution/2100-2199/2135.Count Words Obtained After Adding a Letter/README.md new file mode 100644 index 0000000000000..276797edf82df --- /dev/null +++ b/solution/2100-2199/2135.Count Words Obtained After Adding a Letter/README.md @@ -0,0 +1,103 @@ +# [2135. 统计追加字母可以获得的单词数](https://leetcode-cn.com/problems/count-words-obtained-after-adding-a-letter) + +[English Version](/solution/2100-2199/2135.Count%20Words%20Obtained%20After%20Adding%20a%20Letter/README_EN.md) + +## 题目描述 + + + +

给你两个下标从 0 开始的字符串数组 startWordstargetWords 。每个字符串都仅由 小写英文字母 组成。

+ +

对于 targetWords 中的每个字符串,检查是否能够从 startWords 中选出一个字符串,执行一次 转换操作 ,得到的结果与当前 targetWords 字符串相等。

+ +

转换操作 如下面两步所述:

+ +
    +
  1. 追加 任何 不存在 于当前字符串的任一小写字母到当前字符串的末尾。 +
      +
    • 例如,如果字符串为 "abc" ,那么字母 'd''e''y' 都可以加到该字符串末尾,但 'a' 就不行。如果追加的是 'd' ,那么结果字符串为 "abcd"
    • +
    +
  2. +
  3. 重排 新字符串中的字母,可以按 任意 顺序重新排布字母。 +
      +
    • 例如,"abcd" 可以重排为 "acbd""bacd""cbda",以此类推。注意,它也可以重排为 "abcd" 自身。
    • +
    +
  4. +
+ +

找出 targetWords 中有多少字符串能够由 startWords 中的 任一 字符串执行上述转换操作获得。返回 targetWords 中这类 字符串的数目

+ +

注意:你仅能验证 targetWords 中的字符串是否可以由 startWords 中的某个字符串经执行操作获得。startWords  中的字符串在这一过程中 发生实际变更。

+ +

 

+ +

示例 1:

+ +
+输入:startWords = ["ant","act","tack"], targetWords = ["tack","act","acti"]
+输出:2
+解释:
+- 为了形成 targetWords[0] = "tack" ,可以选用 startWords[1] = "act" ,追加字母 'k' ,并重排 "actk" 为 "tack" 。
+- startWords 中不存在可以用于获得 targetWords[1] = "act" 的字符串。
+  注意 "act" 确实存在于 startWords ,但是 必须 在重排前给这个字符串追加一个字母。
+- 为了形成 targetWords[2] = "acti" ,可以选用 startWords[1] = "act" ,追加字母 'i' ,并重排 "acti" 为 "acti" 自身。
+
+ +

示例 2:

+ +
+输入:startWords = ["ab","a"], targetWords = ["abc","abcd"]
+输出:1
+解释:
+- 为了形成 targetWords[0] = "abc" ,可以选用 startWords[0] = "ab" ,追加字母 'c' ,并重排为 "abc" 。
+- startWords 中不存在可以用于获得 targetWords[1] = "abcd" 的字符串。
+
+ +

 

+ +

提示:

+ +
    +
  • 1 <= startWords.length, targetWords.length <= 5 * 104
  • +
  • 1 <= startWords[i].length, targetWords[j].length <= 26
  • +
  • startWordstargetWords 中的每个字符串都仅由小写英文字母组成
  • +
  • startWordstargetWords 的任一字符串中,每个字母至多出现一次
  • +
+ +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **TypeScript** + + + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2135.Count Words Obtained After Adding a Letter/README_EN.md b/solution/2100-2199/2135.Count Words Obtained After Adding a Letter/README_EN.md new file mode 100644 index 0000000000000..d748b9a7f1c96 --- /dev/null +++ b/solution/2100-2199/2135.Count Words Obtained After Adding a Letter/README_EN.md @@ -0,0 +1,91 @@ +# [2135. Count Words Obtained After Adding a Letter](https://leetcode.com/problems/count-words-obtained-after-adding-a-letter) + +[中文文档](/solution/2100-2199/2135.Count%20Words%20Obtained%20After%20Adding%20a%20Letter/README.md) + +## Description + +

You are given two 0-indexed arrays of strings startWords and targetWords. Each string consists of lowercase English letters only.

+ +

For each string in targetWords, check if it is possible to choose a string from startWords and perform a conversion operation on it to be equal to that from targetWords.

+ +

The conversion operation is described in the following two steps:

+ +
    +
  1. Append any lowercase letter that is not present in the string to its end. +
      +
    • For example, if the string is "abc", the letters 'd', 'e', or 'y' can be added to it, but not 'a'. If 'd' is added, the resulting string will be "abcd".
    • +
    +
  2. +
  3. Rearrange the letters of the new string in any arbitrary order. +
      +
    • For example, "abcd" can be rearranged to "acbd", "bacd", "cbda", and so on. Note that it can also be rearranged to "abcd" itself.
    • +
    +
  4. +
+ +

Return the number of strings in targetWords that can be obtained by performing the operations on any string of startWords.

+ +

Note that you will only be verifying if the string in targetWords can be obtained from a string in startWords by performing the operations. The strings in startWords do not actually change during this process.

+ +

 

+

Example 1:

+ +
+Input: startWords = ["ant","act","tack"], targetWords = ["tack","act","acti"]
+Output: 2
+Explanation:
+- In order to form targetWords[0] = "tack", we use startWords[1] = "act", append 'k' to it, and rearrange "actk" to "tack".
+- There is no string in startWords that can be used to obtain targetWords[1] = "act".
+  Note that "act" does exist in startWords, but we must append one letter to the string before rearranging it.
+- In order to form targetWords[2] = "acti", we use startWords[1] = "act", append 'i' to it, and rearrange "acti" to "acti" itself.
+
+ +

Example 2:

+ +
+Input: startWords = ["ab","a"], targetWords = ["abc","abcd"]
+Output: 1
+Explanation:
+- In order to form targetWords[0] = "abc", we use startWords[0] = "ab", add 'c' to it, and rearrange it to "abc".
+- There is no string in startWords that can be used to obtain targetWords[1] = "abcd".
+
+ +

 

+

Constraints:

+ +
    +
  • 1 <= startWords.length, targetWords.length <= 5 * 104
  • +
  • 1 <= startWords[i].length, targetWords[j].length <= 26
  • +
  • Each string of startWords and targetWords consists of lowercase English letters only.
  • +
  • No letter occurs more than once in any string of startWords or targetWords.
  • +
+ +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **TypeScript** + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/README.md b/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/README.md new file mode 100644 index 0000000000000..05fe0ffda0465 --- /dev/null +++ b/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/README.md @@ -0,0 +1,101 @@ +# [2136. 全部开花的最早一天](https://leetcode-cn.com/problems/earliest-possible-day-of-full-bloom) + +[English Version](/solution/2100-2199/2136.Earliest%20Possible%20Day%20of%20Full%20Bloom/README_EN.md) + +## 题目描述 + + + +

你有 n 枚花的种子。每枚种子必须先种下,才能开始生长、开花。播种需要时间,种子的生长也是如此。给你两个下标从 0 开始的整数数组 plantTimegrowTime ,每个数组的长度都是 n

+ +
    +
  • plantTime[i]播种i 枚种子所需的 完整天数 。每天,你只能为播种某一枚种子而劳作。无须 连续几天都在种同一枚种子,但是种子播种必须在你工作的天数达到 plantTime[i] 之后才算完成。
  • +
  • growTime[i] 是第 i 枚种子完全种下后生长所需的 完整天数 。在它生长的最后一天 之后 ,将会开花并且永远 绽放
  • +
+ +

从第 0 开始,你可以按 任意 顺序播种种子。

+ +

返回所有种子都开花的 最早 一天是第几天。

+ +

 

+ +

示例 1:

+ +
输入:plantTime = [1,4,3], growTime = [2,3,1]
+输出:9
+解释:灰色的花盆表示播种的日子,彩色的花盆表示生长的日子,花朵表示开花的日子。
+一种最优方案是:
+第 0 天,播种第 0 枚种子,种子生长 2 整天。并在第 3 天开花。
+第 1、2、3、4 天,播种第 1 枚种子。种子生长 3 整天,并在第 8 天开花。
+第 5、6、7 天,播种第 2 枚种子。种子生长 1 整天,并在第 9 天开花。
+因此,在第 9 天,所有种子都开花。 
+
+ +

示例 2:

+ +
输入:plantTime = [1,2,3,2], growTime = [2,1,2,1]
+输出:9
+解释:灰色的花盆表示播种的日子,彩色的花盆表示生长的日子,花朵表示开花的日子。 
+一种最优方案是:
+第 1 天,播种第 0 枚种子,种子生长 2 整天。并在第 4 天开花。
+第 0、3 天,播种第 1 枚种子。种子生长 1 整天,并在第 5 天开花。
+第 2、4、5 天,播种第 2 枚种子。种子生长 2 整天,并在第 8 天开花。
+第 6、7 天,播种第 3 枚种子。种子生长 1 整天,并在第 9 天开花。
+因此,在第 9 天,所有种子都开花。 
+
+ +

示例 3:

+ +
输入:plantTime = [1], growTime = [1]
+输出:2
+解释:第 0 天,播种第 0 枚种子。种子需要生长 1 整天,然后在第 2 天开花。
+因此,在第 2 天,所有种子都开花。
+
+ +

 

+ +

提示:

+ +
    +
  • n == plantTime.length == growTime.length
  • +
  • 1 <= n <= 105
  • +
  • 1 <= plantTime[i], growTime[i] <= 104
  • +
+ +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **TypeScript** + + + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/README_EN.md b/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/README_EN.md new file mode 100644 index 0000000000000..31c9242304f10 --- /dev/null +++ b/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/README_EN.md @@ -0,0 +1,92 @@ +# [2136. Earliest Possible Day of Full Bloom](https://leetcode.com/problems/earliest-possible-day-of-full-bloom) + +[中文文档](/solution/2100-2199/2136.Earliest%20Possible%20Day%20of%20Full%20Bloom/README.md) + +## Description + +

You have n flower seeds. Every seed must be planted first before it can begin to grow, then bloom. Planting a seed takes time and so does the growth of a seed. You are given two 0-indexed integer arrays plantTime and growTime, of length n each:

+ +
    +
  • plantTime[i] is the number of full days it takes you to plant the ith seed. Every day, you can work on planting exactly one seed. You do not have to work on planting the same seed on consecutive days, but the planting of a seed is not complete until you have worked plantTime[i] days on planting it in total.
  • +
  • growTime[i] is the number of full days it takes the ith seed to grow after being completely planted. After the last day of its growth, the flower blooms and stays bloomed forever.
  • +
+ +

From the beginning of day 0, you can plant the seeds in any order.

+ +

Return the earliest possible day where all seeds are blooming.

+ +

 

+

Example 1:

+ +
+Input: plantTime = [1,4,3], growTime = [2,3,1]
+Output: 9
+Explanation: The grayed out pots represent planting days, colored pots represent growing days, and the flower represents the day it blooms.
+One optimal way is:
+On day 0, plant the 0th seed. The seed grows for 2 full days and blooms on day 3.
+On days 1, 2, 3, and 4, plant the 1st seed. The seed grows for 3 full days and blooms on day 8.
+On days 5, 6, and 7, plant the 2nd seed. The seed grows for 1 full day and blooms on day 9.
+Thus, on day 9, all the seeds are blooming.
+
+ +

Example 2:

+ +
+Input: plantTime = [1,2,3,2], growTime = [2,1,2,1]
+Output: 9
+Explanation: The grayed out pots represent planting days, colored pots represent growing days, and the flower represents the day it blooms.
+One optimal way is:
+On day 1, plant the 0th seed. The seed grows for 2 full days and blooms on day 4.
+On days 0 and 3, plant the 1st seed. The seed grows for 1 full day and blooms on day 5.
+On days 2, 4, and 5, plant the 2nd seed. The seed grows for 2 full days and blooms on day 8.
+On days 6 and 7, plant the 3rd seed. The seed grows for 1 full day and blooms on day 9.
+Thus, on day 9, all the seeds are blooming.
+
+ +

Example 3:

+ +
+Input: plantTime = [1], growTime = [1]
+Output: 2
+Explanation: On day 0, plant the 0th seed. The seed grows for 1 full day and blooms on day 2.
+Thus, on day 2, all the seeds are blooming.
+
+ +

 

+

Constraints:

+ +
    +
  • n == plantTime.length == growTime.length
  • +
  • 1 <= n <= 105
  • +
  • 1 <= plantTime[i], growTime[i] <= 104
  • +
+ +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **TypeScript** + +```ts + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/images/1.png b/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/images/1.png new file mode 100644 index 0000000000000..9f600ecbe2fbf Binary files /dev/null and b/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/images/1.png differ diff --git a/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/images/2.png b/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/images/2.png new file mode 100644 index 0000000000000..3a3d19f54a360 Binary files /dev/null and b/solution/2100-2199/2136.Earliest Possible Day of Full Bloom/images/2.png differ diff --git a/solution/README.md b/solution/README.md index 5afa2782e82ca..7f4935385ea62 100644 --- a/solution/README.md +++ b/solution/README.md @@ -2133,11 +2133,20 @@ | [2120](https://leetcode-cn.com/problems/execution-of-all-suffix-instructions-staying-in-a-grid) | [执行所有后缀指令](/solution/2100-2199/2120.Execution%20of%20All%20Suffix%20Instructions%20Staying%20in%20a%20Grid/README.md) | `字符串`,`模拟` | 中等 | | | [2121](https://leetcode-cn.com/problems/intervals-between-identical-elements) | [相同元素的间隔之和](/solution/2100-2199/2121.Intervals%20Between%20Identical%20Elements/README.md) | `数组`,`哈希表`,`前缀和` | 中等 | | | [2122](https://leetcode-cn.com/problems/recover-the-original-array) | [还原原数组](/solution/2100-2199/2122.Recover%20the%20Original%20Array/README.md) | `数组`,`哈希表`,`枚举`,`排序` | 困难 | | -| [2123](https://leetcode-cn.com/problems/minimum-operations-to-remove-adjacent-ones-in-matrix) | [Minimum Operations to Remove Adjacent Ones in Matrix](/solution/2100-2199/2123.Minimum%20Operations%20to%20Remove%20Adjacent%20Ones%20in%20Matrix/README.md) | | 困难 | 🔒 | -| [2124](https://leetcode-cn.com/problems/check-if-all-as-appears-before-all-bs) | [检查是否所有 A 都在 B 之前](/solution/2100-2199/2124.Check%20if%20All%20A%27s%20Appears%20Before%20All%20B%27s/README.md) | | 简单 | | -| [2125](https://leetcode-cn.com/problems/number-of-laser-beams-in-a-bank) | [银行中的激光束数量](/solution/2100-2199/2125.Number%20of%20Laser%20Beams%20in%20a%20Bank/README.md) | | 中等 | | -| [2126](https://leetcode-cn.com/problems/destroying-asteroids) | [摧毁小行星](/solution/2100-2199/2126.Destroying%20Asteroids/README.md) | | 中等 | | -| [2127](https://leetcode-cn.com/problems/maximum-employees-to-be-invited-to-a-meeting) | [参加会议的最多员工数](/solution/2100-2199/2127.Maximum%20Employees%20to%20Be%20Invited%20to%20a%20Meeting/README.md) | | 困难 | | +| [2123](https://leetcode-cn.com/problems/minimum-operations-to-remove-adjacent-ones-in-matrix) | [Minimum Operations to Remove Adjacent Ones in Matrix](/solution/2100-2199/2123.Minimum%20Operations%20to%20Remove%20Adjacent%20Ones%20in%20Matrix/README.md) | `图`,`数组`,`矩阵` | 困难 | 🔒 | +| [2124](https://leetcode-cn.com/problems/check-if-all-as-appears-before-all-bs) | [检查是否所有 A 都在 B 之前](/solution/2100-2199/2124.Check%20if%20All%20A%27s%20Appears%20Before%20All%20B%27s/README.md) | `字符串` | 简单 | | +| [2125](https://leetcode-cn.com/problems/number-of-laser-beams-in-a-bank) | [银行中的激光束数量](/solution/2100-2199/2125.Number%20of%20Laser%20Beams%20in%20a%20Bank/README.md) | `数组`,`数学`,`字符串`,`矩阵` | 中等 | | +| [2126](https://leetcode-cn.com/problems/destroying-asteroids) | [摧毁小行星](/solution/2100-2199/2126.Destroying%20Asteroids/README.md) | `贪心`,`数组`,`排序` | 中等 | | +| [2127](https://leetcode-cn.com/problems/maximum-employees-to-be-invited-to-a-meeting) | [参加会议的最多员工数](/solution/2100-2199/2127.Maximum%20Employees%20to%20Be%20Invited%20to%20a%20Meeting/README.md) | `深度优先搜索`,`图`,`拓扑排序` | 困难 | | +| [2128](https://leetcode-cn.com/problems/remove-all-ones-with-row-and-column-flips) | [Remove All Ones With Row and Column Flips](/solution/2100-2199/2128.Remove%20All%20Ones%20With%20Row%20and%20Column%20Flips/README.md) | | 中等 | 🔒 | +| [2129](https://leetcode-cn.com/problems/capitalize-the-title) | [将标题首字母大写](/solution/2100-2199/2129.Capitalize%20the%20Title/README.md) | | 简单 | | +| [2130](https://leetcode-cn.com/problems/maximum-twin-sum-of-a-linked-list) | [链表最大孪生和](/solution/2100-2199/2130.Maximum%20Twin%20Sum%20of%20a%20Linked%20List/README.md) | | 中等 | | +| [2131](https://leetcode-cn.com/problems/longest-palindrome-by-concatenating-two-letter-words) | [连接两字母单词得到的最长回文串](/solution/2100-2199/2131.Longest%20Palindrome%20by%20Concatenating%20Two%20Letter%20Words/README.md) | | 中等 | | +| [2132](https://leetcode-cn.com/problems/stamping-the-grid) | [用邮票贴满网格图](/solution/2100-2199/2132.Stamping%20the%20Grid/README.md) | | 困难 | | +| [2133](https://leetcode-cn.com/problems/check-if-every-row-and-column-contains-all-numbers) | [检查是否每一行每一列都包含全部整数](/solution/2100-2199/2133.Check%20if%20Every%20Row%20and%20Column%20Contains%20All%20Numbers/README.md) | | 简单 | | +| [2134](https://leetcode-cn.com/problems/minimum-swaps-to-group-all-1s-together-ii) | [最少交换次数来组合所有的 1 II](/solution/2100-2199/2134.Minimum%20Swaps%20to%20Group%20All%201%27s%20Together%20II/README.md) | | 中等 | | +| [2135](https://leetcode-cn.com/problems/count-words-obtained-after-adding-a-letter) | [统计追加字母可以获得的单词数](/solution/2100-2199/2135.Count%20Words%20Obtained%20After%20Adding%20a%20Letter/README.md) | | 中等 | | +| [2136](https://leetcode-cn.com/problems/earliest-possible-day-of-full-bloom) | [全部开花的最早一天](/solution/2100-2199/2136.Earliest%20Possible%20Day%20of%20Full%20Bloom/README.md) | | 困难 | | ## 版权 diff --git a/solution/README_EN.md b/solution/README_EN.md index 07f0bd342ea70..1f8be4cb833e8 100644 --- a/solution/README_EN.md +++ b/solution/README_EN.md @@ -2131,11 +2131,21 @@ Press Control+F(or Command+F on the | [2120](https://leetcode.com/problems/execution-of-all-suffix-instructions-staying-in-a-grid) | [Execution of All Suffix Instructions Staying in a Grid](/solution/2100-2199/2120.Execution%20of%20All%20Suffix%20Instructions%20Staying%20in%20a%20Grid/README_EN.md) | `String`,`Simulation` | Medium | | | [2121](https://leetcode.com/problems/intervals-between-identical-elements) | [Intervals Between Identical Elements](/solution/2100-2199/2121.Intervals%20Between%20Identical%20Elements/README_EN.md) | `Array`,`Hash Table`,`Prefix Sum` | Medium | | | [2122](https://leetcode.com/problems/recover-the-original-array) | [Recover the Original Array](/solution/2100-2199/2122.Recover%20the%20Original%20Array/README_EN.md) | `Array`,`Hash Table`,`Enumeration`,`Sorting` | Hard | | -| [2123](https://leetcode.com/problems/minimum-operations-to-remove-adjacent-ones-in-matrix) | [Minimum Operations to Remove Adjacent Ones in Matrix](/solution/2100-2199/2123.Minimum%20Operations%20to%20Remove%20Adjacent%20Ones%20in%20Matrix/README_EN.md) | | Hard | 🔒 | -| [2124](https://leetcode.com/problems/check-if-all-as-appears-before-all-bs) | [Check if All A's Appears Before All B's](/solution/2100-2199/2124.Check%20if%20All%20A%27s%20Appears%20Before%20All%20B%27s/README_EN.md) | | Easy | | -| [2125](https://leetcode.com/problems/number-of-laser-beams-in-a-bank) | [Number of Laser Beams in a Bank](/solution/2100-2199/2125.Number%20of%20Laser%20Beams%20in%20a%20Bank/README_EN.md) | | Medium | | -| [2126](https://leetcode.com/problems/destroying-asteroids) | [Destroying Asteroids](/solution/2100-2199/2126.Destroying%20Asteroids/README_EN.md) | | Medium | | -| [2127](https://leetcode.com/problems/maximum-employees-to-be-invited-to-a-meeting) | [Maximum Employees to Be Invited to a Meeting](/solution/2100-2199/2127.Maximum%20Employees%20to%20Be%20Invited%20to%20a%20Meeting/README_EN.md) | | Hard | | +| [2123](https://leetcode.com/problems/minimum-operations-to-remove-adjacent-ones-in-matrix) | [Minimum Operations to Remove Adjacent Ones in Matrix](/solution/2100-2199/2123.Minimum%20Operations%20to%20Remove%20Adjacent%20Ones%20in%20Matrix/README_EN.md) | `Graph`,`Array`,`Matrix` | Hard | 🔒 | +| [2124](https://leetcode.com/problems/check-if-all-as-appears-before-all-bs) | [Check if All A's Appears Before All B's](/solution/2100-2199/2124.Check%20if%20All%20A%27s%20Appears%20Before%20All%20B%27s/README_EN.md) | `String` | Easy | | +| [2125](https://leetcode.com/problems/number-of-laser-beams-in-a-bank) | [Number of Laser Beams in a Bank](/solution/2100-2199/2125.Number%20of%20Laser%20Beams%20in%20a%20Bank/README_EN.md) | `Array`,`Math`,`String`,`Matrix` | Medium | | +| [2126](https://leetcode.com/problems/destroying-asteroids) | [Destroying Asteroids](/solution/2100-2199/2126.Destroying%20Asteroids/README_EN.md) | `Greedy`,`Array`,`Sorting` | Medium | | +| [2127](https://leetcode.com/problems/maximum-employees-to-be-invited-to-a-meeting) | [Maximum Employees to Be Invited to a Meeting](/solution/2100-2199/2127.Maximum%20Employees%20to%20Be%20Invited%20to%20a%20Meeting/README_EN.md) | `Depth-First Search`,`Graph`,`Topological Sort` | Hard | | +| [2128](https://leetcode.com/problems/remove-all-ones-with-row-and-column-flips) | [Remove All Ones With Row and Column Flips](/solution/2100-2199/2128.Remove%20All%20Ones%20With%20Row%20and%20Column%20Flips/README_EN.md) | | Medium | 🔒 | +| [2129](https://leetcode.com/problems/capitalize-the-title) | [Capitalize the Title](/solution/2100-2199/2129.Capitalize%20the%20Title/README_EN.md) | | Easy | | +| [2130](https://leetcode.com/problems/maximum-twin-sum-of-a-linked-list) | [Maximum Twin Sum of a Linked List](/solution/2100-2199/2130.Maximum%20Twin%20Sum%20of%20a%20Linked%20List/README_EN.md) | | Medium | | +| [2131](https://leetcode.com/problems/longest-palindrome-by-concatenating-two-letter-words) | [Longest Palindrome by Concatenating Two Letter Words](/solution/2100-2199/2131.Longest%20Palindrome%20by%20Concatenating%20Two%20Letter%20Words/README_EN.md) | | Medium | | +| [2132](https://leetcode.com/problems/stamping-the-grid) | [Stamping the Grid](/solution/2100-2199/2132.Stamping%20the%20Grid/README_EN.md) | | Hard | | +| [2133](https://leetcode.com/problems/check-if-every-row-and-column-contains-all-numbers) | [Check if Every Row and Column Contains All Numbers](/solution/2100-2199/2133.Check%20if%20Every%20Row%20and%20Column%20Contains%20All%20Numbers/README_EN.md) | | Easy | | +| [2134](https://leetcode.com/problems/minimum-swaps-to-group-all-1s-together-ii) | [Minimum Swaps to Group All 1's Together II](/solution/2100-2199/2134.Minimum%20Swaps%20to%20Group%20All%201%27s%20Together%20II/README_EN.md) | | Medium | | +| [2135](https://leetcode.com/problems/count-words-obtained-after-adding-a-letter) | [Count Words Obtained After Adding a Letter](/solution/2100-2199/2135.Count%20Words%20Obtained%20After%20Adding%20a%20Letter/README_EN.md) | | Medium | | +| [2136](https://leetcode.com/problems/earliest-possible-day-of-full-bloom) | [Earliest Possible Day of Full Bloom](/solution/2100-2199/2136.Earliest%20Possible%20Day%20of%20Full%20Bloom/README_EN.md) | | Hard | | + ## Copyright diff --git a/solution/summary.md b/solution/summary.md index 9332c96e3c9bd..f37ba599874e7 100644 --- a/solution/summary.md +++ b/solution/summary.md @@ -2170,3 +2170,12 @@ - [2125.Number of Laser Beams in a Bank](/solution/2100-2199/2125.Number%20of%20Laser%20Beams%20in%20a%20Bank/README.md) - [2126.Destroying Asteroids](/solution/2100-2199/2126.Destroying%20Asteroids/README.md) - [2127.Maximum Employees to Be Invited to a Meeting](/solution/2100-2199/2127.Maximum%20Employees%20to%20Be%20Invited%20to%20a%20Meeting/README.md) + - [2128.Remove All Ones With Row and Column Flips](/solution/2100-2199/2128.Remove%20All%20Ones%20With%20Row%20and%20Column%20Flips/README.md) + - [2129.Capitalize the Title](/solution/2100-2199/2129.Capitalize%20the%20Title/README.md) + - [2130.Maximum Twin Sum of a Linked List](/solution/2100-2199/2130.Maximum%20Twin%20Sum%20of%20a%20Linked%20List/README.md) + - [2131.Longest Palindrome by Concatenating Two Letter Words](/solution/2100-2199/2131.Longest%20Palindrome%20by%20Concatenating%20Two%20Letter%20Words/README.md) + - [2132.Stamping the Grid](/solution/2100-2199/2132.Stamping%20the%20Grid/README.md) + - [2133.Check if Every Row and Column Contains All Numbers](/solution/2100-2199/2133.Check%20if%20Every%20Row%20and%20Column%20Contains%20All%20Numbers/README.md) + - [2134.Minimum Swaps to Group All 1's Together II](/solution/2100-2199/2134.Minimum%20Swaps%20to%20Group%20All%201%27s%20Together%20II/README.md) + - [2135.Count Words Obtained After Adding a Letter](/solution/2100-2199/2135.Count%20Words%20Obtained%20After%20Adding%20a%20Letter/README.md) + - [2136.Earliest Possible Day of Full Bloom](/solution/2100-2199/2136.Earliest%20Possible%20Day%20of%20Full%20Bloom/README.md) diff --git a/solution/summary_en.md b/solution/summary_en.md index 3b08fda673cac..6cc2229c6801e 100644 --- a/solution/summary_en.md +++ b/solution/summary_en.md @@ -2170,3 +2170,12 @@ - [2125.Number of Laser Beams in a Bank](/solution/2100-2199/2125.Number%20of%20Laser%20Beams%20in%20a%20Bank/README_EN.md) - [2126.Destroying Asteroids](/solution/2100-2199/2126.Destroying%20Asteroids/README_EN.md) - [2127.Maximum Employees to Be Invited to a Meeting](/solution/2100-2199/2127.Maximum%20Employees%20to%20Be%20Invited%20to%20a%20Meeting/README_EN.md) + - [2128.Remove All Ones With Row and Column Flips](/solution/2100-2199/2128.Remove%20All%20Ones%20With%20Row%20and%20Column%20Flips/README_EN.md) + - [2129.Capitalize the Title](/solution/2100-2199/2129.Capitalize%20the%20Title/README_EN.md) + - [2130.Maximum Twin Sum of a Linked List](/solution/2100-2199/2130.Maximum%20Twin%20Sum%20of%20a%20Linked%20List/README_EN.md) + - [2131.Longest Palindrome by Concatenating Two Letter Words](/solution/2100-2199/2131.Longest%20Palindrome%20by%20Concatenating%20Two%20Letter%20Words/README_EN.md) + - [2132.Stamping the Grid](/solution/2100-2199/2132.Stamping%20the%20Grid/README_EN.md) + - [2133.Check if Every Row and Column Contains All Numbers](/solution/2100-2199/2133.Check%20if%20Every%20Row%20and%20Column%20Contains%20All%20Numbers/README_EN.md) + - [2134.Minimum Swaps to Group All 1's Together II](/solution/2100-2199/2134.Minimum%20Swaps%20to%20Group%20All%201%27s%20Together%20II/README_EN.md) + - [2135.Count Words Obtained After Adding a Letter](/solution/2100-2199/2135.Count%20Words%20Obtained%20After%20Adding%20a%20Letter/README_EN.md) + - [2136.Earliest Possible Day of Full Bloom](/solution/2100-2199/2136.Earliest%20Possible%20Day%20of%20Full%20Bloom/README_EN.md)