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.
My Python solution given the fact that some test cases come with non-square grids
defgridChallenge(grid):# Write your code heren=len(grid)sortedRows=[sorted(row)forrowingrid]iflen(sortedRows[0])!=n:m=len(sortedRows[0])else:m=nforiinrange(m):forjinrange(1,n):ifsortedRows[j][i]<sortedRows[j-1][i]:return'NO'return'YES'
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Grid Challenge
You are viewing a single comment's thread. Return to all comments →
My Python solution given the fact that some test cases come with non-square grids