title: Minimum Xor Value Pair
signature: minimum_xor_value_pair <- function(arr, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(4L, 5L, 7L, 10L, 10L, 11L, 14L, 19L, 21L, 24L, 27L, 27L, 27L, 28L, 28L, 28L, 33L, 34L, 41L, 42L, 43L, 48L, 52L, 53L, 53L, 59L, 62L, 64L, 66L, 71L, 77L, 78L, 78L, 79L, 80L, 82L, 90L, 97L, 99L, 99L), 34L, 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-96L, -94L, -94L, -84L, -70L, -68L, -66L, -64L, -58L, -28L, -22L, -16L, -14L, -10L, -2L, 0L, 8L, 28L, 36L, 42L, 50L, 52L, 56L, 56L, 56L, 66L, 74L, 80L, 80L, 88L, 90L, 90L, 90L, 94L), 17L, 
          -96L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L), 9L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(10L, 11L, 17L, 23L, 25L, 31L, 39L, 42L, 45L, 48L, 57L, 60L, 63L, 65L, 73L, 73L, 75L, 83L, 94L, 96L, 97L, 97L), 21L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-92L, -92L, -90L, -88L, -84L, -82L, -66L, -64L, -64L, -62L, -44L, -42L, -40L, -28L, -22L, -12L, -4L, -2L, 0L, 4L, 16L, 22L, 28L, 34L, 54L, 60L, 72L, 74L, 78L, 86L, 94L), 18L, 
          0L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 36L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(2L, 2L, 6L, 13L, 16L, 16L, 17L, 19L, 19L, 20L, 22L, 25L, 27L, 29L, 34L, 34L, 34L, 36L, 38L, 39L, 42L, 49L, 49L, 53L, 59L, 59L, 71L, 77L, 79L, 82L, 83L, 83L, 84L, 84L, 86L, 86L, 87L, 88L, 93L, 96L), 36L, 
          0L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-96L, -94L, -92L, -82L, -54L, -50L, -48L, -46L, -46L, -28L, -28L, -28L, -20L, -14L, -14L, 6L, 12L, 14L, 20L, 22L, 24L, 36L, 36L, 44L, 46L, 70L, 74L, 82L, 92L, 96L, 96L), 20L, 
          -96L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 39L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(4L, 5L, 11L, 12L, 12L, 13L, 17L, 18L, 19L, 22L, 23L, 23L, 23L, 27L, 32L, 33L, 34L, 38L, 42L, 48L, 48L, 50L, 51L, 54L, 60L, 62L, 64L, 69L, 70L, 70L, 75L, 76L, 77L, 78L, 79L, 82L, 93L, 94L, 96L, 99L), 30L, 
          0L
      )))
  
  }
  
  main()
source_py: def minimum_xor_value_pair(arr, n):
      arr.sort()
      min_xor = 999999
      val = 0
      for i in range(0, (n - 1)):
          for j in range((i + 1), (n - 1)):
              val = (arr[i] ^ arr[j])
              min_xor = min(min_xor, val)
      return min_xor
source_cpp: int minimum_xor_value_pair(vector<int> arr, int n) {
    int min_xor = INT_MAX;
    for ( int i = 0;
    i < n;
    i ++ ) for ( int j = i + 1;
    j < n;
    j ++ ) min_xor = min ( min_xor, arr [ i ] ^ arr [ j ] );
    return min_xor;
  }