Hacker Rank: Pairs
刚注册上 Hacker Rank ,出现了一条练手的题目,竟然不是著名的 Hello World ,而是这题 Pairs 。 连接 题目是这样的 Given N integers [N<=10^5], count the total pairs of integers that have a difference of K. [K>0 and K<1e9]. Each of the N integers will be greater than 0 and at least K away from 2^31-1 (Everything can be done with 32 bit integers). Input Format 1st line contains N & K (integers). 2nd line contains N numbers of the set. All the N numbers are assured to be distinct. ...