Skip to content

feat: add weekly contest 496#5134

Merged
yanglbme merged 1 commit intomainfrom
dev
Apr 5, 2026
Merged

feat: add weekly contest 496#5134
yanglbme merged 1 commit intomainfrom
dev

Conversation

@yanglbme
Copy link
Copy Markdown
Member

@yanglbme yanglbme commented Apr 5, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 5, 2026 09:05
@idoocs idoocs added cpp Issues or Pull requests relate to .cpp code core team Issues or pull requests from core team go Issues or Pull requests relate to .go code java Issues or Pull requests relate to .java code md Issues or Pull requests relate to .md files py Issues or Pull requests relate to .py code rs Issues or Pull requests relate to .rs code ts Issues or Pull requests relate to .ts code labels Apr 5, 2026
@yanglbme yanglbme merged commit 88bcdb7 into main Apr 5, 2026
17 checks passed
@yanglbme yanglbme deleted the dev branch April 5, 2026 09:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds content for Weekly Contest 496 to the LeetCode solutions repository, including new problem entries and one fully implemented solution set, plus some metadata/backfill updates for recent contests.

Changes:

  • Add Weekly Contest 496 entries to the main solution indexes and contest index pages.
  • Add full multi-language solutions + explanation for problem 3889 (Mirror Frequency Distance).
  • Backfill rating/source frontmatter for problems 3880–3887, plus minor formatting and Rust-solution additions elsewhere.

Reviewed changes

Copilot reviewed 37 out of 39 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
solution/README.md Adds contest 496 problems to the Chinese master index.
solution/README_EN.md Adds contest 496 problems to the English master index.
solution/CONTEST_README.md Adds Weekly Contest 496 to the “past contests” list (includes date/time + participants).
solution/CONTEST_README_EN.md Adds Weekly Contest 496 to the English “past contests” list.
solution/3800-3899/3889.Mirror Frequency Distance/README.md New Chinese problem page with explanation and multi-language code tabs.
solution/3800-3899/3889.Mirror Frequency Distance/README_EN.md New English problem page with explanation and multi-language code tabs.
solution/3800-3899/3889.Mirror Frequency Distance/Solution.py Python implementation for 3889.
solution/3800-3899/3889.Mirror Frequency Distance/Solution.java Java implementation for 3889.
solution/3800-3899/3889.Mirror Frequency Distance/Solution.cpp C++ implementation for 3889.
solution/3800-3899/3889.Mirror Frequency Distance/Solution.go Go implementation for 3889.
solution/3800-3899/3889.Mirror Frequency Distance/Solution.ts TypeScript implementation for 3889.
solution/3800-3899/3890.Integers With Multiple Sum of Two Cubes/README.md New CN stub README for 3890 (solution blocks currently empty).
solution/3800-3899/3890.Integers With Multiple Sum of Two Cubes/README_EN.md New EN stub README for 3890 (solution blocks currently empty).
solution/3800-3899/3891.Minimum Increase to Maximize Special Indices/README.md New CN stub README for 3891 (solution blocks currently empty).
solution/3800-3899/3891.Minimum Increase to Maximize Special Indices/README_EN.md New EN stub README for 3891 (solution blocks currently empty).
solution/3800-3899/3892.Minimum Operations to Achieve At Least K Peaks/README.md New CN stub README for 3892 (solution blocks currently empty).
solution/3800-3899/3892.Minimum Operations to Achieve At Least K Peaks/README_EN.md New EN stub README for 3892 (solution blocks currently empty).
solution/3800-3899/3880.Minimum Absolute Difference Between Two Values/README.md Adds rating/source metadata.
solution/3800-3899/3880.Minimum Absolute Difference Between Two Values/README_EN.md Adds rating/source metadata.
solution/3800-3899/3881.Direction Assignments with Exactly K Visible People/README.md Adds rating/source metadata.
solution/3800-3899/3881.Direction Assignments with Exactly K Visible People/README_EN.md Adds rating/source metadata.
solution/3800-3899/3882.Minimum XOR Path in a Grid/README.md Adds rating/source metadata.
solution/3800-3899/3882.Minimum XOR Path in a Grid/README_EN.md Adds rating/source metadata.
solution/3800-3899/3883.Count Non Decreasing Arrays With Given Digit Sums/README.md Adds rating/source metadata.
solution/3800-3899/3883.Count Non Decreasing Arrays With Given Digit Sums/README_EN.md Adds rating/source metadata.
solution/3800-3899/3884.First Matching Character From Both Ends/README.md Adds rating/source metadata.
solution/3800-3899/3884.First Matching Character From Both Ends/README_EN.md Adds rating/source metadata.
solution/3800-3899/3885.Design Event Manager/README.md Adds rating/source metadata.
solution/3800-3899/3885.Design Event Manager/README_EN.md Adds rating/source metadata.
solution/3800-3899/3886.Sum of Sortable Integers/README.md Adds rating/source metadata.
solution/3800-3899/3886.Sum of Sortable Integers/README_EN.md Adds rating/source metadata.
solution/3800-3899/3887.Incremental Even-Weighted Cycle Queries/README.md Adds rating/source metadata.
solution/3800-3899/3887.Incremental Even-Weighted Cycle Queries/README_EN.md Adds rating/source metadata.
solution/2000-2099/2087.Minimum Cost Homecoming of a Robot in a Grid/Solution.ts Formatting cleanup in TypeScript solution.
solution/0600-0699/0657.Robot Return to Origin/Solution.rs Adds Rust implementation for 0657.
solution/0600-0699/0657.Robot Return to Origin/README.md Adds Rust snippet to the CN README language tabs.
solution/0600-0699/0657.Robot Return to Origin/README_EN.md Adds Rust snippet to the EN README language tabs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +76 to +84
### 方法一

<!-- tabs:start -->

#### Python3

```python

```
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该题 README 的解法区块目前只有语言 tab 和空代码块(未提供任何可运行/可复用的参考实现),会让该题在题解索引里看起来“已收录但无解法”。建议补全至少一种语言的完整解法与代码(并同步到对应的 Solution.* 文件,如仓库惯例),或在未完成前暂缓加入索引/竞赛列表。

Copilot uses AI. Check for mistakes.
Comment on lines +71 to +83
## Solutions

<!-- solution:start -->

### Solution 1

<!-- tabs:start -->

#### Python3

```python

```
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Solutions section currently contains only empty language code blocks. This makes the problem appear included but without any usable reference implementation. Please add at least one complete solution (and the corresponding Solution.* files if that’s the repository’s convention for contest problems), or avoid listing it in the indexes/contest list until it’s ready.

Copilot uses AI. Check for mistakes.
Comment on lines +99 to +124
### 方法一

<!-- tabs:start -->

#### Python3

```python

```

#### Java

```java

```

#### C++

```cpp

```

#### Go

```go

Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该题 README 的解法区块目前只有语言 tab 和空代码块(未提供任何可运行/可复用的参考实现),会让该题在题解索引里看起来“已收录但无解法”。建议补全至少一种语言的完整解法与代码(并同步到对应的 Solution.* 文件,如仓库惯例),或在未完成前暂缓加入索引/竞赛列表。

Suggested change
### 方法一
<!-- tabs:start -->
#### Python3
```python
```
#### Java
```java
```
#### C++
```cpp
```
#### Go
```go
### 方法一:动态规划
设所有可能成为特殊下标的位置为 `1..n-2`。如果我们希望某个位置 `i` 成为特殊下标,那么只需要把 `nums[i]` 增加到严格大于两侧邻居即可,因此该位置单独成为峰值的最小代价为:
$$
cost[i] = \max(0, \max(nums[i - 1], nums[i + 1]) + 1 - nums[i])
$$
由于相邻位置不可能同时是特殊下标,所以问题变成:
- 在下标 `1..n-2` 中选择若干个互不相邻的位置;
- 先让选中的位置个数尽量多;
- 在个数最多的前提下,让总增加量最小。
这可以用线性 DP 解决。设:
- `dp0 = (cnt, cost)`:处理到当前位置时,**不选当前点** 的最优结果;
- `dp1 = (cnt, cost)`:处理到当前位置时,**选当前点** 的最优结果。
状态比较时,优先选择 `cnt` 更大的;若 `cnt` 相同,则选择 `cost` 更小的。
时间复杂度 `O(n)`,空间复杂度 `O(1)`
#### Python3
```python
from typing import List, Tuple
class Solution:
def minIncrease(self, nums: List[int]) -> int:
salqoriven = nums[:]
n = len(nums)
def better(a: Tuple[int, int], b: Tuple[int, int]) -> Tuple[int, int]:
if a[0] != b[0]:
return a if a[0] > b[0] else b
return a if a[1] < b[1] else b
neg = (-10**18, 10**18)
dp0 = (0, 0)
dp1 = neg
for i in range(1, n - 1):
need = max(0, max(nums[i - 1], nums[i + 1]) + 1 - nums[i])
ndp0 = better(dp0, dp1)
ndp1 = (dp0[0] + 1, dp0[1] + need)
dp0, dp1 = ndp0, ndp1
return better(dp0, dp1)[1]

Copilot uses AI. Check for mistakes.
Comment on lines +97 to +105
### Solution 1

<!-- tabs:start -->

#### Python3

```python

```
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Solutions section currently contains only empty language code blocks. This makes the problem appear included but without any usable reference implementation. Please add at least one complete solution (and the corresponding Solution.* files if that’s the repository’s convention for contest problems), or avoid listing it in the indexes/contest list until it’s ready.

Copilot uses AI. Check for mistakes.
Comment on lines +98 to +106
### 方法一

<!-- tabs:start -->

#### Python3

```python

```
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该题 README 的解法区块目前只有语言 tab 和空代码块(未提供任何可运行/可复用的参考实现),会让该题在题解索引里看起来“已收录但无解法”。建议补全至少一种语言的完整解法与代码(并同步到对应的 Solution.* 文件,如仓库惯例),或在未完成前暂缓加入索引/竞赛列表。

Copilot uses AI. Check for mistakes.
Comment on lines +96 to +104
### Solution 1

<!-- tabs:start -->

#### Python3

```python

```
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Solutions section currently contains only empty language code blocks. This makes the problem appear included but without any usable reference implementation. Please add at least one complete solution (and the corresponding Solution.* files if that’s the repository’s convention for contest problems), or avoid listing it in the indexes/contest list until it’s ready.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core team Issues or pull requests from core team cpp Issues or Pull requests relate to .cpp code go Issues or Pull requests relate to .go code java Issues or Pull requests relate to .java code md Issues or Pull requests relate to .md files py Issues or Pull requests relate to .py code rs Issues or Pull requests relate to .rs code ts Issues or Pull requests relate to .ts code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants