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 hints

Topics

Also asked at 5 companies


More Salesforce Questions

View all Salesforce questions