Find the Distance Value Between Two Arrays Problem
Find the Distance Value Between Two Arrays Problem — ExecCode Easy DSA Practice
Solve the Find the Distance Value Between Two Arrays problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given two integer arrays arr1 and arr2, and the integer d, return the distance value between the two arrays. Your task is to the distance value is defined as the number of elements arr1[i] such that there is not any element arr2[j] where |arr1[i]-arr2[j]| <= d. Return the required answer exactly as shown in the examples.
Examples
Input {"arr1": [4, 5, 8], "arr2": [10, 9, 1, 8], "d": 2}; Output 2. Input {"arr1": [1, 4, 2, 3], "arr2": [-4, -3, 6, 10, 20, 30], "d": 3}; Output 2
Constraints
1 <= arr1.length, arr2.length <= 500 -1000 <= arr1[i], arr2[j] <= 1000 0 <= d <= 100
Practice Find the Distance Value Between Two Arrays free on ExecCode. Browse DSA problems, topic map, and placement guides.