Can a Sticker Pack Spell Out a Chat Message

Last updated: November 29, 2026

Quick Overview

Each sticker in a Google Messages sticker pack shows one letter. Given the message text and the multiset of letters in the pack, return True if the message's letters (ignoring spaces) can be spelled using each sticker at most once.

Google
Coding & Algorithms
Software Engineer
Google
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Each sticker in a Google Messages sticker pack shows one letter. Given the message text and the multiset of letters in the pack, return True if the message's letters (ignoring spaces) can be spelled using each sticker at most once.

A quick counting question in the style of Google phone screens, often used to warm up before a harder second problem. The interviewer is checking frequency counting with a hash map or fixed array and early exit, plus clean handling of spaces and case.

What the Interviewer Expects
  • Counts available letters once rather than searching repeatedly
  • Decrements counts while scanning the message and exits early
  • Clarifies case sensitivity and whitespace handling
  • States O(n + m) time and O(alphabet) space
  • Writes compact, readable code
Key Topics to Cover
Hash Map
Frequency Counting
Strings
Early Exit
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Return the minimum number of extra stickers you would need to buy.
  • How many full copies of the message can one pack spell?
  • What changes if the pack arrives as a stream and the message is fixed?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Input: message (letters and spaces) and pack (a string of sticker letters).
  • Output: True if every non-space character of message can be matched to a distinct sticker.
  • Clarify: I will treat...
High-Level Design

Build a count of the pack's letters. Then walk the message; for each letter, decrement its count, and if the count would drop below zero, return False immediately. Counting the pack first and consumin...


Submit Your Answer
Markdown supported