s contains only the characters (, ), [, ], { and }. Return True if the brackets are valid: every opening bracket is closed by the same kind of bracket, and brackets are closed in the correct order ("([])" is valid, "([)]" is not). The empty string is valid.
Example 1
Input:
valid_brackets('()[]{}')
Output:
True
Example 2
Input:
valid_brackets('(]')
Output:
False
0 <= len(s) <= 200000No results yet
Run your code to check it against the examples, or submit to run every test.