You are viewing a single comment's thread. Return to all comments →
c++
string gridChallenge(vector<string> grid) { for (auto& s : grid) { sort(s.begin(), s.end()); } const int n = grid.size(); for (int j = 0; j < n; ++j) { for (int i = 0; i < n - 1; ++i) { if (grid[i][j] > grid[i + 1][j]) { 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 →
c++