Problem 921 · Medium

Minimum Add to Make Parentheses Valid

Find how many brackets must be inserted to make a string of brackets balanced. The visual pushes open brackets onto a stack and counts the closing brackets that have nothing to match.

Open the interactive visualisation