public static int [ ] solve ( int [ ] heights ) {
  int n = heights . length ;
  int min = Math . abs ( heights [ n - 1 ] - heights [ 0 ] ) ;
  int idx1 = 0 ;
  int idx2 = n - 1 ;
  for ( int i = 0 ;
  i < n - 1 ;
  i ++ ) {
    if ( Math . abs ( heights [ i ] - heights [ i + 1 ] ) < min ) {
      min = Math . abs ( heights [ i ] - heights [ i + 1 ] ) ;
      idx1 = i ;
      idx2 = i + 1 ;
    }
  }
  return new int [ ] {
    idx1 , idx2 };
  }
  
public static int [ ] solve ( int [ ] heights ) { int n = heights . length ; int min = Math . abs ( heights [ n - 1 ] - heights [ 0 ] ) ; int idx1 = 0 ; int idx2 = n - 1 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( Math . abs ( heights [ i ] - heights [ i + 1 ] ) < min ) { min = Math . abs ( heights [ i ] - heights [ i + 1 ] ) ; idx1 = i ; idx2 = i + 1 ; } } return new int [ ] { idx1 , idx2 } ; }
(method_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (decimal_integer_literal))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))))))) (return_statement (array_creation_expression type: (integral_type) dimensions: (dimensions) value: (array_initializer (identifier) (identifier))))))