Geeksforgeeks

Timer is Running

Given a non-negative integer N. The problem is to check if binary representation of n is palindrome or not. Note that the actual binary representation of the number is being considered for palindrome checking, no leading 0’s are being considered.

**Input:**

The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows. Each test case contains a single line of input denoting the number N.

**Output:**

For each test case, print 1 if binary representation of N is palindrome; else print 0.

**Constraints:**

1<=T<=200

0<=N<=2^{63}-1

**Example:**

**Input:**

3

1

2

3

**Output:**

1

0

1

**Explanation:**

For testcase 2: The binary representation of 2 is 10, and of course, 10 is not a palindrome.

For testcase 3: The binary representation of 3 is 11, needless to say, 11 is a palindrome.

Author: Soul_xhacker

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Pathak1899 | 436 |

yashdip123 | 380 |

kirtidee18 | 377 |

ykaushik | 261 |

_saswata | 232 |

kirtidee18 | 1057 |

ykaushik | 733 |

aggarwalvatsal5 | 709 |

pmr_3689 | 570 |

harbilassingh | 530 |

blackshadows | 5456 |

Ibrahim Nash | 5450 |

akhayrutdinov | 5111 |

mb1973 | 4976 |

Quandray | 4823 |

Login to report an issue on this page.