The OA alone has already dissuaded a wave of people. But in fact, as long as you master the question set and grasp the time allocation, the OA is the first step to a comeback. This guide walks you through the full Google OA process plus four high-frequency questions, so you can hit every point in advance and skip the detours.
1. Google OA Basics
The Google OA is one of the few exams that "can test the original LeetCode questions and still make you think." The direction is relatively stable, but it comes with variations and twists, so on-the-spot reaction matters.
| Item | Detail |
|---|---|
| Platform | CodeSignal (mostly fresher/intern) or Karat (leans senior/in-service) |
| Total time | Typically 70 ~ 90 minutes |
| Structure | 2–3 coding problems, occasionally a few short-answer/logic questions |
| Languages | Python / Java / C++, etc. (pick your strongest) |
| Difficulty | Often 1 Medium + 1 Hard, sometimes 2 Hard — luck plays a role |
| Monitoring | The CodeSignal version usually records the whole session + photo auth |
2. Question 1: Fill 2D Array (Magic Square)
Problem: Given an N×N matrix, fill in 1 to n×n so that each row, each column, and both diagonals have an equal sum. Return null if impossible.
This is magic-square construction: n=2 has no solution (return null); odd n uses the Siamese method (start at the middle of the top row, move up-right each time, wrap around on overflow, drop one row when occupied).
def fill_matrix(n):
if n == 2:
return None
if n % 2 == 1: # odd order: Siamese method
M = [[0] * n for _ in range(n)]
i, j = 0, n // 2
for num in range(1, n * n + 1):
M[i][j] = num
ni, nj = (i - 1) % n, (j + 1) % n
if M[ni][nj]: # target cell occupied -> drop one row
ni, nj = (i + 1) % n, j
i, j = ni, nj
return M
# even orders have dedicated constructions (LUX / quadrant swaps), branch on n%4
return build_even_magic(n)
In interviews n is usually odd, so write the Siamese method solidly first, then add the even orders if needed.
3. Question 2: Largest Subarray (Max Subarray Sum)
Problem: Given an integer array, find the contiguous subarray (at least one number) with the largest sum and return that sum.
Classic Kadane: maintain "the max sum ending at the current element" — either extend the previous run or restart from the current element.
def max_subarray(nums):
cur = best = nums[0]
for x in nums[1:]:
cur = max(x, cur + x) # extend or restart
best = max(best, cur)
return best
Time O(n), space O(1). For an all-negative array you must return the largest negative number, so initialize with nums[0], not 0.
4. Question 3: Maximum Area Serving Cake (Binary Search on the Answer)
Problem: Given the radii of circular cakes and the number of guests, find the largest single equal-area piece that can be cut. Each piece comes from one cake; each guest gets one piece.
The number of pieces is monotonic in the piece size — smaller pieces yield more. Binary search on the area, checking whether the total piece count at a given area is ≥ the guest count:
import math
def max_area_per_guest(radii, guests):
areas = [math.pi * r * r for r in radii]
lo, hi = 0.0, max(areas)
for _ in range(100): # float binary search, fixed iterations for precision
mid = (lo + hi) / 2
pieces = sum(int(a // mid) for a in areas) if mid > 0 else guests
if pieces >= guests:
lo = mid # can go larger
else:
hi = mid
return lo
Key: float binary search uses a fixed iteration count (about 100) to control precision, and the piece count accumulates via integer division a // mid.
5. Question 4: Compare Strings (Minimum-Character Frequency)
Problem: Define "string A is strictly smaller than B" iff the frequency of the lexicographically smallest character in A < that in B. For example, "abcd" (smallest char 'a', frequency 1) < "aaa" ('a' frequency 3). Given query strings and word strings, for each query count how many word strings are strictly greater.
Compress each string to one number = the frequency of its smallest character, then answer queries with sorting + binary search:
import bisect
def f(s): # frequency of the smallest character
m = min(s)
return s.count(m)
def compare_strings(queries, words):
w = sorted(f(x) for x in words)
res = []
for q in queries:
fq = f(q)
# count of words strictly greater than fq = total - first index > fq
res.append(len(w) - bisect.bisect_right(w, fq))
return res
Optimizing the O(Q×W) brute force to O((Q+W) log W) is the core of this question.
6. Time Allocation & On-Site Strategy
| Phase | Action |
|---|---|
| First 2 min | Read all problems, identify the Hard one, do the confident ones first |
| Coding | Write a naive solution to pass samples, then optimize complexity |
| When stuck | Write the brute force for partial credit; don't grind one problem |
| Wrap-up | Leave 5 min to test edges (empty array, all negative, single element, float precision) |
7. Summary
Google OA is stable in direction but comes with twists: magic square via construction, max subarray via Kadane, serving cake via float binary search, compare strings via "compress to frequency + sort and binary search." Drill these four models, then manage time allocation and edges, and the OA becomes a steady pass.
FAQ
Q1: What platform and how long is the Google OA?
Mostly CodeSignal (fresher/intern) or Karat (in-service/senior), typically 70–90 minutes, 2–3 coding problems, often 1 Medium + 1 Hard.
Q2: How do you binary-search a float problem like serving cake?
Binary-search on the answer (single-piece area), use a fixed iteration count (about 100) for precision, and have the check accumulate each cake's integer-division pieces against the guest count.
Q3: How to optimize Compare Strings?
Compress each string to the single number "frequency of its smallest character," sort the words, and answer each query with bisect, replacing O(Q×W) with O((Q+W) log W).
Q4: What if I'm stuck on the Hard?
Write the brute force first for partial credit on hidden cases (CodeSignal gives partial credit), then come back to optimize — don't burn all your time on one problem. For timed Google OA practice and question-type prediction, reach out for the high-frequency questions and review materials for your target role.
Preparing for a Google interview?
oavoservice offers full-loop Google OA practice: timed CodeSignal mocks, drills on high-frequency patterns (magic square / Kadane / binary search on the answer / counting), and time-allocation and edge-check training. Coaches include senior engineers from top companies who know Google's "stable patterns + variations and twists" grading style, helping you max out partial credit and lock down the hard ones.
Add WeChat Coding0201 now to get Google real questions and practice.
Contact
- WeChat: Coding0201
- Email: [email protected]
- Telegram: @OAVOProxy