💯 Beats || Easy and Optimal Solution || C++ 🚀
✨ Intuition:The task is to determine the minimum number of moves required to convert all 'X' characters in the string s into 'O'. Each move can change up to 3 c
# ✨ Intuition:
The task is to determine the minimum number of moves required to convert all 'X' characters in the string s into 'O'. Each move can change up to 3 consecutive characters starting from an 'X'. The goal is to count the minimum moves efficiently. 🌟

# 💡 Approach:
1️⃣ Start by initializing i = 0 (pointer), n (length of string s), and count = 0 (to count moves).
2️⃣ Traverse the string **while i < n:**

- 🧐 If the current character s[i] is 'O', simply move the pointer ahead by 1 step.
- 📈 If the current character s[i] is 'X', increment the count (one move needed) and skip the next 3 characters (i += 3) since the move covers them.

3️⃣ Finally, return count as the minimum number of moves.

This solution is **O(n) in time complexity** as we process each character once and **O(1) in space complexity.**

# Code
```cpp []
class Solution {
public:
    int minimumMoves(string s) {
        int i=0, n=s.length(), count=0;
        while(i<n){
            if(s[i]=='O')
                i++;
            else
                count++, i += 3;
            
        }
        return count;
    }
};
```
['C++']