You are viewing a single comment's thread. Return to all comments →
JS/Javascript Solution, with 3 loops! Any improvement suggestions?
function gridChallenge(grid) { const orderedArr = grid.map(row => row.split('').sort().join('')); for (let i = 0;i< grid.length;i++) { for (let j = 0;j< grid.length - 1;j++) { if (orderedArr[j][i] > orderedArr[j+1][i]) { return "NO"; } } } return 'YES'; }
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 →
JS/Javascript Solution, with 3 loops! Any improvement suggestions?