2027. Minimum Moves to Convert String

Обновлено: 2024-03-12
1 мин
[]

Содержание

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