title: Minimum Xor Value Pair
signature: function minimum_xor_value_pair(arr, n)
test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(arr, n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(arr, n) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      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)
      print(string.format("TEST-0...%s",result))
  
      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)
      print(string.format("TEST-1...%s",result))
  
      result = driver({0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}, 9, 0)
      print(string.format("TEST-2...%s",result))
  
      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)
      print(string.format("TEST-3...%s",result))
  
      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)
      print(string.format("TEST-4...%s",result))
  
      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)
      print(string.format("TEST-5...%s",result))
  
      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)
      print(string.format("TEST-6...%s",result))
  
      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)
      print(string.format("TEST-7...%s",result))
  
      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)
      print(string.format("TEST-8...%s",result))
  
      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)
      print(string.format("TEST-9...%s",result))
  
  end
  
  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;
  }