Question

Using a stack-based algorithm to check balanced brackets, is the string '{[(])}' valid, and at which character does it first fail (if any)?

A Invalid — it fails at '(' because two opening brackets cannot appear consecutively
B Invalid — it fails at the final '}' character due to an empty stack
C Invalid — it fails at the ']' character
D Valid — all brackets are properly matched and nested
E Invalid — it fails at the first '[' character due to a type mismatch with '{'
Practice Next

Hey! Ask a query

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)