Company: Agoda
Difficulty: medium
Project Estimates A number of bids are received for a project. Determine the number of distinct pairs of project costs where their absolute difference is some target value. Two pairs are distinct if they differ in at least one value. Function Description Complete the function countPairs in the editor below. countPairs has the following parameter(s): int projectCosts[n] : array of integers int target : the target difference Return int : the number of distinct pairs in projectCosts with an absolute difference of target Constraints 5 ≤ n ≤ 10 5 0 9 Each projectCosts[i] is distinct, i.e. unique within projectCosts 1 ≤ target ≤ 10 9 Input Format Input from stdin will be processed as follows and passed to the function: The first line contains an integer n, the size of the array projectCosts The next n lines each contain an element projectCosts[i] where 0 ≤ i The next line contains the integer target, the target difference Sample Cases Sample Case 0 5 1 5 3 4 2 2 3 Count the number of pairs i