Search
⌘K

Leetcode 532. K-diff Pairs in an Array

Count the number of unique unordered pairs (x, y) from the array whose absolute difference is k. Handle k>0 by checking distinct values x for which x+k exists, while k=0 requires counting values that appear at least twice.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.