whiteMu

关注

LeetCode题解(0293):翻转游戏(Python)

whiteMu

关注

阅读 33

2022-02-24


题目:​​原题链接​​(简单)

标签:字符串

解法

时间复杂度

空间复杂度

执行用时

Ans 1 (Python)

O ( N )

O ( 1 )

36ms (84.13%)

Ans 2 (Python)

Ans 3 (Python)

解法一:

class Solution:
def generatePossibleNextMoves(self, s: str) -> List[str]:
ans = []
for i in range(len(s) - 1):
if s[i:i + 2] == "++":
ans.append(s[:i] + "--" + s[i + 2:])
return ans



相关推荐

凛冬已至夏日未远

LeetCode题解(0822):翻转卡片游戏(Python)

凛冬已至夏日未远 53 0 0

星巢文化

LeetCode题解(0493):翻转对(Python)

星巢文化 44 0 0

哈哈我是你爹呀

LeetCode题解(1510):石子游戏IV(Python)

哈哈我是你爹呀 48 0 0

IT程序员

LeetCode题解(1686):石子游戏VI(Python)

IT程序员 55 0 0

回望这一段人生

LeetCode题解(0995):K连续位的最小翻转次数(Python)

回望这一段人生 143 0 0

双井暮色

LeetCode题解(0025):K个一组翻转链表(Python)

双井暮色 105 0 0

芭芭蘑菇

LeetCode题解(0174):地下城游戏(Python)

芭芭蘑菇 50 0 0

花姐的职场人生

LeetCode题解(面试16.04):井字游戏(Python)

花姐的职场人生 55 0 0

Spinach菠菜

Python | Leetcode Python题解之第390题消除游戏

Spinach菠菜 22 0 0

金刚豆

LeetCode题解(1535):找出数组游戏的赢家(Python)

金刚豆 43 0 0

精彩评论(0)

0 0 举报