Reported September 2026
Googletwo pointers

Book Reading Evenings

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

Evening 1 offers 2 minutes and the first chapter needs 3, so you read nothing. That's the whole trick in Google's Book Reading Evenings, reported in September 2026. It looks like a story problem, but it's a clean greedy simulation with two pointers. You walk the evenings once, pack chapters in order, and stop when the last one lands. If you've got the OA in a day or two, this is a ten-minute problem once you see it. If your brain locks up under the timer, StealthCoder runs invisibly on your desktop as a safety net and hands you the solution mid-assessment.

The problem

A book contains chapters that must be read in order. The integer array chapter gives the minutes needed to finish each chapter, and evening[j] gives the minutes available on the j-th evening.
During each evening, read as many consecutive unread chapters as possible. A chapter may be started only when it can be finished during that same evening, so a chapter is never split across evenings. Any unused time at the end of an evening is discarded.
Return the one-based number of the evening on which the final chapter is finished. If the book cannot be finished within the supplied evenings, return -1.

Function
solution(chapter: int[], evening: int[]) → int

Examples
Example 1
chapter = [3,2,1]
evening = [2,5,3,3]
return = 3
No chapter fits on evening 1. The first two chapters fit on evening 2, and the last chapter finishes on evening 3.
Example 2
chapter = [5,8,5]
evening = [9,4,5,3,8]
return = -1
The first chapter finishes on evening 1. The second chapter cannot finish until evening 5, leaving no evening for the final chapter.
Example 3
chapter = [3,4,7]
evening = [5,6,7]
return = 3
Exactly one chapter is completed on each evening, so the book finishes on evening 3.

Constraints
1 <= chapter.length, evening.length <= 100000.
1 <= chapter[i], evening[j] <= 10^9.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The pattern is greedy with two pointers. Keep an index i into chapters. For each evening, set remaining to that evening's minutes, then while i < n and chapter[i] <= remaining, subtract it and advance i. If i reaches n after an evening, return that evening's one-based number. If you run out of evenings, return -1. Total work is O(n + m) because each pointer only moves forward. The pitfall is splitting a chapter across evenings. Don't carry leftover time over, and don't skip a chapter that's too big to try a smaller later one, since order is fixed. Also watch the sums. Chapters go up to 10^9 and you only subtract from the evening, so you never build a large total, but use a 64-bit type anyway if your language needs it. A big chapter can also stall the loop, which is why you check every evening, not just one. If the live OA freezes you, StealthCoder is the hedge that gives you this loop in real time.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Book Reading Evenings 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. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Google reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Book Reading Evenings FAQ

How hard is Book Reading Evenings really?+

Easy to medium. There's no fancy data structure. It's a single pass with two indices. The difficulty is reading the rules correctly: chapters stay in order, never split, and leftover time is discarded. Once you code that loop it's short and clean.

What's the trick to solving it?+

Greedy simulation. For each evening, keep reading the next unread chapter while it fits in the remaining minutes. Advance the chapter pointer only forward. When the pointer passes the last chapter, return the current evening number. Otherwise return -1 after the evenings run out.

What's the time complexity I should aim for?+

O(n + m), where n is chapters and m is evenings. Both lengths reach 100000, so nested rescans or anything quadratic is risky. The two-pointer walk touches each chapter and each evening at most once, which is the intended solution.

Which edge cases break most solutions?+

A chapter longer than every evening, which should return -1. Evenings that fit nothing, like evening 1 in example 1. Returning a zero-based index instead of one-based. And finishing exactly on the last evening, as in example 3, where the answer is 3.

How do I prep for this in 48 hours?+

Write the two-pointer loop by hand on the three examples until it's automatic. Then practice similar greedy packing problems where order is fixed. Focus on reading constraints carefully, since the Google statement hides the rules in plain prose. Then test your off-by-one handling.

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