LeetCode Solutions/Problems/2379. Minimum Recolors to Get K Consecutive Black Blocks.java
<reponame>DevashishPathrabe/LeetCode<filename>LeetCode Solutions/Problems/2379. Minimum Recolors to Get K Consecutive Black Blocks.javaclass Solution {
    public int minimumRecolors(String blocks, int k) {
        int countW = k;
        int n = blocks.length();
        for (int i=0;i+k-1<n;i++){
            int count = 0;
            for (int j=i;j<i+k;j++){
                char ch1 = blocks.charAt(j);
                if (ch1 == 'W' ){
                    count++;
                }
            }
            countW = Math.min(count, countW);
        }
        return countW;
    }
}