K14

Valid Parentheses

Junior Level Candidate
Target Time: 15 - 20 Minutes
Type: BOOLEAN

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) -> bool

Input & Output Contract

Output Rule:True veya False.

System Constraints

0 <= metin.length <= 10^4
Karakterler: '()[]{}'

Example Execution Walkthrough

metin = '()[]{}' -> True
metin = '(]' -> False
metin = '([)]' -> False

Example Test Scenarios (3)

Example 1
Input:["()[]{}"]
Expected Output:true
Example 2: Uyuşmazlık
Input:["(]"]
Expected Output:false
Example 3: İç İçe
Input:["([{}])"]
Expected Output:true
Loading Python Editor...
Input Parameters
[
  "()[]{}"
]
Expected Output
true