Quant Memo
Coding/●●●●

Validate matching brackets

Your team's alert language allows nested conditions wrapped in (), [], and {}. Before evaluating an expression you must check the brackets are balanced: every opener has a matching closer of the same type, closed in the right order.

"([{}])"  -> True
"(]"      -> False
"((("     -> False
""        -> True

Write a function that returns whether the bracket string is valid. Aim for O(n)O(n).

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions