Adding solutions for the 6th homework