-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindDistanceValue.java
More file actions
38 lines (36 loc) · 1.05 KB
/
FindDistanceValue.java
File metadata and controls
38 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<<<<<<< HEAD
//1385. Find the Distance Value Between Two Arrays
class Solution {
public int findTheDistanceValue(int[] arr1, int[] arr2, int d) {
int count = 0;
for(int i=0;i<arr1.length;i++){
boolean isValid = true;
for(int j=0;j<arr2.length;j++){
if(Math.abs(arr1[i] - arr2[j]) <= d){
isValid = false;
break;
}
}
if(isValid) count++;
}
return count;
}
=======
//1385. Find the Distance Value Between Two Arrays
class Solution {
public int findTheDistanceValue(int[] arr1, int[] arr2, int d) {
int count = 0;
for(int i=0;i<arr1.length;i++){
boolean isValid = true;
for(int j=0;j<arr2.length;j++){
if(Math.abs(arr1[i] - arr2[j]) <= d){
isValid = false;
break;
}
}
if(isValid) count++;
}
return count;
}
>>>>>>> be6ce0b427078b1421d5dd74adb2300dc02daeec
}