Skip to content

Latest commit

 

History

History

balanced-brackets

Balanced Brackets

Write a function that accepts a string consisting entiring of brackets ([](){}) and returns whether it is balanced. Every "opening" bracket must be followed by a closing bracket of the same type. There can also be nested brackets, which adhere to the same rule.

f('()[]{}(([])){[()][]}') // true
f('())[]{}') // false
f('[(])') // false