Input: N = 4, A[] = {60, 45, 80, 60}, M = 3, B[] = {30, 60, 75}, K= 5
Output: 2
Explanation :
B[0] (= 30): Not present in any of the ranges [A[i] + K, A[i] - K].
B[1] (= 60): B[1] lies in the range [A[0] - K, A[0] + K], i.e. [55, 65].
B[2] (= 75): B[2] lies in the range [A[2] - K, A[2] + K], i.e. [75, 85].
Input: N = 3 A[] = {10, 20, 30}, M = 3, B[] = {5, 10, 15}, K = 10
Output: 2
Below is the implementation of the above approach.