Problem 32 · Hard

Longest Valid Parentheses

Find the length of the longest substring made of properly matched bracket pairs. The visual pushes positions onto a stack and measures the gaps between matched brackets.

Open the interactive visualisation