Skip to content

feat: add solutions for lc No.3548#5108

Merged
yanglbme merged 1 commit intomainfrom
dev
Mar 25, 2026
Merged

feat: add solutions for lc No.3548#5108
yanglbme merged 1 commit intomainfrom
dev

Conversation

@yanglbme
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 25, 2026 00:00
@idoocs idoocs added 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 ts Issues or Pull requests relate to .ts code labels Mar 25, 2026
@yanglbme yanglbme merged commit 1e77ff2 into main Mar 25, 2026
8 checks passed
@yanglbme yanglbme deleted the dev branch March 25, 2026 00:00
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 multi-language reference solutions and documentation for LeetCode 3548 “Equal Sum Grid Partition II”.

Changes:

  • Implemented the algorithm in TypeScript, Python, Java, Go, and C++.
  • Expanded English/Chinese READMEs with the method explanation and code for all supported languages.
  • Added a transpose/“rotate” helper to reuse the horizontal-partition logic for vertical partitions.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
solution/3500-3599/3548.Equal Sum Grid Partition II/Solution.ts Adds TypeScript implementation (check + transpose helper).
solution/3500-3599/3548.Equal Sum Grid Partition II/Solution.py Adds Python implementation using counters and transpose via zip.
solution/3500-3599/3548.Equal Sum Grid Partition II/Solution.java Adds Java implementation with long sums and transpose helper.
solution/3500-3599/3548.Equal Sum Grid Partition II/Solution.go Adds Go implementation with int64 sums and transpose helper.
solution/3500-3599/3548.Equal Sum Grid Partition II/Solution.cpp Adds C++ implementation with long long sums and transpose helper.
solution/3500-3599/3548.Equal Sum Grid Partition II/README_EN.md Documents method and includes code tabs for all languages.
solution/3500-3599/3548.Equal Sum Grid Partition II/README.md Chinese documentation + code tabs for all languages.

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


- The part has more than $1$ row and more than $1$ column.
- The part has exactly $1$ row, and the removed cell is on the boundary of that part (i.e., the first column or the last column).
- The part has exactly $1$ row, and the removed cell is on the boundary of that part (i.e., the first row or the last row).
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

The connectivity criteria bullets contain a contradiction: the last bullet repeats “exactly 1 row” but describes a row-boundary condition that should apply to the “exactly 1 column” case. Update the last bullet to say “exactly 1 column” (first row/last row boundary) to match the intended logic.

Suggested change
- The part has exactly $1$ row, and the removed cell is on the boundary of that part (i.e., the first row or the last row).
- The part has exactly $1$ column, and the removed cell is on the boundary of that part (i.e., the first row or the last row).

Copilot uses AI. Check for mistakes.

- 该部分的行数大于 $1$ 且列数大于 $1$。
- 该部分的行数等于 $1$,且移除的单元格位于该部分的边界(即第一列或最后一列)。
- 该部分的行数等于 $1$,且移除的单元格位于该部分的边界(即第一行或最后一行)。
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

连通性判断的要点描述有重复/矛盾:第 3 条仍写“行数等于 1”,但括号里描述的是“第一行或最后一行”,对应的应是“列数等于 1”的情形。建议将第 3 条里的“行数等于 1”改为“列数等于 1”。

Suggested change
- 该部分的行数等于 $1$,且移除的单元格位于该部分的边界(即第一行或最后一行)。
- 该部分的列数等于 $1$,且移除的单元格位于该部分的边界(即第一行或最后一行)。

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
class Solution:
def canPartitionGrid(self, grid: List[List[int]]) -> bool:
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

This file uses List and defaultdict but does not import them, which will raise a NameError in a standalone Python runtime. Add the required imports (e.g., from typing import List and from collections import defaultdict) in this file to keep it self-contained.

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +7
cnt1 = defaultdict(int)
cnt2 = defaultdict(int)
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

This file uses List and defaultdict but does not import them, which will raise a NameError in a standalone Python runtime. Add the required imports (e.g., from typing import List and from collections import defaultdict) in this file to keep it self-contained.

Copilot uses AI. Check for mistakes.
return false;
}

function rotate(grid: number[][]): number[][] {
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

rotate is performing a transpose (swap rows/columns), not a rotation; this name can mislead readers and makes the README’s “transpose” description harder to match to code. Consider renaming rotate to transpose (and updating call sites) for clarity.

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 ts Issues or Pull requests relate to .ts code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants