Please explain how to solve this as I can’t figure it out
Please tell how to solve this?
the approach, I can’t even think of how to tackle this problem, how to figure out the combinations of the strings
Hey @jayasmit98 try to read this post carefully also if possible make a flow chart for better understanding. in this question you are given a string of length ‘m’.
and you have to make that string of length n
such that you have two conditons which should be true at every point .
lets take the example of the sample test case only.
4 2
((
in this question you have make this string a valid string .
valid string is the sring in which the number of opening and closing bracket are equal.
in this case if you add even one more opening bracket then you woudnt be able to make this a valid string ,because in that case you need to make a string of size 6 so that it can be a valid.
that is the reason you are only left with the the option of concatenating this string with a="" in the front so that the number of opening bracker doesn’t increases .
and to add b with two closing brackets .
which is the only option to make it a valid string .
Try to do it recursively. If still not get it, you can ask me again
please send the code file, can’t figure it out yet\
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.