All Posts
Leetcode 856: Score of Parentheses
Given a balanced parentheses string, calculate the score of the string. The score is computed as follows:
- The score of ‘()’ is 1.
- For a concatenation of two balanced parentheses strings, AB, the score is the sum of their individual scores (A + B).
- For a balanced parentheses string wrapped in another pair of parentheses, (A), the score is twice the score of A (2 * A).