Problem
A row of blocks is described by the string blocks, where 'W' is white and 'B' is black. In one operation you can paint a white block black. Return the minimum number of operations needed so that there are `k` consecutive black blocks somewhere in the row.
Example 1
- Input
- blocks = "WBBWWBBWBW", k = 7
- Output
- 3
Example 2
- Input
- blocks = "WBWBBBW", k = 2
- Output
- 0
- Why
- "BB" already exists
Constraints
1 <= k <= blocks.length <= 100blocks[i] is either 'W' or 'B'.