Source: https://babel.csfoy.ca/profs/maverreault/NYA/Exercices+Sol/Ch04_Exercices+Solutions.pdf