Wed. Dec 11th, 2019

Host your Website

Read and learn

FatCow Web Hosting $1.00/mo* Trust your web hosting to the #1 web host provider, GoDaddy!

leetCode #32 Longest Valid Parentheses (stack) | JSer – in JavaScript

1 min read

#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.

Copyright © All rights reserved. | Newsphere by AF themes.