We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def cavityMap(grid):
size = len(grid)
list = []
for i in range(1,size-1):
for j in range(1,size-1):
if all([ grid[i][j] > adj for adj in [grid[i+1][j], grid[i-1][j], grid[i][j-1], grid[i][j+1]] ]):
grid[i]=grid[i][:j]+'X'+grid[i][j+1:]
return grid
Cookie support is required to access HackerRank
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 →
Python3: