plz tell how to solve this problem…explain as well…
Brackets all over
why is no one replying??
idea is to use 3D top down dp
i guess question is clear if not take a look at testcase given below
Some cases i can think of are:
4 2
((
answer is 1 as only answer possible is (())
6 4
)()(
answer is 1 again and only answer possible is ()()()
6 2
((
answer is 3. (())(), ((())) and ()(()).
5 2
))
Output: 0
this is little bit hard question
you can take help form reference code given below
if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like : and don’t forgot to mark doubt as resolved
if (!close){
if (open >= openingBrackets)
ans = (ans + solve(pos + 1, open - openingBrackets + closeBrackets, 1)) % MOD;
}
``` maam can you please tell why we have incremented pos in this call because here we have not added brackets in the string