Dsa
Stack
Medium
Balanced Parentheses in Expressions
You are given a string expression consisting of only parentheses: '(', ')', '{', '}', '[' and ']'. Your task is to determine if the input expression has balanced parentheses. An expression is considered balanced if every opening bracket has a corresponding closing bracket in the correct order. Return 'True' if it's balanced, otherwise return 'False'. Examples include '([])' which is True, and '([)]' which is False.
Input Format:
- A single string containing the parentheses.
Output Format:
- A single line with 'True' or 'False'.
Example:
Input:
([{}])
Output:
True
Key concepts
stackparenthesesvalidation
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now