Question bank › Strings
Dsa Strings Easy

Balanced Parentheses Check

Write a function that takes a string containing just the characters '(', ')', '{', '}', '[' and ']', and determines if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the same type of brackets. 2. Open brackets must be closed in the correct order. Input: A single line containing the string of parentheses. Output: A single string: "Valid" if the string is valid, "Invalid" otherwise. Example: Input: {[()]} Output: Valid Explanation: All brackets are correctly matched and nested.

Key concepts

stringsparenthesesvalidation

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.