Feasibility of Printing Within Given Days
Updated
Problem statement
You are given an array pages, where pages[i] is the number of pages in chapter i. You can print at most dailyLimit pages per day, and you have days days.
You must print the chapters in order, and a chapter cannot be split across days. Return true if you can print all chapters within days days. Otherwise, return false.
Function
canPrintWithinDays(pages: int[], dailyLimit: int, days: int) → booleanExamples
Example 1
pages = [100,200,300,400]dailyLimit = 500days = 3return = truePrint [100,200] on the first day, [300] on the second day, and [400] on the third day. Each day stays within the daily limit of 500 pages, so the answer is true.
More Agoda interview questions
- Sort Ones, Twos, and Threes In PlacePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Molecular Weight of a Grouped FormulaONSITE INTERVIEW · Seen Oct 2026
- Minimum Daily Printing LimitONSITE INTERVIEW · Seen Aug 2026
- Climb Stairs with One, Two, or Three StepsONSITE INTERVIEW · Seen Aug 2026
- Rank Transform an ArrayONSITE INTERVIEW · Seen Aug 2026
- Minimum Absolute Difference PairsONSITE INTERVIEW · Seen Jun 2026
- 3SumONSITE INTERVIEW · Seen May 2026
- Can Place FlowersPHONE SCREEN · Seen Nov 2026
- Reverse Words in a StringPHONE SCREEN · Seen Nov 2026
- Disk Space Window AnalyzerPHONE SCREEN · Seen Sep 2026
Similar questions at other companies
- Minimum Piano Hand Raises and Thumb PositionsGoogle · ONSITE INTERVIEWGoogle interview questions
- Fair Capped Money DistributionGusto · PHONE SCREEN · ONSITE INTERVIEWGusto interview questions
- Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
- Minimum Station Tracks for a Train ScheduleBNSF Railway · ONSITE INTERVIEWBNSF Railway interview questions
- Best Time to Buy and Sell Stock IIKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
- Minimize Total Weight After HalvingAmazon · ONSITE INTERVIEW
- Capacity to Ship Packages Within DaysMicrosoft · OA · ONSITE INTERVIEWMicrosoft interview questions
- Gas StationeBay · ONSITE INTERVIEWeBay interview questions
- Wizard Scroll Allocation StrategyJane Street · ONSITE INTERVIEWJane Street interview questions
- Maximize Compatible Car RidersUber Freight · PHONE SCREEN · ONSITE INTERVIEWUber Freight interview questions