title: Minimum Xor Value Pair 1
signature: function minimum_xor_value_pair_1(arr, n)
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;
  }
question_info.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({8, 11, 12, 27, 32, 32, 36, 56, 57, 66, 68, 70, 74, 78, 82, 83, 96}, 10, 0)
      print(string.format("TEST-0...%s",result))
  
      result = driver({-60, -8, 4, 38, 40, 42, 48, 66}, 7, -4)
      print(string.format("TEST-1...%s",result))
  
      result = driver({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)
      print(string.format("TEST-2...%s",result))
  
      result = driver({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)
      print(string.format("TEST-3...%s",result))
  
      result = driver({-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)
      print(string.format("TEST-4...%s",result))
  
      result = driver({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)
      print(string.format("TEST-5...%s",result))
  
      result = driver({6, 6, 19, 31, 41, 45, 49, 56, 78, 96, 98}, 6, 0)
      print(string.format("TEST-6...%s",result))
  
      result = driver({-90, -84, -4, 22, 62}, 3, 10)
      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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 21, 0)
      print(string.format("TEST-8...%s",result))
  
      result = driver({7, 10, 13, 20, 28, 29, 34, 37, 39, 42, 43, 56, 58, 65, 69, 72, 74, 83, 91, 92, 93, 99}, 14, 1)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 0, "inputs": {"arr": [8, 11, 12, 27, 32, 32, 36, 56, 57, 66, 68, 70, 74, 78, 82, 83, 96], "n": 10}}, {"idx": 1, "outputs": -4, "inputs": {"arr": [-60, -8, 4, 38, 40, 42, 48, 66], "n": 7}}, {"idx": 2, "outputs": 0, "inputs": {"arr": [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], "n": 19}}, {"idx": 3, "outputs": 0, "inputs": {"arr": [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], "n": 36}}, {"idx": 4, "outputs": -28, "inputs": {"arr": [-88, -84, -76, -58, -40, -38, -28, -24, -20, -14, -12, 16, 20, 28, 28, 30, 40, 44, 56, 58, 60, 92, 92], "n": 13}}, {"idx": 5, "outputs": 0, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 20}}, {"idx": 6, "outputs": 0, "inputs": {"arr": [6, 6, 19, 31, 41, 45, 49, 56, 78, 96, 98], "n": 6}}, {"idx": 7, "outputs": 10, "inputs": {"arr": [-90, -84, -4, 22, 62], "n": 3}}, {"idx": 8, "outputs": 0, "inputs": {"arr": [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], "n": 21}}, {"idx": 9, "outputs": 1, "inputs": {"arr": [7, 10, 13, 20, 28, 29, 34, 37, 39, 42, 43, 56, 58, 65, 69, 72, 74, 83, 91, 92, 93, 99], "n": 14}}]
question_info.extension: lua
question_info.entry_fn_name: minimum_xor_value_pair_1
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: lua __FILENAME__