K14
Valid Parentheses
Problem Statement & Objective
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. Open brackets must be closed by the same type of brackets and in the correct order.
Function Signature (Python)
is_valid_parentheses(s: str) -> boolInput & Output Contract
Output Rule:True veya False.
System Constraints
0 <= metin.length <= 10^4
Karakterler: '()[]{}'Example Execution Walkthrough
metin = '()[]{}' -> True
metin = '(]' -> False
metin = '([)]' -> FalseExample Test Scenarios (3)
Example 1
Input:
["()[]{}"]Expected Output:
trueExample 2: Uyuşmazlık
Input:
["(]"]Expected Output:
falseExample 3: İç İçe
Input:
["([{}])"]Expected Output:
true