Solution Review: Max Depth Parenthesis
Let’s take a detailed look at the previous challenge’s solution.
We'll cover the following...
First solution
Let’s see how we can solve this problem:
-
Create a stack.
-
When we come across the open parenthesis, we insert it to the stack and increase the depth counter.
-
When we get a closing parenthesis, we pop the opening parenthesis from the stack and decrease the depth counter.
-
We ...