Add solutions to exercise 3.1 and 3.2 (day18)