This loop doubles i until it reaches n:
count = 0
i = 1
while i < n:
i *= 2
count += 1
Implement count_doubling_steps(n) so it returns the final value of count.
Example 1
Input:
count_doubling_steps(8)
Output:
3
i goes 1, 2, 4, 8.
Example 2
Input:
count_doubling_steps(9)
Output:
4
i goes 1, 2, 4, 8, 16.
1 <= n <= 10**18No results yet
Run your code to check it against the examples, or submit to run every test.