Loading problem…
You're building a code editor that needs to validate JSON, HTML, and code structure in real-time. The editor should check if brackets, parentheses, and braces are properly matched and nested.
Given a string containing only the characters '(', ')', '{', '}', '[', and ']', determine if the input string is valid.
An input string is valid if:
isValid("()"); // true
isValid("()[]{}"); // true
isValid("(]"); // false
isValid("([)]"); // false
isValid("{[]}"); // trueThis problem models real code editor features: