Medium20 min

Balanced Brackets

Return whether every opening bracket has a matching closing bracket in the correct order. Input contains only (), [], and {}.

Your function

Implement solve(value, extra) in JavaScript. Return the answer; printing alone does not count as a result.

Examples

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

Constraints

Input contains at most 1,000 values or characters. Numbers are finite integers. Inputs follow the structure shown in the examples.

13px
main.jsYour ideas, in code.
Loading your editor…
Run your code to see the output here.
Ready to buildUTF-84 lines

Test freely without an account. Signed-in submissions are checked independently by the isolated execution service before progress is awarded.