  In 1970, Lawson solved the topological realization problem for minimal
surfaces in the sphere, showing that any closed orientable surface can be
minimally embedded in $\mathbb{S}^3$. The analogous problem for surfaces with
boundary was posed by Fraser and Li in 2014, and it has attracted much
attention in recent years, stimulating the development of many new
constructions for free boundary minimal surfaces. In this paper, we resolve
this problem by showing that any compact orientable surface with boundary can
be embedded in $\mathbb{B}^3$ as a free boundary minimal surface with area
below $2\pi$. Furthermore, we show that the number of minimal surfaces in
$\mathbb{S}^3$ of prescribed topology and area below $8\pi$, and the number of
free boundary minimal surfaces in $\mathbb{B}^3$ with prescribed topology and
area below $2\pi$, grow at least linearly with the genus. This is achieved via
a new method for producing minimal surfaces of prescribed topology in
low-dimensional balls and spheres, based on the optimization of Laplace and
Steklov eigenvalues in the presence of a discrete symmetry group.
  As a key ingredient, we develop new techniques for proving the existence of
maximizing metrics, which can be used to resolve the existence problem in many
symmetric situations and provide at least partial existence results for
classical eigenvalue optimization problems.
