Given a non-negative integer N. Check whether the Binary Representation of the number is Palindrome or not. 
Note: No leading 0’s are being considered.
Example 1:
Input:
N = 5
Output: 1
Explanation: The Binary Representation of
5 is 101 which is a Palindrome.
Ã¢â¬â¹Example 2:
Input: 
N = 10
Output: 0
Explanation: The Binary Representation of
10 is 1010 which is not a Palindrome.
Your Task:
You don't need to read input or print anything. Your task is to complete the function binaryPalin() which takes an integer N as input and returns 1 if the binary representation of N is a palindrome. Else, return 0 .
Expected Time Complexity: Log(N). 
Expected Auxiliary Space: O(1).
Constraints:
0<=N<=2^{63}-1

Difficulty: EASY
Tags: String algorithms

Bit manipulation

Data structures
Skill types: Bit manipulation

Data structures
Expected Time Complexity: Log(N).
Expected Auxiliary Space: O(1).

Starter code:
#User function Template for python3
class Solution:
	def binaryPalin (self, N):
		# Your Code Here

Solutions:
class Solution:

	def binaryPalin(self, N):
		b = str(bin(N).replace('0b', ''))
		if b == b[::-1]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		s = '{0:b}'.format(N)
		if s == s[::-1]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, n):
		b = bin(n)[2:]
		if b == b[::-1]:
			return 1
		return 0


class Solution:

	def binaryPalin(self, N):
		a = bin(N).replace('0b', '')
		if a[::-1] == a:
			return 1
		return 0


class Solution:

	def binaryPalin(self, N):
		ans = 0
		ans2 = 0
		i = 0
		while N != 0:
			bit = N & 1
			ans = bit * 10 ** i + ans
			ans2 = ans2 * 10 + bit
			i += 1
			N = N >> 1
		if ans == ans2:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		s = bin(N)[2:]
		if s == s[::-1]:
			return 1
		return 0


class Solution:

	def palin(num):
		check = num[::-1]
		if num == check:
			return 1
		else:
			return 0

	def binaryPalin(self, N):
		bina = ''
		while N > 0:
			bina += str(N % 2)
			N = int(N / 2)
		return Solution.palin(bina)


class Solution:

	def binaryPalin(self, N):
		s = ''
		temp = N
		while N > 0:
			s += str(N % 2)
			N = N // 2
		if s == s[::-1]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		a = bin(N)[2:]
		b = a[::-1]
		if a == b:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		a = int(bin(N)[2:])
		temp = a
		rev = 0
		while temp:
			rem = temp % 10
			rev = rev * 10 + rem
			temp = temp // 10
		if rev == a:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		k = bin(N)[2:]
		t = k[::-1]
		if k == t:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		c = bin(int(N)).replace('0b', '')
		if str(c) == str(c)[::-1]:
			return 1
		return 0


class Solution:

	def binaryPalin(self, N):
		num = bin(N)[2:]
		return int(num == num[::-1])


class Solution:

	def binaryPalin(self, N):
		a = bin(N)
		s = str(a)
		x = ''
		for i in range(len(s) - 1, 1, -1):
			x = x + s[i]
		b = x[::-1]
		if x == b:
			return 1
		return 0


class Solution:

	def binaryPalin(self, N):
		binary_string = str(bin(N).replace('0b', ''))
		if binary_string == binary_string[::-1]:
			return 1
		return 0


class Solution:

	def binaryPalin(self, n):
		s = str(bin(n))[2:]
		if s == s[::-1]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		res = bin(N)
		a = str(res)
		ans = res.replace('0b', '')
		p = ans[::-1]
		if ans == p:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		s = str(bin(N))
		l = s.split('b')
		a = l[1]
		p = a[::-1]
		if a == p:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		b = list(bin(N))
		l = b[2:]
		if l == l[::-1]:
			return 1
		return 0


class Solution:

	def binaryPalin(self, N):
		ans = bin(N)
		ans1 = ''
		ans = ans[2:]
		ans1 = ans[::-1]
		a = ans == ans1
		if a == True:
			return 1
		return 0


class Solution:

	def binaryPalin(self, N):
		bi = bin(N).replace('0b', '')
		if bi == bi[::-1]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N: int) -> int:
		bin_number = self.binary(N)
		if bin_number == bin_number[::-1]:
			return 1
		else:
			return 0

	@staticmethod
	def binary(n: int) -> str:
		result = []
		while n:
			result.insert(0, str(n % 2))
			n //= 2
		return ''.join(result)


class Solution:

	def binaryPalin(self, N):
		n1 = bin(N).replace('0b', '')
		for i in n1:
			if n1 == n1[::-1]:
				return 1
				break
			else:
				return 0


class Solution:

	def binaryPalin(self, N):
		x = bin(n)
		x = x[2:]
		l = 0
		r = len(x) - 1
		while l < r:
			if x[l] == x[r]:
				l += 1
				r -= 1
			else:
				return 0
		return 1


class Solution:

	def binaryPalin(self, N):
		no = bin(N)[2:]
		if int(no[0]) != 0:
			if no == no[::-1]:
				return 1
			else:
				return 0
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		b = bin(N)[2:]
		return int(b == b[::-1])


class Solution:

	def binaryPalin(self, N):
		l = []
		while N > 0:
			l.append(N % 2)
			N //= 2
		f = l[::-1]
		if f == l:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		a = '{0:b}'.format(int(N))
		c = a[::-1]
		if a == c:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		arr = []
		while N != 0:
			arr.append(N & 1)
			N >>= 1
		length = len(arr)
		iterations = length // 2
		for x in range(iterations):
			if arr[x] != arr[length - x - 1]:
				return 0
		return 1


class Solution:

	def binaryPalin(self, N):
		x = int(bin(N)[2:])
		if str(x) == str(x)[::-1]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		l = str(bin(N)[2:])
		h = l[::-1]
		if l == h:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		binstr = bin(N)[2:]
		binpal = ''.join(list(reversed(binstr)))
		if binpal == binstr:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		N = str(bin(N)[2:])
		n = len(N)
		for i in range(int(n / 2)):
			if N[i] != N[n - i - 1]:
				return 0
		return 1


class Solution:

	def binaryPalin(self, N):
		binaryN = bin(N).replace('0b', '')
		rev = binaryN[::-1]
		if binaryN == rev:
			return 1
		return 0


class Solution:

	def binaryPalin(self, N):
		x = bin(N)
		y = x[::-1]
		if x[2:] == y[:-2]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		binary = bin(N)[2:]
		rbin = binary[::-1]
		if binary == rbin:
			return 1
		else:
			return 0


class Solution:

	def binary(self, num):
		binary = ''
		while num != 0:
			rem = num % 2
			binary = str(rem) + binary
			num //= 2
		return binary

	def binaryPalin(self, N):
		binary = self.binary(N)
		temp = str(int(binary))
		rev = temp[::-1]
		if temp == rev:
			return 1
		return 0


class Solution:

	def binaryPalin(self, n):
		reverseBinary = ''
		while n:
			reverseBinary += str(n & 1)
			n >>= 1
		if reverseBinary == reverseBinary[::-1]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		binary = bin(N).replace('0b', '')
		n = len(binary)
		for i in range(n):
			if binary[i] != binary[n - i - 1]:
				return 0
		return 1


class Solution:

	def binaryPalin(self, N):
		st = bin(N)[2:]
		if st == st[::-1]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		a = bin(N)
		b = a.replace('0b', '')
		c = str(b)
		d = c[::-1]
		if b == d:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		return 1 if bin(N)[2:] == bin(N)[2:][::-1] else 0
if __name__ == '__main__':
	t = int(input())
	for tc in range(t):
		n = int(input())
		ob = Solution()
		print(ob.binaryPalin(n))


class Solution:

	def binaryPalin(self, N):
		binary = format(N, 'b')
		if str(binary) == str(binary)[::-1]:
			return 1
		else:
			return 0
if __name__ == '__main__':
	t = int(input())
	for tc in range(t):
		n = int(input())
		ob = Solution()
		print(ob.binaryPalin(n))


class Solution:

	def binaryPalin(self, N):
		s = bin(N).replace('0b', '')
		str(s)
		if s == s[::-1]:
			return 1
		else:
			return 0
if __name__ == '__main__':
	t = int(input())
	for tc in range(t):
		n = int(input())
		ob = Solution()
		print(ob.binaryPalin(n))


class Solution:

	def binaryPalin(self, N):
		bi = '{0:b}'.format(N)
		st = bi[::-1]
		for i in range(len(bi)):
			if st[i] != bi[i]:
				return 0
		return 1
if __name__ == '__main__':
	t = int(input())
	for tc in range(t):
		n = int(input())
		ob = Solution()
		print(ob.binaryPalin(n))


class Solution:

	def binaryPalin(self, N):
		bin = ''
		while N != 0:
			bin = str(N % 2) + bin
			N = N // 2
		i = 0
		j = len(bin) - 1
		while i <= len(bin) - 1 or j > i:
			if i == j or i > j:
				return 1
			elif bin[i] != bin[j]:
				return 0
			i = i + 1
			j = j - 1


class Solution:

	def binaryPalin(self, N):
		s = bin(N)[2:]
		m = str(s)
		if m == m[::-1]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		N = bin(N)
		N_final = N[2:len(N)]
		N_final_rev = ''
		for i in range(len(N_final) - 1, -1, -1):
			N_final_rev += N_final[i]
		if N_final == N_final_rev:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, num):
		b = bin(num)[2:]
		if b == b[::-1]:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):

		def binary(num):
			if int(num) == 1:
				return '1'
			else:
				re = int(num) % 2
				num = int(int(num)) // 2
				return str(re) + binary(num)
		x = binary(N)
		x1 = x[::-1]
		if x1 == x:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):

		def isPalindrome(x):
			return x == x[::-1]
		binary = bin(N)
		return 1 if isPalindrome(binary[2:]) else 0


class Solution:

	def binaryPalin(self, N):
		a = bin(N)[2:]
		x = str(a)
		ans = x[::-1]
		if x == ans:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		o = str(bin(N)[2:])
		p = o[::-1]
		if p == o:
			return 1
		else:
			return 0


class Solution:

	def binaryPalin(self, N):
		n = bin(N)
		n = list(n)
		n = n[2:]
		k = n[::-1]
		if k == n:
			return 1
		return 0


class Solution:

	def binaryPalin(self, N):
		a = bin(N)
		x = a[a.index('b') + 1:]
		if x == x[::-1]:
			return 1
		else:
			return 0