Assignment 7.1 and 6.1 New Updates

looks like you are looping 3 times for O(n^2 + n) i think the can be made more effecient. can you think of a way to cut a loop?