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 →
Instead of using two arrays, compare the center matrix (formed excluding boundary values) while printing the matrix..! ;)
Thanks!
if we replace %1d with %d... why the input contains extra zeros?? what is the significance of 1? can you please explain..
%1d signifies read 1 digit at a time. If you write %d, one entire row of digits will be read at once, which is not what you want.
okay.. thank u
Thanks!
Nifty!
yeah..!! Thanks.....
Thanks! Very helpful
coool!
nice
thank you for the code
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)