Codility 'Nesting' Solution | MartinKysel.com
Determine whether given string of parentheses is properly nested.
Read full article from Codility 'Nesting' Solution | MartinKysel.com
Determine whether given string of parentheses is properly nested.
Because there is only one type of brackets, the problem is easier than Brackets. Just check if there is always a opening bracket before a closing one.
def solution(S):    leftBrackets = 0         for symbol in S:        if symbol == '(':            leftBrackets += 1        else:            if leftBrackets == 0:                return 0            leftBrackets -= 1          if leftBrackets != 0:        return 0         return 1Read full article from Codility 'Nesting' Solution | MartinKysel.com
