LeetCode #293: Flip Game
β’ 45 words β’ 1 min β’ updated
python
class Solution:
def generatePossibleNextMoves(self, currentState: str) -> List[str]:
s = currentState
ans = []
for i in range(len(s) - 1):
j = i + 1
if s[i] == s[j] == '+':
ans.append(s[:i] + '--' + s[j + 1:])
return ans