Strings with an Even Number of Zeros — Solution & Editorial
Model the count as a linear state transition (a fixed matrix acting on the current state vector) and raise the matrix to the N-th power in O(log N).
Complexity: O(log N)
Model the count as a linear state transition (a fixed matrix acting on the current state vector) and raise the matrix to the N-th power in O(log N).
Complexity: O(log N)