Check If Binary Representation of a Number is Palindrome

Given an integer N, determine if its binary representation is a palindrome.

Input:

The first line contains a single integer ‘T’ representing the number of test cases.

The first and only line of each test case contains a single integer ‘N’ denoting the given integer.

Output:

Return true if the binary representation of the given number is a palindrome. Else return false.

Example:

Input:
T = 2
N = 5
N = 14
Output:
True
False
Explanation:

The binary representation of 5 is "101", which is a palindrome. The binary representation of 14 is "1110", which is not a palindrome.

Constraints:

  • 1 ≤ T ≤ 100
  • 1 ≤ N ≤ 1018
Note:
You do not need to print anything, it has already been taken care of. Just implement the given function.
AnswerBot
4mo

Check if the binary representation of a number is a palindrome.

  • Convert the integer to binary representation.

  • Check if the binary representation is a palindrome by comparing it with its reverse.

  • Return t...read more

Help your peers!
Select
Add answer anonymously...

Nagarro Software Developer Intern interview questions & answers

A Software Developer Intern was asked Q. Word Break Problem Statement You are given a list of N strings called A. Your ta...read more
A Software Developer Intern was asked Q. Sort 0 and 1 Problem Statement Given an integer array ARR of size N containing o...read more
A Software Developer Intern was asked Q. Check If Binary Representation of a Number is Palindrome Given an integer N, det...read more

Popular interview questions of Software Developer Intern

A Software Developer Intern was asked Q1. Word Break Problem Statement You are given a list of N strings called A. Your ta...read more
A Software Developer Intern was asked Q2. Sort 0 and 1 Problem Statement Given an integer array ARR of size N containing o...read more
A Software Developer Intern was asked Q3. Check If Binary Representation of a Number is Palindrome Given an integer N, det...read more
Nagarro Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits