Check if given number is power of 2 or not.
Since the value of N is as large as 10^9,store all the powers of 2 less than 10^9 in array and check if the given number is in the array or not.
Count the number of ones in binary representation of number N.If the count is equal to 1,answer is YES else
answer is NO.
AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution can be found here.