from collections import Counter
def minSubstrLenForPermutation(s, arr):
def containsPermutation(s1, s2):
count_s1 = Counter(s1)
count_s2 = Counter(s2)
return all(count_s1[char] >= count_s2[char] for char in count_s2)
result = []
for pattern in arr:
min_len = float('inf')
found = False
for i in range(len(s)):
for j in range(i + len(pattern), len(s) + 1):
if containsPermutation(s[i:j], pattern):
min_len = min(min_len, j - i)
found = True
if found:
result.append(min_len)
else:
result.append(-1)
return result
# Example usage:
s = "064819848398"
arr = ["088", "364", "07"]
result = minSubstrLenForPermutation(s, arr)
print(result)