title: Minimum Xor Value Pair
signature: int minimumXorValuePair(vector<int> arr, int n) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual == expected;
  }
  
  string driver(vector<int> arr, int n, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(arr, n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver({4, 5, 7, 10, 10, 11, 14, 19, 21, 24, 27, 27, 27, 28, 28, 28, 33, 34, 41, 42, 43, 48, 52, 53, 53, 59, 62, 64, 66, 71, 77, 78, 78, 79, 80, 82, 90, 97, 99, 99}, 34, 0); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver({-96, -94, -94, -84, -70, -68, -66, -64, -58, -28, -22, -16, -14, -10, -2, 0, 8, 28, 36, 42, 50, 52, 56, 56, 56, 66, 74, 80, 80, 88, 90, 90, 90, 94}, 17, -96); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver({0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}, 9, 0); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver({10, 11, 17, 23, 25, 31, 39, 42, 45, 48, 57, 60, 63, 65, 73, 73, 75, 83, 94, 96, 97, 97}, 21, 0); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver({-92, -92, -90, -88, -84, -82, -66, -64, -64, -62, -44, -42, -40, -28, -22, -12, -4, -2, 0, 4, 16, 22, 28, 34, 54, 60, 72, 74, 78, 86, 94}, 18, 0); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 36, 0); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver({2, 2, 6, 13, 16, 16, 17, 19, 19, 20, 22, 25, 27, 29, 34, 34, 34, 36, 38, 39, 42, 49, 49, 53, 59, 59, 71, 77, 79, 82, 83, 83, 84, 84, 86, 86, 87, 88, 93, 96}, 36, 0); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver({-96, -94, -92, -82, -54, -50, -48, -46, -46, -28, -28, -28, -20, -14, -14, 6, 12, 14, 20, 22, 24, 36, 36, 44, 46, 70, 74, 82, 92, 96, 96}, 20, -96); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 39, 0); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver({4, 5, 11, 12, 12, 13, 17, 18, 19, 22, 23, 23, 23, 27, 32, 33, 34, 38, 42, 48, 48, 50, 51, 54, 60, 62, 64, 69, 70, 70, 75, 76, 77, 78, 79, 82, 93, 94, 96, 99}, 30, 0); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
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;
  }