PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency in combinatorial optimization, bit manipulation, and state-compression techniques for selecting subsets under uniqueness constraints.

  • medium
  • Meta
  • Coding & Algorithms
  • Machine Learning Engineer

Maximize Unique Letters

Company: Meta

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Given a list of lowercase words, choose any subset of words such that: - no selected word contains a repeated character internally, and - no character appears in more than one selected word across the subset. Return the maximum possible number of distinct characters covered by the selected subset. Follow-up stages: 1. Solve the exact problem for small inputs such as `n <= 12`. 2. Scale the solution to much larger inputs, potentially up to around `10^4` words. You should preprocess each word into a 26-bit mask, discard words that are internally invalid, and describe or implement pruning and a more scalable state-compression strategy.

Quick Answer: This question evaluates proficiency in combinatorial optimization, bit manipulation, and state-compression techniques for selecting subsets under uniqueness constraints.

Choose a subset of words with no repeated letters internally or across words, returning maximum covered characters.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: (['un','iq','ue'],)

Expected Output: 4

Explanation: Classic example.

Input: (['aa','bc'],)

Expected Output: 2

Explanation: Drop invalid word.

Input: (['ab','cd','a'],)

Expected Output: 4

Explanation: Choose disjoint subset.

Hints

  1. Use deterministic tie-breaking for prompts with multiple valid outputs.
  2. For design-style APIs, simulate operations with explicit inputs.
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

  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)