Created
January 22, 2019 16:01
-
-
Save cristianbgp/3c90e594992a64be136d403958f1cdae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validParentheses(parens) { | |
pairLenght = parens.length; | |
for (let i = 0; i < pairLenght; i++) { | |
parens = parens.replace('()',''); | |
} | |
return parens.length < 1; | |
} | |
console.log(validParentheses('(()')); | |
console.log(validParentheses('(())((()())())')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment