Google binary search interview

Google binary search interview questions test predicate search, not sorted arrays. Learn the answer-space pattern behind top Google problems.

10 minutes
Intermediate
What you will learn

Why Google favors predicate search over classic binary search

How predicate search works on the answer space instead of arrays

The monotonic predicate that makes answer-space search possible

How to recognize predicate search triggers in unfamiliar problems

Most engineers preparing for a Google binary search interview practice the wrong variant. They drill sorted-array search until they can write it with their eyes closed. Then they sit down in the actual interview, see a problem about shipping packages or calculating speeds, and don't recognize it as binary search at all.

The pattern Google actually tests most often isn't classic binary search. It's predicate search, a variant that binary-searches on the answer space instead of a sorted array. Most prep platforms don't even name it.

TL;DR
Google disproportionately tests predicate search, a binary search variant that searches the answer space using a monotonic boolean predicate. Problems like Minimum Shipping Capacity, Punctual Arrival Speed, and Trip Completion Frenzy all use this pattern. Most engineers never encounter it as a named, teachable concept.

How we collected this data

Every problem across Codeintuition's 16 courses carries company tags based on where that problem has appeared in real interviews. The Searching course alone covers 27 problems across 5 distinct search patterns, each tagged to specific companies.

The data here comes from those tags. When we say "Google tests predicate search," we mean Google-tagged problems on the platform cluster around that specific pattern at a higher rate than any other FAANG company. This isn't scraped from interview forums or estimated from self-reports. It's derived from the problems themselves and the companies that ask them.

The sample is limited to Codeintuition's problem bank, not the entire universe of interview questions. But the pattern signal is consistent enough to say something useful about what Google favors.

Google binary search interview problems cluster around one variant

Binary search appears across 7 major companies in our tagging data: Apple, Google, Amazon, Adobe, Uber, Facebook, and Yahoo. No surprise there, since classic binary search is a foundational skill.

But look at where Google's binary search shows up. Their interview problems don't just test "find an element in a sorted array." They test a completely different application of the same algorithmic principle. Here are the Google-tagged predicate search problems.

  • Punctual Arrival Speed (Google, PhonePe): Given travel distances and a time limit, find the minimum speed that gets you everywhere on time.
  • Trip Completion Frenzy (Uber, Google): Given trip durations and a deadline, find the minimum rate to complete all trips.
  • Calculate Square Root (Amazon, Apple, Microsoft, Google): Find the integer square root without using built-in functions.
  • Minimum Shipping Capacity: Find the minimum ship capacity to deliver all packages within a given number of days.

None of these problems mention sorted arrays. None of them look like textbook binary search. Yet they all use the exact same algorithmic structure: define a monotonic boolean predicate on the answer space, then binary-search for the boundary.

“Google doesn't test whether you can search a sorted array. They test whether you can recognize that an optimization problem has a searchable answer space.”
Pattern data from 450+ company-tagged problems

Amazon and Apple also test binary search heavily, but their problems distribute more evenly across classic binary search, lower bound, upper bound, and 2D search. Amazon covers the widest range of search variants of any company in the dataset. Microsoft and Apple both test 2D Binary Search and Staircase Search at rates other companies don't match. Google's concentration on predicate search stands out.

That doesn't mean Google only cares about predicate search. But when a Google interview includes a binary search problem, there's a higher chance than at any other FAANG company that it requires answer-space reasoning rather than array-element lookup. If you've only practiced the array version, you're underprepared for the variant they favor most.

And this is where engineers get tripped up. Classic binary search has obvious signals. You see a sorted array, you need to find an element. The problem practically announces the algorithm.

Predicate search flips the concept. Instead of searching through a data structure, you're searching through possible answers. A lot of optimization problems have a monotonic property: if an answer of size X works, then every answer larger than X also works (or vice versa). That monotonicity means you can binary-search on the answer space itself.

Take Minimum shipping capacity as a worked example.

You have packages with weights [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and need to ship them all within 5 days. Each day, the ship loads packages in order until the next package would exceed capacity. What's the minimum capacity?

The answer space ranges from the heaviest single package (10) to the total weight (55). For any candidate capacity, you can check: "Can I ship everything in 5 days with this capacity?" That check is a simple greedy simulation. And if capacity 15 works, then 16, 17, 18, and every larger value also works.

That monotonic predicate is the whole trick. Below some threshold, the answer is "no." Above it, "yes." Binary search finds the exact boundary.

  1. Python

The binary search code itself looks identical to classic binary search. The difference is what you're searching. You're not looking for an element in an array. You're looking for a boundary in the answer space where a boolean condition flips.

LeetCode's tagging system contributes to the blind spot here. On LeetCode, Minimum Shipping Capacity is tagged as "Binary Search" and "Array." Punctual Arrival Speed doesn't exist under that name. Trip Completion Frenzy doesn't either. There's no unifying "Predicate Search" category that groups these problems together and teaches the shared structure. You might solve three of them and never realize they're the same pattern.

💡 Tip
The identification trigger for predicate search: you're asked to find the minimum (or maximum) value of something, and you can write a boolean function that checks whether a candidate answer is feasible. If that function is monotonic (all feasible answers are on one side), predicate search applies.

Most platforms never name this pattern

LeetCode has the problems. You can find Minimum Shipping Capacity, Koko Eating Bananas (a predicate search variant), and similar problems in the problem bank. But they're scattered across different tags and difficulty levels with no unifying concept. A problem tagged "Binary Search" and "Array" doesn't tell you that the core technique is answer-space search with a monotonic predicate. It tells you the solution uses binary search somewhere, which you already knew from the difficulty rating.

NeetCode's roadmap includes some predicate search problems in its binary search section, but doesn't teach predicate search as a named, distinct pattern with its own identification triggers. You work through the problems and might extract the pattern yourself, or you might not.

That gap matters.

Because identification is the hard part. Once you know a problem is predicate search, the implementation is straightforward: define the search space, write the feasibility check, run binary search. The real challenge is looking at "What's the minimum speed to arrive on time?" and recognizing that speed is a searchable answer space with a monotonic feasibility predicate.

The concept of monotonicity is what makes this work. If you can prove that the feasibility function never flips back (once true, always true for larger values), binary search is guaranteed to find the boundary. If you understand this property, you can verify your approach is correct before writing a single line of code. Without it, you're guessing.

This goes beyond Google specifically. Most resources treat binary search as a single technique with variations. But the jump from "search a sorted array" to "search the answer space" is a genuine conceptual leap. It's closer to the greedy-to-DP transition than the lower-bound-to-upper-bound one. Treating them as the same pattern undersells how hard it is to recognize the second one in the wild.

Codeintuition splits predicate search into two explicitly named patterns in the Searching course: Minimum Predicate Search and Maximum Predicate Search. Each has its own understanding lesson, its own identification lesson teaching the structural triggers, and its own problem set. The identification training is what matters for Google interviews. You learn to spot the monotonic predicate before you see the solution.

What this means for your interview preparation

If you're targeting Google specifically, the data points toward a clear priority shift. Classic binary search on sorted arrays is table stakes. The differentiator is whether you can look at an optimization problem with no sorted data in sight and recognize that the answer space is searchable.

Predicate search is the pattern that separates candidates, and most people skip it because they don't realize it's a distinct skill to train. What this looks like in practice:

  • Learn predicate search as a named pattern, not a trick: Understand the monotonic predicate property. Practice writing the feasibility check for different problem types. The O(n log(answer_space)) complexity pattern should feel as natural as O(log n) for classic search.
  • Practice identification, not just implementation: Given a problem statement with no hints, can you spot that the answer is searchable? That's what Google tests. Solving predicate search problems after someone tells you the approach is a different skill from spotting the approach yourself in a cold problem.
  • Work through at least four problems: Predicate search applies to shipping capacity, speed optimization, resource allocation, and square root computation. These problems all look completely different on the surface. Three or four builds the recognition that one problem can't.

Codeintuition's learning path sequences searching after sorting, so you arrive at predicate search with the prerequisite reasoning already in place. The predicate search sections alone include 8 problems covering both minimum and maximum variants, each with company tags showing exactly where that specific pattern appears in real interviews.

You've almost certainly practiced binary search for Google. But have you practiced the right binary search for Google?

Do you want to master data structures?

Try our data structures learning path made of highly visual and interactive courses. Get hands on experience by solving real problems in a structured manner. All resources you would ever need in one place for FREE

No, Google also tests classic binary search, 2D binary search, and other search variants. But predicate search appears disproportionately in Google-tagged problems compared to other FAANG companies. It's the variant most likely to catch you off guard because it doesn't look like traditional binary search. Most candidates already know sorted-array search well. Predicate search is where the preparation gap shows up.
Classic binary search finds an element in a sorted array. Predicate search finds a boundary in the answer space where a monotonic boolean condition flips from false to true (or vice versa). The search mechanics are identical, but you're searching possible answers instead of array elements. The real difficulty is recognizing that a problem has a searchable answer space.
Four to six problems across both minimum and maximum predicate search variants gives you enough exposure. Include at least two minimum predicate search problems (like shipping capacity and arrival speed) and two maximum variants (like square root and ribbon cutting). You're not trying to memorize solutions. You're training yourself to recognize the monotonic feasibility pattern in problems that don't mention binary search at all. After the fourth or fifth problem, you'll start noticing the structural signals before you even finish reading the constraints.
You can find predicate search problems on LeetCode, but they're not grouped under a single pattern label. Problems like Capacity To Ship Packages, Koko Eating Bananas, and Split Array Largest Sum all use predicate search, but LeetCode tags them differently. Without a unifying framework, you might solve them individually without recognizing the shared structure that makes all of them approachable the same way.
Google typically allows Python, Java, C++, and sometimes JavaScript or Go. Pick whichever language you're fastest and most accurate in under timed conditions.
Was this helpful?