title: Minimum Xor Value Pair 1
signature: minimum_xor_value_pair_1 <- 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(8L, 11L, 12L, 27L, 32L, 32L, 36L, 56L, 57L, 66L, 68L, 70L, 74L, 78L, 82L, 83L, 96L), 10L, 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-60L, -8L, 4L, 38L, 40L, 42L, 48L, 66L), 7L, 
          -4L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(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), 19L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(2L, 3L, 4L, 6L, 7L, 7L, 10L, 11L, 12L, 15L, 16L, 20L, 24L, 28L, 29L, 32L, 36L, 37L, 38L, 44L, 48L, 49L, 50L, 52L, 57L, 57L, 57L, 61L, 63L, 64L, 65L, 66L, 67L, 68L, 70L, 76L, 78L, 81L, 82L, 86L, 87L, 89L, 91L, 95L, 95L, 98L), 36L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-88L, -84L, -76L, -58L, -40L, -38L, -28L, -24L, -20L, -14L, -12L, 16L, 20L, 28L, 28L, 30L, 40L, 44L, 56L, 58L, 60L, 92L, 92L), 13L, 
          -28L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 20L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(6L, 6L, 19L, 31L, 41L, 45L, 49L, 56L, 78L, 96L, 98L), 6L, 
          0L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-90L, -84L, -4L, 22L, 62L), 3L, 
          10L
      )))
  
      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, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 21L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(7L, 10L, 13L, 20L, 28L, 29L, 34L, 37L, 39L, 42L, 43L, 56L, 58L, 65L, 69L, 72L, 74L, 83L, 91L, 92L, 93L, 99L), 14L, 
          1L
      )))
  
  }
  
  main()
source_py: def minimum_xor_value_pair_1(arr, n):
      arr.sort()
      minXor = int(sys.float_info.max)
      val = 0
      for i in range(0, (n - 1)):
          val = (arr[i] ^ arr[(i + 1)])
          minXor = min(minXor, val)
      return minXor
source_cpp: int minimum_xor_value_pair_1(vector<int> arr, int n) {
    sort(arr.begin(), arr.end());
    int minXor = INT_MAX;
    int val = 0;
    for ( int i = 0;
    i < n - 1;
    i ++ ) {
      val = arr [ i ] ^ arr [ i + 1 ];
      minXor = min ( minXor, val );
    }
    return minXor;
  }