(string S)
| 25 | |
| 26 | // C++ Code |
| 27 | int minFlips (string S) |
| 28 | { |
| 29 | // your code here |
| 30 | int flips=0; |
| 31 | for(int i=0;i<S.length();i++) |
| 32 | { |
| 33 | if(i%2==0) |
| 34 | { |
| 35 | if(S[i]=='0') flips++; |
| 36 | } |
| 37 | |
| 38 | else if(i%2!=0) |
| 39 | { |
| 40 | if(S[i]=='1') flips++; |
| 41 | } |
| 42 | } |
| 43 | if(flips<S.length()-flips) |
| 44 | return flips; |
| 45 | else |
| 46 | return S.length()-flips; |
| 47 | } |
nothing calls this directly
no outgoing calls
no test coverage detected