Data Structures19 sections · 729 units
Open in Course

Problem - Valid Parentheses

Classic stack problem

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

1.1. Open brackets are closed by the same type of brackets.

2.2. Open brackets are closed in the correct order. You're looking at the entry-level stack problem. Every competitive programmer should be able to solve it in two minutes.