Question: Write a function count Valid Strings() that takes a string, where each character in the string is a bracket, and returns the count of unique
Write a function count Valid Strings() that takes a string, where each character in the string is a bracket, and returns the count of unique strings that are valid when minimum number of invalid parentheses are removed to make the invalid string valid. For example: countValidString("()())()") will return 2 because "(())()" and "()()()" are the two valid strings that can be formed by removing only one character from the given string. Please keep in mind that countValidStrings() will return 0 if already a valid string is passed as input.
Step by Step Solution
There are 3 Steps involved in it
Heres a Python function countValidStrings that fulfills the described requirements def countVali... View full answer
Get step-by-step solutions from verified subject matter experts
