Last active
September 2, 2025 02:48
-
-
Save AbeEstrada/befe892280d98ed1705f8c67a6e21354 to your computer and use it in GitHub Desktop.
Exercise: Balanced Brackets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isBalanced(s) { | |
| const pattern = /\[\]|\(\)|\{\}/g; | |
| while (pattern.test(s)) { | |
| s = s.replace(pattern, ""); | |
| } | |
| return s ? "NO" : "YES"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment