static String isKSortedArray ( int arr [ ] , int n , int k ) {
  int aux [ ] = new int [ n ] ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) aux [ i ] = arr [ i ] ;
  Arrays . sort ( aux ) ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    int j = Arrays . binarySearch ( aux , arr [ i ] ) ;
    if ( Math . abs ( i - j ) > k ) return "No" ;
  }
  return "Yes" ;
}

static String isKSortedArray ( int arr [ ] , int n , int k ) { int aux [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) aux [ i ] = arr [ i ] ; Arrays . sort ( aux ) ; for ( int i = 0 ; i < n ; i ++ ) { int j = Arrays . binarySearch ( aux , arr [ i ] ) ; if ( Math . abs ( i - j ) > k ) return " No " ; } return " Yes " ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))) right: (identifier))) consequence: (return_statement (string_literal))))) (return_statement (string_literal))))