package leetcode;

/**
 * https://leetcode.com/problems/uncrossed-lines/
 */
public class Problem1035 {
    public int maxUncrossedLines(int[] A, int[] B) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1035 prob = new Problem1035();
        System.out.println(prob.maxUncrossedLines(new int[]{1, 4, 2}, new int[]{1, 2, 4})); // 2
        System.out.println(prob.maxUncrossedLines(new int[]{2, 5, 1, 2, 5}, new int[]{10, 5, 2, 1, 5, 2})); // 3
        System.out.println(prob.maxUncrossedLines(new int[]{2, 5, 1, 2, 5, 8}, new int[]{10, 5, 2, 1, 5, 2, 8})); // 4
        System.out.println(prob.maxUncrossedLines(new int[]{1, 3, 7, 1, 7, 5}, new int[]{1, 9, 2, 5, 1})); // 2
    }
}

@@ -162,24 +162,310 @@
     
-// TODO%0A
+int answer = 0;%0A        for (int i = 0; i %3C A.length; i++) %7B%0A            answer = Math.max(answer, maxUncrossedLines(A, B, i, 0));%0A        %7D%0A        return answer;%0A    %7D%0A%0A    private static int maxUncrossedLines(int%5B%5D a, int%5B%5D b, int i, int j) %7B%0A        if (i == a.length %7C%7C j == b.length) %7B%0A  
         
 retu
@@ -456,24 +456,26 @@
 %7B%0A          
+  
 return 0;%0A  
@@ -468,24 +468,253 @@
   return 0;%0A
+        %7D%0A        int max = 0;%0A        if (a%5Bi%5D == b%5Bj%5D) %7B%0A            max = Math.max(max, maxUncrossedLines(a, b, i + 1, j + 1) + 1);%0A        %7D%0A        max = Math.max(max, maxUncrossedLines(a, b, i, j + 1));%0A        return max;%0A
     %7D%0A%0A    p

Update problem 1035