Goldman Sachs logoGoldman Sachs
Coding·60 minMembers

Count Unique Pairs With Difference K

Members only

Count the number of unique pairs `(a, b)` in an integer array such that `b - a = k`. The variant where `k` may be zero is a common trip-up.

SWE
hashmap
set
array
easy
Frequency
Single report
Last asked
2024-10-26
Stage
oa

Log in to continue reading the full content

Comments

Sign in to join the discussion
Loading...