Tap here to switch tabs
Problem
Submissions

Problem: Time Needed to Rearrange a Binary String

med
30 min
Try to solve the Time Needed to Rearrange a Binary String problem.

Statement

You are given a binary string s. In one second, every occurrence of "01" is simultaneously replaced with "10". This process repeats until no occurrences of "01" remain in s.

Return the number of seconds required to complete this process.

Constraints:

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

  • s[i] is either '0' or '1'.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Time Needed to Rearrange a Binary String

med
30 min
Try to solve the Time Needed to Rearrange a Binary String problem.

Statement

You are given a binary string s. In one second, every occurrence of "01" is simultaneously replaced with "10". This process repeats until no occurrences of "01" remain in s.

Return the number of seconds required to complete this process.

Constraints:

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

  • s[i] is either '0' or '1'.