Leetcode 293 Solution
This article provides solution to leetcode question 293 (flip-game)
Access this page by simply typing in "lcs 293" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/flip-game
Solution
class Solution {
public:
vector<string> generatePossibleNextMoves(string s) {
vector<string> res;
for (int i = 0; i < (int)s.size() - 1; i++)
{
if (s[i] == '+' && s[i + 1] == '+')
{
s[i] = s[i + 1] = '-';
res.push_back(s);
s[i] = s[i + 1] = '+';
}
}
return res;
}
};