The problem has been explained really poorly. For example, it is given that we have two append two strings a and b in the order a+s+b, but what is s ?. Also in the the sample input two strings have not been provided. The explanation of the question is really poor. Can someone explain it properly ?
Explanation on BRACKETS ALL OVER
Hi @prajwalbakshi, the problem says that you are given a string s, it’s length m and a number n. You have generate all possible pairs of a and b such that:
a + s + b is a valid sequence of brackets of length exactly n.
For example if you are given s = “))” and n = 6(m = 2 obviously) then you can generate following pairs of a and b to make a+s+b a valid sequence:
“()((” “))” “” // Remeber a and b can be blank also.
“((” “))” “()”
“(((” “))” “)”
“(()(” “))” “”
“((()” “))” “”
Hence, the ans for this testcase is 5. If there is no possible combination then print -1. Pls try the question now.
Hope this helps 
1 Like