Problem · Dynamic Programming
Convert to Good String
Learn this problemProblem statement
Given A String Containing Integers, A Good String Is One Not Containing A Subsequence With The Patterns "010" Or "101". You Can Perform Operations To Convert 0 To 1 Or 1 To 0. Return The Number Of Operations Required To Convert A Given String To A Good String
Function
convertToGoodString(s: String) → intExamples
Example 1
s = "111101110100"return = 2We convert the 0s to 1s in Position 5 andnd 9 -
"1111111111100"