Quote:
I tried to solve but didn't get any idea.
This is an indication that you are not skilled enough for the exam.
Because, as programmer, it is your job to analyze a requirement, and this 1 is not really complicated.
The keys are:
- A worker can do 0, 1 or more jobs.
- A job is done by exactly 1 worker.
- Minimize time to have all jobs completed.
Then take a sheet of paper and a pencil and start to solve by hand.
Work time by worker
J0 J1 J2 J3 W0 W1 W2 W3 W4 Max time
W0 W0 W0 W0 20 0 0 0 0 20
W0 W0 W0 W1 15 6 0 0 0 15
W0 W0 W0 W2 15 0 8 0 0 15
....
W0 W0 W1 W1 10 8 0 0 0 10
....
This is basically a brute force algorithm (try every possibility)
Quote:
Any algorithm which is better than brute-force?
For such a small dataset, not sure any other solution will be faster.
For this requirement, not sure any other algorithm exist.