Reported October 2025
Googlebinary search

Minimize the Maximum Pages Allocated

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

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

Google reported this one in October 2025, and it looks like a partitioning puzzle but it's really a search problem in disguise. You get an array of book pages, a student count, and you split the array into contiguous chunks to minimize the biggest chunk. If you're staring at an OA invite, here's the reduction: binary search on the answer, then a greedy check. It's the classic book allocation setup. If your mind goes blank mid-assessment, StealthCoder runs invisibly as a safety net, but knowing this shape gets you most of the way there.

The problem

You are given an integer array pages, where pages[i] is the number of pages in the i-th book. The books are arranged in their original order.
Allocate every book to exactly students students under these rules:
Each student must receive at least one book.
Each student receives one contiguous segment of books.
The order of the books cannot change.
The load of a student is the total number of pages in that student's segment. Return the minimum possible value of the maximum student load.
If there are more students than books, return -1.

Function
minimizeMaximumPages(pages: int[], students: int) → long

Examples
Example 1
pages = [12,34,67,90]
students = 2
return = 113
Allocate books [12,34,67] to the first student and [90] to the second. Their loads are 113 and 90, so the maximum load is 113. No valid allocation has a smaller maximum.
Example 2
pages = [10,20,30,40]
students = 2
return = 60
The allocation [10,20,30] and [40] has loads 60 and 40. Every other split produces a maximum load of at least 60.
Example 3
pages = [5,10,15]
students = 4
return = -1
There are more students than books, so it is impossible to give every student a non-empty segment.

Constraints
1 <= pages.length <= 10^5
1 <= pages[i] <= 10^9
1 <= students <= 10^5

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick: the answer lives between max(pages) and sum(pages). Binary search that range. For each candidate limit, walk the array greedily, start a new student whenever adding the next book would exceed the limit, and count students. If the count is at most students, the limit is feasible, so try lower. Otherwise go higher. Feasibility is monotonic, which is why binary search works. Pitfalls: forgetting the -1 case when students exceeds the number of books, using 32-bit ints when sums reach 10^14 (the return type is long for a reason), and setting the lower bound to 0 or 1 instead of max(pages), which lets a single book exceed the limit. Complexity is O(n log(sum)), fine for 10^5 elements. If you freeze on the live OA, StealthCoder can surface this exact structure while you keep typing.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Minimize the Maximum Pages Allocated 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. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as split array largest sum. If you have time before the OA, drill that.

⏵ The honest play

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

Google reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Minimize the Maximum Pages Allocated FAQ

What's the trick to Minimize the Maximum Pages Allocated?+

Binary search on the answer, not on the array. Low is the largest single book, high is the total pages. For each midpoint, greedily count how many students you need. If it fits within the student count, shrink high. Otherwise raise low. The monotonic feasibility check is the whole idea.

How hard is this problem really?+

Medium to hard on paper, but it's formulaic once you've seen binary search on the answer. The code is about 25 lines. The difficulty is recognizing the pattern, since nothing in the statement says binary search. Google candidates reporting it in October 2025 should expect that recognition step to be the real test.

Why does the greedy check work?+

For a fixed limit, packing as many books as possible into each student before starting a new one minimizes the number of students needed. If even that greedy packing needs more students than allowed, no other split with that limit can work. So the check is exact, not just a heuristic.

What edge cases should I handle?+

Return -1 immediately when students is greater than the number of books. Use 64-bit integers since sums can reach 10^14. Start the lower bound at max(pages). Also test one student, which returns the full sum, and students equal to book count, which returns the max book.

How do I prepare for this in 48 hours?+

Write the binary-search-on-answer template from memory twice, then solve two variants like splitting an array into k subarrays or shipping packages in D days. They share the same feasibility check. Focus on getting the bounds and the loop condition right, since off-by-one errors are what usually break it.

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

OA at Google?
Invisible during screen share
Get it