Given a sequence of closing and opening parentheses, count the number of subsequences that formed a balanced set of parentheses?
Notice: it's subsequence not substring.
I've no idea, any one can try?