← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jul 2026

Summary

Google SWE coding round, one algorithmic problem about grouping two-digit integers by shared digit. Pretty clean problem once you see the angle, but I fumbled the initial framing a bit.

Questions Asked (1)

Q1

You have an array of N integers, each between 10 and 99. A group is valid if there's at least one digit (0 through 9) that appears in every number in the group. Find the maximum size of a valid group you can form from the array.

Algorithms & Data Structures
Author's notes

My first instinct was to overthink it and reach for some graph-based approach.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Recognize that a valid group is defined by a common digit, so for each digit 0-9, count how many numbers contain that digit. The maximum count across all digits is the answer. This reduces the problem to a simple frequency count per digit.

Pro tip: Clarify that numbers are two-digit, so each number contains exactly two digits (possibly the same). This means we can efficiently check membership for each digit without iterating over all digits of the number.

1. Understand the problem

A group is valid if there exists at least one digit that appears in every number of the group. We need the maximum size of such a group.

2. Identify the key insight

The common digit must be one of the digits present in the numbers. Since numbers are between 10 and 99, each number has exactly two digits. Thus, we can consider each digit 0-9 separately.

3. Design the algorithm

Initialize an array of size 10 to zero. For each number, extract its tens and ones digits, and increment the count for each digit. Then, the maximum count among all digits is the answer.

4. Analyze complexity

The algorithm runs in O(N) time and O(1) space, which is optimal. Mention that this is efficient for large N.

5. Consider edge cases

Discuss cases where no digit is common (e.g., numbers with disjoint digits) or when the array is empty. Also, note that digits can repeat within a number (e.g., 11), but that doesn't affect the count.

Key Points to Mention

  • The problem reduces to finding the digit that appears in the most numbers.
  • Each number contributes to the count of its two digits (tens and ones).
  • Use an array of size 10 to count occurrences of each digit.
  • Time complexity is O(N) and space complexity is O(1).
  • Edge cases: empty array, numbers with no common digit, repeated digits in a number.
  • The solution is optimal because any valid group must be a subset of numbers containing a particular digit, so the maximum is exactly the maximum frequency of any digit.

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