Contest Arena
[Exp 2] Valid Balanced Parentheses Check
UNIT-II Rubric: 10m Code + 5m Viva + 5m Record MEDIUM 15 Marks
Session: 59:59
Bubblewrap Sandbox Active
Problem Statement
Given a string containing only brackets: '(', ')', '{', '}', '[', and ']', determine if the input string is valid. An input string is valid if: 1. Open brackets are closed by the same type of brackets. 2. Open brackets are closed in the correct order. 3. Every close bracket has a corresponding open bracket of the same type.
Input Format
A single line containing the bracket string S.
Output Format
Print "YES" if the bracket sequence is balanced and valid; otherwise, print "NO".
Constraints
1 <= length(S) <= 10^5 S consists solely of the characters '()[]{}'.
Status Lang Score Time Submitted
No prior submissions for this problem.
Ready
Click Run Code to evaluate against sample test cases, or Submit Solution for full evaluation.
Instructor Guidance