294. Flip Game II
Approach 1: Brute force all ways using Recursion
class Solution:
def canWin(self, s):
"""
:type s: str
:rtype: bool
"""
for i in range(len(s)-1):
if s[i]+s[i+1] == '++' and not self.canWin(s[:i]+'--'+s[i+2:]):
return True
return FalseLast updated