Rust | 0ms | O(n) | beats 100%
Intuition\n\n\n# Approach\nWhen an \'X\' is encountered, increment change count, and there are two more converts reamining for the next two indices. Keep decrem
# Intuition\n\n\n# Approach\nWhen an \'X\' is encountered, increment change count, and there are two more converts reamining for the next two indices. Keep decrementing remaining if its greater than 0 and increment change count only if remaining is 0.\n\n# Complexity\n- Time complexity: $$O(n)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nimpl Solution {\n    pub fn minimum_moves(s: String) -> i32 {\n        let (mut ans, mut remaining) = (0, 0);\n        for b in s.into_bytes() {\n            if b == b\'X\' {\n                if remaining == 0 {\n                    ans += 1;\n                    remaining = 3;\n                }\n            }\n            if remaining > 0 {\n                remaining -= 1;\n            }\n        }\n        ans\n    }\n}\n```
['Rust']