Classical and Quantum Polynomial Reconstruction via Legendre Symbol Evaluation