public static int get_money ( int num , LinkedList list [ ] ) {
  if ( list [ num ] . size ( ) == 0 ) {
    return 1 ;
  }
  else {
    int min = Integer . MAX_VALUE ;
    int max = 0 ;
    for ( int i = 0 ;
    i < list [ num ] . size ( ) ;
    i ++ ) {
      int n = get_money ( list [ num ] . get ( i ) , list ) ;
      min = Math . min ( min , n ) ;
      max = Math . max ( max , n ) ;
    }
    return min + max + 1 ;
  }
}

public static int get_money ( int num , LinkedList list [ ] ) { if ( list [ num ] . size ( ) == 0 ) { return 1 ; } else { int min = Integer . MAX_VALUE ; int max = 0 ; for ( int i = 0 ; i < list [ num ] . size ( ) ; i ++ ) { int n = get_money ( list [ num ] . get ( i ) , list ) ; min = Math . min ( min , n ) ; max = Math . max ( max , n ) ; } return min + max + 1 ; } }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (identifier))) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))) (return_statement (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))))