← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Google SWE coding round, one algorithmic problem the whole session. Not the hardest thing I've seen but I fumbled the setup before getting to the clean solution.

Questions Asked (1)

Q1

Given an array of two-digit integers (each between 10 and 99), find the largest subset where every number in the subset shares at least one common digit. Return the size of that subset.

Algorithms & Data Structures
Author's notes

I overcomplicated this at first.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify that the problem reduces to finding the maximum frequency of any digit (0-9) across all numbers, since a subset sharing a common digit must all contain that digit. Iterate through each number, extract its digits, and count occurrences per digit; the answer is the maximum count. This yields an O(n) time and O(1) space solution.

Pro tip: Mention that the problem is equivalent to finding the most frequent digit, and note that the two-digit constraint (10-99) ensures no leading zeros, simplifying digit extraction. This shows you can simplify the problem and handle edge cases.

1. Clarify the problem

Confirm that the subset must share at least one common digit, and that the subset can be any size. Ask if the array can be empty or contain duplicates.

2. Identify the key insight

Realize that the largest subset sharing a common digit is simply the set of all numbers containing the most frequent digit. So the problem reduces to finding the maximum frequency of any digit.

3. Design the algorithm

Use an array of size 10 to count occurrences of each digit. For each number, extract its tens and ones digits, increment their counts, and track the maximum.

4. Analyze complexity

State that the algorithm runs in O(n) time and O(1) space, which is optimal. Mention that each number is processed once.

5. Test with examples

Walk through a small example, such as [12, 23, 34, 45], to verify the approach. Also consider edge cases like all numbers sharing a digit or no common digit.

Key Points to Mention

  • Reduction to maximum digit frequency problem
  • Digit extraction using modulo and division
  • Use of constant-size array for counting
  • Time and space complexity analysis
  • Handling of duplicates and edge cases
  • Alternative approaches (e.g., brute force) and why they are less efficient

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