Sub-Array with a unique element You have an Array of length n. If you pick a sub-array from the array, it must contain at least one unique element. The sub-array could be of any length but must contain consecutive/successive elements.

The question is what is the minimum number of characters you need to ensure that your array has the property mentioned and how should those elements be placed in the array? the answer needs to be in terms of n.

For Instance,

Let n be 10. Then you can place n different characters in it.

a, b, c, d, e, f, g, h, i, j

such that any sub-array would contain all unique elements. In this case the answer is n. But, of course this is not optimal as you need only one unique element in the sub-array.

In the same example of to pick 2 elements a and b and place them as

a, b, a, b, a, b, a, b, a, b

and you pick a sub-array of the first 4 elements a, b, a, b then you do not have any unique element. In this case the answer is 2 but is Incorrect.

So, what is the minimum number of unique element (and their placement in the array) you need to ensure your array has the property mentioned.
$\lceil \lg n \rceil$.

For example, for $n=10$, try ABACABADAB.  See if you can work out the pattern.

(I'll leave it at that, as this is a nice exercise problem and I'll let you have the joy of solving it on your own.)