For a computer science class we were asked to analyze the run time of an algorithm. The answer was posted. I am not sure the proof is correct. I believe the answer should be $ k c(n^2) $ (where $k$ is a constant). The part that I understand the least is line 2 to line 3. Can anyone give guidance?

This is the first half of the problem, in case it's useful:

Matt
Looks correct to me. From line 2 to line 3, you can make a change of variable $m=j-i$, then $m$ would be from $1$ to $n-i$.