less than 1 minute read

Given a string s containing round, curly, and square open and closing brackets, return whether the brackets are balanced.

Constraints

  • n ≤ 100,000 where n is the length of s

https://binarysearch.com/problems/Balanced-Brackets-Sequel

Examples

Example 1

Input

  • s = [(])

Output

  • answer = False

Example 2

Input

  • s = ([])[]({})

Output

  • answer = True

Solution

Leave a comment