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.
for i in range(N):
for j in range(N):
if not ( i in [0,N-1] or j in [0,N-1] ):
c = M[i][j]
if M[i-1][j] < c and M[i+1][j] < c and M[i][j-1] < c and M[i][j+1] < c :
temp = M[i]
temp = list(temp)
temp[j] = 'X'
temp2=''
for j in temp:
temp2+=j
M[i] = temp2
return M
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 →
def cavityMap(grid): M = grid N = len(M)