Leetcode 2006. Count Number of Pairs With Absolute Difference K
Count the number of index pairs (i < j) in an integer array whose absolute difference equals k. With n ≤ 200 and values in [1,100], the problem reduces to counting matching value pairs (easily done using a frequency table or by sorting).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.