Question: PLEASE DO IT FAST AS SOON AS POSSIBLE NOTE:MUST BE DONE IN C LANGUAGE Suppose one string of length N is given to you which
PLEASE DO IT FAST AS SOON AS POSSIBLE
NOTE:MUST BE DONE IN C LANGUAGE
Suppose one string of length N is given to you which is made up of only uppercase characters 'W' and B', where 'W' stands for White and 'B' stands for Black. Write a program in C to find out the minimum number of characters you need to change to make the whole string of the same colour. If the characters are the same, then you can choose anyone among W and B to make the whole string of the same colour.
For example:
Input:
N=5
S="WBWBW"
Output:
2
Explanation:
We need to change only the 2nd and 4th(1-index based) characters to 'B', so that the whole string becomes the same colour.
Now your task to print the minimum number of characters you need to change to make the whole string of the same colour for the following strings:
a) WBBBBWBB
b) BBBBWWWBB
c) WWWWBBWW
d) BBWWWWBBBWB
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
