diff --git "a/0294.\347\277\273\350\275\254\346\270\270\346\210\217II/0294-\347\277\273\350\275\254\346\270\270\346\210\217II.py" "b/0294.\347\277\273\350\275\254\346\270\270\346\210\217II/0294-\347\277\273\350\275\254\346\270\270\346\210\217II.py" new file mode 100644 index 0000000..0bfa03a --- /dev/null +++ "b/0294.\347\277\273\350\275\254\346\270\270\346\210\217II/0294-\347\277\273\350\275\254\346\270\270\346\210\217II.py" @@ -0,0 +1,19 @@ +class Solution(object): + def canWin(self, string): + """ + :type s: str + :rtype: bool + """ + record = {} + def helper(s): + if s in record: + return record[s] + for i in range(len(s) - 1): + if s[i:i + 2] == "++": + next_s = s[:i] + "--" + s[i + 2:] + if not helper(next_s): + record[next_s] = False + return True + return False # ++²»´وشع + + return helper(string) \ No newline at end of file