Longest Valid Parentheses
Longest Valid Parentheses (100 Marks) Source: Techgig Challenge Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Input Format Input 1: "(()" Input 2: ")()())" Constraints NA Output Format For Input 1, The longest valid parentheses sub-string is "()" For Input 2, The longest valid parentheses sub-string is "()()" Sample TestCase 1 : Input "()(()))))" Output 6 SOLUTION Java8 /* * Enter your code here. Read input from STDIN. Print your output to STDOUT. * Your class should be named CandidateCode. */ import java.io.*; import java.util.*; public class CandidateCode { public static void main(String args[] ) throws Exception { //Write code here Scanner scan = new Scanner ( System.in ); ...