
Asked in Nagarro
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!
Add answer anonymously...
Top Software Developer Intern Interview Questions Asked at Nagarro
Q. Word Break Problem Statement You are given a list of N strings called A. Your ta...read more
Q. Sort 0 and 1 Problem Statement Given an integer array ARR of size N containing o...read more
Q. Count Pairs with Given Sum Given an integer array/list arr and an integer 'Sum',...read more
Interview Questions Asked to Software Developer Intern at Other Companies
Top Skill-Based Questions for Nagarro Software Developer Intern
C++ Interview Questions and Answers
300 Questions
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Operating Systems Interview Questions and Answers
250 Questions
System Design Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


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
AmbitionBox Awards
Get AmbitionBox app

