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.
functiongridChallenge(grid){// Write your code hereconstsortedGrid=grid.map(row=>row.split('').sort().join(''))for(letcol=0;col<sortedGrid[0].length;col++){for(letrow=1;row<sortedGrid.length;row++){if(sortedGrid[row][col]<sortedGrid[row-1][col]){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 →
Here is one way to do it in javaScript