<gouthampradhan>dynamic_programming_LengthofLongestFibonacciSubsequence_1.java
public int lenLongestFibSubseq(int[] A) {
    if (A.length < 3) return 0;
    Map<Integer, Map<Integer, Integer>> indexMap = new HashMap<>();
    int max = 0;
    for (int i = A.length - 1; i >= 0; i--) {
      Map<Integer, Integer> subHashMap = new HashMap<>();
      for (int j = 0; j < i; j++) {
        int sum = A[i] + A[j];
        if (indexMap.containsKey(sum)) {
          if (indexMap.get(sum).containsKey(A[i])) {
            int value = 1 + indexMap.get(sum).get(A[i]);
            subHashMap.put(A[j], value);
            max = Math.max(max, value);
          } else {
            subHashMap.put(A[j], 1);
            max = Math.max(max, 1);
          }
        }
      }
      indexMap.put(A[i], subHashMap);
    }
    return max == 0 ? 0 : max + 2;
  }
public int sample_funcname ( int [ ] var_0 ) {
  if ( var_0 . length < 3 ) return 0 ;
  Map < Integer , Map < Integer , Integer >> var_7 = new HashMap < > ( ) ;
  int max = 0 ;
  for ( int var_10 = var_0 . length - 1 ;
  var_10 >= 0 ;
  var_10 -- ) {
    Map < Integer , Integer > var_11 = new HashMap < > ( ) ;
    for ( int var_12 = 0 ;
    var_12 < var_10 ;
    var_12 ++ ) {
      int var_13 = var_0 [ var_10 ] + var_0 [ var_12 ] ;
      if ( var_7 . containsKey ( var_13 ) ) {
        if ( var_7 . get ( var_13 ) . containsKey ( var_0 [ var_10 ] ) ) {
          int var_16 = 1 + var_7 . get ( var_13 ) . get ( var_0 [ var_10 ] ) ;
          var_11 . put ( var_0 [ var_12 ] , var_16 ) ;
          max = Math . max ( max , var_16 ) ;
        }
        else {
          var_11 . put ( var_0 [ var_12 ] , 1 ) ;
          max = Math . max ( max , 1 ) ;
        }
      }
    }
    var_7 . put ( var_0 [ var_10 ] , var_11 ) ;
  }
  return max == 0 ? 0 : max + 2 ;
}
