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.
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
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- 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 ProblemsSample Answer
Requirements
- Input:
message(letters and spaces) andpack(a string of sticker letters). - Output: True if every non-space character of
messagecan 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...