Please enter your email address or userHandle.
Given a string S consisting of opening and closing parenthesis '(' and ')'. Find length of the longest valid parenthesis substring.
First line contains number of test cases T. Each test case have one line string S of character '(' and ')' of length N.
1 <= T <= 500
1 <= N <= 105
Testcase 1: Longest valid balanced parantheses is () and its length is 2.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.