Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a function that checks if a given string has balanced parentheses, brackets, and braces.

Hard

Problem 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("{[ ()() ]}"));
Log in or sign up to run or submit your code.Log inSign up
Input
"{[ ()() ]}"
Expected Output
true