Dsa
Stack
Easy
Balanced Parentheses Checker
Given a string containing only the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if open brackets are closed by the same type of brackets and in the correct order.
Input Format:
- A single line containing the string of parentheses.
Output Format:
- Print 'Valid' if the string is valid, otherwise print 'Invalid'.
Example:
Input:
{[()]}
Output:
Valid
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