Python Code


  • 1
    R
    class Solution(object):
        def generatePossibleNextMoves(self, s):
            """
            :type s: str
            :rtype: List[str]
            """
            result = []
            for i in range(len(s)-1):
                if s[i] == s[i+1] == "+":
                  result.append(''.join([s[:i], "--", s[i+2:]]))
            return result
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.