A failing test in a Shopify Liquid utility points to incorrect bracket validation. You are given a string s containing only the characters ()[]{} and must return True if the brackets are balanced and properly nested, otherwise return False.
This models a common debugging task: isolate the edge case causing the failure and implement the correct validation logic.
sTrue when every opening bracket has a matching closing bracket of the same type in the correct order.Example 1
s = "()[]{}"TrueExample 2
s = "([)]"False) does not match the most recent unmatched opening bracket [.Example 3
s = "{[]}"True1 <= len(s) <= 10^5s contains only the characters (, ), [, ], {, }Your solution should handle large inputs efficiently and correctly catch common failing cases such as early closing brackets, incorrect nesting, and leftover unmatched openings.