Company: Barclays
Difficulty: medium
Find the Total Number of Lucky Customers The manager of a supermarket wishes to hold an event at which he will distribute gift baskets to lucky customers. Each gift basket contains a pair of products. Each basket contains different product pairs, but the overall value of the baskets may be the same. There are N types of products and each product has a price. The gift baskets will be awarded to the customers that pick a product pair that has a difference in price equal to the given integer value K . Write an algorithm to help the Manager find the total number of lucky customers who will win a gift basket. Input Format The first line of the input consists of an integer list_input_size , representing the types of products ( N ). The second line consists of N space-separated integers - list_input[0], list_input[1], ..., list_input[N-1] , representing the price of the products. The last line consists of an integer K_input , representing the given value K . Output Format Print an integer rep