[C] sliding window(optimized) | Time: O(n), Space: O(1)
```C []
static int min_int_2(const int a, const int b){
	return (a <= b)? a : b;
}

int minFlips(const char * const str){
	const int strLen = strlen(str);

	int cnt = 0; //evenZeroCnt + oddOneCnt
	for (int i = 0; i < strLen; i += 1){
		if ((i % 2 == 0) == (str[i] == '0')){
			cnt += 1;
		}
	}

	int minOp = min_int_2(cnt, strLen - cnt);
	if (strLen % 2 == 0){
		goto SKIP_LOOP;
	}

	for (int i = 0; i < strLen - 1; i += 1){
		cnt += ((i % 2 == 0) == (str[i] == '0'))? -1 : 1;

		const int curOp = min_int_2(cnt, strLen - cnt);
		if (curOp < minOp){
			minOp = curOp;
		}
	}
SKIP_LOOP:

	return minOp;
}
```
['C']