I have a program below which calculates the Maximum Pairwise Product.
for i in range(n):
for j in range(i + 1, n):
product = max(product, a[i] * a[j])
As per my calculation the above program takes (n^2 - n) steps where n is the number of elements but the book I am following it says n^2 steps. Can anyone help me in understanding which is right?