I am not getting the meaning of a+s+b;question is ambigous,at first itβs written otherwise print 0,and then at last -1
Brackets all over strings
@sattyrajpoot39 hey satyam
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.
means u can have character before s and also after s
which can be empty also a and b
so after combinaing them all that is concatining u will get the full string
I hope Iβve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.