Consider an array with distinct integers in it.

Example : { 1 , 5 , 4 ,8 , 9 } , Say , x = 4

Then , the output will be 3 { (9-5) , (5-1) and (8-4) }.

Find number of pairs (i,j) , such that j>i and a[j]-a[i] = x .

Write answer in two sets :-

1)Explanation.

2)Code.