Dyck paths with $k$ peaks There are $n$ $1$'s and $n$ $0$'s.
We have to arrange them in a row such that at no position in this row the number of $0$'s from the beginning exceed the number of $1$'s from the beginning.
Also the number of occasions when a $1$ is immediately followed by a $0$ should be exactly $k$.
In how many ways can they be arranged?
 A: Let the number of paths be $f(n,k)$; by actual computation we find the following values for $f(n,k)$ for $1\le k\le n\le 5$:
$$\begin{array}{l|cc}
n\backslash k&1&2&3&4&5\\ \hline
1&1\\
2&1&1\\
3&1&3&1\\
4&1&6&6&1\\
5&1&10&20&10&1
\end{array}$$
Looking this up in OEIS, we find that it appears to be OEIS A$001263$, the triangle of Narayana numbers. This is confirmed by the second comment, which identifies $f(n,k)$ as the number of Dyck $n$-paths with exactly $k$ peaks. As noted at both links,
$$f(n,k)=\frac1n\binom{n}k\binom{n}{k-1}\;.$$
Added: If $b=b_1\ldots b_{2n}$ is such a sequence, let $b^+=1b_1\ldots b_{2n}$; $b^+$ has $n+1$ $1$’s and $n$ $0$’s, and it also has exactly $k$ instances of a $1$ immediately followed by a $0$. Clearly $b_{2n}=0$, so $$b^+=1^{p_1}0^{q_1}1^{p_2}0^{q_2}\ldots 1^{p_k}0^{q_k}$$ for some positive integers $p_i$ and $q_i$ such that $p_1+\ldots+p_k=n+1$ and $q_1+\ldots+q_k=n$. There are $\binom{n}{k-1}$ compositions of $n+1$ with $k$ parts and $\binom{n-1}{k-1}$ compositions of $n$ with $k$ parts, so there are $\binom{n}{k-1}\binom{n-1}{k-1}$ pairs of $k$-part compositions $p_1+\ldots+p_k=n+1$ and $q_1+\ldots+q_k=n$. Each pair gives rise to a sequence $1^{p_1}0^{q_1}1^{p_2}0^{q_2}\ldots 1^{p_k}0^{q_k}$, but this sequence may not be $b^+$ for any admissible $2n$-sequence $b$.
Say that two sequences of $n+1$ $1$’s and $n$ $0$’s matching the (generalized) regular expression $(1^+0^+)^k$ are equivalent if they generate the same circular sequence; this clearly is an equivalence relation, and each equivalence class has $k$ elements. (E.g., $1^{p_3}0^{q_3}1^{p_4}0^{q_4}\ldots 1^{p_k}0^{q_k}1^{p_1}0^{q_1}1^{p_2}0^{q_2}$ is equivalent to $1^{p_1}0^{q_1}1^{p_2}0^{q_2}\ldots 1^{p_k}0^{q_k}$.) Raney’s lemma [PDF, p. 5] (= Cycle Lemma [PDF] with $k=1$) implies that exactly one of the $2n+1$ circular shifts of $1^{p_1}0^{q_1}1^{p_2}0^{q_2}\ldots 1^{p_k}0^{q_k}$ is $b^+$ for some admissible $2n$-sequence $b$. (To see this, just replace each $0$ by $-1$.) It’s clear that this shift must be one of the $k$ matching the pattern $(0^+1^+)^k$, so each equivalence class contains exactly one sequence that is $b^+$ for some admissible $2n$-sequence $b$. Thus, there are $$\frac1k\binom{n}{k-1}\binom{n-1}{k-1}=\frac1n\binom{n}{k-1}\binom{n}k$$ admissible $2n$-sequences.
(This argument is my slight adaptation of Richard P. Stanley’s solution to Exercise $36$(a) of the excerpt on problems relating to Catalan numbers taken from Volume $2$ of his Enumerative Combinatorics; the excerpt and solutions can be downloaded from this page.)
