« first day (129 days earlier)      last day (3227 days later) » 

7:40 PM
A TopCoder problem
As of late, your usually high-performance computer has been acting rather sluggish. You come to realize that while you have plenty of free disk space on your machine, it is split up over many hard drives. You decide that the secret to improving performance is to consolidate all the data on your computer onto as few hard drives as possible.
Given a tuple (integer) used, representing the amount of disk space used on each drive, and a corresponding tuple (integer) total, representing the total capacity of each drive mentioned in used, you should attempt to pack the data onto as few hard drives
Sample
0)


{300,525,110}
{350,600,115}
Returns: 2
In this example, the computer contains three hard drives:
Hard drive 1: 350 MB total, 300 MB used, 50 MB free
Hard drive 2: 600 MB total, 525 MB used, 75 MB free
Hard drive 3: 115 MB total, 110 MB used, 5 MB free
One way to pack the data onto as few drives as possible is as follows. First, move 50 MB from hard drive 3 to hard drive 1, completely filling it up. Next, move the remaining 60 MB from hard drive 3 to hard drive 2. There are still two hard drives which contain data after this process, so your method should return 2.
Its such a common problem
which everybody would have tried to solve in one point of time or the other
But, can we solve it with a program?
7 messages moved from Python
 
user559633
I thought it was fine :/
 

« first day (129 days earlier)      last day (3227 days later) »