Flip Game
Problem: Flip Game
We just scan through all the 2-letter long sub-string and try to change them to "--".
Code in Python:
class Solution(object):
def generatePossibleNextMoves(self, s):
"""
:type s: str
:rtype: List[str]
"""
ans = []
for i in xrange(1, len(s)):
if s[i-1:i+1] == "++":
ans.append(s[:i-1] + "--" + s[i+1:])
return ans