You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/GPB-dpsvQ8Y
string gridChallenge(vector<string> grid) { for(int i = 0; i < grid.size(); i++) sort(grid[i].begin(), grid[i].end()); for(int col = 0; col < grid.size(); col++){ for(int row = 1; row < grid.size(); row++) if(grid[row][col] < grid[row-1][col]) 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 →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/GPB-dpsvQ8Y