3292. Minimum Number of Valid Strings to Form Target II
You are given an array of strings
words
and a stringtarget
.A string
x
is called valid ifx
is a prefix of any string inwords
.Return the minimum number of valid strings that can be concatenated to form
target
. If it is not possible to formtarget
, return-1
.A prefix of a string is a substring that starts from the beginning of the string and extends to any point within it.