Company: CRED_23aug
Difficulty: medium
Minimum Flips to Achieve Target Problem Description Start with an initial string of zeros. Choose any digit to flip. When a digit is flipped, its value and those to the right switch state between 0 and 1. Given a target string of binary digits, determine the minimum number of flips required to achieve the target. Complete the function `minimumFlips` in the editor with the following parameter(s): `string target`: a string of 0s and 1s to match. Returns: `int`: the minimum number of flips needed to obtain the target string. Examples Example 1: Input: target = '0011' Output: 1 Explanation: The number of digits is length(target)=4. Starting with `0000`, flip the 3rd digit (index 2) to obtain the desired state `0011` after 1 flip. Example 2: Input: target = '1010' Output: 4 Explanation: Starting with `0000`, flip the 4th, 3rd, 2nd and 1st digits in sequence to produce `0000` -> `0001` -> `0010` -> `0101` -> `1010` after 4 operations. Constraints `1 `0 The target string consists of digits 0