leetle

Daily challenge for 2026-01-17

382. Simple Stack Bracket Depth

Given a string s consisting only of parentheses '(', ')', '{', '}', '[' and ']', determine the maximum nesting depth of the valid parentheses structure. The input string is guaranteed to represent a valid sequence of brackets.

For example, in "(()(()))", the maximum depth is 3. In "{}{[]}", the maximum depth is 2 (from the inner '[]' within '{}').

Input: s = "(()(()))"
Output: 3

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