Question

Consider the set of strings S that contains the binary representation of the numbers 0 to 99. What is the shortest string T such that every element of S is a substring of T?

Was it helpful?

Solution

What you're asking for is very similar to the binary De Bruijn sequence. The algorithm for that problem, which uses Eulerian cycles, can easily be adapted to solve your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top