Balanced Brackets
You’re given a string s
consisting solely of "("
and ")"
. Return whether the parentheses are balanced.
Constraints
n ≤ 100,000
wheren
is the length ofs
.
https://binarysearch.com/problems/Balanced-Brackets
Examples
Example 1
Input
- s =
()
Output
- answer =
True
Example 2
Input
- s =
()()
Output
- answer =
True
Example 3
Input
- s =
)(
Output
- answer =
False
Example 4
Input
- s = ``
Output
- answer =
True
Example 5
Input
- s =
((()
Output
- answer =
False
Example 6
Input
- s =
((()))
Output
- answer =
True
Leave a comment