Company: ibm_7nov
Difficulty: medium
Minimum Operations for Valid Arrangement Problem Description You have n machines arranged in a line within a manufacturing unit. This arrangement is depicted as a binary string called machines where the length of the string is n . Each character in the string represents the state of a machine: '1' means the machine is running, and '0' means it is not running. You can change the state of any machine any number of times, flipping '1' to '0' or '0' to '1' . A valid arrangement is one where no running machine ( '1' ) is immediately followed by a non-running machine ( '0' ). In other words, the string must not contain the substring "10" . Determine the minimum number of operations needed to achieve a valid arrangement. Complete the function getMinimumOperations in the editor with the following parameter: string machines : a binary string that denotes the initial arrangement of machines Returns: int : the minimum number of operations required to make the arrangement valid Examples Example 1: