class Solution {
public int findTheDistanceValue(int[] arr1, int[] arr2, int d) {
int result = arr1.length;
for(int i : arr1){
for(int j : arr2){
if(Math.abs(i - j) <= d){
--result;
break;
}
}
}
return result;
}
}
1385.两个数组间的距离值
本文介绍了一个计算两个整数数组间特定距离值的方法。通过遍历两个数组并利用绝对值比较来确定是否满足条件,从而计算出符合条件的元素数量。

被折叠的 条评论
为什么被折叠?



