  We give a new approach to characterizing and computing the set of global
maximizers and minimizers of the functions in the Takagi class and, in
particular, of the Takagi--Landsberg functions. The latter form a family of
fractal functions $f_\alpha:[0,1]\to\mathbb R$ parameterized by
$\alpha\in(-2,2)$. We show that $f_\alpha$ has a unique maximizer in $[0,1/2]$
if and only if there does not exist a Littlewood polynomial that has $\alpha$
as a certain type of root, called step root. Our general results lead to
explicit and closed-form expressions for the maxima of the Takagi--Landsberg
functions with $\alpha\in(-2,1/2]\cup(1,2)$. For $(1/2,1]$, we show that the
step roots are dense in that interval. If $\alpha\in (1/2,1]$ is a step root,
then the set of maximizers of $f_\alpha$ is an explicitly given perfect set
with Hausdorff dimension $1/(n+1)$, where $n$ is the degree of the minimal
Littlewood polynomial that has $\alpha$ as its step root. In the same way, we
determine explicitly the minima of all Takagi--Landsberg functions. As a
corollary, we show that the closure of the set of all real roots of all
Littlewood polynomials is equal to $[-2,-1/2]\cup[1/2,2]$.
