Find the Distance Value Between Two Arrays LeetCode solution in Java

1
class Solution {
2
public int findTheDistanceValue(int[] arr1, int[] arr2, int d) {
3
int x = 0, val = 0;
4
for (int i : arr1) {
5
for (int j : arr2) {
6
if (Math.abs(i - j) <= d) {
7
x--;
8
break;
9
}
10
}
11
x++;
12
}
13
return x;
14
}
15
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0