title: Find Minimum Difference Pair 1
signature: fun findMinimumDifferencePair1(arr: ArrayList<Int>, n: Int): Int {
test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(arr: ArrayList<Int>, n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(arr, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(3, 25, 44, 46, 54, 60, 81), 3, 19)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(82, 68, -98, -66, -36, -42, 98, -38, 58, -6, -28, 70, -24, 18, 16, 10, 92, 44, 28, -96, -72, 24, 28, -80, -4, 38, 88, 76), 22, 0)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(1, 1, 1), 2, 0)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(87, 25, 80, 45, 44, 20, 48, 47, 51, 54, 68, 47, 89, 95, 15, 29, 5, 45, 2, 64, 53, 96, 94, 22, 23, 43, 61, 75, 74, 50), 15, 0)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-74, -48, -42, -26, -16, -12, 0, 4, 8, 18, 46, 46, 62, 70, 74, 88, 92, 96, 98), 18, 0)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0), 36, 0)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(27, 42, 59, 80), 2, 15)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(-96, -94, 10, -36, 18, -40), 4, 2)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1), 12, 0)
      println("TEST-8...${result}")
      
          
  }
  
  main()
source_py: def find_minimum_difference_pair_1(arr, n):
      arr = sorted(arr)
      diff = (10 ** 20)
      for i in range((n - 1)):
          if ((arr[(i + 1)] - arr[i]) < diff):
              diff = (arr[(i + 1)] - arr[i])
      return diff
source_cpp: int find_minimum_difference_pair_1(vector<int> arr, int n) {
    sort(arr.begin(), arr.end());
    int diff = INT_MAX;
    for ( int i = 0;
    i < n - 1;
    i ++ ) if ( arr [ i + 1 ] - arr [ i ] < diff ) diff = arr [ i + 1 ] - arr [ i ];
    return diff;
  }