Problem: Palindromic Binary Representation
Given an integer A find the Ath number whose binary representation is a palindrome. NOTE
Consider the 1st number whose binary representation is a palindrome as 1, instead of 0
Do not consider the leading zeros, while considering the binary representation.
1 <= A <= 2104
The first and only argument is an integer A.
Return an integer denoting the Ath number whose binary representation is a palindrome.
Input 1: A = 1 Input 1: A = 9
Output 1: 1 Output 2: 27
1st Number whose binary representation is palindrome is 1
9th Number whose binary representation is palindrome is 27 (11011)
Solution in C++:
If you have any questions or queries, feel free to drop a comment in the comments section below.
Note: Help us improve this blog
If you have a better solution, and you think you can help your peers to understand this problem better, then please drop your solution and approach in the comments section below.
We will upload your approach and solution here by giving you the proper credit so that you can showcase it among your peers.