2025-08-22 15:46:45 +0000 UTC
Modify the Matrix
Categories:
Links
Code
class Solution:
def modifiedMatrix(self, matrix: List[List[int]]) -> List[List[int]]:
rows, cols = len(matrix), len(matrix[0])
for col in range(cols):
max_val = -1
for row in range(rows):
max_val = max(max_val, matrix[row][col])
for row in range(rows):
if matrix[row][col] == -1:
matrix[row][col] = max_val
return matrix