1: class Solution {
2: public:
3: vector<string> generatePossibleNextMoves(string s) {
4: int n = s.size();
5: vector<string> res;
6: for (int i = 0; i < n-1; i++) {
7: if (s[i] == '+' && s[i+1] == '+') {
8: s[i] = s[i+1] = '-';
9: res.push_back(s);
10: s[i] = s[i+1] = '+';
11: }
12: }
13: return res;
14: }
15: };
No comments:
Post a Comment