Example 3.3.2 Let \( S=\{1,2,3,4\}, n \) terms of the sequence \( a_{1}, a_{2}, \cdots, a_{n}\left(a_{i} \in S\right) \) have the following property: for any non-empty subset \( B \) of \( S \), there are adjacent \( |B| \) terms in the sequence that exactly form the set \( B \). Find the minimum value of \( n \).
For each element in $S$, such as 1, consider the 2-element subsets containing 1, which are $\{1,2\},\{1,3\},\{1,4\}$. These must all appear in the sequence, so 1 must appear at least twice in the sequence. Similarly, 2, 3, and 4 must also appear twice, hence $n \geqslant 8$.
When $n=8$, a sequence that meets the requirements can be constructed as: $3,1,2,3,4,1,2,4$.