title: Find Minimum Difference Pair
signature: find_minimum_difference_pair <- function(arr, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(1L, 1L, 2L, 3L, 5L, 8L, 10L, 11L, 15L, 15L, 16L, 20L, 26L, 28L, 30L, 30L, 33L, 33L, 39L, 50L, 50L, 50L, 54L, 62L, 66L, 68L, 69L, 69L, 74L, 74L, 75L, 75L, 76L, 78L, 82L, 83L, 85L, 86L, 86L, 89L, 89L, 91L, 91L, 92L, 92L, 92L, 93L, 94L, 98L), 32L, 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(6L, 6L, -20L, 88L, -78L, -18L, 74L, 72L, 80L, 76L, -62L, 38L), 11L, 
          0L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 1L, 1L, 1L, 1L), 3L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(75L, 85L, 49L, 66L, 44L, 89L, 80L, 39L, 64L, 70L, 25L, 21L, 81L, 33L, 90L, 68L, 51L), 16L, 
          1L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-96L, -10L, 0L, 4L, 54L, 64L), 3L, 
          10L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 0L), 41L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(3L, 3L, 5L, 5L, 7L, 7L, 9L, 11L, 11L, 18L, 18L, 18L, 20L, 29L, 29L, 31L, 31L, 32L, 37L, 43L, 44L, 46L, 48L, 50L, 52L, 52L, 53L, 63L, 63L, 65L, 69L, 72L, 76L, 76L, 81L, 84L, 85L, 86L, 87L, 87L, 90L, 94L, 97L, 97L), 27L, 
          0L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(40L, -46L, 72L, -28L, 8L, 90L, 86L, -90L, 8L, -66L, -98L, 6L, 42L, 86L, 88L, 42L, -50L, 74L, -34L, -16L, -94L, -56L, -18L, -18L, 84L, -44L, 34L, 80L, 96L, 42L, -50L, -92L, 70L, 80L, 62L, -38L, -4L, 68L, 54L, -14L, 30L, -18L, -58L), 33L, 
          0L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(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), 26L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(15L, 41L, 32L, 19L, 68L, 36L, 61L, 59L, 5L, 91L, 53L, 95L, 10L, 64L, 15L, 32L, 14L, 64L, 48L, 70L, 85L, 19L, 83L, 2L, 33L, 58L, 93L, 88L, 21L, 88L, 45L, 45L, 18L, 8L), 24L, 
          0L
      )))
  
  }
  
  main()
source_py: def find_minimum_difference_pair(arr, n):
      diff = (10 ** 20)
      for i in range((n - 1)):
          for j in range((i + 1), n):
              if (abs((arr[i] - arr[j])) < diff):
                  diff = abs((arr[i] - arr[j]))
      return diff
source_cpp: int find_minimum_difference_pair(vector<int> arr, int n) {
    int diff = INT_MAX;
    for ( int i = 0;
    i < n - 1;
    i ++ ) for ( int j = i + 1;
    j < n;
    j ++ ) if ( abs ( arr [ i ] - arr [ j ] ) < diff ) diff = abs ( arr [ i ] - arr [ j ] );
    return diff;
  }