not able to understand the question even after reading the editorial
Brackets all over
You are not able to understand question or solution ?
If u are not able to understand problem
You are given an input string s, which will only contain open or close brackets.
For example: s=((( contains only opening and s=)) contains only closing.
You have to form a+s+b of size n, where a and b are any strings chosen by you and s is the given input string.
Now, the string a and b must be chosen such that string a+s+b, follows 2 properties:
i) At any index, number of opening brackets should be greater than closing brackets.
ii) No. of opening and closing brackets should be equal.
Now consider the given sample input:
4 2
((
here n =4 , string length = 2 and string s = β((β.
There is only one possible way to form a+s+b, with above two properties and with size = n.
i.e. take a = ββ , b = β))β
a+s+b equals = ββ+ β((β +"))"
Final output string = β(())β
The new string β(())β have above two properties.
Hence output will be 1, as there is only one way possible.
Refer to this
@Kartikkhariwal1
he just wrote the editorial in explaination
which i already read and not able to understand
I havent done this question before
Will go through it tomorrow
Till then drop the things u are not able to understand here
Will reply u tomorrow on it