Skip to content

Commit 756a543

Browse files
refactor 532
1 parent 3ba2a7a commit 756a543

File tree

1 file changed

+0
-27
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-27
lines changed

src/main/java/com/fishercoder/solutions/_532.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,6 @@
33
import java.util.HashMap;
44
import java.util.Map;
55

6-
/**
7-
* 532. K-diff Pairs in an Array
8-
*
9-
* Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array.
10-
* Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numbers in the array and their absolute difference is k.
11-
12-
Example 1:
13-
Input: [3, 1, 4, 1, 5], k = 2
14-
Output: 2
15-
Explanation: There are two 2-diff pairs in the array, (1, 3) and (3, 5).
16-
Although we have two 1s in the input, we should only return the number of unique pairs.
17-
18-
Example 2:
19-
Input:[1, 2, 3, 4, 5], k = 1
20-
Output: 4
21-
Explanation: There are four 1-diff pairs in the array, (1, 2), (2, 3), (3, 4) and (4, 5).
22-
23-
Example 3:
24-
Input: [1, 3, 1, 5, 4], k = 0
25-
Output: 1
26-
Explanation: There is one 0-diff pair in the array, (1, 1).
27-
28-
Note:
29-
The pairs (i, j) and (j, i) count as the same pair.
30-
The length of the array won't exceed 10,000.
31-
All the integers in the given input belong to the range: [-1e7, 1e7].
32-
*/
336
public class _532 {
347

358
public static class Solution1 {

0 commit comments

Comments
 (0)