Given a number N. check whether a given number N  is palindrome or not in it's both formates (Decimal and Binary ).
Example 1:
Input: N = 7
Output: "Yes" 
Explanation: 7 is palindrome in it's decimal 
and also in it's binary (111).So answer is "Yes".
Example 2:
Input: N = 12
Output: "No"
Explanation: 12 is not palindrome in it's decimal
and also in it's binary (1100).So answer is "No". 
Your Task:  
You don't need to read input or print anything. Complete the function isDeciBinPalin() which takes N as input parameter and returns "Yes" if N is a palindrome in its both formates else returns "No".
Expected Time Complexity: O(logN)
Expected Auxiliary Space: O(1)
Constraints:
1<= N <=10^{7}

Difficulty: EASY
Tags: String algorithms

Mathematics
Expected Time Complexity: O(logN)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3
class Solution:
    def isDeciBinPalin (self, N):
        # code here 

Solutions:
class Solution:

	def isDeciBinPalin(self, n):
		d = 0
		x = ''
		while n > 0:
			d = n % 2
			x += str(d)
			n = n // 2
		l = x[::-1]
		n = str(n)
		if l == x and n == n[::-1]:
			return 'Yes'
		return 'No'


class Solution:

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


class Solution:

	def isDeciBinPalin(self, N):
		b = bin(N)[2:]
		n = str(N)
		if b == b[::-1] and n == n[::-1]:
			return 'Yes'
		return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		a = str(N)
		if a == a[::-1] and bin(N)[2:] == bin(N)[2:][::-1]:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		k = bin(N)[2:]
		if k == k[::-1] and str(N) == str(N)[::-1]:
			return 'Yes'
		return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		a = str(N)
		b = a[::-1]
		x = bin(N)[2:]
		y = x[::-1]
		if a == b and x == y:
			return 'Yes'
		return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		k = bin(N)[2:]
		if k == k[::-1]:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		bin = format(N, 'b')
		return 'Yes' if str(N) == str(N)[::-1] and bin == bin[::-1] else 'No'


class Solution:

	def isDeciBinPalin(self, N):
		s = str(N)
		c = bin(N)
		d = c[2:]
		if d == d[::-1] and s == s[::-1]:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		h = str(N)[::-1]
		j = str(bin(N))[2:]
		if str(N) == h and j == j[::-1]:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		tem = N
		st = N
		rev = 0
		re1 = 0
		while N > 0:
			rem = N % 10
			rev = rev * 10 + rem
			N = N // 10
		ans = bin(st)
		a = ans.replace('0b', '')
		na = int(a)
		ad = na
		while na > 0:
			re = na % 10
			re1 = re1 * 10 + re
			na = na // 10
		if re1 == ad and rev == tem:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, N):

		def f(x):
			a = str(x)
			if a == a[::-1]:
				return True
			return False

		def g(x):
			a = ''
			while x != 0:
				dig = x % 2
				a += str(dig)
				x //= 2
			if a == a[::-1]:
				return True
			return False
		if f(N) and g(N):
			return 'Yes'
		return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		n = str(N)
		rn = n[::-1]
		x = str(bin(N).replace('0b', ''))
		y = x[::-1]
		if rn == n and x == y:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		a = str(bin(N).replace('0b', ''))
		b = list(a)
		b.reverse()
		b = ''.join(b)
		if a == b:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, n):
		t = bin(n)
		t = t[2:]
		if t == t[::-1]:
			return 'Yes'
		return 'No'


class Solution:

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

	def binary(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 False
		return True

	def isDeciBinPalin(self, N):
		if self.binary(N) and self.decimal(N):
			return 'Yes'
		return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		n = str(N)
		b = bin(N).replace('0b', '')
		if n == n[::-1]:
			if b == b[::-1]:
				return 'Yes'
		return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		x = bin(N).replace('0b', '')
		y = x[::-1]
		if x == y:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		n = bin(N)
		s = str(n).replace('0b', '')
		l1 = list(str(N))
		l2 = list(s)
		l1.reverse()
		l2.reverse()
		s1 = ''.join(map(str, l1))
		s2 = ''.join(map(str, l2))
		if str(N) == s1 and s == s2:
			return 'Yes'
		else:
			return 'No'


class Solution:

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


class Solution:

	def isDeciBinPalin(self, N):
		a = bin(N)[2:]
		b = a[::-1]
		if b == a:
			return 'Yes'
		else:
			return 'No'
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.isDeciBinPalin(N))


class Solution:

	def isDeciBinPalin(self, N):
		if N == 0:
			return 'Yes'
		b = bin(N)[2:]
		s = str(N)
		if s == s[::-1] and b == b[::-1]:
			return 'Yes'
		return 'No'
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.isDeciBinPalin(N))


class Solution:

	def isDeciBinPalin(self, N):
		s1 = str(N)
		s2 = str(bin(N))[2:]
		if s1[::-1] == s1 and s2[::-1] == s2:
			return 'Yes'
		return 'No'
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.isDeciBinPalin(N))


class Solution:

	def isDeciBinPalin(self, N):
		s = str(N)
		if s == s[::-1]:
			s = self.binary(N)
			if s == s[::-1]:
				return 'Yes'
		return 'No'

	def binary(self, N):
		s = ''
		while N > 0:
			s += str(int(N % 2))
			N = int(N / 2)
		return s
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.isDeciBinPalin(N))


class Solution:

	def isDecPalin(self, n):
		(rev, tmp) = (0, n)
		while tmp > 0:
			rev = rev * 10 + tmp % 10
			tmp //= 10
		return rev == n

	def isBinPalin(self, _bin):
		(s, e) = (2, len(_bin) - 1)
		while s < e:
			if _bin[s] != _bin[e]:
				return False
			(s, e) = (s + 1, e - 1)
		return True

	def isDeciBinPalin(self, n):
		if self.isDecPalin(n) and self.isBinPalin(bin(n)):
			return 'Yes'
		return 'No'
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.isDeciBinPalin(N))


class Solution:

	def isDeciBinPalin(self, N):
		ans = str(bin(N)[2:])
		n = str(N)
		if n == n[::-1] and ans == ans[::-1]:
			return 'Yes'
		else:
			return 'No'
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.isDeciBinPalin(N))


class Solution:

	def isDeciBinPalin(self, N):
		N = str(N)
		if N == N[::-1]:
			k = str(bin(int(N)).replace('0b', ''))
			if k == k[::-1]:
				return 'Yes'
			return 'No'
		return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		s = bin(N)[2:]
		rev = 0
		digit = 0
		t = N
		while t != 0:
			digit = t % 10
			rev = rev * 10 + digit
			t //= 10
		rs = s[::-1]
		if rev == N and s == rs:
			return 'Yes'
		return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		if N == int(str(N)[::-1]):
			Bin = bin(N)[2:]
			if Bin == Bin[::-1]:
				return 'Yes'
			else:
				return 'No'
		return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		a = bin(N)
		N = list(str(N))
		a = list(str(a[2:]))
		b = N.copy()
		b.reverse()
		N = str(N)
		b = str(b)
		c = a.copy()
		c.reverse()
		a = str(a)
		c = str(c)
		if b == N and c == a:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, n):
		flag = 'No'
		sn = str(n)
		snr = sn[::-1]
		snb = str(bin(n))[2:]
		snbr = snb[::-1]
		if sn == snr and snb == snbr:
			flag = 'Yes'
		return flag


class Solution:

	def isDeciBinPalin(self, N):
		a = N
		c = ''
		while a > 0:
			x = a % 2
			c = c + str(x)
			a = a // 2
		if c == c[::-1]:
			if str(N) == str(N)[::-1]:
				return 'Yes'
		return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		r = bin(N)
		res = str(r)[2:]
		ans = res[::-1]
		if res == ans:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		b = str(bin(N)[2:])
		temp = N
		sum1 = 0
		while temp > 0:
			a = temp % 10
			sum1 = sum1 * 10 + a
			temp = temp // 10
		if b == b[::-1] and sum1 == N:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDeciBinPalin(self, N):
		t = '{0:b}'.format(N)
		s = str(t)
		u = s[::-1]
		S = str(N)
		U = S[::-1]
		if u == s and U == S:
			y = 'Yes'
			return y
		else:
			n = 'No'
			return n


class Solution:

	def isDeciBinPalin(self, N):
		s = str(N)
		ini = bin(N)
		b = ini[2:]
		if s == s[::-1] and b == b[::-1]:
			return 'Yes'
		else:
			return 'No'


def palin(s):
	s = str(s)
	if s == s[::-1]:
		return 1
	return 0

class Solution:

	def isDeciBinPalin(self, N):
		n = bin(N)
		ans = n[2:]
		if palin(N) and palin(ans):
			return 'Yes'
		return 'No'