Company: Amazon_14oct
Difficulty: medium
Code Question 1 Problem Description Engineers at a cloud infrastructure company are working to optimise how much capacity their server fleet can offer. The system has n servers, and the memory capacity of the ith server is given by the array memory[i] . The fleet always has an even number of servers. Given 2x servers, x of them serve as primary and the remaining x as backup. Every primary server P must be paired with a backup server B whose memory capacity is at least that of P. The fleet's overall memory capacity is the sum of the memory capacities of all primary servers. Given n servers and the array memory, determine the largest fleet memory capacity achievable using these n servers. Examples Consider the following conceptual examples for selecting primary and backup servers: Primary Servers Options Backup Servers Options Conditions Valid Option serverA, serverB serverC, serverD memory[serverA] ≤ memory[serverC] memory[serverB] ≤ memory[serverD] No serverA, serverD serverB, serverE