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.
defgridChallenge(grid):# rearrange elements for rowsrows=[sorted(list(row_str))forrow_stringrid]# check for columns orderforcolinzip(*rows):forjinrange(len(col)-1):ifcol[j]>col[j+1]: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 →
Python
Even better option: 1.3x faster