You are given a blocks of length n, where blocks[i] is either 'W' or 'B', representing the color of the 'W' and 'B' denote the colors white and black, respectively.
You are also given an integer k, which represents the desired number of consecutive black blocks.
In one operation, you can recolor a white block to become a black block.
Return the minimum number of operations required so that there is at least one sequence of k consecutive black blocks.
Constraints:
n == blocks.length
n
blocks[i] is either 'W' or 'B'.
k n
You are given a blocks of length n, where blocks[i] is either 'W' or 'B', representing the color of the 'W' and 'B' denote the colors white and black, respectively.
You are also given an integer k, which represents the desired number of consecutive black blocks.
In one operation, you can recolor a white block to become a black block.
Return the minimum number of operations required so that there is at least one sequence of k consecutive black blocks.
Constraints:
n == blocks.length
n
blocks[i] is either 'W' or 'B'.
k n