2585. Delete Greatest Value in Each Row
My accepted Python solution to LeetCode problem 2585, Delete Greatest Value in Each Row, running in 4ms.
- Difficulty: Easy
- Python
- Runtime 4ms
- Memory 17.5MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 4ms, memory 17.5MB, accepted 2026-01-01.
class Solution:
def deleteGreatestValue(self, grid: List[List[int]]) -> int:
for row in grid:
row.sort()
result = 0
for col in range(len(grid[0])):
max_val = max(row[col] for row in grid)
result += max_val
return result