Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Stickers to Spell Word

XPChallenge Points: 30
levelLevel: Hard

You are given a collection of n stickers, where each sticker contains a lowercase English word.

Your goal is to form the string target by cutting out individual letters from the stickers and rearranging them in any order.

You may use any sticker multiple times and assume you have an unlimited supply of each sticker type.

Return the minimum number of stickers required to construct the target string.
If it’s not possible to form the target using the available stickers, return -1.

Example 1:

Input: stickers = ["these", "guess", "about", "garden", "him"], target = "atom"

Output: 2

Explanation:

We can use letters from "about" twice and "these" once to form "atom". This requires a total of 3 stickers.

Example 2:

Input: stickers = ["look", "just", "like", "her"], target = "hello"

Output: 3

Explanation:

The letter 'h' cannot be formed using any given sticker.

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result