Counting the number of times the inner most loop gets executed equals,
n-2 + n-3 + n-2 + ....1
+n-3 + n-2 + .... + 1
+
...
+ 3 + 2 + 1
= (n-2)(n-1)/2 + (n-3)(n-2)/2 + ... + 3*4/2
= (n2 - 3n + 2 + n2 - 5n + 6 + .... )/2
= O(n3) as there are n terms and n2 is the dominating term in each of them.