Wait till this appears on LeetCode and gets included in the FAANG whiteboard interviews to be solved in 15 minutes.
See here: http://www.njohnston.ca/2014/08/obvious-does-not-imply-true-...
It has been asked in real interviews
The solution to this problem is given by de Bruijn sequences: https://en.wikipedia.org/wiki/De_Bruijn_sequence
And can confirm that at least one FAANG company has asked this in a real interview.
And if so - if someone solves this programming task on leetcode have they not then also solved the permutation problem from OP?