Added solution for logic exercise.