Created
December 7, 2017 19:09
-
-
Save aarohmankad/cc6bd119d0ab9cf8b1c2799d9037e50e to your computer and use it in GitHub Desktop.
An example of handling some simple edge cases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<pair<int, int>> findCells(const vector<pair<int, int>>& gameBoard, const int FLAG_CODE) { | |
if (gameBoard.empty()) { | |
return vector<pair<int, int>> {}; | |
} | |
vector<pair<int, int>> cells; | |
for (pair<int, int> cell : gameBoard) { | |
if (cell.second == FLAG_CODE) { | |
cells.push_back(cell); | |
} | |
} | |
return cells; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment