Dsa
Dynamic Programming
Easy
Nested Brackets Validation
You are given a string of brackets that includes parentheses, square brackets, and curly braces. Your task is to determine if it is possible to remove up to one bracket to make the string valid. A valid string should have every opening bracket matched with a corresponding closing bracket in the correct order.
Input format:
A single line containing a string of brackets (1 <= length <= 100).
Output format:
Print 'YES' if it is possible to make the string valid by removing at most one bracket, otherwise print 'NO'.
Example:
Input:
{[()]}(]
Output:
YES
Key concepts
dynamic_programmingstringvalidation
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