← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Google SWE interview with a tricky black-box debugging problem. The kind of question that looks deceptively simple until you actually have to think about the search space.

Questions Asked (1)

Q1

You're given a black-box function that takes a list of test cases and either passes or fails. It's known that exactly two specific test cases in the list cause a failure when both are present together. How do you find that pair?

Algorithms & Data StructuresRoot Cause Analysis
Author's notes

My first instinct was brute force all pairs, which is O(n^2) calls to run().

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the problem as finding a failing pair among n test cases using a black-box pass/fail oracle. Use a divide-and-conquer strategy: split the list into halves, test each half, and recursively search the half that fails; when both halves pass, the pair is split across halves, so use binary search to identify one element and then find its partner. This yields O(n log n) oracle calls, which is optimal up to constants.

Pro tip: Mention that you can reduce the number of oracle calls by testing subsets in parallel or using group testing, but emphasize that the divide-and-conquer approach is simple and meets the lower bound of Ω(n log n) for comparison-based search.

1. Define the oracle and problem

Clarify that the black-box function returns 'pass' if the subset contains neither or only one of the failing pair, and 'fail' if it contains both. The goal is to identify the two specific test cases.

2. Divide and conquer search

Split the list into two halves. Test each half. If one half fails, recurse on that half. If both pass, the failing pair is split across halves, so proceed to find one element from each half.

3. Find one element of the pair

When the pair is split, take one half and binary search for an element that, when combined with the other half, causes failure. This identifies one member of the pair.

4. Find the partner element

With one element known, binary search the other half to find the second element that, together with the first, causes failure.

5. Analyze complexity and optimize

The algorithm uses O(n log n) oracle calls. Discuss potential optimizations like early termination or parallel testing, and note that this is optimal in the comparison model.

Key Points to Mention

  • Divide-and-conquer approach to isolate the failing subset
  • Binary search to identify individual elements when the pair is split
  • Time complexity: O(n log n) oracle calls
  • Lower bound: Ω(n log n) for comparison-based search
  • Handling edge cases: pair at boundaries, list size small
  • Potential for parallelization or group testing to reduce calls

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.