PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Meta

Select words to maximize unique characters

Last updated: Apr 13, 2026

Quick Overview

This question evaluates understanding of combinatorial search and string manipulation, specifically the ability to reason about unique-character constraints, subset selection, and set-like representations.

  • medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Select words to maximize unique characters

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

## Problem You are given an array of strings `words`. You may choose **any subset** of these strings and concatenate the chosen strings in any order. Your goal is to produce a concatenated string that contains the **maximum possible number of unique characters**, subject to the constraint that **no character appears more than once** in the concatenation. Return **any valid concatenated string** (or equivalently, any subset) that achieves the maximum number of unique characters. ## Input - `words: string[]` ## Output - A string `s` such that: - all characters in `s` are unique - `|s|` is maximized among all valid choices ## Examples - `words = ["un","iq","ue"]` - One optimal answer: `"uniq"` (length 4) - `words = ["aa","bc","d"]` - `"aa"` cannot be used (has duplicate `a`), optimal answer could be `"bcd"` ## Constraints (typical interview assumptions) - `1 <= words.length <= 16` (or small enough to allow backtracking) - Total characters across all words is moderate (e.g., <= 200) - Characters are lowercase English letters (state assumptions if asked)

Quick Answer: This question evaluates understanding of combinatorial search and string manipulation, specifically the ability to reason about unique-character constraints, subset selection, and set-like representations.

Related Interview Questions

  • Solve Two Backtracking Array Problems - Meta (hard)
  • Solve Array, Matrix, and Recommendation Problems - Meta (medium)
  • Find a String Containing Another - Meta (medium)
  • Solve Subarray Sum and Local Minimum - Meta (hard)
  • Validate abbreviations and brackets - Meta (medium)
Meta logo
Meta
Dec 15, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
27
0

Problem

You are given an array of strings words. You may choose any subset of these strings and concatenate the chosen strings in any order.

Your goal is to produce a concatenated string that contains the maximum possible number of unique characters, subject to the constraint that no character appears more than once in the concatenation.

Return any valid concatenated string (or equivalently, any subset) that achieves the maximum number of unique characters.

Input

  • words: string[]

Output

  • A string s such that:
    • all characters in s are unique
    • |s| is maximized among all valid choices

Examples

  • words = ["un","iq","ue"]
    • One optimal answer: "uniq" (length 4)
  • words = ["aa","bc","d"]
    • "aa" cannot be used (has duplicate a ), optimal answer could be "bcd"

Constraints (typical interview assumptions)

  • 1 <= words.length <= 16 (or small enough to allow backtracking)
  • Total characters across all words is moderate (e.g., <= 200)
  • Characters are lowercase English letters (state assumptions if asked)

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Software Engineer•Meta Software Engineer•Meta 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.