← Questions

Pair servers as primary and backup to maximize memory

0
AmazonCodingLast asked Jan 2026

Each server has a memory size. Choose servers and group them into pairs, each pair a primary and a backup, where the backup must be able to take over for its primary (its memory is at least the primary's). The system's capacity is the total memory of the primaries. Return the largest capacity you can reach.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding