← Google Interview Insights

Google·Software Engineer·Onsite - Coding / Algorithms·Intermediate

Intermediate
Jun 2026

Summary

Went through a Google SWE coding round with three problems. Two felt pretty standard but the unlock pattern one was genuinely tricky and I'm not sure I handled it well under pressure.

Questions Asked (3)

Q1

Given an integer N, return the N-th license plate in lexicographic order, where each plate has exactly 6 characters: the first 3 are uppercase letters (A-Z) and the last 3 are digits (0-9).

Algorithms & Data Structures
Author's notes

Basically a base conversion problem once you see it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Treat the license plate as a mixed-radix number where the first three characters are base-26 digits (A-Z) and the last three are base-10 digits (0-9). Convert the 1-indexed N to a 0-indexed value, then extract each character by dividing and taking remainders, handling the letter and digit parts separately. This yields an O(1) time and space solution.

Pro tip: Clarify whether N is 1-indexed or 0-indexed and confirm the lexicographic ordering (e.g., 'AAA000' is first). Mentioning edge cases like N=1 and the maximum N=26^3 * 10^3 shows attention to detail.

1. Understand the problem and constraints

Confirm the format: 3 uppercase letters followed by 3 digits. Determine if N is 1-indexed and what the lexicographic order means (e.g., 'AAA000' is the first plate).

2. Model as a mixed-radix number

Recognize that the plate can be viewed as a number in base 26 for the letters and base 10 for the digits. The total number of plates is 26^3 * 10^3 = 17,576,000.

3. Convert N to 0-indexed and decompose

Subtract 1 from N to make it 0-indexed. Compute the letter part by dividing by 1000 (since there are 1000 digit combinations) and the digit part by taking N modulo 1000.

4. Generate the characters

For the letter part, extract each of the three letters by repeatedly dividing by 26 and mapping remainders to 'A'-'Z'. For the digit part, extract each digit by dividing by 10 and mapping remainders to '0'-'9'.

5. Assemble and return the plate

Combine the three letters and three digits into a string. Verify with a small example (e.g., N=1 gives 'AAA000') to ensure correctness.

Key Points to Mention

  • Mixed-radix number system: base 26 for letters, base 10 for digits
  • 1-indexed vs 0-indexed conversion (subtract 1 from N)
  • Total number of plates: 26^3 * 10^3 = 17,576,000
  • Time and space complexity: O(1) since the plate length is fixed
  • Handling edge cases: N=1, N=17,576,000, and invalid N
  • Lexicographic order: letters take precedence over digits

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

Q2

Count all valid Android-style 3x3 grid unlock patterns that use between 4 and 9 dots, where a move is only valid if any dot lying on the straight line between two points has already been visited.

Algorithms & Data Structures
Author's notes

This one hurt.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the 3x3 grid as a graph where edges represent valid moves, precomputing the intermediate dots that must be visited for each pair. Use backtracking to explore all paths of length 4 to 9, marking visited dots and checking the intermediate condition before each move. Count and return the total number of valid patterns.

Pro tip: Precompute the intermediate dot for every pair of dots (including 'none' when no dot lies between) to avoid repeated geometric checks during backtracking, and consider symmetry to reduce redundant exploration if optimizing.

1. Represent the grid and moves

Label dots 1-9 in a 3x3 grid. Precompute a 10x10 table where table[i][j] gives the dot that must be visited before moving from i to j, or 0 if no such dot exists.

2. Define backtracking state

Use a visited array to track which dots are currently in the pattern, and a counter for the current pattern length. Start from each dot as the first element.

3. Recursive exploration

From the current dot, iterate over all unvisited dots. For each, check if the intermediate dot (if any) is already visited. If valid, mark it visited, recurse, then unmark.

4. Count valid patterns

At each recursion depth between 4 and 9, increment a global counter. Continue until all paths are explored.

5. Return the total count

After backtracking completes, return the total number of valid patterns.

Key Points to Mention

  • Precomputing the intermediate dot table to handle the 'line of sight' rule efficiently.
  • Using backtracking to explore all possible sequences without repetition.
  • The condition that a move is invalid if the intermediate dot exists and is unvisited.
  • Pattern lengths from 4 to 9 inclusive, counting each valid sequence once.
  • Time complexity analysis: worst-case O(9!) but pruned by the intermediate rule.
  • Potential optimizations like symmetry reduction or memoization (though not necessary for 3x3).

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

Q3

Given two lists of non-overlapping, sorted closed intervals, return all intervals representing the intersection of the two lists.

Algorithms & Data Structures
Author's notes

Two-pointer, done.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a two-pointer technique to traverse both interval lists simultaneously, comparing current intervals to find overlaps. At each step, add the intersection if it exists, then advance the pointer of the interval that ends first. Continue until one list is exhausted.

Pro tip: Clarify edge cases upfront, such as empty lists or intervals that just touch (e.g., [1,2] and [2,3] intersect at [2,2]). Also, discuss time and space complexity: O(m+n) time and O(1) extra space (excluding output).

1. Understand the problem

Restate the problem in your own words and ask clarifying questions about interval inclusivity, input constraints, and expected output format.

2. Plan the approach

Explain that you'll use two pointers, one for each list, and iterate while both have intervals left.

3. Define intersection logic

For current intervals A and B, compute the overlap as [max(A.start, B.start), min(A.end, B.end)]. If start <= end, add to result.

4. Advance pointers

Move the pointer of the interval with the smaller end time, because it cannot overlap with any future interval in the other list.

5. Analyze complexity and edge cases

State time complexity O(m+n) and space O(1) extra. Mention edge cases: empty lists, no intersections, touching intervals, and single-point intersections.

Key Points to Mention

  • Two-pointer technique for linear traversal
  • Intersection condition: max(starts) <= min(ends)
  • Advancing the pointer with the smaller end time
  • Time complexity O(m+n) and space O(1) extra
  • Handling edge cases: empty lists, touching intervals, single-point intersections
  • Closed intervals: endpoints are inclusive

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