← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
The Collatz conjecture defines a process for any positive integer n:
Repeat until n becomes 1. Count the number of steps it takes.
Follow-up: If this method is called many times, how would you optimize? (Use memoization to cache results)