FastPrepMinimum Daily Printing Limit

Minimum Daily Printing Limit

Agoda logoAgoda● MediumFULLTIMEONSITE INTERVIEW
Learn

Problem statement

You are given an array pages, where pages[i] is the number of pages in chapter i, and an integer days.

Chapters must be printed in order, and a chapter cannot be split across days. Return the minimum daily printing limit needed to finish all chapters within days days.

Function

minimumDailyPrintingLimit(pages: int[], days: int) → int

Examples

Example 1

pages = [100,200,300,400]days = 3return = 400

A limit of 400 permits the three days [100, 200], [300], and [400]. A smaller limit cannot print the 400-page chapter, so 400 is minimal.

More Agoda problems

See Agoda hiring insights
public int minimumDailyPrintingLimit(int[] pages, int days) {
  // write your code here
}
pages[100,200,300,400]
days3
expected400
Checking account…