📚 Practice Mode

Test on time complexity

Learn at your own pace with hints and detailed explanations

1 / 8
Multiple Choice

What is time complexity of fun()?

int fun(int n)
{
  int count = 0;
  for (int i = 0; i < n; i++)
     for (int j = i; j > 0; j--)
        count = count + 1;
  return count;
}
  1. $\theta(n^2)$
  2. $\theta(nlogn)$
  3. $\theta(n)$
  4. $\theta(logn)^2$