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 } }
Yes, the time complexity of this is O(n^2).