Collatz Sequence
Given a positive integer n, find the length of its Collatz sequence. The Collatz sequence is generated sequentially where
n = n / 2if n is evenn = 3 * n + 1if n is odd- And the sequence ends if 
n = 1 
https://binarysearch.com/problems/Collatz-Sequence
Examples
Example 1
Input
- n = 
11 
Output
- answer = 
15 
Explanation
The Collatz sequence is: [11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1] and its length is 15.
      
      
Leave a comment