Return the number of substrings that contain balanced string
Anonymous User
487

A string that contains only the following => ‘(‘, ‘)’, ‘[’, ‘]’. At some places there is ‘?’ in place of any bracket.
Determine the number of substrings that can be formed by replacing all ‘?’s with appropriate bracket, is it possible to make a valid bracket sequence.
Example:
S = "()[?(?)])"
Ans => 2
s1 = "()"
s2 = "[(([)])"

Note: I don't remember the exact examples

Comments (0)