Google's 3-Part Winning Tile Coding Question
Google interviewers often start small on purpose: write the function signature before any logic, then build up, then change the spec on you. It tests whether your first design is clean enough to bend. Here is the full Winning Tile question, Java for each part, and the rubric.
The question
Two players each draw 6 tiles, each tile numbered 1 to 10. Write a function that takes both hands and decides who wins. Part 1: write only the signature, with parameters and types, body left as a stub. Part 2: the winner is whoever holds the single highest tile; implement it. Part 3: the product manager changes the tiles. The set is now 2 to 9 plus letters: A = 1, B = 10, and a new C = 11. Update your code.
Part 1 · The signature
Resist writing logic. A precise signature, clear parameters, a documented return contract, is the artifact being graded here. Get the contract right and Parts 2 and 3 are small.
/**
* Decide which player wins by comparing their hands of tiles.
*
* @param handA player A's tiles (each value 1..10)
* @param handB player B's tiles
* @return 1 if A wins, 2 if B wins, 0 on a tie
*/
int winner(int[] handA, int[] handB) {
return 0; // Part 1: signature only
}
Part 2 · Compare the highest tile
Whoever holds the single highest tile wins. A linear max over each hand, then compare. O(n) time, O(1) space.
int winner(int[] handA, int[] handB) {
int hiA = max(handA), hiB = max(handB);
if (hiA > hiB) return 1;
if (hiB > hiA) return 2;
return 0;
}
private int max(int[] hand) {
int m = Integer.MIN_VALUE;
for (int v : hand) m = Math.max(m, v);
return m;
}
Part 3 · The spec change
Tiles are now strings: digits 2 to 9, plus A = 1, B = 10, and C = 11. The comparison logic does not change at all; only how you read a tile's value does. Isolate that in one function and the rest of Part 2 stands.
int winner(String[] handA, String[] handB) {
int hiA = maxValue(handA), hiB = maxValue(handB);
return hiA > hiB ? 1 : (hiB > hiA ? 2 : 0);
}
private int maxValue(String[] hand) {
int m = Integer.MIN_VALUE;
for (String t : hand) m = Math.max(m, value(t));
return m;
}
private int value(String tile) {
switch (tile) {
case "A": return 1;
case "B": return 10;
case "C": return 11;
default: return Integer.parseInt(tile); // "2".."9"
}
}
If the spec change forced you to touch the comparison logic, that is the signal. A clean Part 2 localizes the change to value() alone.
How Google scores it
| Dimension | Weak | Strong |
|---|---|---|
| Signature first | Dives into logic immediately | Precise types and a documented return contract |
| Correctness | Mishandles ties or empty hands | Returns 0 on tie, defines empty-hand behavior |
| Adaptability | Rewrites the comparison for Part 3 | Localizes the change to one value() function |
| Communication | Silent coding | Narrates assumptions and trade-offs |
| Complexity | Unsure of the cost | States O(n) time, O(1) space |
This is one question of 35 pages
Get the full Google question bank
The full Google bank carries the coding and design rounds, each problem with its follow-ups and a rubric, compiled from people familiar with the process and cross-verified across sources.
Google interview FAQ
What does the Google coding interview ask?+
Clean algorithmic problems where structure and communication matter as much as the answer. Interviewers frequently ask for the signature first, then the implementation, then a spec change to see if your design absorbs it.
How is the Google coding interview scored?+
On the four Google axes: general cognitive ability, role-related knowledge, coding quality, and communication. A clean signature, correct implementation, graceful handling of the changed spec, and edge cases all count.
Does Google still ask LeetCode-style questions?+
Yes, but with emphasis on how you structure and explain the solution, handle edge cases, and adapt when requirements change mid-interview. Pure pattern-matching without communication scores poorly.
Where can I find real Google interview questions?+
Pichup maintains a 35-page Google question bank compiled from people familiar with the process, with the coding and design questions, their follow-ups, and rubrics. The question in this guide is one of them.