You are viewing a single comment's thread. Return to all comments →
Python Implementation:
Just concentrate on (n-2)X(n-2) matrix as we need to ignore the borders
n = int(input().strip()) grid = [] grid_i = 0 for grid_i in range(n): grid_t = list(str(input().strip())) grid.append(grid_t) for i in range(1,(n-2)+1): for j in range(1,(n-2)+1): if grid[i][j]>max(grid[i-1][j],grid[i+1][j],grid[i][j-1],grid[i][j+1]): grid[i][j]='X' for i in range(n): print (''.join(grid[i]))
Seems like cookies are disabled on this browser, please enable them to open this website
Cavity Map
You are viewing a single comment's thread. Return to all comments →
Python Implementation:
Just concentrate on (n-2)X(n-2) matrix as we need to ignore the borders