def canWin(self, s):
for i in xrange(len(s)-1):
if s[i]=='+' and s[i+1]=='+' and not self.canWin(s[:i]+'--'+s[i+2:]): return True
You have to use memoization to speedup your implementation.
Did you got time limit exceeded?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.