Grid Challenge Discussions | | HackerRank

Grid Challenge

  • + 0 comments

    my solution in python3 .. might not be the fastest but passes all tests..

    def gridChallenge(grid): rows = len(grid) cols = len(grid[0])

    for i in range(rows):
        grid[i] = sorted(grid[i])
    
    for j in range(cols):
        for i in range(rows-1):
            if grid[i][j] > grid[i+1][j]:
                return 'NO'
    return 'YES'