Company: Amazon_7nov
Difficulty: medium
Safe Devices A rack holds X electronic devices. Device i draws A[i] units of power. Devices are put into groups. Two devices may share a group only when their power draws differ by at least Y ; anything closer than that makes them interfere, so they must go into different groups. Several groups may be formed. Report the number of devices in the largest group that can be built this way. Implement safeDevices(X, Y, A) ; it returns that largest group size. Input Format The first line holds two integers X and Y : the number of devices and the smallest difference two devices in one group may have. The second line holds X integers, A[0] to A[X - 1] , the power draw of each device. Output Format Print one integer, the size of the largest group that can be formed. Constraints 1 <= X <= 2000 (inferred -- the source capture gives no bound; 2000 devices with values up to 1000000000 keep a single input inside the judge's 200,000 byte stdin limit) 0 <= Y <= 1000000000 0 <= A[i] <=