title: Find The Minimum Distance Between Two Numbers
signature: function find_the_minimum_distance_between_two_numbers(arr, n, x, y)
source_py: def find_the_minimum_distance_between_two_numbers(arr, n, x, y):
      min_dist = 99999999
      for i in range(n):
          for j in range((i + 1), n):
              if ((((x == arr[i]) and (y == arr[j])) or ((y == arr[i]) and (x == arr[j]))) and (min_dist > abs((i - j)))):
                  min_dist = abs((i - j))
          return min_dist
source_cpp: int find_the_minimum_distance_between_two_numbers(vector<int> arr, int n, int x, int y) {
    int i, j;
    int min_dist = INT_MAX;
    for ( i = 0;
    i < n;
    i ++ ) {
      for ( j = i + 1;
      j < n;
      j ++ ) {
        if ( ( x == arr [ i ] && y == arr [ j ] || y == arr [ i ] && x == arr [ j ] ) && min_dist > abs ( i - j ) ) {
          min_dist = abs ( i - j );
        }
      }
    }
    return min_dist;
  }
question_info.entry_fn_name: find_the_minimum_distance_between_two_numbers
question_info.entry_cls_name: Solution
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
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, x, y, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(arr, n, x, y) 
      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, 7, 7, 8, 11, 14, 16, 25, 34, 35, 36, 36, 38, 40, 41, 43, 45, 47, 57, 60, 64, 72, 73, 74, 75, 82, 83, 83, 84, 84, 84, 92}, 22, 7, 40, 99999999)
      print(string.format("TEST-0...%s",result))
  
      result = driver({96, 70, 88, -64, -42, 58, 92, 66, -14, 90, -66, 12, 88, -12, 48, -4, 90, 24, 98, 14, 32, 38, 98, 78, 2, 26, 12, -36, 90, 80, 40, 58, 88, 64, 16}, 25, 58, 70, 99999999)
      print(string.format("TEST-1...%s",result))
  
      result = driver({0, 0, 1}, 1, 1, 1, 99999999)
      print(string.format("TEST-2...%s",result))
  
      result = driver({46, 96, 82, 73, 30, 36, 56, 20, 5, 36, 4, 7, 89, 63, 54, 97, 80, 56, 93, 34, 90, 56, 25, 27, 75, 68, 14, 90}, 26, 54, 82, 99999999)
      print(string.format("TEST-3...%s",result))
  
      result = driver({-96, -88, -82, -66, -62, -52, -52, -46, -46, -40, -40, -28, -24, -12, 0, 4, 10, 24, 42, 46, 48, 48, 50, 60, 62, 64, 64, 70, 92, 98}, 24, 0, 4, 99999999)
      print(string.format("TEST-4...%s",result))
  
      result = driver({0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1}, 10, 0, 1, 2)
      print(string.format("TEST-5...%s",result))
  
      result = driver({1, 2, 2, 6, 10, 14, 15, 18, 19, 22, 23, 29, 30, 37, 40, 40, 41, 41, 42, 42, 44, 46, 46, 54, 56, 72, 73, 81, 83, 83, 86, 88, 93}, 27, 1, 42, 18)
      print(string.format("TEST-6...%s",result))
  
      result = driver({46, 86, -52, 18, -32, 86, 2, 38, 72, 72, -60, 70, -58, 66, -66, -72, -74, 58, 52, 58, 16, 64, 62, -62, 80, -70, -96, -44, -20, -74, -10, 14, -32, 48, 30, 76, -16, 80, 66, -46, -92, 26, -86, 28, -76, -24, -98, 54, 50}, 30, 25, 45, 99999999)
      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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 38, 0, 0, 1)
      print(string.format("TEST-8...%s",result))
  
      result = driver({32, 65, 10, 72, 17, 58, 79, 28, 67, 36, 18, 35}, 7, 10, 7, 99999999)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.test_list: [{"idx": 0, "outputs": 99999999, "inputs": {"arr": [4, 7, 7, 8, 11, 14, 16, 25, 34, 35, 36, 36, 38, 40, 41, 43, 45, 47, 57, 60, 64, 72, 73, 74, 75, 82, 83, 83, 84, 84, 84, 92], "n": 22, "x": 7, "y": 40}}, {"idx": 1, "outputs": 99999999, "inputs": {"arr": [96, 70, 88, -64, -42, 58, 92, 66, -14, 90, -66, 12, 88, -12, 48, -4, 90, 24, 98, 14, 32, 38, 98, 78, 2, 26, 12, -36, 90, 80, 40, 58, 88, 64, 16], "n": 25, "x": 58, "y": 70}}, {"idx": 2, "outputs": 99999999, "inputs": {"arr": [0, 0, 1], "n": 1, "x": 1, "y": 1}}, {"idx": 3, "outputs": 99999999, "inputs": {"arr": [46, 96, 82, 73, 30, 36, 56, 20, 5, 36, 4, 7, 89, 63, 54, 97, 80, 56, 93, 34, 90, 56, 25, 27, 75, 68, 14, 90], "n": 26, "x": 54, "y": 82}}, {"idx": 4, "outputs": 99999999, "inputs": {"arr": [-96, -88, -82, -66, -62, -52, -52, -46, -46, -40, -40, -28, -24, -12, 0, 4, 10, 24, 42, 46, 48, 48, 50, 60, 62, 64, 64, 70, 92, 98], "n": 24, "x": 0, "y": 4}}, {"idx": 5, "outputs": 2, "inputs": {"arr": [0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1], "n": 10, "x": 0, "y": 1}}, {"idx": 6, "outputs": 18, "inputs": {"arr": [1, 2, 2, 6, 10, 14, 15, 18, 19, 22, 23, 29, 30, 37, 40, 40, 41, 41, 42, 42, 44, 46, 46, 54, 56, 72, 73, 81, 83, 83, 86, 88, 93], "n": 27, "x": 1, "y": 42}}, {"idx": 7, "outputs": 99999999, "inputs": {"arr": [46, 86, -52, 18, -32, 86, 2, 38, 72, 72, -60, 70, -58, 66, -66, -72, -74, 58, 52, 58, 16, 64, 62, -62, 80, -70, -96, -44, -20, -74, -10, 14, -32, 48, 30, 76, -16, 80, 66, -46, -92, 26, -86, 28, -76, -24, -98, 54, 50], "n": 30, "x": 25, "y": 45}}, {"idx": 8, "outputs": 1, "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, 1, 1, 1, 1, 1, 1, 1], "n": 38, "x": 0, "y": 0}}, {"idx": 9, "outputs": 99999999, "inputs": {"arr": [32, 65, 10, 72, 17, 58, 79, 28, 67, 36, 18, 35], "n": 7, "x": 10, "y": 7}}]