Company: amazon_23april
Difficulty: medium
Code Question 1 A regional telecom operator is rolling out a line of sensor nodes and relay towers along a highway that can be treated as a single straight axis. Every sensor node must be paired with exactly one relay tower so that all pairings together use up the least possible amount of signal lag. The positions of the n sensor nodes and the n relay towers are given as two arrays. Any sensor node placed at center[i] can be paired with any relay tower placed at destination[j]; the lag contributed by connecting a node at position x to a tower at position y is |x - y|, the absolute difference between the two positions. Work out the smallest total lag achievable when every sensor node is paired with a distinct relay tower. Function Description Complete the function getMinDistance in the editor below. getMinDistance has the following parameter(s): int center[n] : the positions of the sensor nodes int destination[n] : the positions of the relay towers Returns long int : the smallest achiev