package leetcode;

/**
 * https://leetcode.com/problems/length-of-longest-fibonacci-subsequence/
 */
public class Problem873 {
    public int lenLongestFibSubseq(int[] A) {
        return 0;
    }

    public static void main(String[] args) {
        Problem873 prob = new Problem873();
        System.out.println(prob.lenLongestFibSubseq(new int[]{1, 2, 3, 4, 5, 6, 7, 8})); // 5
        System.out.println(prob.lenLongestFibSubseq(new int[]{1, 3, 7, 11, 12, 14, 18})); // 3
    }
}

@@ -162,24 +162,555 @@
 (int%5B%5D A) %7B%0A
+        int max = 0;%0A        for (int i = 0; i %3C A.length; i++) %7B%0A            for (int j = i + 1; j %3C A.length; j++) %7B%0A                max = Math.max(max, lenLongestFibSubseq(A, i, j) + 2);%0A            %7D%0A        %7D%0A        return max;%0A    %7D%0A%0A    private int lenLongestFibSubseq(int%5B%5D a, int i, int j) %7B%0A        int sum = a%5Bi%5D + a%5Bj%5D;%0A        int x = j + 1;%0A        while (x %3C a.length && a%5Bx%5D %3C= sum) %7B%0A            if (a%5Bx%5D == sum) %7B%0A                return lenLongestFibSubseq(a, j, x) + 1;%0A            %7D%0A            x++;%0A        %7D%0A
         retu

Update problem 873