<gouthampradhan>dynamic_programming_NumberOfLIS_1.java
public int findNumberOfLIS(int[] nums) {
    if (nums.length == 0) return 0;
    int[] length = new int[nums.length];
    length[0] = 1;
    int maxVal = 1;
    for (int i = 1; i < nums.length; i++) {
      int max = 1;
      for (int j = 0; j < i; j++) {
        if (nums[i] > nums[j]) {
          max = Math.max(max, length[j] + 1);
          maxVal = Math.max(maxVal, max);
        }
      }
      length[i] = max;
    }
    int[] count = new int[nums.length];
    count[0] = 1;
    for (int i = 1; i < length.length; i++) {
      for (int j = 0; j < i; j++) {
        if ((length[j] + 1 == length[i]) && (nums[j] < nums[i])) {
          count[i] += count[j];
        }
      }
      if (count[i] == 0) {
        count[i] = 1; 
      }
    }
    int ans = 0;
    for (int i = 0; i < length.length; i++) {
      if (length[i] == maxVal) {
        ans += count[i];
      }
    }
    return ans;
  }
public int sample_funcname ( int [ ] var_0 ) {
  if ( var_0 . length == 0 ) return 0 ;
  int [ ] length = new int [ var_0 . length ] ;
  length [ 0 ] = 1 ;
  int var_4 = 1 ;
  for ( int var_5 = 1 ;
  var_5 < var_0 . length ;
  var_5 ++ ) {
    int max = 1 ;
    for ( int var_7 = 0 ;
    var_7 < var_5 ;
    var_7 ++ ) {
      if ( var_0 [ var_5 ] > var_0 [ var_7 ] ) {
        max = Math . max ( max , length [ var_7 ] + 1 ) ;
        var_4 = Math . max ( var_4 , max ) ;
      }
    }
    length [ var_5 ] = max ;
  }
  int [ ] var_9 = new int [ var_0 . length ] ;
  var_9 [ 0 ] = 1 ;
  for ( int var_5 = 1 ;
  var_5 < length . length ;
  var_5 ++ ) {
    for ( int var_7 = 0 ;
    var_7 < var_5 ;
    var_7 ++ ) {
      if ( ( length [ var_7 ] + 1 == length [ var_5 ] ) && ( var_0 [ var_7 ] < var_0 [ var_5 ] ) ) {
        var_9 [ var_5 ] += var_9 [ var_7 ] ;
      }
    }
    if ( var_9 [ var_5 ] == 0 ) {
      var_9 [ var_5 ] = 1 ;
    }
  }
  int var_10 = 0 ;
  for ( int var_5 = 0 ;
  var_5 < length . length ;
  var_5 ++ ) {
    if ( length [ var_5 ] == var_4 ) {
      var_10 += var_9 [ var_5 ] ;
    }
  }
  return var_10 ;
}
