问一个题...# JobHunting - 待字闺中
m*o
1 楼
Suppose we are given N different types of stickers. Each sticker type has a
word on it, for example, we could have 4 sticker types that say “math”, “
science”, “english”, and “history” respectively. You would like to
spell out the target word “learning” by cutting out individual letters
from your collection of stickers and rearranging them. If you are allowed to
use more than one sticker of a given type to form the target word, what is
the minimum number of total stickers you will require? In the example above,
one possible optimal solution is to use 1 “math” sticker, 2 “english”
stickers, and 1 “history” sticker, for a total of 4 stickers.
这题咋做...没什么很好的思路,难道用dfs?
word on it, for example, we could have 4 sticker types that say “math”, “
science”, “english”, and “history” respectively. You would like to
spell out the target word “learning” by cutting out individual letters
from your collection of stickers and rearranging them. If you are allowed to
use more than one sticker of a given type to form the target word, what is
the minimum number of total stickers you will require? In the example above,
one possible optimal solution is to use 1 “math” sticker, 2 “english”
stickers, and 1 “history” sticker, for a total of 4 stickers.
这题咋做...没什么很好的思路,难道用dfs?