/Split-Bracket-String-into-Equal-Parts

A string S consisting of N brackets opening '(' and closing ')'. The goal is to split S into 2 parts, such that the number of opening brackets in the first group is equal to the number of closing brackets in the second group

Primary LanguagePython

Split-Bracket-String-into-Equal-Parts

A string S consisting of N brackets opening '(' and closing ')'. The goal is to split S into 2 parts, such that the number of opening brackets in the first group is equal to the number of closing brackets in the second group.

Find K such that opening brackets in K is the same as closing brackets in N-K

For example: S = '(())))(' has K = 4 S = ')())(' has K = 3