Bending Spoons interview question

Explain the difference between overfitting and underfitting. How can you prevent them?