Reported July 2026
Agodabinary search

Minimum Daily Printing Limit

Reported by candidates from Agoda's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Agoda OA. Under 2s to a working solution.
Founder's read

The sneaky part of this Agoda OA, reported in July 2026, is the lower bound. Plenty of people set the search range from 1 and then wonder why their answer prints a chapter that doesn't fit. Minimum Daily Printing Limit is a binary search on the answer. You have chapters in order, no splitting, and a day count to hit. If you blank on the setup, StealthCoder runs invisibly on your screen and can hand you the working solution live. Know the shape first, though, because it's short once you see it.

The problem

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 = 3
return = 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.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick: the answer is a number, not an index. Binary search on the daily limit. The low bound is max(pages), since no chapter can be split, so any smaller limit fails outright. The high bound is sum(pages), which finishes everything in one day. For each candidate limit, greedily pack chapters in order and count days. Start a new day when adding the next chapter would exceed the limit. If days used is at most the allowed days, shrink the range. Otherwise grow it. The pitfall is starting low at 1 or 0, or using the average as a floor. Example 1 shows it: the answer is 400 because of the single biggest chapter. Also watch for days larger than the number of chapters, where the answer is just max(pages). Complexity is O(n log(sum)). If the live OA rattles you, StealthCoder is the hedge that keeps you moving.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Minimum Daily Printing Limit cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as capacity to ship packages within d days. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Agoda's OA.

Agoda reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Minimum Daily Printing Limit FAQ

What's the trick in Minimum Daily Printing Limit?+

Binary search on the answer. Pick a daily limit, greedily pack chapters in order, and count the days needed. If it fits in the allowed days, try a smaller limit. If not, go larger. The feasibility check is monotonic, which is why binary search works.

What should my search bounds be?+

Low is the largest chapter, because chapters can't be split across days. High is the total of all pages, which means one day. Starting low at 1 is the classic bug, since the feasibility check would then accept limits that can't print the biggest chapter.

How hard is this one really?+

Medium. The code is about 20 lines. The difficulty is recognizing that you search over limits instead of over the array. Once you see that, the greedy check is simple. Most people who fail it get the bounds wrong or reorder chapters.

What edge cases should I test?+

Test days equal to 1, which returns the sum. Test days at least the chapter count, which returns the max chapter. Test a single chapter. Test big values to avoid overflow in the sum. Example 1 with [100,200,300,400] and 3 days should return 400.

Can I prepare for this in 48 hours?+

Yes. Write the binary-search-on-answer template once from memory, then solve the same shape with different feasibility checks. Focus on the monotonic condition and bounds. Skip memorizing solutions. The pattern shows up repeatedly in OAs, so the template pays off across problems.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Agoda.

OA at Agoda?
Invisible during screen share
Get it