Problem 1249 · Medium

Minimum Remove to Make Valid Parentheses

Delete the fewest parentheses from a string so that every opening bracket has a matching closing bracket. The visual scans left to right with a stack and marks unmatched brackets for removal.

Open the interactive visualisation