private static int dp ( int n , int [ ] num ) {
  if ( 0 == n ) {
    return 0 ;
  }
  int min = num [ 0 ] ;
  if ( n % min == 0 ) {
    return n / min ;
  }
  else {
    for ( int number : num ) {
      if ( n >= number ) {
        int next = dp ( n - number , num ) ;
        if ( next >= 0 ) {
          return next + 1 ;
        }
      }
    }
  }
  return - 1 ;
}

private static int dp ( int n , int [ ] num ) { if ( 0 == n ) { return 0 ; } int min = num [ 0 ] ; if ( n % min == 0 ) { return n / min ; } else { for ( int number : num ) { if ( n >= number ) { int next = dp ( n - number , num ) ; if ( next >= 0 ) { return next + 1 ; } } } } return - 1 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier))) consequence: (block (return_statement (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (return_statement (binary_expression left: (identifier) right: (identifier)))) alternative: (block (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (binary_expression left: (identifier) right: (decimal_integer_literal))))))))))) (return_statement (unary_expression operand: (decimal_integer_literal)))))