'' Find the first element arr[j] such that  (arr[j] - arr[i]) >= K  This is because after this element, all the elements will have absolute difference  with arr[i] >= k and the count of  valid pairs will be (n - j)
INDENT while ( j < n and ( arr [ j ] - arr [ i ] ) < k ) : NEW_LINE j += 1 ; NEW_LINE DEDENT