题目链接:https://leetcode-cn.com/problems/find-the-distance-value-between-two-arrays/
题目如下:
class Solution {
public:
int findTheDistanceValue(vector<int>& arr1, vector<int>& arr2, int d) {
int res=0;
for(auto e1:arr1){
int cnt=0;
for(auto e2:arr2){
if(abs(e1-e2)>d) cnt++;
}
if(cnt==arr2.size()) res++;
}
return res;
}
};