Here is the problem statement.
In this problem we need to notice that it will stop if at some point n will be 2 and with teh first if statement it will turn 1 and the cycle will break. If N has divisors other than the powers of 2 => that the cycle is unbreakable. So we only need to check if the given nurmber is a power of 2 or not.
In this problem we need to notice that it will stop if at some point n will be 2 and with teh first if statement it will turn 1 and the cycle will break. If N has divisors other than the powers of 2 => that the cycle is unbreakable. So we only need to check if the given nurmber is a power of 2 or not.
No comments:
Post a Comment