Statistics

Problem Statement for "TypingJob"

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 an 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:
TypingJob
Method:
bestTime
Parameters:
int[]
Returns:
int
Method signature:
int bestTime(int[] pages)
(be sure your method is public)

Constraints

  • pages has between 1 and 10 elements inclusive
  • each element of pages is between 1 and 100 inclusive

Examples

  1. {38}

    Returns: 38

  2. {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.

  3. {100,100,100,100,100,100,100,100,100,100}

    Returns: 400

  4. {1,2,3,4,5}

    Returns: 5

  5. {1,2,3,4,5,6,7}

    Returns: 10

  6. {100,99,98,97,96,95,94,93,92,91}

    Returns: 370

  7. {1,100,2,99}

    Returns: 100

  8. {1,100,2,99,3,98}

    Returns: 101

  9. {1,1,1,1,1,1,80}

    Returns: 80

  10. {10,11,12,13,14,15,16,17,18,19}

    Returns: 49

  11. {10,20,30,40,50,60,70,80,90,100}

    Returns: 190

  12. {100,1,100,1,100,1,100,1,100,1}

    Returns: 200

  13. {100,100,100,100,1,2,3,4,5,6}

    Returns: 200

  14. {100,100,100,1,2,3,4,5,6,7}

    Returns: 110

  15. {25,10,11,12,46,37,49}

    Returns: 67

  16. {3,5,7,11,13,17,19,23,31,37}

    Returns: 56

  17. {1,1,2,3,5,8,13,21,34,55}

    Returns: 55

    Fibonnaci numbers

  18. {4,76,41,49,57,85,41,29,3,11}

    Returns: 133

    Ten random test cases

  19. {32,41,94,39,35,1,44,69,31,76}

    Returns: 157

  20. {88,73,100,21,92,32,50,50,88,8}

    Returns: 201

  21. {100,35,13,83,4,95,62,13,100,70}

    Returns: 195

  22. {25,60,38,8,29,20,87,38,25,95}

    Returns: 143

  23. {75,10,88,58,79,70,37,88,75,45}

    Returns: 210

  24. {22,63,89,81,10,4,19,7,17,52}

    Returns: 122

  25. {69,15,91,4,41,38,100,27,58,59}

    Returns: 168

  26. {62,21,95,49,4,6,62,65,42,74}

    Returns: 161

  27. {48,31,3,40,29,43,87,43,8,2}

    Returns: 116

  28. { 10, 10, 9, 5, 3, 3, 3 }

    Returns: 15

  29. { 6, 4, 3, 1, 1 }

    Returns: 6

  30. { 1, 8, 6, 5, 3, 9, 5, 6, 2 }

    Returns: 15

  31. { 1, 2, 3, 4, 5, 6, 7, 8 }

    Returns: 12

  32. { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }

    Returns: 19

  33. { 1, 4, 6, 7, 8, 12, 13 }

    Returns: 18

  34. { 20, 1, 1, 1, 1, 1, 1 }

    Returns: 20

  35. { 44, 55, 66, 67, 68, 69, 54, 33, 64 }

    Returns: 175

  36. { 15, 10, 5, 7, 8, 9, 5, 6, 9 }

    Returns: 25

  37. { 80, 80, 100, 90, 80, 80, 30, 30 }

    Returns: 190

  38. { 44, 45, 46, 47, 48, 66, 64, 46, 33, 54 }

    Returns: 168

  39. { 10, 10, 9, 5, 3, 3, 3 }

    Returns: 15

  40. { 6, 4, 3, 1, 1 }

    Returns: 6

  41. { 1, 8, 6, 5, 3, 9, 5, 6, 2 }

    Returns: 15

  42. { 1, 2, 3, 4, 5, 6, 7, 8 }

    Returns: 12

  43. { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }

    Returns: 19

  44. { 1, 4, 6, 7, 8, 12, 13 }

    Returns: 18

  45. { 20, 1, 1, 1, 1, 1, 1 }

    Returns: 20

  46. { 44, 55, 66, 67, 68, 69, 54, 33, 64 }

    Returns: 175

  47. { 15, 10, 5, 7, 8, 9, 5, 6, 9 }

    Returns: 25

  48. { 80, 80, 100, 90, 80, 80, 30, 30 }

    Returns: 190

  49. { 44, 45, 46, 47, 48, 66, 64, 46, 33, 54 }

    Returns: 168


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)2024, TopCoder, Inc. All rights reserved.
This problem was used for: