LeetCode Weekly Contest 22 | 小小小宇
K-diff Pairs in an Array
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. 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.
Example 1:
|
|
Example 2:
|
|
Example 3:
|
|
Note:
- The pairs (i, j) and (j, i) count as the same pair.
- The length of the array won't exceed 10,000.
- All the integers in the given input belong to the range: [-1e7, 1e7].
Read full article from LeetCode Weekly Contest 22 | 小小小宇
No comments:
Post a Comment