Practice Stickers to Spell Word
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Stickers to Spell Word
Problem Statement
We are given n different types of stickers. Each sticker has a lowercase English word on it. You would like to spell out the given string target by cutting individual letters from your collection of stickers and rearranging them. You can use each sticker more than once if you want, and you have infinite quantities of each sticker. Return the minimum number of stickers that you need to spell out target. If the task is impossible, return -1. Note: In all test cases, all words were chosen randomly from the 1000 most common US English words, and target was chosen as a concatenation of two random words.
Source: Stickers to Spell Word on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
stickers = ["with","example","science"], target = "thehat"
3
# Example 2
stickers = ["notice","possible"], target = "basicbasic"
-1
Constraints
Related LeetCode Problems
Practice more problems similar to Stickers to Spell Word.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.