Very simple 4 line Python Solution using Counter


#1
def solve(self, A):
    if A[0] == ')':
        return 0
    count = collections.Counter(A)
    if count['('] == count[')']:
        return 1
    return 0