Find the given number binary value is palindrome or not
Problem to check the given number binary value is palindrome or not.
Example-1:
Input : n = 5 Output : true Explain : 5 binary value is "101".It is a palindrome.
Example-2:
Input : n = 4 Output : false Explain : 4 binary value is "100". It is not a palindrome.
Solution
n = 5 a = bin(n) b = a[2:] if(b == b[::-1]): print("true") else: print("false")
Output
true