Added solution to 18.1 and 18.2