LeetCode 293 Flip Game

LeetCode 293 Flip Game Problem

Download Code
class Solution(object):
    def generatePossibleNextMoves(self, s):
        """
        :type s: str
        :rtype: List[str]
        """
        # return [s[:i] + "--" + s[i+2:] for i in range(len(s) - 1) if s[i] == s[i + 1] == "+"]
        res = []
        if s is None or len(s) == 0:
            return res
        ls = len(s)
        for i in range(ls - 1):
            if s[i] == '+' and s[i + 1] == '+':
                res.append(s[:i] + '--' + s[i + 2:])
        return res
Download Flip Game.py

List of all Flip Game problems

Leetcode 293 Flip Game problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.

Feedback is the most important part of any website.

If you have any query, suggestion or feedback, Please feel free to contact us.