Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0e1a67

Browse files
refactor 1385
1 parentf0d78f1 commitc0e1a67

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

‎src/main/java/com/fishercoder/solutions/_1385.java

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,5 @@
11
packagecom.fishercoder.solutions;
22

3-
/**
4-
* 1385. Find the Distance Value Between Two Arrays
5-
*
6-
* Given two integer arrays arr1 and arr2, and the integer d, return the distance value between the two arrays.
7-
* The distance value is defined as the number of elements arr1[i] such that there is not any element arr2[j] where |arr1[i]-arr2[j]| <= d.
8-
*
9-
* Example 1:
10-
* Input: arr1 = [4,5,8], arr2 = [10,9,1,8], d = 2
11-
* Output: 2
12-
* Explanation:
13-
* For arr1[0]=4 we have:
14-
* |4-10|=6 > d=2
15-
* |4-9|=5 > d=2
16-
* |4-1|=3 > d=2
17-
* |4-8|=4 > d=2
18-
* For arr1[1]=5 we have:
19-
* |5-10|=5 > d=2
20-
* |5-9|=4 > d=2
21-
* |5-1|=4 > d=2
22-
* |5-8|=3 > d=2
23-
* For arr1[2]=8 we have:
24-
* |8-10|=2 <= d=2
25-
* |8-9|=1 <= d=2
26-
* |8-1|=7 > d=2
27-
* |8-8|=0 <= d=2
28-
*
29-
* Example 2:
30-
* Input: arr1 = [1,4,2,3], arr2 = [-4,-3,6,10,20,30], d = 3
31-
* Output: 2
32-
*
33-
* Example 3:
34-
* Input: arr1 = [2,1,100,3], arr2 = [-5,-2,10,-3,7], d = 6
35-
* Output: 1
36-
*
37-
* Constraints:
38-
* 1 <= arr1.length, arr2.length <= 500
39-
* -10^3 <= arr1[i], arr2[j] <= 10^3
40-
* 0 <= d <= 100
41-
* */
423
publicclass_1385 {
434
publicstaticclassSolution1 {
445
publicintfindTheDistanceValue(int[]arr1,int[]arr2,intd) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp