Standard Bar Strings · Medium O(n) · O(1)
A kernel debug logger writes each trace as a single balanced line where every nested subroutine call adds one more layer of parentheses around its own sub-expression. The profiler's summary reports how deep the call stack ever gets — the largest number of parentheses that are simultaneously open at any point of the line. Digits and operators are noise; only the brackets move the gauge.
Input: A valid parentheses string s containing digits, the operators '+', '-', '*', '/', and the parentheses '(' and ')'.
Output: The nesting depth of s — the maximum count of simultaneously open parentheses at any point in the string.
1 <= s.length <= 100s is a valid parentheses string: every '(' has a matching ')' in orderInput: {"s":"(1+(2*3)+((8)/4))+1"}
Output: 3
The term (8)/4 sits inside three simultaneously open pairs — the deepest point of the line.
Input: {"s":"(1)+((2))+(((3)))"}
Output: 3
The three bracket groups nest one, two, and three levels deep, so the deepest group sets the answer.