Skip to content

feat: update lc problems #3321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions solution/0000-0099/0015.3Sum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ tags:

<!-- description:start -->

<p>给你一个整数数组 <code>nums</code> ,判断是否存在三元组 <code>[nums[i], nums[j], nums[k]]</code> 满足 <code>i != j</code>、<code>i != k</code> 且 <code>j != k</code> ,同时还满足 <code>nums[i] + nums[j] + nums[k] == 0</code> 。请</p>

<p>你返回所有和为 <code>0</code> 且不重复的三元组。</p>
<p>给你一个整数数组 <code>nums</code> ,判断是否存在三元组 <code>[nums[i], nums[j], nums[k]]</code> 满足 <code>i != j</code>、<code>i != k</code> 且 <code>j != k</code> ,同时还满足 <code>nums[i] + nums[j] + nums[k] == 0</code> 。请你返回所有和为 <code>0</code> 且不重复的三元组。</p>

<p><strong>注意:</strong>答案中不可以包含重复的三元组。</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ tags:
<pre>
<strong>Input:</strong> mapping = [8,9,4,0,2,1,3,5,7,6], nums = [991,338,38]
<strong>Output:</strong> [338,38,991]
<strong>Explanation:</strong>
<strong>Explanation:</strong>
Map the number 991 as follows:
1. mapping[9] = 6, so all occurrences of the digit 9 will become 6.
2. mapping[1] = 9, so all occurrences of the digit 1 will become 9.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tags:

<p>给你一个长度为 <code>n</code>&nbsp;的二进制数组&nbsp;<code>possible</code>&nbsp;。</p>

<p>Alice 和 Bob 正在玩一个有 <code>n</code> 个关卡的游戏,游戏中有一些关卡是 <strong>困难</strong>&nbsp;模式,其他的关卡是 <strong>简单</strong>&nbsp;模式。如果&nbsp;<code>possible[i] == 0</code>&nbsp;,那么第&nbsp;<code>i</code> 个关卡是 <strong>困难</strong>&nbsp;模式。一个玩家通过一个简单模式的关卡可以获得 <code>1</code>&nbsp;分,通过困难模式的关卡将失去 <code>1</code>&nbsp;分。</p>
<p>Alice 和 Bob 正在玩一个有 <code>n</code> 个关卡的游戏,游戏中有一些关卡是 <strong>困难</strong>&nbsp;模式,其他的关卡是 <strong>简单</strong>&nbsp;模式。如果&nbsp;<code>possible[i] == 0</code>&nbsp;,那么第&nbsp;<code>i</code> 个关卡是 <strong>困难</strong>&nbsp;模式,两个玩家&nbsp;<strong>都不可能</strong> 通过。一个玩家通过一个简单模式的关卡可以获得 <code>1</code>&nbsp;分,遇到困难模式的关卡将失去 <code>1</code>&nbsp;分。</p>

<p>游戏的一开始,Alice 将从第 <code>0</code>&nbsp;级开始 <strong>按顺序</strong> 完成一些关卡,然后 Bob 会完成剩下的所有关卡。</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ tags:
<p><img 10px="" alt="" padding:="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/3100-3199/3112.Minimum%20Time%20to%20Visit%20Disappearing%20Nodes/images/example1.png" style="width: 350px; height: 210px;" /></p>

<div class="example-block" style="border-color: var(--border-tertiary); border-left-width: 2px; color: var(--text-secondary); margin-bottom: 1rem; margin-top: 1rem; overflow: visible; padding-left: 1rem;">
<p style=""><span class="example-io" style="font-size: 8.75px;"><b>输入:</b></span><span class="example-io" style="font-size: 0.85rem; font-family: Menlo, sans-serif;">n = 3, edges = [[0,1,2],[1,2,1],[0,2,4]], disappear = [1,1,5]</span></p>
<p style=""><span class="example-io"><b>输入:</b></span><span class="example-io" style="font-size: 0.85rem; font-family: Menlo, sans-serif;">n = 3, edges = [[0,1,2],[1,2,1],[0,2,4]], disappear = [1,1,5]</span></p>

<p style=""><span class="example-io" style="font-size: 8.75px;"><b>输出:</b></span><span class="example-io" style="font-size: 0.85rem; font-family: Menlo, sans-serif;">[0,-1,4]</span></p>
<p style=""><span class="example-io"><b>输出:</b></span><span class="example-io" style="font-size: 0.85rem; font-family: Menlo, sans-serif;">[0,-1,4]</span></p>

<p style="font-size: 0.875rem;"><strong>解释:</strong></p>

Expand All @@ -56,9 +56,9 @@ tags:
<p><img 10px="" alt="" padding:="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/3100-3199/3112.Minimum%20Time%20to%20Visit%20Disappearing%20Nodes/images/example2.png" style="width: 350px; height: 210px;" /></p>

<div class="example-block" style="border-color: var(--border-tertiary); border-left-width: 2px; color: var(--text-secondary); margin-bottom: 1rem; margin-top: 1rem; overflow: visible; padding-left: 1rem;">
<p style=""><span class="example-io" style="font-size: 8.75px;"><b>输入:</b></span><span class="example-io" style="font-size: 0.85rem; font-family: Menlo, sans-serif;">n = 3, edges = [[0,1,2],[1,2,1],[0,2,4]], disappear = [1,3,5]</span></p>
<p style=""><span class="example-io"><b>输入:</b></span><span class="example-io" style="font-size: 0.85rem; font-family: Menlo, sans-serif;">n = 3, edges = [[0,1,2],[1,2,1],[0,2,4]], disappear = [1,3,5]</span></p>

<p style=""><span class="example-io" style="font-size: 8.75px;"><b>输出:</b></span><span class="example-io" style="font-size: 0.85rem; font-family: Menlo, sans-serif;">[0,2,3]</span></p>
<p style=""><span class="example-io"><b>输出:</b></span><span class="example-io" style="font-size: 0.85rem; font-family: Menlo, sans-serif;">[0,2,3]</span></p>

<p style="font-size: 0.875rem;"><strong>解释:</strong></p>

Expand Down
41 changes: 21 additions & 20 deletions solution/3200-3299/3220.Odd and Even Transactions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ tags:

<!-- problem:start -->

# [3220. Odd and Even Transactions](https://leetcode.cn/problems/odd-and-even-transactions)
# [3220. 奇数和偶数交易](https://leetcode.cn/problems/odd-and-even-transactions)

[English Version](/solution/3200-3299/3220.Odd%20and%20Even%20Transactions/README_EN.md)

## 题目描述

<!-- description:start -->

<p>Table: <code>transactions</code></p>
<p>表:<code>transactions</code></p>

<pre>
+------------------+------+
Expand All @@ -26,23 +26,24 @@ tags:
| amount | int |
| transaction_date | date |
+------------------+------+
The transactions_id column uniquely identifies each row in this table.
Each row of this table contains the transaction id, amount and transaction date.
transactions_id 列唯一标识了表中的每一行。
这张表的每一行包含交易 id,金额总和和交易日期。
</pre>

<p>Write a solution to find the <strong>sum of amounts</strong> for <strong>odd</strong> and <strong>even</strong> transactions for each day. If there are no odd or even transactions for a specific date, display as <code>0</code>.</p>
<p>编写一个解决方案来查找每天 <strong>奇数</strong> 交易金额和 <strong>偶数</strong> 交易金额的 <strong>总和</strong>。如果某天没有奇数或偶数交易,显示为&nbsp;<code>0</code></p>

<p>Return <em>the result table ordered by</em> <code>transaction_date</code> <em>in <strong>ascending</strong> order</em>.</p>
<p>返回结果表以&nbsp;<code>transaction_date</code> <strong>升序</strong>&nbsp;排序。</p>

<p>The result format is in the following example.</p>
<p>结果格式如下所示。</p>

<p>&nbsp;</p>
<p><strong class="example">Example:</strong></p>

<p><strong class="example">示例:</strong></p>

<div class="example-block">
<p><strong>Input:</strong></p>
<p><b>输入:</b></p>

<p><code>transactions</code> table:</p>
<p><code>transactions</code> 表:</p>

<pre class="example-io">
+----------------+--------+------------------+
Expand All @@ -57,7 +58,7 @@ Each row of this table contains the transaction id, amount and transaction date.
+----------------+--------+------------------+
</pre>

<p><strong>Output:</strong></p>
<p><strong>输出:</strong></p>

<pre class="example-io">
+------------------+---------+----------+
Expand All @@ -69,34 +70,34 @@ Each row of this table contains the transaction id, amount and transaction date.
+------------------+---------+----------+
</pre>

<p><strong>Explanation:</strong></p>
<p><strong>解释:</strong></p>

<ul>
<li>For transaction dates:
<li>对于交易日期:
<ul>
<li>2024-07-01:
<ul>
<li>Sum of amounts for odd transactions: 75</li>
<li>Sum of amounts for even transactions: 150 + 200 = 350</li>
<li>奇数交易金额总和:75</li>
<li>偶数交易金额总和:150 + 200 = 350</li>
</ul>
</li>
<li>2024-07-02:
<ul>
<li>Sum of amounts for odd transactions: 0</li>
<li>Sum of amounts for even transactions: 300 + 50 = 350</li>
<li>奇数交易金额总和:0</li>
<li>偶数交易金额总和:300 + 50 = 350</li>
</ul>
</li>
<li>2024-07-03:
<ul>
<li>Sum of amounts for odd transactions: 0</li>
<li>Sum of amounts for even transactions: 120</li>
<li>奇数交易金额总和:0</li>
<li>偶数交易金额总和:120</li>
</ul>
</li>
</ul>
</li>
</ul>

<p><strong>Note:</strong> The output table is ordered by <code>transaction_date</code> in ascending order.</p>
<p><b>注意:</b>输出表以&nbsp;<code>transaction_date</code>&nbsp;升序排序。</p>
</div>

<!-- description:end -->
Expand Down
40 changes: 19 additions & 21 deletions solution/3200-3299/3221.Maximum Array Hopping Score II/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,50 @@ tags:

<!-- problem:start -->

# [3221. Maximum Array Hopping Score II 🔒](https://leetcode.cn/problems/maximum-array-hopping-score-ii)
# [3221. 最大数组跳跃得分 II 🔒](https://leetcode.cn/problems/maximum-array-hopping-score-ii)

[English Version](/solution/3200-3299/3221.Maximum%20Array%20Hopping%20Score%20II/README_EN.md)

## 题目描述

<!-- description:start -->

<p>Given an array <code>nums</code>, you have to get the <strong>maximum</strong> score starting from index 0 and <strong>hopping</strong> until you reach the last element of the array.</p>
<p>给定一个数组&nbsp;<code>nums</code>,你必须从索引 0 开始跳跃,直到到达数组的最后一个元素,使得获取 <strong>最大</strong> 分数。</p>

<p>In each <strong>hop</strong>, you can jump from index <code>i</code> to an index <code>j &gt; i</code>, and you get a <strong>score</strong> of <code>(j - i) * nums[j]</code>.</p>
<p>每一次 <strong>跳跃</strong> 中,你可以从下标&nbsp;<code>i</code>&nbsp;跳到一个&nbsp;<code>j &gt; i</code>&nbsp;的下标,并且可以得到&nbsp;<code>(j - i) * nums[j]</code>&nbsp;的分数。</p>

<p>Return the <em>maximum score</em> you can get.</p>
<p>返回你能够取得的最大分数。</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [1,5,8]</span></p>
<p><strong>示例 1:</strong></p>

<p><strong>Output:</strong> <span class="example-io">16</span></p>
<p><b>输入:</b>nums = [1,5,8]</p>

<p><strong>Explanation:</strong></p>
<p><b>输出:</b>16</p>

<p>There are two possible ways to reach the last element:</p>
<p><strong>解释:</strong></p>

<p>有两种可能的方法可以到达最后一个元素:</p>

<ul>
<li><code>0 -&gt; 1 -&gt; 2</code> with a score of <code>(1 - 0) * 5 + (2 - 1) * 8 = 13</code>.</li>
<li><code>0 -&gt; 2</code> with a score of <code>(2 - 0) * 8 = 16</code>.</li>
<li><code>0 -&gt; 1 -&gt; 2</code> 得分为&nbsp;<code>(1 - 0) * 5 + (2 - 1) * 8 = 13</code></li>
<li><code>0 -&gt; 2</code> 得分为&nbsp;<code>(2 - 0) * 8 =&nbsp;16</code></li>
</ul>
</div>

<p><strong class="example">Example 2:</strong></p>
<p><strong>示例 2:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [4,5,2,8,9,1,3]</span></p>
<p><b>输入:</b>nums = [4,5,2,8,9,1,3]</p>

<p><strong>Output:</strong> <span class="example-io">42</span></p>
<p><b>输出:</b>42</p>

<p><strong>Explanation:</strong></p>
<p><strong>解释:</strong></p>

<p>We can do the hopping <code>0 -&gt; 4 -&gt; 6</code> with a score of&nbsp;<code>(4 - 0) * 9 + (6 - 4) * 3 = 42</code>.</p>
</div>
<p>我们可以按&nbsp;<code>0 -&gt; 4 -&gt; 6</code>&nbsp;进行跳跃,得分为&nbsp;<code>(4 - 0) * 9 + (6 - 4) * 3 = 42</code>。</p>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<p><b>提示:</b></p>

<ul>
<li><code>2 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
Expand Down
4 changes: 2 additions & 2 deletions solution/CONTEST_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ comments: true

## 往期竞赛

#### 第 407 场周赛(2024-07-21 10:30, 90 分钟) 参赛人数 3169
#### 第 407 场周赛(2024-07-21 10:30, 90 分钟) 参赛人数 3268

- [3226. 使两个整数相等的位更改次数](/solution/3200-3299/3226.Number%20of%20Bit%20Changes%20to%20Make%20Two%20Integers%20Equal/README.md)
- [3227. 字符串元音游戏](/solution/3200-3299/3227.Vowels%20Game%20in%20a%20String/README.md)
- [3228. 将 1 移动到末尾的最大操作次数](/solution/3200-3299/3228.Maximum%20Number%20of%20Operations%20to%20Move%20Ones%20to%20the%20End/README.md)
- [3229. 使数组等于目标数组所需的最少操作次数](/solution/3200-3299/3229.Minimum%20Operations%20to%20Make%20Array%20Equal%20to%20Target/README.md)

#### 第 135 场双周赛(2024-07-20 22:30, 90 分钟) 参赛人数 2259
#### 第 135 场双周赛(2024-07-20 22:30, 90 分钟) 参赛人数 2260

- [3222. 求出硬币游戏的赢家](/solution/3200-3299/3222.Find%20the%20Winning%20Player%20in%20Coin%20Game/README.md)
- [3223. 操作后字符串的最短长度](/solution/3200-3299/3223.Minimum%20Length%20of%20String%20After%20Operations/README.md)
Expand Down
2 changes: 1 addition & 1 deletion solution/DATABASE_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
| 3198 | [查找每个州的城市](/solution/3100-3199/3198.Find%20Cities%20in%20Each%20State/README.md) | `数据库` | 简单 | 🔒 |
| 3204 | [按位用户权限分析](/solution/3200-3299/3204.Bitwise%20User%20Permissions%20Analysis/README.md) | `数据库` | 中等 | 🔒 |
| 3214 | [同比增长率](/solution/3200-3299/3214.Year%20on%20Year%20Growth%20Rate/README.md) | `数据库` | 困难 | 🔒 |
| 3220 | [Odd and Even Transactions](/solution/3200-3299/3220.Odd%20and%20Even%20Transactions/README.md) | `数据库` | 中等 | |
| 3220 | [奇数和偶数交易](/solution/3200-3299/3220.Odd%20and%20Even%20Transactions/README.md) | `数据库` | 中等 | |
| 3230 | [客户购买行为分析](/solution/3200-3299/3230.Customer%20Purchasing%20Behavior%20Analysis/README.md) | `数据库` | 中等 | 🔒 |

## 版权
Expand Down
4 changes: 2 additions & 2 deletions solution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3230,8 +3230,8 @@
| 3217 | [从链表中移除在数组中存在的节点](/solution/3200-3299/3217.Delete%20Nodes%20From%20Linked%20List%20Present%20in%20Array/README.md) | `数组`,`哈希表`,`链表` | 中等 | 第 406 场周赛 |
| 3218 | [切蛋糕的最小总开销 I](/solution/3200-3299/3218.Minimum%20Cost%20for%20Cutting%20Cake%20I/README.md) | `贪心`,`数组`,`动态规划`,`排序` | 中等 | 第 406 场周赛 |
| 3219 | [切蛋糕的最小总开销 II](/solution/3200-3299/3219.Minimum%20Cost%20for%20Cutting%20Cake%20II/README.md) | `贪心`,`数组`,`排序` | 困难 | 第 406 场周赛 |
| 3220 | [Odd and Even Transactions](/solution/3200-3299/3220.Odd%20and%20Even%20Transactions/README.md) | `数据库` | 中等 | |
| 3221 | [Maximum Array Hopping Score II](/solution/3200-3299/3221.Maximum%20Array%20Hopping%20Score%20II/README.md) | `栈`,`贪心`,`数组`,`单调栈` | 中等 | 🔒 |
| 3220 | [奇数和偶数交易](/solution/3200-3299/3220.Odd%20and%20Even%20Transactions/README.md) | `数据库` | 中等 | |
| 3221 | [最大数组跳跃得分 II](/solution/3200-3299/3221.Maximum%20Array%20Hopping%20Score%20II/README.md) | `栈`,`贪心`,`数组`,`单调栈` | 中等 | 🔒 |
| 3222 | [求出硬币游戏的赢家](/solution/3200-3299/3222.Find%20the%20Winning%20Player%20in%20Coin%20Game/README.md) | `数学`,`博弈`,`模拟` | 简单 | 第 135 场双周赛 |
| 3223 | [操作后字符串的最短长度](/solution/3200-3299/3223.Minimum%20Length%20of%20String%20After%20Operations/README.md) | `哈希表`,`字符串`,`计数` | 中等 | 第 135 场双周赛 |
| 3224 | [使差值相等的最少数组改动次数](/solution/3200-3299/3224.Minimum%20Array%20Changes%20to%20Make%20Differences%20Equal/README.md) | `数组`,`哈希表`,`前缀和` | 中等 | 第 135 场双周赛 |
Expand Down
2 changes: 1 addition & 1 deletion solution/contest.json

Large diffs are not rendered by default.

Loading