Missing cases in the following problem

https://practice.geeksforgeeks.org/problems/longest-valid-parentheses/0
Sir,in this problem, i am getting wrong answer,can u guide me what cases am i missing…Here is the link to my solution in O(n) time.


Check this link out. The correct approach to solve this problem in O(n) time complexity is by using a stack.

I even used the same kind of approach if you go through my code ‘op’ indicates the length of the stack.I just saved insertion,deletion operations for the stack.Approschis same but dont know why for some some test cases,it is not returning the correct answer

Compare your code with the one given in the link. And try to find your mistake.
You did not make any stack for storing the indexes.