top of page

### Looking to master object-oriented and system design for tech interviews or career growth?

• Improve your system design and machine coding skills.

• Study with our helpful resources.

**We're in beta mode and would love to hear your feedback.

Search

# Palindromic Binary Representation InterviewBit Solution

Problem Description

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.

Problem Constraints

1 <= A <= 2104

Input Format

The first and only argument is an integer A.

Output Format

Return an integer denoting the Ath number whose binary representation is a palindrome.

Example Input

Input 1: A = 1 Input 1: A = 9

Example Output

Output 1: 1 Output 2: 27

Example Explanation*

Explanation 1:

` 1st Number whose binary representation is palindrome is 1`

Explanation 2:

` 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.