Company: Docusign swe intern
Difficulty: medium
In HackerLand, people are preparing for a parade with a rule that no red uniform can be immediately to the left of a blue one. Given a binary string named color where: "0" represents a person in a red uniform "1" represents a person in a blue uniform The goal is to remove any occurrence of "01" in the string through a specific process: At each second, all substrings "01" in the string are simultaneously changed to "10". This process repeats until no "01" is present in the string. Calculate the number of seconds it takes for this process to stop. Example Initial string: color = "001011" Step-by-step simulation: t = 0, color = "001011" t = 1, color = "010101" t = 2, color = "101010" t = 3, color = "110100" t = 4, color = "111000" Therefore, this process takes 4 seconds. Function Description Complete the function getSwapTime in the editor with the following parameter(s): string color: a binary string that represents the uniform colors of people Returns int: the time to complete the proces