Given a sorted array of integers (not necessarily distinct) A and an integer B,
find and return how many pair of integers ( A[i], A[j] ) such that i != j have sum equal to B.
Since the number of such pairs can be very large, return number of such pairs modulo (109+7).
The first argument given is the integer array A. The second argument given is integer B.
Return the number of pairs for which sum is equal to B modulo (10^9+7).
1 <= length of the array <= 100000 1 <= A[i] <= 10^9 1 <= B <= 10^9
Input 1: A = [1, 1, 1, 2, 3] B = 4 Output 1: 3 Input 2: A = [1, 2, 2, 3, 4] B = 5 Output 2: 3
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.