← ALL NOTES
String

856. Score of Parentheses

A balanced string scores by three rules: () is 1, AB adds, and (A) doubles. Unfold the recursion and every point traces back to one innermost () pair, worth exactly 2^d for its nesting depth.

Loading…