Check if a Integer is power of 8 or not
Easy Accuracy: 50.01% Submissions: 134 Points: 2

Given a positive integer N, The task is to find if it is a power of eight or not.

Example 1: 

Input: 64
Output: Yes
Explanation: 64 is power of 8.

Example 2:

Input: 75
Output: No
Explanation: 75 is not a power of 8.

Your Task:
You don't need to read or print anything. your task is to complete the function is_power_of_eight() which takes N as the input parameter and returns "Yes" if N is power of eight otherwise returns "No"(Wihtout quotes).

Expected Time Complexity: O(log(N))
Expected Space Complexity: O(1)

1 <= N <= 1018

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Check if a Integer is power of 8 or not

Output Window