Skip to main content
3 of 5
added 308 characters in body
user avatar
user avatar

Io, 110 bytes

method(x,n,K :=Range 1 to(n)asList;(O :=x map(i,v,x slice(i,i+n)))unique select(x,x sort==K)size==K reduce(*))

Try it online!

Explanation (Ungolfed)

method(x,n,                        // Take the tbd string and the num of uniquified integers
    K := Range 1 to(n)asList       // K = [1..n]
    O := x map(i,v,x slice(i,i+n)) // O = all n-slices of x
    O unique                       // Uniquify these slices
    select(x,                      // Filter: (x : current item)
        x sort==K                  //     sort(x) == [1..n]?
    ) size                         // Number of items that satisfy this
    == K reduce(*)                 // == factorial(n)?
)
user92069