Sum of sequence complexity I try to find out what is the time complexity of this program:

for (int i =0; i &lt; n; i++)
{
    for (int j = i+1; j &lt; n; j++)
    {
         //Do something O(1)
    }
}


I tried to find any explanation, As I see, it something like Arithmetic progression sum (n(n-1)/2). 

Is it? or it's just O(n^2)
The inner loop will iterate once with $j=i+1$, once again with $j=i+2$, and so on, up to the last iteration with $j=n-1$, so there will be, for each $i$ in the outer loop, $(i+1)-(n-1)-1=n+i-1$ time contributions from the inner loop. Add these to get your answer.