← All coding problems

Balanced brackets

MediumStacks

Return true if every bracket in s ( (), [], {} ) is closed in the right order.

Function
function solve(s)
Example 1
s = "([]{})"
→ true
Example 2
s = "(]"
→ false

Submit also runs 4 hidden tests, including edge cases.

console.log output is shown below