#3291
Minimum Number of Valid Strings to Form Target I
expert · 1185 · lc medium +32 · 21.7% accepted · 176 likes · top 2%
Description
You are given string array words and string target. A string is valid if it is a prefix of any word in words. Return the minimum number of valid strings concatenated to equal target, or -1 if impossible.
Code
1
2
3