add solution for exercise-3.1