title: Find Minimum Difference Pair 1
signature: func findMinimumDifferencePair1(arr []int, n int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(arr []int, n int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(arr, n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver([]int{3, 25, 44, 46, 54, 60, 81}, 
  	3, 19)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver([]int{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)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver([]int{1, 1, 1}, 
  	2, 0)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver([]int{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)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver([]int{-74, -48, -42, -26, -16, -12, 0, 4, 8, 18, 46, 46, 62, 70, 74, 88, 92, 96, 98}, 
  	18, 0)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver([]int{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)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver([]int{27, 42, 59, 80}, 
  	2, 15)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver([]int{-96, -94, 10, -36, 18, -40}, 
  	4, 2)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver([]int{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 
  	12, 0)
      fmt.Printf("TEST-8...%s\n", result)
      
          
  }
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;
  }