...

/

Solution Review: Print Parentheses Number

Solution Review: Print Parentheses Number

Let’s take a detailed look at the previous challenge’s solution.

Solution

A stack is used to keep track of the parenthesis count. A count variable is used to keep track of the count of the current opening parenthesis. Traverse the string and when we get an opening parenthesis, then we add the count to the stack and output. Then, increase the ...