Hey,
I've used stacks to solve this. Although I'm getting correct results for all the test cases I could think of, I'm still getting a WA on submission. Please Help!
import java.util.*;import java.lang.*;import java.io.*;class Codechef{public static void main (String[] args) throws java.lang.Exception{Scanner sc = new Scanner(System.in);Stack<Integer> stack = new Stack<Integer>();int pos1=0;int pos2=0;int length=0;int lengthmax=0;int depth=0;int depthmax=0;
Read more… (30 words)