Sir doubt in this question

whatis the approach to solve this problem

hello @tejasddongare do you want the code for this problem or you want me to explain the question ?

@tejasddongare this is the code for this problem .


if you face any problem in understanding the code .
please ask here .
Happy Learning !!

sir i needed the explanation

@tejasddongare ahve you gone through the code ?
and if not please go through the code because according to me this is the only way i find to code this problem .
Happy Learning!!

but i didnt underatood what exactly is the logic

@tejasddongare 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 .

i have coded this logic .
if you still have any doubt please write here .
Happy Learning !!

@tejasddongare mark this doubt as resolved if your doubt is cleared .