Solving T(n) = T(n-1) + 1

Coding
Recurrences
Easy
Solve .
Hint 1

Each recursive call reduces the problem size by only 1 unit while doing constant work.

Hint 2

Unroll the recurrence to count the number of calls before reaching the base case.

Show worked solution
  1. 1. Unroll the recurrence

    Expanding repeatedly gives .

  2. 2. Conclude the complexity

    With constant, .

Answer: O(n)

Related roles: Browse quant jobs

Related problems