Brackets all over

plz tell how to solve this problem…explain as well…

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

Reference Code

if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like :heart:: and don’t forgot to mark doubt as resolved :grinning: