Data Structures & AlgorithmsHardICPC regional · Codeforces Div2 B

Problem: For the same Collatz process starting at n = 27, what is the largest value that appears in the sequence?

  1. A. 111
  2. B. 82
  3. C. 3077
  4. D. 9232

Correct answer: D. 9232

Tracking the maximum while simulating, the sequence from 27 peaks at 9232 (reached as 3 · 3077 + 1) before falling to 1. 111 is the number of steps, 82 is only the first value after 27, and 3077 is the largest ODD value.

More Coding Interview Problems questions

Exams that ask this topic