You are viewing a single comment's thread. Return to all comments →
Simple Python solution:
n=len(grid) c=0 for i in range(1,n-1): for j in range(1,n-1): if grid[i][j]>grid[i][j-1] and grid[i][j]>grid[i][j+1] and grid[i][j]>grid[i-1][j] and grid[i][j]>grid[i+1][j]: p=list(grid[i]) p[j]='X' grid[i]=''.join(p) return grid
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 →
Simple Python solution: