Create a function that checks if a given string has balanced parentheses, brackets, and braces.
HardProblem Statement
Create a function that checks if a given string has balanced parentheses, brackets, and braces.
Sample Input
"{[ ()() ]}"Sample Output
true
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
// Check if a string has balanced parentheses, brackets, and braces
function isBalanced(str) {
// Use a stack to track opening characters
// For each closing character, check for matching opening character in stack
}
console.log(isBalanced("{[ ()() ]}"));
Input
"{[ ()() ]}"Expected Output
true