I have been getting WA despite checking on many test cases. Please help me.
Idea: Whenever I encounter a closing bracket ‘)’ and my stack is not empty then I change the value of flag to 0. This tells me that me that if next I encounter ‘(’ then the depth does not increase. Whenever the stack becomes empty I check for the maximum depth.