Given the fragment:
Code:
for(int i=0; i < n; i++)
       for(int j=0; j < (n*n); j++)
            for(int k=0;k < j; k++)
                sum++;
Find the Big-O notation.

I'm having a little trouble with this. I know that the outer loop is going to run n times, the second inner loop will run n^2 times, but I'm not sure about the third inner loop. I'm guessing this is O(n^3) since there are three nested loops, but I don't think that's right. Can someone explain this to me?