leetle

Daily challenge for 2025-08-07

219. Parentheses Score Calculator

Write a function solve that calculates the score of a balanced parentheses string. Rules: () = 1 point, (X) = 2 * score(X), and XY = score(X) + score(Y) where X and Y are sub-expressions.

Example:
Input: "(()(()))"
Output: 6 (outer doubles the inner: 2 * (1 + 2) = 6)

Run this challenge interactively in Python or JavaScript when the app loads.