A question that was asked during a job interview (which I pretty much failed) and sadly, something I still cannot figure out.
Let's assume that you're given some positive integer, n. Assume that you construct a sequence consisting of only 1 and 0, and you want to construct a sequence of length 2^n + n-1 such that every sequence of length n consisting of adjacent numbers is unique.
for instance
00110 (00, 01, 11, 10) for n=2
How would one construct such a sequence?
I think one should start with 0000..0 (n zeroes) and do something about it.
If there is a constructive way of doing it, maybe I could extend that method to constructing a sequence consisting of only 0, 1, ..., k-1, and having length k^n + n-1 such that every sequence of length n consisting of adjacent numbers is unique (or maybe not..)
(sorry, my sequence for n=3 is wrong, so I deleted it. also, i've never heard of De Bruijin's sequence. I know it now! thanks for all the answers and comments).