Dsa
Stack
Medium
Balanced Parentheses with Min Stack
Given a string containing only the characters '(', ')', '{', '}', '[' and ']', determine if the input string is a valid sequence of parentheses. A valid sequence must satisfy the following conditions:
1. Open brackets must be closed by the corresponding type of brackets.
2. Open brackets must be closed in the correct order.
Implement a function that reads from standard input and prints 'true' if the input string is valid, otherwise print 'false'.
### Example:
Input:
{[()]}
Output:
true
### Input format:
A single line string containing only '(', ')', '{', '}', '[', ']', with a maximum length of 100.
### Output format:
'true' or 'false'.
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