Minimum Recolor Window
You are given a string blocks where each character is 'W' (white) or 'B' (black). In one operation, you can recolor a white block to black.
Return the minimum number of recolorings needed so that the string contains at least k consecutive black blocks.
If it is impossible, return -1.
Examples
Input: ["WBWBBBW",7]
Output: 3
Input: ["BB",2]
Output: 0
Hints
<details>
<summary>Hint 1</summary>
You are looking for a contiguous segment of exactly `k` blocks. How does changing the window's leftmost character affect its rightmost character?
Related Problems
Minimum Recolor Window
You are given a string `blocks` where each character is `'W'` (white) or `'B'` (black). In one operation, you can recolor a white block to black.