Search⌘ K
AI Features

Balanced Brackets

Understand how to verify balanced brackets in a string using JavaScript by applying a stack approach that efficiently matches open and close brackets. This lesson helps you write code to check parentheses, curly braces, and square brackets balance, supporting your algorithm and data structures knowledge for interviews.

We'll cover the following...

Balanced Brackets

Instructions

Given a string, return true if it contains all balanced parentheses (), curly-brackets {}, and square-brackets [].

Input: String

Output: Boolean

Examples

isBalanced("(x +
...