LC 20

Valid Parentheses

Easy · LC 1–100

stackstring
Free

候选解法路线

Primary

括号匹配栈

Free

Invariant: 扫描前缀后,栈按出现顺序保存且仅保存尚未匹配的开放符;栈顶是唯一允许被下一个关闭符匹配的开放符。

candidate confidence: 0.740 · metadata_only

如何使用本页

先读原题与 constraints,再逐一验证 Recognition signals、invariant 与 complexity;candidate score 不能证明正确性。