Big-O of nested loop

An outer loop runs ii from 11 to nn; an inner loop runs jj from 11 to ii. For n=10n = 10, how many inner-loop iterations execute in total?

Show hints (2)+
  1. The inner count grows with $i$.
  2. $\sum_{i=1}^{n} i = n(n+1)/2$.

Answer

Reveal answer →

55

Want the full step-by-step worked solution? It's part of Premium — along with a worked solution for every question in the bank.

Asked at: Optiver, IMC

Related questions