# JavaScript (ES6), <s> 83 </s> 82 bytes Returns a Boolean value. <!-- language-all: lang-javascript --> f=(s,a=[...new Set(s)],p)=>s.match(p)&&a.every((c,n)=>f(s,a.filter(_=>n--),[p]+c)) [Try it online!](https://tio.run/##fctBCsIwEEDRvaeQLsoMpgNN3aaX6LIUCXGilZqEJFQ8fbRbKW7/4z/0qpOJc8iN81cuxSpIQquRiBy/jgNnSDiJgKpP9NTZ3CFgXWvileMbwAj3JbtNZOclc4SL6l3ToBjDdDKIxXiX/MK0@BtYqFrZnSvEw2/ea7tRdq1sO/nHNiof "JavaScript (Node.js) – Try It Online") ### How? If all permutations of the \$N\$ symbols are present in the input string \$s\$, so are all prefixes of said permutations. Therefore, it's safe to test that all \$p\$ are found in \$s\$ even when \$p\$ is an incomplete permutation whose size is less than \$N\$. That's why we can use a function that recursively builds each permutation \$p\$ of the symbols and tests whether \$p\$ exists in \$s\$ at each iteration, even when \$p\$ is still incomplete. ### Commented f = ( // f is a recursive function taking: s, // s = input string a = [...new Set(s)], // a[] = list of unique characters in s p // p = current permutation, initially undefined ) => // s.match(p) && // abort if p is not found in s // NB: s.match(undefined) is truthy because it's equivalent // to looking for an empty string in s a.every((c, n) => // otherwise, for each character c at position n in a[]: f( // do a recursive call: s, // pass s unchanged a.filter(_ => n--), // remove the n-th character in a[] (0-indexed) [p] + c // coerce p to a string and append c to p ) // end of recursive call ) // end of every()