An extremal problem for polynomials