Skip to content

Commit abd3c05

Browse files
authored
Update README_EN.md
1 parent 0739689 commit abd3c05

File tree

1 file changed

+1
-28
lines changed
  • solution/3500-3599/3548.Equal Sum Grid Partition II

1 file changed

+1
-28
lines changed

solution/3500-3599/3548.Equal Sum Grid Partition II/README_EN.md

+1-28
Original file line numberDiff line numberDiff line change
@@ -112,34 +112,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3548.Eq
112112
#### Python3
113113

114114
```python
115-
from typing import List
116-
117-
class Solution:
118-
def canPartitionGrid(self, grid: List[List[int]]) -> bool:
119-
m, n = len(grid), len(grid[0])
120-
121-
total_sum = sum(sum(row) for row in grid)
122-
123-
# Try horizontal cuts
124-
row_prefix_sum = 0
125-
for i in range(m - 1): # cut between row i and i+1
126-
row_prefix_sum += sum(grid[i])
127-
if row_prefix_sum * 2 == total_sum:
128-
return True
129-
130-
# Try vertical cuts
131-
col_sums = [0] * n
132-
for i in range(m):
133-
for j in range(n):
134-
col_sums[j] += grid[i][j]
135-
136-
col_prefix_sum = 0
137-
for j in range(n - 1): # cut between column j and j+1
138-
col_prefix_sum += col_sums[j]
139-
if col_prefix_sum * 2 == total_sum:
140-
return True
141-
142-
return False
115+
143116
```
144117

145118
#### Java

0 commit comments

Comments
 (0)