Solution (source code)

= Solution

For each $x$, $g(x)^n\to0$ if $g(x)<1$, and remains one if $g(x)=1$. Continuity gives pointwise convergence to $f(0)$ off $E=\{x:g(x)=1\}$ and to $f(1)$ on $E$. The functions are measurable and bounded by $\max_{[0,1]}|f|$, an integrable constant on a unit-length interval. The <dominated convergence theorem> therefore gives
$$
\boxed{\lim_n\int_0^1f(g(x)^n)dx=(1-|E|)f(0)+|E|f(1)}.
$$
Here $|E|$ is <Lebesgue measure>. This convex combination belongs to \b[$[f(0),f(1)]$], without requiring $f$ to be monotone.