You are viewing a single comment's thread. Return to all comments →
Typescript
function gridChallenge(grid: string[]): string { const sortedGrid = grid.map(row => [...row].sort().join("")); for(let i = 0; i < sortedGrid[0].length; i++) { let lastAsciiCode = 'a'.charCodeAt(0); for(let j = 0; j < sortedGrid.length; j++) { const charCode = sortedGrid[j].charCodeAt(i); if (charCode < lastAsciiCode) { return "NO"; } lastAsciiCode = charCode; } } 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 →
Typescript