Use a stack to validate that every opening bracket has a correct matching close.
About this algorithm
Valid parentheses (balanced brackets) is solved with a stack: push every opening bracket, and on each closing bracket pop the top and check that it is the matching opener. The string is valid when every closer matched and the stack is empty at the end, so "({[]})" is valid and "([)]" is not, even though it has one of each opener and closer. It takes one left to right pass.
Use this check for anything with nesting: code editors highlighting a missing brace, compilers and JSON parsers rejecting bad input, HTML tags that must close in reverse order. If the string has only one kind of bracket, a simple counter that goes up on ( and down on ) is enough. With two or more kinds a counter fails, because it cannot see order: "([)]" leaves every count at zero. The stack remembers which opener came last, which is exactly what the next closer has to match.
Read the string left to right. When you see (, [ or {, push it. It stays on the stack until its closer arrives.
When you see ), ] or }, look at the top of the stack. If the stack is empty, or the top is a different kind of opener, the string is invalid: return false.
If the top is the matching opener, pop it. That pair is done, and the opener below it is now the one waiting.
After the last character, the string is valid only if the stack is empty. Anything left over is an opener that was never closed, as in "((".
The page plays two strings. First ({[]}): push (, push {, push [, so three openers wait with [ on top. The ] matches [ and pops it, the } matches { and pops it, the ) matches ( and pops it. The stack is empty at the end, so the string is valid. Then ([)] on a fresh stack: push (, push [. The ) arrives while [ is on top, and [ is not the partner of ), so the answer is false on the third character, without reading the last ].
A valid string always has an even length, so an odd length can be rejected before scanning. This page does not take that shortcut, so you can watch where an odd string actually fails.
Time: each character is read once and causes at most one push or one pop. Space: a string of n openers, like "((((", puts all n on the stack before anything is popped.