Skip to content

Commit 04f1f5a

Browse files
committed
iterate through each and check if difference is less than equal to d,increment
1 parent 2fd4532 commit 04f1f5a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

1385/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
impl Solution {
2+
pub fn find_the_distance_value(arr1: Vec<i32>, arr2: Vec<i32>, d: i32) -> i32 {
3+
let mut ans = 0;
4+
for item in arr1 {
5+
if !arr2.iter().any(|curr| (curr -item).abs() <= d) {
6+
ans+=1;
7+
}
8+
}
9+
ans
10+
11+
}
12+
}

0 commit comments

Comments
 (0)