Balanced Brackets

Write the code, see it run, pass the checks.

The problem

  • easy
  • Code

Write isBalanced(text): return true if every bracket in text, (), [] and {}, is closed by the same kind in the right order, and false otherwise. Other characters don't matter: "f(a[1]) { }" is balanced, but "(]", "([)]" and "((" aren't.

Your code must pass

  • Accepts balanced brackets
  • Rejects the wrong kind or order
  • Rejects brackets left open or closed too soon
  • Ignores other characters