You are given a binary string of length n where all characters are initially 0, indexed from 1 to n.
At each step i from 1 to n, the character at the 1-based index flips[i - 1] is flipped to 1.
A binary string is considered prefix aligned at step i if every character from index 1 to i is 1 and all other characters from index i + 1 to n are 0.
Return the total number of steps at which the binary string is prefix aligned.
Constraints:
n is equal to flips.length
n
flips is a permutation of the integers in the range n
You are given a binary string of length n where all characters are initially 0, indexed from 1 to n.
At each step i from 1 to n, the character at the 1-based index flips[i - 1] is flipped to 1.
A binary string is considered prefix aligned at step i if every character from index 1 to i is 1 and all other characters from index i + 1 to n are 0.
Return the total number of steps at which the binary string is prefix aligned.
Constraints:
n is equal to flips.length
n
flips is a permutation of the integers in the range n