Solution to leetcode problem 856: Score of parentheses
In this Leetcode problem, we are given a balance parentheses string. That roughly means that each opening parenthesis is matched with exactly one closing parenthesis placed after the opening parenthesis. This way we won’t have illegal strings such as ())
or )(())(
.
We are given a recursive definition of String score:
score( () ) = 1
(base case)