Dsa
Stack
Medium
Maximum Nested Parenthesis Depth
Given a string consisting of properly nested parentheses, your task is to find the maximum depth of nested parentheses.
Input:
A single line string containing only '(' and ')', with a maximum length of 10000.
Output:
An integer representing the maximum depth of nested parentheses.
Example:
Input:
((()))
Output:
3
Key concepts
stackdepthparentheses
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now