The developers at Amazon are working on optimising the capacity of their cloud system.
In the system, there are n servers where the memory capacity of the i-th server is represented by the array memory[i].
A system always contains an even number 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 ≥ memory capacity of P.
The system's memory capacity is the sum of the memory capacity of all the primary servers.
memory = [1, 2, 1, 2] return = 3
Unlock the full problem
- Full problem statement and constraints
- 2 more worked examples, explained
- Guided hints and editorial
- Run your code on real test cases
Pro subscription, billed yearly — or $19 month-to-month. Cancel anytime.
Unlock the full problem
- Full problem statement and constraints
- 2 more worked examples, explained
- Guided hints and editorial
- Run your code on real test cases
Pro subscription, billed yearly — or $19 month-to-month. Cancel anytime.