Problem 2267 · Hard

Check if There Is a Valid Parentheses String Path

Track every balance a path can have at each cell; a valid path needs balance 0 at the end and never below 0.

Open the interactive visualisation