PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Google

Find largest subset sharing a common digit

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of digit-level properties within arrays and the ability to reason about selection size under explicit constraints, involving combinatorial and counting concepts.

  • medium
  • Google
  • Coding & Algorithms
  • Software Engineer

Find largest subset sharing a common digit

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You are given a list of **two-digit integers** (each from `10` to `99`, inclusive). You want to select as many numbers as possible **in one selection** such that: - There exists a digit `d` (0–9) where **every selected number contains digit `d` in at least one position** (tens or ones). For example, from `[11, 21, 31, 41, 16, 17, 18, 34, 57]`, you can select `11, 21, 31, 41, 16, 17, 18` (7 numbers) because they all contain digit `1`. Return the **maximum possible size** of such a selection. ### Input - An integer array `nums` of length `n`, where each `nums[i]` is a two-digit integer (`10`–`99`). ### Output - An integer: the maximum number of elements you can select.

Quick Answer: This question evaluates understanding of digit-level properties within arrays and the ability to reason about selection size under explicit constraints, involving combinatorial and counting concepts.

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
Sep 5, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
3
0

You are given a list of two-digit integers (each from 10 to 99, inclusive). You want to select as many numbers as possible in one selection such that:

  • There exists a digit d (0–9) where every selected number contains digit d in at least one position (tens or ones).

For example, from [11, 21, 31, 41, 16, 17, 18, 34, 57], you can select 11, 21, 31, 41, 16, 17, 18 (7 numbers) because they all contain digit 1.

Return the maximum possible size of such a selection.

Input

  • An integer array nums of length n , where each nums[i] is a two-digit integer ( 10 – 99 ).

Output

  • An integer: the maximum number of elements you can select.

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.