diff --git a/solution/3500-3599/3549.Multiply Two Polynomials/README.md b/solution/3500-3599/3549.Multiply Two Polynomials/README.md index 63befadf152ff..1417fea469f74 100644 --- a/solution/3500-3599/3549.Multiply Two Polynomials/README.md +++ b/solution/3500-3599/3549.Multiply Two Polynomials/README.md @@ -21,7 +21,7 @@ tags: <p>设 <code>A(x)</code> 和 <code>B(x)</code> 分别是 <code>poly1</code> 和 <code>poly2</code> 表示的多项式。</p> -<p>返回一个整数数组 <code>result</code> 表示乘积多项式 <code>R(x) = A(x) * B(x)</code> 的系数,其中 <code>result[i]</code> 表示 <code>R(x)</code> 中 <code>x<sup>i</sup></code> 的系数。</p> +<p>返回一个长度为 <code>(poly1.length + poly2.length - 1)</code> 的整数数组 <code>result</code> 表示乘积多项式 <code>R(x) = A(x) * B(x)</code> 的系数,其中 <code>result[i]</code> 表示 <code>R(x)</code> 中 <code>x<sup>i</sup></code> 的系数。</p> <p> </p> diff --git a/solution/3500-3599/3549.Multiply Two Polynomials/README_EN.md b/solution/3500-3599/3549.Multiply Two Polynomials/README_EN.md index 1aa73537918af..bdbdecb600922 100644 --- a/solution/3500-3599/3549.Multiply Two Polynomials/README_EN.md +++ b/solution/3500-3599/3549.Multiply Two Polynomials/README_EN.md @@ -21,7 +21,7 @@ tags: <p>Let <code>A(x)</code> and <code>B(x)</code> be the polynomials represented by <code>poly1</code> and <code>poly2</code>, respectively.</p> -<p>Return an integer array <code>result</code> representing the coefficients of the product polynomial <code>R(x) = A(x) * B(x)</code>, where <code>result[i]</code> denotes the coefficient of <code>x<sup>i</sup></code> in <code>R(x)</code>.</p> +<p>Return an integer array <code>result</code> of length <code>(poly1.length + poly2.length - 1)</code> representing the coefficients of the product polynomial <code>R(x) = A(x) * B(x)</code>, where <code>result[i]</code> denotes the coefficient of <code>x<sup>i</sup></code> in <code>R(x)</code>.</p> <p> </p> <p><strong class="example">Example 1:</strong></p> diff --git a/solution/3500-3599/3555.Smallest Subarray to Sort in Every Sliding Window/README.md b/solution/3500-3599/3555.Smallest Subarray to Sort in Every Sliding Window/README.md index 82e631eef37aa..4071fe4919a20 100644 --- a/solution/3500-3599/3555.Smallest Subarray to Sort in Every Sliding Window/README.md +++ b/solution/3500-3599/3555.Smallest Subarray to Sort in Every Sliding Window/README.md @@ -2,6 +2,13 @@ comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3555.Smallest%20Subarray%20to%20Sort%20in%20Every%20Sliding%20Window/README.md +tags: + - 栈 + - 贪心 + - 数组 + - 双指针 + - 排序 + - 单调栈 --- <!-- problem:start --> diff --git a/solution/3500-3599/3555.Smallest Subarray to Sort in Every Sliding Window/README_EN.md b/solution/3500-3599/3555.Smallest Subarray to Sort in Every Sliding Window/README_EN.md index 0573791ebb1e9..446fb651be68b 100644 --- a/solution/3500-3599/3555.Smallest Subarray to Sort in Every Sliding Window/README_EN.md +++ b/solution/3500-3599/3555.Smallest Subarray to Sort in Every Sliding Window/README_EN.md @@ -2,6 +2,13 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3555.Smallest%20Subarray%20to%20Sort%20in%20Every%20Sliding%20Window/README_EN.md +tags: + - Stack + - Greedy + - Array + - Two Pointers + - Sorting + - Monotonic Stack --- <!-- problem:start --> diff --git a/solution/3500-3599/3556.Sum of Largest Prime Substrings/README.md b/solution/3500-3599/3556.Sum of Largest Prime Substrings/README.md index 379cd7f524ca8..b649667ce62b2 100644 --- a/solution/3500-3599/3556.Sum of Largest Prime Substrings/README.md +++ b/solution/3500-3599/3556.Sum of Largest Prime Substrings/README.md @@ -2,6 +2,12 @@ comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3556.Sum%20of%20Largest%20Prime%20Substrings/README.md +tags: + - 哈希表 + - 数学 + - 字符串 + - 数论 + - 排序 --- <!-- problem:start --> diff --git a/solution/3500-3599/3556.Sum of Largest Prime Substrings/README_EN.md b/solution/3500-3599/3556.Sum of Largest Prime Substrings/README_EN.md index 4525afd8ef0b5..ee28b3cff5b6e 100644 --- a/solution/3500-3599/3556.Sum of Largest Prime Substrings/README_EN.md +++ b/solution/3500-3599/3556.Sum of Largest Prime Substrings/README_EN.md @@ -2,6 +2,12 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3556.Sum%20of%20Largest%20Prime%20Substrings/README_EN.md +tags: + - Hash Table + - Math + - String + - Number Theory + - Sorting --- <!-- problem:start --> diff --git a/solution/3500-3599/3557.Find Maximum Number of Non Intersecting Substrings/README.md b/solution/3500-3599/3557.Find Maximum Number of Non Intersecting Substrings/README.md index a08d47b9fdafd..19cac123092c8 100644 --- a/solution/3500-3599/3557.Find Maximum Number of Non Intersecting Substrings/README.md +++ b/solution/3500-3599/3557.Find Maximum Number of Non Intersecting Substrings/README.md @@ -2,6 +2,11 @@ comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3557.Find%20Maximum%20Number%20of%20Non%20Intersecting%20Substrings/README.md +tags: + - 贪心 + - 哈希表 + - 字符串 + - 动态规划 --- <!-- problem:start --> diff --git a/solution/3500-3599/3557.Find Maximum Number of Non Intersecting Substrings/README_EN.md b/solution/3500-3599/3557.Find Maximum Number of Non Intersecting Substrings/README_EN.md index c3c5e57518031..df941c3ab6d70 100644 --- a/solution/3500-3599/3557.Find Maximum Number of Non Intersecting Substrings/README_EN.md +++ b/solution/3500-3599/3557.Find Maximum Number of Non Intersecting Substrings/README_EN.md @@ -2,6 +2,11 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3557.Find%20Maximum%20Number%20of%20Non%20Intersecting%20Substrings/README_EN.md +tags: + - Greedy + - Hash Table + - String + - Dynamic Programming --- <!-- problem:start --> diff --git a/solution/3500-3599/3558.Number of Ways to Assign Edge Weights I/README.md b/solution/3500-3599/3558.Number of Ways to Assign Edge Weights I/README.md index 4fade87561c3b..4139dd239cec7 100644 --- a/solution/3500-3599/3558.Number of Ways to Assign Edge Weights I/README.md +++ b/solution/3500-3599/3558.Number of Ways to Assign Edge Weights I/README.md @@ -2,6 +2,10 @@ comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3558.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20I/README.md +tags: + - 树 + - 深度优先搜索 + - 数学 --- <!-- problem:start --> diff --git a/solution/3500-3599/3558.Number of Ways to Assign Edge Weights I/README_EN.md b/solution/3500-3599/3558.Number of Ways to Assign Edge Weights I/README_EN.md index 9ec51f93e3f21..a75c0cb066438 100644 --- a/solution/3500-3599/3558.Number of Ways to Assign Edge Weights I/README_EN.md +++ b/solution/3500-3599/3558.Number of Ways to Assign Edge Weights I/README_EN.md @@ -2,6 +2,10 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3558.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20I/README_EN.md +tags: + - Tree + - Depth-First Search + - Math --- <!-- problem:start --> diff --git a/solution/3500-3599/3559.Number of Ways to Assign Edge Weights II/README.md b/solution/3500-3599/3559.Number of Ways to Assign Edge Weights II/README.md index 4b12016cf602d..cc538dec3c74d 100644 --- a/solution/3500-3599/3559.Number of Ways to Assign Edge Weights II/README.md +++ b/solution/3500-3599/3559.Number of Ways to Assign Edge Weights II/README.md @@ -2,6 +2,12 @@ comments: true difficulty: 困难 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3559.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20II/README.md +tags: + - 树 + - 深度优先搜索 + - 数组 + - 数学 + - 动态规划 --- <!-- problem:start --> diff --git a/solution/3500-3599/3559.Number of Ways to Assign Edge Weights II/README_EN.md b/solution/3500-3599/3559.Number of Ways to Assign Edge Weights II/README_EN.md index 4c07baabb6761..6268dc6858e85 100644 --- a/solution/3500-3599/3559.Number of Ways to Assign Edge Weights II/README_EN.md +++ b/solution/3500-3599/3559.Number of Ways to Assign Edge Weights II/README_EN.md @@ -2,6 +2,12 @@ comments: true difficulty: Hard edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3559.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20II/README_EN.md +tags: + - Tree + - Depth-First Search + - Array + - Math + - Dynamic Programming --- <!-- problem:start --> diff --git a/solution/3500-3599/3560.Find Minimum Log Transportation Cost/README.md b/solution/3500-3599/3560.Find Minimum Log Transportation Cost/README.md index a61f873580752..39ea5b2164e9d 100644 --- a/solution/3500-3599/3560.Find Minimum Log Transportation Cost/README.md +++ b/solution/3500-3599/3560.Find Minimum Log Transportation Cost/README.md @@ -2,6 +2,8 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3560.Find%20Minimum%20Log%20Transportation%20Cost/README.md +tags: + - 数学 --- <!-- problem:start --> diff --git a/solution/3500-3599/3560.Find Minimum Log Transportation Cost/README_EN.md b/solution/3500-3599/3560.Find Minimum Log Transportation Cost/README_EN.md index 61e1e379cc4db..4898cdf7ea597 100644 --- a/solution/3500-3599/3560.Find Minimum Log Transportation Cost/README_EN.md +++ b/solution/3500-3599/3560.Find Minimum Log Transportation Cost/README_EN.md @@ -2,6 +2,8 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3560.Find%20Minimum%20Log%20Transportation%20Cost/README_EN.md +tags: + - Math --- <!-- problem:start --> diff --git a/solution/3500-3599/3561.Resulting String After Adjacent Removals/README.md b/solution/3500-3599/3561.Resulting String After Adjacent Removals/README.md index f9c935f73907e..0f2444eba999e 100644 --- a/solution/3500-3599/3561.Resulting String After Adjacent Removals/README.md +++ b/solution/3500-3599/3561.Resulting String After Adjacent Removals/README.md @@ -2,6 +2,10 @@ comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3561.Resulting%20String%20After%20Adjacent%20Removals/README.md +tags: + - 栈 + - 字符串 + - 模拟 --- <!-- problem:start --> diff --git a/solution/3500-3599/3561.Resulting String After Adjacent Removals/README_EN.md b/solution/3500-3599/3561.Resulting String After Adjacent Removals/README_EN.md index 1d88885331f2c..607f4865a98d4 100644 --- a/solution/3500-3599/3561.Resulting String After Adjacent Removals/README_EN.md +++ b/solution/3500-3599/3561.Resulting String After Adjacent Removals/README_EN.md @@ -2,6 +2,10 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3561.Resulting%20String%20After%20Adjacent%20Removals/README_EN.md +tags: + - Stack + - String + - Simulation --- <!-- problem:start --> diff --git a/solution/3500-3599/3562.Maximum Profit from Trading Stocks with Discounts/README.md b/solution/3500-3599/3562.Maximum Profit from Trading Stocks with Discounts/README.md index 48c2fc3bb1459..7bb8c966164e8 100644 --- a/solution/3500-3599/3562.Maximum Profit from Trading Stocks with Discounts/README.md +++ b/solution/3500-3599/3562.Maximum Profit from Trading Stocks with Discounts/README.md @@ -2,6 +2,11 @@ comments: true difficulty: 困难 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3562.Maximum%20Profit%20from%20Trading%20Stocks%20with%20Discounts/README.md +tags: + - 树 + - 深度优先搜索 + - 数组 + - 动态规划 --- <!-- problem:start --> diff --git a/solution/3500-3599/3562.Maximum Profit from Trading Stocks with Discounts/README_EN.md b/solution/3500-3599/3562.Maximum Profit from Trading Stocks with Discounts/README_EN.md index d7f75d857d91f..fb44fc7a68dea 100644 --- a/solution/3500-3599/3562.Maximum Profit from Trading Stocks with Discounts/README_EN.md +++ b/solution/3500-3599/3562.Maximum Profit from Trading Stocks with Discounts/README_EN.md @@ -2,6 +2,11 @@ comments: true difficulty: Hard edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3562.Maximum%20Profit%20from%20Trading%20Stocks%20with%20Discounts/README_EN.md +tags: + - Tree + - Depth-First Search + - Array + - Dynamic Programming --- <!-- problem:start --> diff --git a/solution/3500-3599/3563.Lexicographically Smallest String After Adjacent Removals/README.md b/solution/3500-3599/3563.Lexicographically Smallest String After Adjacent Removals/README.md index 78d69511fb88a..63a0ebed9af10 100644 --- a/solution/3500-3599/3563.Lexicographically Smallest String After Adjacent Removals/README.md +++ b/solution/3500-3599/3563.Lexicographically Smallest String After Adjacent Removals/README.md @@ -2,6 +2,9 @@ comments: true difficulty: 困难 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3563.Lexicographically%20Smallest%20String%20After%20Adjacent%20Removals/README.md +tags: + - 字符串 + - 动态规划 --- <!-- problem:start --> diff --git a/solution/3500-3599/3563.Lexicographically Smallest String After Adjacent Removals/README_EN.md b/solution/3500-3599/3563.Lexicographically Smallest String After Adjacent Removals/README_EN.md index 66c88c680e50f..9ebf3ac10e5b3 100644 --- a/solution/3500-3599/3563.Lexicographically Smallest String After Adjacent Removals/README_EN.md +++ b/solution/3500-3599/3563.Lexicographically Smallest String After Adjacent Removals/README_EN.md @@ -2,6 +2,9 @@ comments: true difficulty: Hard edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3563.Lexicographically%20Smallest%20String%20After%20Adjacent%20Removals/README_EN.md +tags: + - String + - Dynamic Programming --- <!-- problem:start --> diff --git a/solution/3500-3599/3564.Seasonal Sales Analysis/README.md b/solution/3500-3599/3564.Seasonal Sales Analysis/README.md index 860de61f83848..d0ad338b92881 100644 --- a/solution/3500-3599/3564.Seasonal Sales Analysis/README.md +++ b/solution/3500-3599/3564.Seasonal Sales Analysis/README.md @@ -8,7 +8,7 @@ tags: <!-- problem:start --> -# [3564. Seasonal Sales Analysis](https://leetcode.cn/problems/seasonal-sales-analysis) +# [3564. 季节性销售分析](https://leetcode.cn/problems/seasonal-sales-analysis) [English Version](/solution/3500-3599/3564.Seasonal%20Sales%20Analysis/README_EN.md) @@ -16,7 +16,7 @@ tags: <!-- description:start --> -<p>Table: <code>sales</code></p> +<p>表:<code>sales</code></p> <pre> +---------------+---------+ @@ -28,11 +28,11 @@ tags: | quantity | int | | price | decimal | +---------------+---------+ -sale_id is the unique identifier for this table. -Each row contains information about a product sale including the product_id, date of sale, quantity sold, and price per unit. +sale_id 是这张表的唯一主键。 +每一行包含一件产品的销售信息,包括 product_id,销售日期,销售数量,以及单价。 </pre> -<p>Table: <code>products</code></p> +<p>表:<code>products</code></p> <pre> +---------------+---------+ @@ -42,32 +42,33 @@ Each row contains information about a product sale including the product_id, dat | product_name | varchar | | category | varchar | +---------------+---------+ -product_id is the unique identifier for this table. -Each row contains information about a product including its name and category. +product_id 是这张表的唯一主键。 +每一行包含一件产品的信息,包括它的名字和分类。 </pre> -<p>Write a solution to find the most popular product category for each season. The seasons are defined as:</p> +<p>编写一个解决方案来找到每个季节最受欢迎的产品分类。季节定义如下:</p> <ul> - <li><strong>Winter</strong>: December, January, February</li> - <li><strong>Spring</strong>: March, April, May</li> - <li><strong>Summer</strong>: June, July, August</li> - <li><strong>Fall</strong>: September, October, November</li> + <li><strong>冬季</strong>:十二月,一月,二月</li> + <li><strong>春季</strong>:三月,四月,五月</li> + <li><strong>夏季</strong>:六月,七月,八月</li> + <li><strong>秋季</strong>:九月,十月,十一月</li> </ul> -<p>The <strong>popularity</strong> of a <strong>category</strong> is determined by the <strong>total quantity sold</strong> in that <strong>season</strong>. If there is a <strong>tie</strong>, select the category with the highest <strong>total revenue</strong> (<code>quantity × price</code>).</p> +<p>一个 <strong>分类</strong> 的 <b>受欢迎度</b> 由某个 <strong>季节</strong> 的 <strong>总销售量</strong> 决定。如果有并列,选择总收入最高的类别 (<code>quantity × price</code>)。</p> -<p>Return <em>the result table ordered by season in <strong>ascending</strong> order</em>.</p> +<p>返回结果表以季节 <strong>升序</strong> 排序。</p> -<p>The result format is in the following example.</p> +<p>结果格式如下所示。</p> <p> </p> -<p><strong class="example">Example:</strong></p> + +<p><strong class="example">示例:</strong></p> <div class="example-block"> -<p><strong>Input:</strong></p> +<p><strong>输入:</strong></p> -<p>sales table:</p> +<p>sales 表:</p> <pre class="example-io"> +---------+------------+------------+----------+-------+ @@ -91,7 +92,7 @@ Each row contains information about a product including its name and category. +---------+------------+------------+----------+-------+ </pre> -<p>products table:</p> +<p>products 表:</p> <pre class="example-io"> +------------+-----------------+----------+ @@ -105,7 +106,7 @@ Each row contains information about a product including its name and category. +------------+-----------------+----------+ </pre> -<p><strong>Output:</strong></p> +<p><strong>输出:</strong></p> <pre class="example-io"> +---------+----------+----------------+---------------+ @@ -118,47 +119,47 @@ Each row contains information about a product including its name and category. +---------+----------+----------------+---------------+ </pre> -<p><strong>Explanation:</strong></p> +<p><strong>解释:</strong></p> <ul> - <li><strong>Fall (Sep, Oct, Nov):</strong> + <li><strong>秋季(九月,十月,十一月):</strong> <ul> - <li>Apparel: 10 items sold (6 Jackets in Sep, 4 Jeans in Nov), revenue $120.00 (6×$10.00 + 4×$15.00)</li> - <li>Fitness: 3 Yoga Mats sold in Sep, revenue $36.00</li> - <li>Most popular: Apparel with highest total quantity (10)</li> + <li>服装:售出 10 件商品(在 9 月有 6 件夹克,在 11 月 有 4 条牛仔裤),收入 $120.00(6×$10.00 + 4×$15.00)</li> + <li>健身: 9 月售出 3 张瑜伽垫,收入 $36.00</li> + <li>最受欢迎:服装总数量最多(10)</li> </ul> </li> - <li><strong>Spring (Mar, Apr, May):</strong> + <li><strong>春季(三月,四月,五月):</strong> <ul> - <li>Kitchen: 3 Cutting Boards sold in Mar, revenue $54.00</li> - <li>Tech: 1 Smart Speaker sold in Apr, revenue $20.00</li> - <li>Apparel: 2 Warm Jackets sold in May, revenue $20.00</li> - <li>Most popular: Kitchen with highest total quantity (3) and highest revenue ($54.00)</li> + <li>厨房:5 月 售出 3 张菜板,收入 $54.00</li> + <li>科技:4 月 售出 1 台智能音箱,收入 $20.00</li> + <li>服装: 五月售出 2 件保暖夹克,收入 $20.00</li> + <li>最受欢迎:厨房总数量最多(3)且收入最多($54.00)</li> </ul> </li> - <li><strong>Summer (Jun, Jul, Aug):</strong> + <li><strong>夏季(六月,七月,八月</strong><strong>):</strong> <ul> - <li>Apparel: 4 Designer Jeans sold in Jun, revenue $60.00</li> - <li>Fitness: 5 Yoga Mats sold in Jun, revenue $60.00</li> - <li>Kitchen: 2 Cutting Boards sold in Jul, revenue $36.00</li> - <li>Tech: 5 Smart Speakers sold in Aug, revenue $100.00</li> - <li>Most popular: Tech and Fitness both have 5 items, but Tech has higher revenue ($100.00 vs $60.00)</li> + <li>服装:六月售出 4 件名牌牛仔裤,收入 $60.00</li> + <li>健身:六月售出 5 张瑜伽垫,收入 $60.00</li> + <li>厨房:七月售出 2 张菜板,收入 $36.00</li> + <li>科技:八月售出 5 台智能音箱,收入 $100.00</li> + <li>最受欢迎:科技和健身都有 5 件商品,但科技收入更多($100.00 vs $60.00)</li> </ul> </li> - <li><strong>Winter (Dec, Jan, Feb):</strong> + <li><strong>冬季(十二月,一月,二月</strong><strong>):</strong> <ul> - <li>Apparel: 9 items sold (5 Jackets in Jan, 4 Jeans in Jan), revenue $110.00</li> - <li>Kitchen: 6 Cutting Boards sold in Dec, revenue $108.00</li> - <li>Tech: 3 Smart Speakers sold in Dec, revenue $60.00</li> - <li>Fitness: 2 Yoga Mats sold in Feb, revenue $24.00</li> - <li>Most popular: Apparel with highest total quantity (9) and highest revenue ($110.00)</li> + <li>服装:售出 9 件商品(一月有 5 件夹克和 4 条牛仔裤),收入 $110.00</li> + <li>厨房:十二月售出 6 张菜板,收入 $108.00</li> + <li>科技:十二月售出 3 台智能音箱,收入 $60.00</li> + <li>健身:二月售出 2 张瑜伽垫,收入 $24.00</li> + <li>最受欢迎:服装总数量最多(9)且收入最多($110.00)</li> </ul> </li> </ul> -<p>The result table is ordered by season in ascending order.</p> +<p>结果表以季节升序排序。</p> </div> <!-- description:end --> diff --git a/solution/3500-3599/3565.Sequential Grid Path Cover/README.md b/solution/3500-3599/3565.Sequential Grid Path Cover/README.md index 4a8d7bffe4c7f..65b730883aa2b 100644 --- a/solution/3500-3599/3565.Sequential Grid Path Cover/README.md +++ b/solution/3500-3599/3565.Sequential Grid Path Cover/README.md @@ -6,7 +6,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3565.Se <!-- problem:start --> -# [3565. Sequential Grid Path Cover 🔒](https://leetcode.cn/problems/sequential-grid-path-cover) +# [3565. 顺序网格路径覆盖 🔒](https://leetcode.cn/problems/sequential-grid-path-cover) [English Version](/solution/3500-3599/3565.Sequential%20Grid%20Path%20Cover/README_EN.md) @@ -14,53 +14,55 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3565.Se <!-- description:start --> -<p>You are given a 2D array <code>grid</code> of size <code>m x n</code>, and an integer <code>k</code>. There are <code>k</code> cells in <code>grid</code> containing the values from 1 to <code>k</code> <strong>exactly once</strong>, and the rest of the cells have a value 0.</p> +<p>给定一个 <code>m x n</code> 大小的 2 维数组 <code>grid</code>,和一个整数 <code>k</code>。<code>grid</code> 中有 <code>k</code> 个单元格包含从 1 到 <code>k</code> 的值,每个值恰好出现一次,其余单元格的值为 0。</p> -<p>You can start at any cell, and move from a cell to its neighbors (up, down, left, or right). You must find a path in <code>grid</code> which:</p> +<p>你可以从任何单元格开始,并且从一个单元格移动到相邻的单元格(上,下,左,右)。你必须找到一条 <code>grid</code> 中的路径,满足:</p> <ul> - <li>Visits each cell in <code>grid</code> <strong>exactly once</strong>.</li> - <li>Visits the cells with values from 1 to <code>k</code> <strong>in order</strong>.</li> + <li>访问 <code>grid</code> 中的每个单元格 <strong>恰好一次</strong>。</li> + <li><strong>按顺序</strong> 访问值为 1 到 <code>k</code> 的单元格。</li> </ul> -<p>Return a 2D array <code>result</code> of size <code>(m * n) x 2</code>, where <code>result[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> represents the <code>i<sup>th</sup></code> cell visited in the path. If there are multiple such paths, you may return <strong>any</strong> one.</p> +<p>返回一个大小为 <code>(m * n) x 2</code> 的二维数组 <code>result</code>,其中 <code>result[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> 表示路径中访问的第 <code>i</code> 个单元格。如果存在多条这样的路径,你可以返回 <strong>任何</strong> 一条。</p> -<p>If no such path exists, return an <strong>empty</strong> array.</p> +<p>如果不存在这样的路径,返回一个 <strong>空</strong> 数组。</p> <p> </p> -<p><strong class="example">Example 1:</strong></p> + +<p><strong class="example">示例 1:</strong></p> <div class="example-block"> -<p><strong>Input:</strong> <span class="example-io">grid = [[0,0,0],[0,1,2]], k = 2</span></p> +<p><span class="example-io"><b>输入:</b>grid = [[0,0,0],[0,1,2]], k = 2</span></p> -<p><strong>Output:</strong> <span class="example-io">[[0,0],[1,0],[1,1],[1,2],[0,2],[0,1]]</span></p> +<p><span class="example-io"><b>输出:</b>[[0,0],[1,0],[1,1],[1,2],[0,2],[0,1]]</span></p> -<p><strong>Explanation:</strong></p> +<p><strong>解释:</strong></p> <p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/3500-3599/3565.Sequential%20Grid%20Path%20Cover/images/ezgifcom-animated-gif-maker1.gif" style="width: 200px; height: 160px;" /></p> </div> -<p><strong class="example">Example 2:</strong></p> +<p><strong class="example">示例 2:</strong></p> <div class="example-block"> -<p><strong>Input:</strong> <span class="example-io">grid = [[1,0,4],[3,0,2]], k = 4</span></p> +<p><span class="example-io"><b>输入:</b>grid = [[1,0,4],[3,0,2]], k = 4</span></p> -<p><strong>Output:</strong> <span class="example-io">[]</span></p> +<p><span class="example-io"><b>输出:</b>[]</span></p> -<p><strong>Explanation:</strong></p> +<p><strong>解释:</strong></p> -<p>There is no possible path that satisfies the conditions.</p> +<p>没有满足条件的路径。</p> </div> <p> </p> -<p><strong>Constraints:</strong></p> + +<p><strong>提示:</strong></p> <ul> <li><code>1 <= m == grid.length <= 6</code></li> <li><code>1 <= n == grid[i].length <= 6</code></li> <li><code>1 <= k <= m * n</code></li> <li><code>0 <= grid[i][j] <= k</code></li> - <li><code>grid</code> contains all integers between 1 and <code>k</code> <strong>exactly</strong> once.</li> + <li><code>grid</code> 包含 1 到 <code>k</code> 的所有整数 <strong>恰好</strong> 一次。</li> </ul> <!-- description:end --> diff --git a/solution/DATABASE_README.md b/solution/DATABASE_README.md index 24a3b9e52afcc..8600a6685370a 100644 --- a/solution/DATABASE_README.md +++ b/solution/DATABASE_README.md @@ -316,7 +316,7 @@ | 3497 | [分析订阅转化](/solution/3400-3499/3497.Analyze%20Subscription%20Conversion/README.md) | `数据库` | 中等 | | | 3521 | [查找推荐产品对](/solution/3500-3599/3521.Find%20Product%20Recommendation%20Pairs/README.md) | `数据库` | 中等 | | | 3554 | [查找类别推荐对](/solution/3500-3599/3554.Find%20Category%20Recommendation%20Pairs/README.md) | `数据库` | 困难 | | -| 3564 | [Seasonal Sales Analysis](/solution/3500-3599/3564.Seasonal%20Sales%20Analysis/README.md) | | 中等 | | +| 3564 | [季节性销售分析](/solution/3500-3599/3564.Seasonal%20Sales%20Analysis/README.md) | `数据库` | 中等 | | ## 版权 diff --git a/solution/DATABASE_README_EN.md b/solution/DATABASE_README_EN.md index 2bd26d6443147..92a871dcd6026 100644 --- a/solution/DATABASE_README_EN.md +++ b/solution/DATABASE_README_EN.md @@ -314,7 +314,7 @@ Press <kbd>Control</kbd> + <kbd>F</kbd>(or <kbd>Command</kbd> + <kbd>F</kbd> on | 3497 | [Analyze Subscription Conversion](/solution/3400-3499/3497.Analyze%20Subscription%20Conversion/README_EN.md) | `Database` | Medium | | | 3521 | [Find Product Recommendation Pairs](/solution/3500-3599/3521.Find%20Product%20Recommendation%20Pairs/README_EN.md) | `Database` | Medium | | | 3554 | [Find Category Recommendation Pairs](/solution/3500-3599/3554.Find%20Category%20Recommendation%20Pairs/README_EN.md) | `Database` | Hard | | -| 3564 | [Seasonal Sales Analysis](/solution/3500-3599/3564.Seasonal%20Sales%20Analysis/README_EN.md) | | Medium | | +| 3564 | [Seasonal Sales Analysis](/solution/3500-3599/3564.Seasonal%20Sales%20Analysis/README_EN.md) | `Database` | Medium | | ## Copyright diff --git a/solution/README.md b/solution/README.md index 1fd9de8c70eb4..2ac9fbc9ed8cb 100644 --- a/solution/README.md +++ b/solution/README.md @@ -3565,17 +3565,17 @@ | 3552 | [网格传送门旅游](/solution/3500-3599/3552.Grid%20Teleportation%20Traversal/README.md) | `广度优先搜索`,`数组`,`哈希表`,`矩阵` | 中等 | 第 450 场周赛 | | 3553 | [包含给定路径的最小带权子树 II](/solution/3500-3599/3553.Minimum%20Weighted%20Subgraph%20With%20the%20Required%20Paths%20II/README.md) | `树`,`深度优先搜索`,`数组` | 困难 | 第 450 场周赛 | | 3554 | [查找类别推荐对](/solution/3500-3599/3554.Find%20Category%20Recommendation%20Pairs/README.md) | `数据库` | 困难 | | -| 3555 | [排序每个滑动窗口中最小的子数组](/solution/3500-3599/3555.Smallest%20Subarray%20to%20Sort%20in%20Every%20Sliding%20Window/README.md) | | 中等 | 🔒 | -| 3556 | [最大质数子字符串之和](/solution/3500-3599/3556.Sum%20of%20Largest%20Prime%20Substrings/README.md) | | 中等 | 第 157 场双周赛 | -| 3557 | [不相交子字符串的最大数量](/solution/3500-3599/3557.Find%20Maximum%20Number%20of%20Non%20Intersecting%20Substrings/README.md) | | 中等 | 第 157 场双周赛 | -| 3558 | [给边赋权值的方案数 I](/solution/3500-3599/3558.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20I/README.md) | | 中等 | 第 157 场双周赛 | -| 3559 | [给边赋权值的方案数 II](/solution/3500-3599/3559.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20II/README.md) | | 困难 | 第 157 场双周赛 | -| 3560 | [木材运输的最小成本](/solution/3500-3599/3560.Find%20Minimum%20Log%20Transportation%20Cost/README.md) | | 简单 | 第 451 场周赛 | -| 3561 | [移除相邻字符](/solution/3500-3599/3561.Resulting%20String%20After%20Adjacent%20Removals/README.md) | | 中等 | 第 451 场周赛 | -| 3562 | [折扣价交易股票的最大利润](/solution/3500-3599/3562.Maximum%20Profit%20from%20Trading%20Stocks%20with%20Discounts/README.md) | | 困难 | 第 451 场周赛 | -| 3563 | [移除相邻字符后字典序最小的字符串](/solution/3500-3599/3563.Lexicographically%20Smallest%20String%20After%20Adjacent%20Removals/README.md) | | 困难 | 第 451 场周赛 | -| 3564 | [Seasonal Sales Analysis](/solution/3500-3599/3564.Seasonal%20Sales%20Analysis/README.md) | | 中等 | | -| 3565 | [Sequential Grid Path Cover](/solution/3500-3599/3565.Sequential%20Grid%20Path%20Cover/README.md) | | 中等 | 🔒 | +| 3555 | [排序每个滑动窗口中最小的子数组](/solution/3500-3599/3555.Smallest%20Subarray%20to%20Sort%20in%20Every%20Sliding%20Window/README.md) | `栈`,`贪心`,`数组`,`双指针`,`排序`,`单调栈` | 中等 | 🔒 | +| 3556 | [最大质数子字符串之和](/solution/3500-3599/3556.Sum%20of%20Largest%20Prime%20Substrings/README.md) | `哈希表`,`数学`,`字符串`,`数论`,`排序` | 中等 | 第 157 场双周赛 | +| 3557 | [不相交子字符串的最大数量](/solution/3500-3599/3557.Find%20Maximum%20Number%20of%20Non%20Intersecting%20Substrings/README.md) | `贪心`,`哈希表`,`字符串`,`动态规划` | 中等 | 第 157 场双周赛 | +| 3558 | [给边赋权值的方案数 I](/solution/3500-3599/3558.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20I/README.md) | `树`,`深度优先搜索`,`数学` | 中等 | 第 157 场双周赛 | +| 3559 | [给边赋权值的方案数 II](/solution/3500-3599/3559.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20II/README.md) | `树`,`深度优先搜索`,`数组`,`数学`,`动态规划` | 困难 | 第 157 场双周赛 | +| 3560 | [木材运输的最小成本](/solution/3500-3599/3560.Find%20Minimum%20Log%20Transportation%20Cost/README.md) | `数学` | 简单 | 第 451 场周赛 | +| 3561 | [移除相邻字符](/solution/3500-3599/3561.Resulting%20String%20After%20Adjacent%20Removals/README.md) | `栈`,`字符串`,`模拟` | 中等 | 第 451 场周赛 | +| 3562 | [折扣价交易股票的最大利润](/solution/3500-3599/3562.Maximum%20Profit%20from%20Trading%20Stocks%20with%20Discounts/README.md) | `树`,`深度优先搜索`,`数组`,`动态规划` | 困难 | 第 451 场周赛 | +| 3563 | [移除相邻字符后字典序最小的字符串](/solution/3500-3599/3563.Lexicographically%20Smallest%20String%20After%20Adjacent%20Removals/README.md) | `字符串`,`动态规划` | 困难 | 第 451 场周赛 | +| 3564 | [季节性销售分析](/solution/3500-3599/3564.Seasonal%20Sales%20Analysis/README.md) | `数据库` | 中等 | | +| 3565 | [顺序网格路径覆盖](/solution/3500-3599/3565.Sequential%20Grid%20Path%20Cover/README.md) | | 中等 | 🔒 | ## 版权 diff --git a/solution/README_EN.md b/solution/README_EN.md index 83599a0b176e9..69a734febcd8a 100644 --- a/solution/README_EN.md +++ b/solution/README_EN.md @@ -3563,16 +3563,16 @@ Press <kbd>Control</kbd> + <kbd>F</kbd>(or <kbd>Command</kbd> + <kbd>F</kbd> on | 3552 | [Grid Teleportation Traversal](/solution/3500-3599/3552.Grid%20Teleportation%20Traversal/README_EN.md) | `Breadth-First Search`,`Array`,`Hash Table`,`Matrix` | Medium | Weekly Contest 450 | | 3553 | [Minimum Weighted Subgraph With the Required Paths II](/solution/3500-3599/3553.Minimum%20Weighted%20Subgraph%20With%20the%20Required%20Paths%20II/README_EN.md) | `Tree`,`Depth-First Search`,`Array` | Hard | Weekly Contest 450 | | 3554 | [Find Category Recommendation Pairs](/solution/3500-3599/3554.Find%20Category%20Recommendation%20Pairs/README_EN.md) | `Database` | Hard | | -| 3555 | [Smallest Subarray to Sort in Every Sliding Window](/solution/3500-3599/3555.Smallest%20Subarray%20to%20Sort%20in%20Every%20Sliding%20Window/README_EN.md) | | Medium | 🔒 | -| 3556 | [Sum of Largest Prime Substrings](/solution/3500-3599/3556.Sum%20of%20Largest%20Prime%20Substrings/README_EN.md) | | Medium | Biweekly Contest 157 | -| 3557 | [Find Maximum Number of Non Intersecting Substrings](/solution/3500-3599/3557.Find%20Maximum%20Number%20of%20Non%20Intersecting%20Substrings/README_EN.md) | | Medium | Biweekly Contest 157 | -| 3558 | [Number of Ways to Assign Edge Weights I](/solution/3500-3599/3558.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20I/README_EN.md) | | Medium | Biweekly Contest 157 | -| 3559 | [Number of Ways to Assign Edge Weights II](/solution/3500-3599/3559.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20II/README_EN.md) | | Hard | Biweekly Contest 157 | -| 3560 | [Find Minimum Log Transportation Cost](/solution/3500-3599/3560.Find%20Minimum%20Log%20Transportation%20Cost/README_EN.md) | | Easy | Weekly Contest 451 | -| 3561 | [Resulting String After Adjacent Removals](/solution/3500-3599/3561.Resulting%20String%20After%20Adjacent%20Removals/README_EN.md) | | Medium | Weekly Contest 451 | -| 3562 | [Maximum Profit from Trading Stocks with Discounts](/solution/3500-3599/3562.Maximum%20Profit%20from%20Trading%20Stocks%20with%20Discounts/README_EN.md) | | Hard | Weekly Contest 451 | -| 3563 | [Lexicographically Smallest String After Adjacent Removals](/solution/3500-3599/3563.Lexicographically%20Smallest%20String%20After%20Adjacent%20Removals/README_EN.md) | | Hard | Weekly Contest 451 | -| 3564 | [Seasonal Sales Analysis](/solution/3500-3599/3564.Seasonal%20Sales%20Analysis/README_EN.md) | | Medium | | +| 3555 | [Smallest Subarray to Sort in Every Sliding Window](/solution/3500-3599/3555.Smallest%20Subarray%20to%20Sort%20in%20Every%20Sliding%20Window/README_EN.md) | `Stack`,`Greedy`,`Array`,`Two Pointers`,`Sorting`,`Monotonic Stack` | Medium | 🔒 | +| 3556 | [Sum of Largest Prime Substrings](/solution/3500-3599/3556.Sum%20of%20Largest%20Prime%20Substrings/README_EN.md) | `Hash Table`,`Math`,`String`,`Number Theory`,`Sorting` | Medium | Biweekly Contest 157 | +| 3557 | [Find Maximum Number of Non Intersecting Substrings](/solution/3500-3599/3557.Find%20Maximum%20Number%20of%20Non%20Intersecting%20Substrings/README_EN.md) | `Greedy`,`Hash Table`,`String`,`Dynamic Programming` | Medium | Biweekly Contest 157 | +| 3558 | [Number of Ways to Assign Edge Weights I](/solution/3500-3599/3558.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20I/README_EN.md) | `Tree`,`Depth-First Search`,`Math` | Medium | Biweekly Contest 157 | +| 3559 | [Number of Ways to Assign Edge Weights II](/solution/3500-3599/3559.Number%20of%20Ways%20to%20Assign%20Edge%20Weights%20II/README_EN.md) | `Tree`,`Depth-First Search`,`Array`,`Math`,`Dynamic Programming` | Hard | Biweekly Contest 157 | +| 3560 | [Find Minimum Log Transportation Cost](/solution/3500-3599/3560.Find%20Minimum%20Log%20Transportation%20Cost/README_EN.md) | `Math` | Easy | Weekly Contest 451 | +| 3561 | [Resulting String After Adjacent Removals](/solution/3500-3599/3561.Resulting%20String%20After%20Adjacent%20Removals/README_EN.md) | `Stack`,`String`,`Simulation` | Medium | Weekly Contest 451 | +| 3562 | [Maximum Profit from Trading Stocks with Discounts](/solution/3500-3599/3562.Maximum%20Profit%20from%20Trading%20Stocks%20with%20Discounts/README_EN.md) | `Tree`,`Depth-First Search`,`Array`,`Dynamic Programming` | Hard | Weekly Contest 451 | +| 3563 | [Lexicographically Smallest String After Adjacent Removals](/solution/3500-3599/3563.Lexicographically%20Smallest%20String%20After%20Adjacent%20Removals/README_EN.md) | `String`,`Dynamic Programming` | Hard | Weekly Contest 451 | +| 3564 | [Seasonal Sales Analysis](/solution/3500-3599/3564.Seasonal%20Sales%20Analysis/README_EN.md) | `Database` | Medium | | | 3565 | [Sequential Grid Path Cover](/solution/3500-3599/3565.Sequential%20Grid%20Path%20Cover/README_EN.md) | | Medium | 🔒 | ## Copyright