Wells Fargo interview question

How to avoid overfitting and underfitting in machine learning?