Dashboard Temp Share Shortlinks Frames API

HTMLify

LeetCode - Time Needed to Rearrange a Binary String - Python
Views: 604 | Author: abh
1
2
3
4
5
6
7
class Solution:
    def secondsToRemoveOccurrences(self, s: str) -> int:
        secs = 0
        while "01" in s:
            s = s.replace("01", "10")
            secs += 1
        return secs