Skip to content

Commit ed9122b

Browse files
Create 2500.py
1 parent 0dd8a56 commit ed9122b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

2001-2500/2500.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
class Solution:
2+
def deleteGreatestValue(self, grid: List[List[int]]) -> int:
3+
i,res,curMax=0,0,0
4+
while True:
5+
if len(grid[i])==0:
6+
break
7+
grid[i].sort()
8+
curMax = max(curMax,grid[i][-1])
9+
grid[i].pop()
10+
i+=1
11+
if i==len(grid):
12+
res+=curMax
13+
curMax,i=0,0
14+
return res
15+
16+
17+
class Solution:
18+
def deleteGreatestValue(self, grid: List[List[int]]) -> int:
19+
for i in range(len(grid)):
20+
grid[i].sort()
21+
22+
grid = list(zip(*grid))
23+
24+
return sum(max(row) for row in grid)
25+

0 commit comments

Comments
 (0)