2027. Minimum Moves to Convert String

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2027

class Solution:
    def minimumMoves(self, s: str) -> int:
        res = i = 0
        while i < len(s):
            if s[i] == "X":
                res += 1
                i += 3
            else:
                i += 1
        return res