Easy42.8% acceptance

Valid Parentheses

Determine whether a string of brackets is correctly balanced.

Topics

StackStrings

Examples

Input: s = "()"
Output: true
Input: s = "([)]"
Output: false

Expected Complexity

O(n) time and O(n) space using a stack.

What happens after Submit?

ERROR DNA analyzes your submission and identifies recurring patterns in your mistakes.

solution.cppC++17
Loading...
C++17