← Questions
Validate a bracket string after digit-driven deletions
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A string mixes brackets and digits, for example (())2)1(). Each digit d requires removing exactly d of the brackets that come before it. Decide whether the deletions can be chosen so the remaining brackets are balanced. Agree on the exact rules with the interviewer, then work out a greedy or stack-based check.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
