solution for problem 1, has notes in file