Valid Parenthesis Checker
Basic Greedy Problems DSA practice problem on Onlearn.
Difficulty: medium.
Topics: Valid Parenthesis Checker, Stack, String Manipulation, Loops, Conditional Statements, Time Complexity, Space Complexity, space complexity, string processing, stack, stack algorithms, time complexity analysis, Parentheses Parsing.
Problem: Valid Parentheses Checker Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The string is valid if: 1. Open brackets are closed by the same type of brackets. 2. Open brackets are closed in the correct order. Input Specification: The input consists of a single string s of length n (1 ≤ n ≤ 10^4), containing only the characters '(', ')', '{', '}', '[', ']'. Output Specification: Return true if the string is valid, otherwise return false. Examples: Input: "()" Output: true Input: "()[]{}" Output: true Input: "(]" Output: false Input: "([)]" Output: false Input: "{[]}" Output: true Difficulty Level: Easy