Explicit solution of the finite time L2-norm polynomial approximation problem