Online Java Practice Problem TypingJob
This problem statement is the exclusive and proprietary property of
TopCoder, Inc. Any unauthorized use or reproduction of this information
without the prior written consent of TopCoder, Inc. is strictly
prohibited. (c)2002, TopCoder, Inc. All rights reserved.
Problem Statement
You have three assistants working for you. They all type with the same speed
of one page per minute. You came to your office today with a bunch of papers
you need to have typed as soon as possible. You have to distribute the papers
among your assistants in such a way that they finish all the papers at the
earliest possible time.
Your task is, given a
int[]
with the number of pages for each paper, return
the minimum number of minutes needed for your assistants to type all these
papers. Assume that they can't divide a paper into parts, that is, each paper
is typed by one person.
Definition
Class
public class TypingJob
{
public int bestTime(int[] pages)
{
// fill in code here
}
}
Constraints
- pages has between 1 and 10 elements inclusive
- each element of pages is between 1 and 100 inclusive
Examples
-
{38}
Returns: 38
-
{15, 10, 5, 7, 8}
Returns: 15
The first secretary can type the 15-page paper. The second secretary
can type the 10-page and 5-page papers. The third secretary can type
the 7-page and 8-page papers.
-
{100,100,100,100,100,100,100,100,100,100}
Returns: 400
-
{1,2,3,4,5}
Returns: 5
-
{1,2,3,4,5,6,7}
Returns: 10
Owen L. Astrachan
Last modified: Wed Feb 2 15:40:44 EST 2005