Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A suburban street consists of n homes arranged in a row, each painted black or white. You are given a string input of length n
A suburban street consists of n homes arranged in a row, each painted black or white. You are given a string input of length n such that the ith character is B if the ith house is black and W if the ith house is white.
You consider the homes appealing if all black houses appear before all white houses OR if all white houses appear before all black houses. As a skilled painter, it takes you one day to repaint any one of the houses any color of your
Choice.
Write a function that takes the input string and returns an integer, the minimum number of days it will take to make the homes appealing. The input string is guaranteed to contain at most characters.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started