1 line in Python


  • 7
    class Solution(object):
        def generatePossibleNextMoves(self, s):
            return [s[:i] + "--" + s[i+2:] for i in range(len(s) - 1) if s[i] == s[i + 1] == "+"]

  • 0
    F

    very nice! I have the same method but yours is much shorter


Log in to reply
 

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