added solution to problem 10 and made problem 7 much more efficient