Math Fundamentals18 sections · 814 units
Open in Course

Problem - Valid Parentheses

LeetCode 20

Given a string containing just the characters '(', ')', '{', '}', '[', and ']', determine if the input string is valid.

A string is valid if: open brackets are closed by the same type of brackets, and open brackets are closed in the correct order. Every close bracket has a matching open bracket of the same type.

Example: "()" is valid, "()[]{}" is valid, "(]" is not valid. Your task uses boolean conditions to validate structure.