I need to calculate the time complexity of the following code:
for (i = 1; i <= n; i++) { for(j = 1; j <= i; j++) { // Some code } } >
for (i = 1; i <= n; i++) { for(j = 1; j <= i; j++) { // Some code } }
Indeed, it is O(n^2). See also a very similar example with the same runtime here.