> For the complete documentation index, see [llms.txt](https://timmybeeflin.gitbook.io/cracking-leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://timmybeeflin.gitbook.io/cracking-leetcode/string/293.-flip-game.md).

# 293. Flip Game

T: O(n)

S: O(n)

```java
class Solution {
    public List<String> generatePossibleNextMoves(String currentState) {
        List<String> res = new ArrayList<>();
        char[] str = currentState.toCharArray();
        for (int i = 0; i < str.length-1;i++) {
            if (str[i] == '+' && str[i+1] == '+') {
                char[] newStr = new String(currentState).toCharArray();
                newStr[i] = '-';
                newStr[i+1] = '-';
                res.add(String.valueOf(newStr));
            }
        }
        return res;
    }
}
```
