You are viewing a single comment's thread. Return to all comments →
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions/tree/master , feel free to give a star :) )
std::string gridChallenge(std::vector<std::string> _grid){ for(auto & line : _grid){ std::sort(line.begin(), line.end()); } size_t i = 0; size_t const sz = _grid.front().size(); for(auto it1 = _grid.begin(), it2 = it1 + 1; it2 != _grid.end(); it1 = it2, ++it2, i = 0 ){ while(i < sz){ if((*it1)[i] > (*it2)[i]){ return "NO"; } ++i; } } 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++ (more at https://github.com/IhorVodko/Hackerrank_solutions/tree/master , feel free to give a star :) )