An open API service indexing awesome lists of open source software.

https://github.com/jackhowa/balance-the-parens

Algorithm test for using arrays to check for equality of a string of parens
https://github.com/jackhowa/balance-the-parens

Last synced: over 1 year ago
JSON representation

Algorithm test for using arrays to check for equality of a string of parens

Awesome Lists containing this project

README

          

# balance-the-parens
input: string, paren hash from opening paren to closing paren

output: boolean which determines if the string contains balanced parentheses

"12(3)3" => True
")(" => False

"[](){}" => True

"[_((_]))" => True

"[({})]{}()[]"

"[ (] )" => False
["[","(","]"] # 1
[["("], [")"]]

"((()))()"

"[()]"
^
"[dsfa({fdas}f)das]...." => True
"([)]" => False
'[' => False

parens: {'(' => ')', '[' => ']', '{' => '}'}