Analysis:
As the tips in the problem, the list of the incremental sequence can be divided by the pow of 2.
Then we can repeat the circle of 5 = 4(1) + 1(1) or 9 = 8(1) + 1(1)
Time Complexity:
- O(n)
Space Complexity:
- O(n)
Code
1 | class Solution(object): |