Bonsai AI interview question

Write a function to determine if brackets or parenthesis are balanced.