{
"customerName": "Tony Stark"
"cpf": "68541500004"
"personId": 21,
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
import pytest | |
def brackets_analysis(string): | |
if len(string) % 2 != 0: | |
return 'invalid' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
def brackets_analysis(string: str) -> str: | |
pairs = {')': '(', ']': '[', '}': '{'} | |
stack = [] | |
for ch in string: | |
if ch in pairs.values(): # opening | |
stack.append(ch) | |
elif ch in pairs: # closing |