re: Daily Challenge #51 - Valid Curly Braces VIEW POST

FULL DISCUSSION
 

Python solution

from collections import Counter


def are_curly_braces_matched(braces: str) -> bool:
    closing_brace = '}'
    opening_brace = '{'

    if braces[0] == closing_brace:
        return False

    elements = Counter(braces)
    return elements.get(opening_brace) == elements.get(closing_brace)
code of conduct - report abuse