Tap here to switch tabs
Problem
Submissions

Problem: Minimum Moves to Convert String

med
30 min
Try to solve the Minimum Moves to Convert String problem.

Statement

You are given a string s consisting of characters 'X' and 'O'.

In one move, you can select 33 consecutive characters of s and convert all of them into 'O'.

Return the minimum number of moves needed to convert all characters in s into 'O'.

Note: If a selected group of 33 consecutive characters already contains 'O', those characters remain 'O'.

Constraints:

  • 3≤3 \leq s.length ≤1000\leq 1000

  • s[i] is either 'X' or 'O'.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Moves to Convert String

med
30 min
Try to solve the Minimum Moves to Convert String problem.

Statement

You are given a string s consisting of characters 'X' and 'O'.

In one move, you can select 33 consecutive characters of s and convert all of them into 'O'.

Return the minimum number of moves needed to convert all characters in s into 'O'.

Note: If a selected group of 33 consecutive characters already contains 'O', those characters remain 'O'.

Constraints:

  • 3≤3 \leq s.length ≤1000\leq 1000

  • s[i] is either 'X' or 'O'.