can anyone suggest me how to solve the problem bracket sequences II from cses problemset?
link to the problem is here https://cses.fi/problemset/task/2187
Codeforces Edu Round 190 (Div 2) — Solution Discussion