Video ID Generation (Generic)
TikTok is working to make the process of creating unique video IDs more efficient. A TikTok video ID is represented
as a string called idStream of length n, made up of the digits "0" to "9". TikTok
also has a list called videoIds, which contains m target video ID strings, each also made up of digits "0" to "9".
For each target video ID in videoIds, find the shortest part of idStream that contains all the
characters needed to form any possible arrangement (permutation) of the target string.
You will need to return an array of integers. The number at each position i in the array should be the length of the
shortest part of idStream that can include all characters of the ith string in the videoIds. If it is
impossible to create the target video ID from idStream, reutrn -1 for that position.
1Example 1
Constraints
Limits and guarantees your solution can rely on.
1 <= n <= 1051 <= m <= 2*1041 <= sum of the lengths of strings in videoIds <= 5*105All strings consist of characters '0' - '9' only.