Search
⌘K

Leetcode 3292. Minimum Number of Valid Strings to Form Target II

Given words and a target, find the minimum number of segments needed to partition target so each segment is a prefix of some word in words (return -1 if impossible). This is a string-segmentation / shortest-path DP problem that requires efficient prefix matching (e.g., trie or prefix lookup) to handle large target and word lengths.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.