Time Needed to Rearrange a Binary String at Salesforce
Medium52.6% acceptance
This problem has 75.0% frequency at Salesforce.
Problem Description
You are given a binary string `s`. In one second, **all** occurrences of `"01"` are **simultaneously** replaced with `"10"`. This process **repeats** until no occurrences of `"01"` exist. Return _the number of seconds needed to complete this process._
Read full problem and hintsTopics
Also asked at 5 companies
More Salesforce Questions
Minimum Operations to Reduce an Integer to 0MediumString CompressionMediumRemove Adjacent Almost-Equal CharactersMediumMaximum Number of Occurrences of a SubstringMediumSmallest Substring With Identical Characters IIHard
View all Salesforce questions