Company: Amazon_7nov

Difficulty: medium

Problem Statement

Safe Devices Problem Description You have a set of electronic devices, represented by an integer array A of length X . Each element of A corresponds to a device, and the value of each element represents the power consumption of that device (D 1 , D 2 , D 3 , and so on, up to D X ). The objective is to group these devices such that the difference in power consumption between any two devices in the same group is at least Y . If the difference is less than Y , the devices will interfere with each other and cannot be placed in the same group. Your task is to find and return an integer value representing the maximum number of devices that can be grouped together without causing interference due to their power consumption differences. Note: There may be multiple groups formed, and the maximum number of devices in any group should be considered. Input Specification An integer value X , representing the total number of devices. An integer value Y , representing the minimum difference between t

More Amazon_7nov OA questionsInterview experiences