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.

I had also gone with the same logic..but the problem is that some test cases contain spaces whereas some test cases don't have spaces..
Please help me on that..

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

## Cavity Map

You are viewing a single comment's thread. Return to all comments →

I had also gone with the same logic..but the problem is that some test cases contain spaces whereas some test cases don't have spaces.. Please help me on that..

Same problem....... Any solution?????

def cavityMap(grid): M = grid N = len(M)