Challenge: Max Depth Parenthesis

Let’s learn how to find the depth of parentheses in a valid sequence of parentheses.

Problem statement

Given a balanced parentheses expression, find the maximum depth of the parentheses. For example, in () the maximum depth is 1 and in ((()))() the maximum depth is 3.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.