title: Count Pairs Difference Equal K 1
signature: function countPairsDifferenceEqualK1($arr, $n, $k) {
source_py: def count_pairs_difference_equal_k_1(arr, n, k):
      count = 0
      arr.sort()
      l = 0
      r = 0
      while (r < n):
          if ((arr[r] - arr[l]) == k):
              count += 1
              l += 1
              r += 1
          elif ((arr[r] - arr[l]) > k):
              l += 1
          else:
              r += 1
      return count
source_cpp: int count_pairs_difference_equal_k_1(vector<int> arr, int n, int k) {
    int count = 0;
    sort(arr.begin(), arr.end());
    int l = 0;
    int r = 0;
    while ( r < n ) {
      if ( arr [ r ] - arr [ l ] == k ) {
        count ++;
        l ++;
        r ++;
      }
      else if ( arr [ r ] - arr [ l ] > k ) l ++;
      else r ++;
    }
    return count;
  }