@@ -0,0 +1,1332 @@
+package com.interview.dynamic;%0A%0A/**%0A * http://www.geeksforgeeks.org/longest-even-length-substring-sum-first-second-half/%0A * Test cases%0A * Even length string%0A * odd length string%0A * 0 length string%0A */%0Apublic class LongestEvenLengthSubstringOfEqualHalf %7B%0A    %0A    public int findMaxLength(int input%5B%5D)%7B%0A        assert input != null;%0A        int T%5B%5D%5B%5D = new int%5Binput.length%5D%5Binput.length%5D;%0A        %0A        for(int i=0; i %3C T.length; i++)%7B%0A            T%5Bi%5D%5Bi%5D = input%5Bi%5D;%0A        %7D%0A        int max = 0;%0A        for(int len = 2; len %3C= input.length; len++)%7B%0A            for(int i=0; i %3C input.length - len+1; i++)%7B%0A                int j = i + len-1;%0A                //updating sum for each lenght%0A                T%5Bi%5D%5Bj%5D = T%5Bi%5D%5Bj-1%5D + input%5Bj%5D;%0A                %0A                if(len %25 2 == 0)%7B%0A                    int k = (i + j)/2;%0A                    if(T%5Bi%5D%5Bk%5D == T%5Bk+1%5D%5Bj%5D)%7B%0A                        if(max %3C len)%7B%0A                            max = len;%0A                        %7D%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A        return max;%0A    %7D%0A    %0A    public static void main(String args%5B%5D)%7B%0A        int input%5B%5D = %7B1,5,3,8,0,2,14,9%7D;%0A        LongestEvenLengthSubstringOfEqualHalf lel = new LongestEvenLengthSubstringOfEqualHalf();%0A        System.out.println(lel.findMaxLength(input));%0A        %0A    %7D%0A%7D%0A

Find equal length sequence of equal sum in an array