Practice Minimum Moves to Convert String
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a string s consisting of n characters which are either 'X' or 'O'. A move is defined as selecting three consecutive characters of s and converting them to 'O'. Note that if a move is applied to the character 'O', it will stay the same. Return the minimum number of moves required so that all the characters of s are converted to 'O'.
Source: Minimum Moves to Convert String on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "XXX"
1
# Example 2
s = "XXOX"
2
# Example 3
s = "OOOO"
0
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Moves to Convert String.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.