Grid Challenge Discussions | | HackerRank

Grid Challenge

Sort by

recency

|

445 Discussions

|

  • + 0 comments

    yet another exercise where the description is just wrong, plain wrong.

    Despite the powerful technical tool and nice UI, this site has a very low quality of content, unfortunately.

  • + 0 comments

    The problem states that is will be a square grid of characters. However, one of the tests attempts to input a 3x4 grid.

  • + 0 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';
    }
    
  • + 0 comments

    Javascript

    function gridChallenge(grid: string[]): string { // Write your code here const sorted_grid = grid.map(row => Array.from(row).sort())

    for(let j=0; j<sorted_grid.length; j++){
        for(let i=0; i <sorted_grid.length-1; i++){
          if (sorted_grid[i+1][j] < sorted_grid[i][j]){
              return 'NO'
          }   
        }
    }
    
    return 'YES'
    

    }

  • + 0 comments

    The problem description incorrectly uses the term ascending. Ascending is not the same as non-decreasing.