class Solution {
public int minOperations(String s) {
char[] c = s.toCharArray();
int n = c.length;
int res1 = 0;
int res2 = 0;
for (int i = 0; i < n; i++) {
if ((i & 1) == 0) {
if (c[i] == '0') res1++;
if (c[i] == '1') res2++;
} else {
if (c[i] == '1') res1++;
if (c[i] == '0') res2++;
}
}
return Math.min(res1, res2);
}
}
标签:操作数,二进制,res1,res2,++,int,1758
From: https://www.cnblogs.com/eiffelzero/p/16934289.html