Company: Amazon_8oct
Difficulty: medium
Maximum System Memory Capacity Problem Description The developers at Amazon are working on optimizing the capacity of their cloud system. In the system, there are n servers in total. The memory capacity of the i th server is represented by the array memory[i] . A system always contains a primary and backup set of servers. If the system has 2x servers, then x of them will be primary and the other x will be backup servers. For each primary server P , there exists a backup server B where the memory capacity of B is greater than or equal to the memory capacity of P . The system memory capacity is the sum of the memory capacity of all the primary servers. Given n servers and an array memory , find the maximum system memory capacity that can be formed using the n servers. Function Description Complete the function maximumCapacity in the editor below. maximumCapacity has the following parameter: int memory[n] : the memory capacity of the given servers Returns long int : the maximum system mem