Consider a vector $V$ of length $2n-1$ whose entries are either $1$ or $0$, chosen independently and uniformly at random. Let $X\_i$ be the number of $1$s in subvector $V[i,i+n-1]$. We know $\mathbb{E}(X\_i)=n/2$ and we can consider the $X\_i$ as representing a 1d discrete random walk (with $i$ as the time variable). The difference $X\_{i+1}-X\_i$ can be $-1$, $0$ or $1$. What is the expected maximum distance of the $X\_i$ from $n/2$? (My interest is in large $n$ results.)


Intuitively it seems that the dependency between successive $X\_i$ values will reduce the expected maximum distance of the random walk. Had we just sampled $n$ vectors uniformly at random with no dependency then the answer would be asymptotically something like $\sqrt{\frac{n}{c} \ln n}$, for some constant $2 < c < 2.5$. However our random walk "reverts to the mean".



Expected maximum distance of a random walk
Define $S\_i$, $i=1,\ldots,2n$ to be the number of $1$s in the interval $[0,i]$, minus $i/2$. Then, 
with your notation, $Y\_i:=X\_{i+1}-n/2=S\_{n+i}-S\_i$. You are interested in
$M^\*\_n:=\max\_{i=1}^n |Y\_i|/\sqrt{n}$. Since $\{S\_{[nt]}\}/\sqrt{n}$, $t\geq 0$, converges to one half times a Brownian motion $\{W\_t\}$, it follows that $M\_n^\*$ converges to the random variable 
$X^\*=0.5 \max\_{t\in [0,1]} |W\_{t+1}-W\_t|$. Since this random variable is of order $1$, the expectation you are after is of order $\sqrt{n}$.


