![]() |
VOOZH | about |
Given a non-negative integer n. The problem is to check if binary representation of n is palindrome or not. Note that the actual binary representation of the number is being considered for palindrome checking, no leading 0’s are being considered.
Examples :
Input : 9 Output : Yes (9)10 = (1001)2 Input : 10 Output : No (10)10 = (1010)2
Approach: Following are the steps:
Implementation:
Yes
Time Complexity: O(num), where num is the number of bits in the binary representation of n.
Auxiliary Space: O(1).