Add solution for exercise 4 assignment 3.