# Minimum Moves to Convert String (LeetCode 2027)

Cover 'X' groups with moves of length 3.

## Approach

```python
def minimumMoves(s: str) -> int:
    i = moves = 0
    while i < len(s):
        if s[i] == 'X':
            moves += 1
            i += 3
        else:
            i += 1
    return moves
```

## Complexity

- Time / space depend on the scan above; keep the solution linear when possible.

## Interview tip

Narrate the invariant before coding. I drill these patterns with [interview copilot app](https://www.linkjob.ai/coding-interview-copilot/) ahead of OA rounds.

*Disclosure: I work on Linkjob AI, an interview copilot. The algorithm above stands on its own.*