Skip to content

feat: update lc problems #3660

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
Oct 22, 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
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ tags:

<pre>
<strong>输入:</strong>intersectVal = 0, listA = [2,6,4], listB = [1,5], skipA = 3, skipB = 2
<strong>输出:</strong>null
<strong>输出:</strong>No intersection
<strong>解释:</strong>从各自的表头开始算起,链表 A 为 [2,6,4],链表 B 为 [1,5]。
由于这两个链表不相交,所以 intersectVal 必须为 0,而 skipA 和 skipB 可以是任意值。
这两个链表不相交,因此返回 null 。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Explanation: The two lists do not intersect, so return null.
<li>The number of nodes of <code>listB</code> is in the <code>n</code>.</li>
<li><code>1 &lt;= m, n &lt;= 3 * 10<sup>4</sup></code></li>
<li><code>1 &lt;= Node.val &lt;= 10<sup>5</sup></code></li>
<li><code>0 &lt;= skipA &lt;&nbsp;m</code></li>
<li><code>0 &lt;= skipB &lt;&nbsp;n</code></li>
<li><code>0 &lt;= skipA &lt;= m</code></li>
<li><code>0 &lt;= skipB &lt;= n</code></li>
<li><code>intersectVal</code> is <code>0</code> if <code>listA</code> and <code>listB</code> do not intersect.</li>
<li><code>intersectVal == listA[skipA] == listB[skipB]</code> if <code>listA</code> and <code>listB</code> intersect.</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion solution/0100-0199/0191.Number of 1 Bits/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tags:

<!-- description:start -->

<p>编写一个函数,获取一个正整数的二进制形式并返回其二进制表达式中 <span data-keyword="set-bit">设置位</span> 的个数(也被称为<a href="https://baike.baidu.com/item/%E6%B1%89%E6%98%8E%E9%87%8D%E9%87%8F" target="_blank">汉明重量</a>)。</p>
<p>给定一个正整数 <code>n</code>,编写一个函数,获取一个正整数的二进制形式并返回其二进制表达式中 <span data-keyword="set-bit">设置位</span> 的个数(也被称为<a href="https://baike.baidu.com/item/%E6%B1%89%E6%98%8E%E9%87%8D%E9%87%8F" target="_blank">汉明重量</a>)。</p>

<p>&nbsp;</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ source: 第 234 场周赛 Q4
tags:
- 递归
- 数学
- 数论
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ source: Weekly Contest 234 Q4
tags:
- Recursion
- Math
- Number Theory
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tags:

<p>正整数的 <strong>前缀 </strong>是其 <strong>最左边 </strong>的一位或多位数字组成的整数。例如,<code>123</code> 是整数 <code>12345</code> 的前缀,而 <code>234</code><strong> 不是 </strong>。</p>

<p>设若整数 <code>c</code> 是整数 <code>a</code> 和 <code>b</code> 的<strong> 公共前缀 </strong>,那么 <code>c</code> 需要同时是 <code>a</code> 和 <code>b</code> 的前缀。例如,<code>5655359</code> 和 <code>56554</code> 有公共前缀 <code>565</code> ,而 <code>1223</code> 和 <code>43456</code><strong> 没有 </strong>公共前缀。</p>
<p>设若整数 <code>c</code> 是整数 <code>a</code> 和 <code>b</code> 的<strong> 公共前缀 </strong>,那么 <code>c</code> 需要同时是 <code>a</code> 和 <code>b</code> 的前缀。例如,<code>5655359</code> 和 <code>56554</code> 有公共前缀 <code>565</code>&nbsp;和 <code>5655</code>,而 <code>1223</code> 和 <code>43456</code><strong> 没有 </strong>公共前缀。</p>

<p>你需要找出属于 <code>arr1</code> 的整数 <code>x</code> 和属于 <code>arr2</code> 的整数 <code>y</code> 组成的所有数对 <code>(x, y)</code> 之中最长的公共前缀的长度。</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tags:

<p>A <strong>prefix</strong> of a positive integer is an integer formed by one or more of its digits, starting from its <strong>leftmost</strong> digit. For example, <code>123</code> is a prefix of the integer <code>12345</code>, while <code>234</code> is <strong>not</strong>.</p>

<p>A <strong>common prefix</strong> of two integers <code>a</code> and <code>b</code> is an integer <code>c</code>, such that <code>c</code> is a prefix of both <code>a</code> and <code>b</code>. For example, <code>5655359</code> and <code>56554</code> have a common prefix <code>565</code> while <code>1223</code> and <code>43456</code> <strong>do not</strong> have a common prefix.</p>
<p>A <strong>common prefix</strong> of two integers <code>a</code> and <code>b</code> is an integer <code>c</code>, such that <code>c</code> is a prefix of both <code>a</code> and <code>b</code>. For example, <code>5655359</code> and <code>56554</code> have common prefixes <code>565</code> and <code>5655</code> while <code>1223</code> and <code>43456</code> <strong>do not</strong> have a common prefix.</p>

<p>You need to find the length of the <strong>longest common prefix</strong> between all pairs of integers <code>(x, y)</code> such that <code>x</code> belongs to <code>arr1</code> and <code>y</code> belongs to <code>arr2</code>.</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3323.Minimize%20Connected%20Groups%20by%20Inserting%20Interval/README.md
tags:
- 数组
- 二分查找
- 排序
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3323.Minimize%20Connected%20Groups%20by%20Inserting%20Interval/README_EN.md
tags:
- Array
- Binary Search
- Sorting
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3324.Find%20the%20Sequence%20of%20Strings%20Appeared%20on%20the%20Screen/README.md
tags:
- 字符串
- 模拟
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3324.Find%20the%20Sequence%20of%20Strings%20Appeared%20on%20the%20Screen/README_EN.md
tags:
- String
- Simulation
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3325.Count%20Substrings%20With%20K-Frequency%20Characters%20I/README.md
tags:
- 哈希表
- 字符串
- 滑动窗口
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3325.Count%20Substrings%20With%20K-Frequency%20Characters%20I/README_EN.md
tags:
- Hash Table
- String
- Sliding Window
---

<!-- problem:start -->
Expand All @@ -14,9 +18,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3325.Co

<!-- description:start -->

<p>Given a string <code>s</code> and an integer <code>k</code>, return the total number of substrings of <code>s</code> where <strong>at least one</strong> character appears <strong>at least</strong> <code>k</code> times.</p>

<p>A <strong>substring</strong> is a contiguous <b>non-empty</b> sequence of characters within a string.</p>
<p>Given a string <code>s</code> and an integer <code>k</code>, return the total number of <span data-keyword="substring-nonempty">substrings</span> of <code>s</code> where <strong>at least one</strong> character appears <strong>at least</strong> <code>k</code> times.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3326.Minimum%20Division%20Operations%20to%20Make%20Array%20Non%20Decreasing/README.md
tags:
- 贪心
- 数组
- 数学
- 数论
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3326.Minimum%20Division%20Operations%20to%20Make%20Array%20Non%20Decreasing/README_EN.md
tags:
- Greedy
- Array
- Math
- Number Theory
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3327.Check%20if%20DFS%20Strings%20Are%20Palindromes/README.md
tags:
- 树
- 深度优先搜索
- 数组
- 哈希表
- 字符串
- 哈希函数
---

<!-- problem:start -->
Expand Down Expand Up @@ -217,7 +224,7 @@ class Solution {
}
dfsStr.append(s[i]);
int r = dfsStr.length();
pos[i] = new int[]{l, r};
pos[i] = new int[] {l, r};
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3327.Check%20if%20DFS%20Strings%20Are%20Palindromes/README_EN.md
tags:
- Tree
- Depth-First Search
- Array
- Hash Table
- String
- Hash Function
---

<!-- problem:start -->
Expand Down Expand Up @@ -31,13 +38,11 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3327.Ch

<ul>
<li>Empty the string <code>dfsStr</code> and call <code>dfs(i)</code>.</li>
<li>If the resulting string <code>dfsStr</code> is a <strong>palindrome</strong>, then set <code>answer[i]</code> to <code>true</code>. Otherwise, set <code>answer[i]</code> to <code>false</code>.</li>
<li>If the resulting string <code>dfsStr</code> is a <span data-keyword="palindrome-string">palindrome</span>, then set <code>answer[i]</code> to <code>true</code>. Otherwise, set <code>answer[i]</code> to <code>false</code>.</li>
</ul>

<p>Return the array <code>answer</code>.</p>

<p>A <strong>palindrome</strong> is a string that reads the same forward and backward.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/3300-3399/3327.Check%20if%20DFS%20Strings%20Are%20Palindromes/images/tree1drawio.png" style="width: 240px; height: 256px;" />
Expand Down Expand Up @@ -210,7 +215,7 @@ class Solution {
}
dfsStr.append(s[i]);
int r = dfsStr.length();
pos[i] = new int[]{l, r};
pos[i] = new int[] {l, r};
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ private void dfs(int i) {
}
dfsStr.append(s[i]);
int r = dfsStr.length();
pos[i] = new int[]{l, r};
pos[i] = new int[] {l, r};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tags:

<pre>
+-------------+---------+
| Column Name | Type |
| Column Name | Type |
+-------------+---------+
| state | varchar |
| city | varchar |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tags:

<pre>
+-------------+---------+
| Column Name | Type |
| Column Name | Type |
+-------------+---------+
| state | varchar |
| city | varchar |
Expand Down
2 changes: 1 addition & 1 deletion solution/CONTEST_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ comments: true

## 往期竞赛

#### 第 420 场周赛(2024-10-20 10:30, 90 分钟) 参赛人数 2921
#### 第 420 场周赛(2024-10-20 10:30, 90 分钟) 参赛人数 2995

- [3324. 出现在屏幕上的字符串序列](/solution/3300-3399/3324.Find%20the%20Sequence%20of%20Strings%20Appeared%20on%20the%20Screen/README.md)
- [3325. 字符至少出现 K 次的子字符串 I](/solution/3300-3399/3325.Count%20Substrings%20With%20K-Frequency%20Characters%20I/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 @@ -298,7 +298,7 @@
| 3293 | [计算产品最终价格](/solution/3200-3299/3293.Calculate%20Product%20Final%20Price/README.md) | `数据库` | 中等 | 🔒 |
| 3308 | [Find Top Performing Driver](/solution/3300-3399/3308.Find%20Top%20Performing%20Driver/README.md) | `数据库` | 中等 | 🔒 |
| 3322 | [英超积分榜排名 III](/solution/3300-3399/3322.Premier%20League%20Table%20Ranking%20III/README.md) | `数据库` | 中等 | 🔒 |
| 3328 | [Find Cities in Each State II](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README.md) | | 中等 | 🔒 |
| 3328 | [Find Cities in Each State II](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README.md) | `数据库` | 中等 | 🔒 |

## 版权

Expand Down
2 changes: 1 addition & 1 deletion solution/DATABASE_README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ Press <kbd>Control</kbd> + <kbd>F</kbd>(or <kbd>Command</kbd> + <kbd>F</kbd> on
| 3293 | [Calculate Product Final Price](/solution/3200-3299/3293.Calculate%20Product%20Final%20Price/README_EN.md) | `Database` | Medium | 🔒 |
| 3308 | [Find Top Performing Driver](/solution/3300-3399/3308.Find%20Top%20Performing%20Driver/README_EN.md) | `Database` | Medium | 🔒 |
| 3322 | [Premier League Table Ranking III](/solution/3300-3399/3322.Premier%20League%20Table%20Ranking%20III/README_EN.md) | `Database` | Medium | 🔒 |
| 3328 | [Find Cities in Each State II](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README_EN.md) | | Medium | 🔒 |
| 3328 | [Find Cities in Each State II](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README_EN.md) | `Database` | Medium | 🔒 |

## Copyright

Expand Down
14 changes: 7 additions & 7 deletions solution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,7 @@
| 1805 | [字符串中不同整数的数目](/solution/1800-1899/1805.Number%20of%20Different%20Integers%20in%20a%20String/README.md) | `哈希表`,`字符串` | 简单 | 第 234 场周赛 |
| 1806 | [还原排列的最少操作步数](/solution/1800-1899/1806.Minimum%20Number%20of%20Operations%20to%20Reinitialize%20a%20Permutation/README.md) | `数组`,`数学`,`模拟` | 中等 | 第 234 场周赛 |
| 1807 | [替换字符串中的括号内容](/solution/1800-1899/1807.Evaluate%20the%20Bracket%20Pairs%20of%20a%20String/README.md) | `数组`,`哈希表`,`字符串` | 中等 | 第 234 场周赛 |
| 1808 | [好因子的最大数目](/solution/1800-1899/1808.Maximize%20Number%20of%20Nice%20Divisors/README.md) | `递归`,`数学` | 困难 | 第 234 场周赛 |
| 1808 | [好因子的最大数目](/solution/1800-1899/1808.Maximize%20Number%20of%20Nice%20Divisors/README.md) | `递归`,`数学`,`数论` | 困难 | 第 234 场周赛 |
| 1809 | [没有广告的剧集](/solution/1800-1899/1809.Ad-Free%20Sessions/README.md) | `数据库` | 简单 | 🔒 |
| 1810 | [隐藏网格下的最小消耗路径](/solution/1800-1899/1810.Minimum%20Path%20Cost%20in%20a%20Hidden%20Grid/README.md) | `深度优先搜索`,`广度优先搜索`,`图`,`交互`,`堆(优先队列)` | 中等 | 🔒 |
| 1811 | [寻找面试候选人](/solution/1800-1899/1811.Find%20Interview%20Candidates/README.md) | `数据库` | 中等 | 🔒 |
Expand Down Expand Up @@ -3333,12 +3333,12 @@
| 3320 | [统计能获胜的出招序列数](/solution/3300-3399/3320.Count%20The%20Number%20of%20Winning%20Sequences/README.md) | `字符串`,`动态规划` | 困难 | 第 419 场周赛 |
| 3321 | [计算子数组的 x-sum II](/solution/3300-3399/3321.Find%20X-Sum%20of%20All%20K-Long%20Subarrays%20II/README.md) | `数组`,`哈希表`,`滑动窗口`,`堆(优先队列)` | 困难 | 第 419 场周赛 |
| 3322 | [英超积分榜排名 III](/solution/3300-3399/3322.Premier%20League%20Table%20Ranking%20III/README.md) | `数据库` | 中等 | 🔒 |
| 3323 | [通过插入区间最小化连通组](/solution/3300-3399/3323.Minimize%20Connected%20Groups%20by%20Inserting%20Interval/README.md) | | 中等 | 🔒 |
| 3324 | [出现在屏幕上的字符串序列](/solution/3300-3399/3324.Find%20the%20Sequence%20of%20Strings%20Appeared%20on%20the%20Screen/README.md) | | 中等 | 第 420 场周赛 |
| 3325 | [字符至少出现 K 次的子字符串 I](/solution/3300-3399/3325.Count%20Substrings%20With%20K-Frequency%20Characters%20I/README.md) | | 中等 | 第 420 场周赛 |
| 3326 | [使数组非递减的最少除法操作次数](/solution/3300-3399/3326.Minimum%20Division%20Operations%20to%20Make%20Array%20Non%20Decreasing/README.md) | | 中等 | 第 420 场周赛 |
| 3327 | [判断 DFS 字符串是否是回文串](/solution/3300-3399/3327.Check%20if%20DFS%20Strings%20Are%20Palindromes/README.md) | | 困难 | 第 420 场周赛 |
| 3328 | [Find Cities in Each State II](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README.md) | | 中等 | 🔒 |
| 3323 | [通过插入区间最小化连通组](/solution/3300-3399/3323.Minimize%20Connected%20Groups%20by%20Inserting%20Interval/README.md) | `数组`,`二分查找`,`排序` | 中等 | 🔒 |
| 3324 | [出现在屏幕上的字符串序列](/solution/3300-3399/3324.Find%20the%20Sequence%20of%20Strings%20Appeared%20on%20the%20Screen/README.md) | `字符串`,`模拟` | 中等 | 第 420 场周赛 |
| 3325 | [字符至少出现 K 次的子字符串 I](/solution/3300-3399/3325.Count%20Substrings%20With%20K-Frequency%20Characters%20I/README.md) | `哈希表`,`字符串`,`滑动窗口` | 中等 | 第 420 场周赛 |
| 3326 | [使数组非递减的最少除法操作次数](/solution/3300-3399/3326.Minimum%20Division%20Operations%20to%20Make%20Array%20Non%20Decreasing/README.md) | `贪心`,`数组`,`数学`,`数论` | 中等 | 第 420 场周赛 |
| 3327 | [判断 DFS 字符串是否是回文串](/solution/3300-3399/3327.Check%20if%20DFS%20Strings%20Are%20Palindromes/README.md) | `树`,`深度优先搜索`,`数组`,`哈希表`,`字符串`,`哈希函数` | 困难 | 第 420 场周赛 |
| 3328 | [Find Cities in Each State II](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README.md) | `数据库` | 中等 | 🔒 |

## 版权

Expand Down
Loading
Loading