filmov
tv
leetCode 32 Longest Valid Parentheses (stack) | JSer - in JavaScript

Показать описание
leetCode 32 Longest Valid Parentheses
We've tackled a related problem which validate a parentheses string, with a stack. Here we can use a similar technique to do the validation, yet we need detect the max substring length, so we store the `index` rather than the character in the stack(because we can easily get the character from the index).
Hi I'm a JavaScript engineer who is not good at algorithms,
and currently practicing leetCode online. If you are interested, maybe we can learn together.
We've tackled a related problem which validate a parentheses string, with a stack. Here we can use a similar technique to do the validation, yet we need detect the max substring length, so we store the `index` rather than the character in the stack(because we can easily get the character from the index).
Hi I'm a JavaScript engineer who is not good at algorithms,
and currently practicing leetCode online. If you are interested, maybe we can learn together.