Use the Stack data structure. Here's how it'd work:
- Whenever an open brace of any type is encountered, store it in the stack
- Whenever a closing brace of any type is encountered, check if it matches the type of brace at the top of the stack
- If it doesn't or the stack is empty, return "false"
- If it matches, pop the stack and then repeat the process till one of the "false" conditions I just stated is encountered or until the end of the string is reached
- The fact that you reach the end of the string shows that it's balanced