PracHub
QuestionsCoachesLearningGuidesInterview Prep

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.

Given two-digit integers, return the largest number of elements that all contain one common digit.

Constraints

  • Numbers are two-digit integers in normal inputs

Examples

Input: ([11, 21, 31, 41, 16, 17, 18, 34, 57],)

Expected Output: 7

Input: ([23, 35, 30, 19],)

Expected Output: 3

Input: ([10, 22, 33],)

Expected Output: 1

Input: ([],)

Expected Output: 0

Hints

  1. Count how many numbers contain each digit, counting a number once per digit even if repeated.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ 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
  • AI Coding 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.

Related Coding Questions

  • Busiest Rental Car - Google (easy)
  • Find Common Free Time Slots Across Calendars - Google (easy)
  • Deterministic Task Execution Order - Google (easy)
  • Count Clusters of 2D Points Within a Radius - Google (medium)
  • Infection Spread on a Grid (Cellular Automaton) - Google (hard)