title: Find The Minimum Distance Between Two Numbers
signature: find_the_minimum_distance_between_two_numbers <- function(arr, n, x, y) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, x, y, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n, x, y), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(4L, 7L, 7L, 8L, 11L, 14L, 16L, 25L, 34L, 35L, 36L, 36L, 38L, 40L, 41L, 43L, 45L, 47L, 57L, 60L, 64L, 72L, 73L, 74L, 75L, 82L, 83L, 83L, 84L, 84L, 84L, 92L), 22L, 7L, 40L, 
          99999999L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(96L, 70L, 88L, -64L, -42L, 58L, 92L, 66L, -14L, 90L, -66L, 12L, 88L, -12L, 48L, -4L, 90L, 24L, 98L, 14L, 32L, 38L, 98L, 78L, 2L, 26L, 12L, -36L, 90L, 80L, 40L, 58L, 88L, 64L, 16L), 25L, 58L, 70L, 
          99999999L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 1L), 1L, 1L, 1L, 
          99999999L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(46L, 96L, 82L, 73L, 30L, 36L, 56L, 20L, 5L, 36L, 4L, 7L, 89L, 63L, 54L, 97L, 80L, 56L, 93L, 34L, 90L, 56L, 25L, 27L, 75L, 68L, 14L, 90L), 26L, 54L, 82L, 
          99999999L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-96L, -88L, -82L, -66L, -62L, -52L, -52L, -46L, -46L, -40L, -40L, -28L, -24L, -12L, 0L, 4L, 10L, 24L, 42L, 46L, 48L, 48L, 50L, 60L, 62L, 64L, 64L, 70L, 92L, 98L), 24L, 0L, 4L, 
          99999999L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 1L), 10L, 0L, 1L, 
          2L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(1L, 2L, 2L, 6L, 10L, 14L, 15L, 18L, 19L, 22L, 23L, 29L, 30L, 37L, 40L, 40L, 41L, 41L, 42L, 42L, 44L, 46L, 46L, 54L, 56L, 72L, 73L, 81L, 83L, 83L, 86L, 88L, 93L), 27L, 1L, 42L, 
          18L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(46L, 86L, -52L, 18L, -32L, 86L, 2L, 38L, 72L, 72L, -60L, 70L, -58L, 66L, -66L, -72L, -74L, 58L, 52L, 58L, 16L, 64L, 62L, -62L, 80L, -70L, -96L, -44L, -20L, -74L, -10L, 14L, -32L, 48L, 30L, 76L, -16L, 80L, 66L, -46L, -92L, 26L, -86L, 28L, -76L, -24L, -98L, 54L, 50L), 30L, 25L, 45L, 
          99999999L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 38L, 0L, 0L, 
          1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(32L, 65L, 10L, 72L, 17L, 58L, 79L, 28L, 67L, 36L, 18L, 35L), 7L, 10L, 7L, 
          99999999L
      )))
  
  }
  
  main()
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;
  }