algoadvance

Leetcode Question: 1614 **********************************************
1614. Maximum Nesting Depth of the Parentheses
**********************************************

Given a valid parentheses string s, return the nesting depth of s. The nesting depth is the maximum number of nested parentheses.

 

Example 1:

Input: s = "(1+(2*3)+((8)/4))+1"

Output: 3

Explanation:

Digit 8 is inside of 3 nested parentheses in the string.

Example 2:

Input: s = "(1)+((2))+(((3)))"

Output: 3

Explanation:

Digit 3 is inside of 3 nested parentheses in the string.

Example 3:

Input: s = "()(())((()()))"

Output: 3

 

Constraints:





Solutions: Python   Java  C++
Cut study time in HALF and DOMINATE your interview with AlgoAdvance AI