Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: A monotone sequence is built: start with 1, and append the next number as (previous number) + (number of digits of previous number). The sequence is 1, 2, 3, ... with this rule. After 6 steps (starting from 1), what is the value?

  1. A. 6
  2. B. 28
  3. C. 7
  4. D. 64

Correct answer: C. 7

All values stay single-digit, so each step adds 1: 1 → 2 → … → 7 after 6 steps. Counting the start as a step gives 6, adding the digit sum instead of the digit count gives 1, 2, 4, 8, 16, 23, 28, and plain doubling gives 64.

More Coding Interview Problems questions

Exams that ask this topic