PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Google

Find largest digit-sharing subset

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to reason about digit-based frequency analysis and efficient counting on arrays, testing competencies in combinatorics and algorithmic optimization for grouping elements by shared features.

  • easy
  • Google
  • Coding & Algorithms
  • Software Engineer

Find largest digit-sharing subset

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Take-home Project

You are given an array of N integers. Each integer has exactly two decimal digits (i.e., each element is between 10 and 99 inclusive). You want to choose some of the array elements to form a **group**. A group is **valid** if there exists at least one digit (0–9) that appears in **every** number in the group. - For example, numbers 52, 25, and 55 can form a valid group because they all contain digit 5. - Numbers 11, 52, and 34 cannot form a valid group, because there is no single digit that appears in all three numbers. Your task: - Determine the **maximum possible size** of a valid group that can be chosen from the array. - If no two numbers share a digit, the answer can be 1 (any single element is trivially a valid group, since the shared digit condition holds vacuously for one element). **Input:** - An integer N (number of elements in the array). - N integers, each between 10 and 99 inclusive. **Output:** - A single integer: the maximum size of a valid group. You should design an efficient algorithm that works for large N.

Quick Answer: This question evaluates a candidate's ability to reason about digit-based frequency analysis and efficient counting on arrays, testing competencies in combinatorics and algorithmic optimization for grouping elements by shared features.

Related Interview Questions

  • Solve Flower Placement and Directory Deletion - Google (medium)
  • Compute Turnstile Crossing Times - Google (hard)
  • Simulate In-Place Cellular State Updates - Google (hard)
  • Determine Whether a Word Exists in a Graph - Google (medium)
  • Implement Checksums and Feature Rollout Evaluation - Google (medium)
Google logo
Google
Dec 8, 2025, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
7
0

You are given an array of N integers. Each integer has exactly two decimal digits (i.e., each element is between 10 and 99 inclusive).

You want to choose some of the array elements to form a group. A group is valid if there exists at least one digit (0–9) that appears in every number in the group.

  • For example, numbers 52, 25, and 55 can form a valid group because they all contain digit 5.
  • Numbers 11, 52, and 34 cannot form a valid group, because there is no single digit that appears in all three numbers.

Your task:

  • Determine the maximum possible size of a valid group that can be chosen from the array.
  • If no two numbers share a digit, the answer can be 1 (any single element is trivially a valid group, since the shared digit condition holds vacuously for one element).

Input:

  • An integer N (number of elements in the array).
  • N integers, each between 10 and 99 inclusive.

Output:

  • A single integer: the maximum size of a valid group.

You should design an efficient algorithm that works for large N.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Google•More Software Engineer•Google Software Engineer•Google Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.