Solution to exercise #1
Solution to exercise #2.