title: Minimum Xor Value Pair 1
signature: pub fn minimum_xor_value_pair_1(arr: Vec<i32>, n: i32) -> i32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(arr: Vec<i32>, n: i32, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        Vec::from([8, 11, 12, 27, 32, 32, 36, 56, 57, 66, 68, 70, 74, 78, 82, 83, 96]), 10, 
        0
      ));
      
      println!("TEST-1...{}", driver(
        Vec::from([-60, -8, 4, 38, 40, 42, 48, 66]), 7, 
        -4
      ));
      
      println!("TEST-2...{}", driver(
        Vec::from([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]), 19, 
        0
      ));
      
      println!("TEST-3...{}", driver(
        Vec::from([2, 3, 4, 6, 7, 7, 10, 11, 12, 15, 16, 20, 24, 28, 29, 32, 36, 37, 38, 44, 48, 49, 50, 52, 57, 57, 57, 61, 63, 64, 65, 66, 67, 68, 70, 76, 78, 81, 82, 86, 87, 89, 91, 95, 95, 98]), 36, 
        0
      ));
      
      println!("TEST-4...{}", driver(
        Vec::from([-88, -84, -76, -58, -40, -38, -28, -24, -20, -14, -12, 16, 20, 28, 28, 30, 40, 44, 56, 58, 60, 92, 92]), 13, 
        -28
      ));
      
      println!("TEST-5...{}", driver(
        Vec::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 20, 
        0
      ));
      
      println!("TEST-6...{}", driver(
        Vec::from([6, 6, 19, 31, 41, 45, 49, 56, 78, 96, 98]), 6, 
        0
      ));
      
      println!("TEST-7...{}", driver(
        Vec::from([-90, -84, -4, 22, 62]), 3, 
        10
      ));
      
      println!("TEST-8...{}", driver(
        Vec::from([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]), 21, 
        0
      ));
      
      println!("TEST-9...{}", driver(
        Vec::from([7, 10, 13, 20, 28, 29, 34, 37, 39, 42, 43, 56, 58, 65, 69, 72, 74, 83, 91, 92, 93, 99]), 14, 
        1
      ));
      
  }
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;
  }