Given an integer, check whether it is a palindrome or not.
Example 1:
Input: n = 555
Output: Yes
Example 2:
Input: n = 123
Output: No
 
Your Task:
You don't need to read or print anything. Your task is to complete the function is_palindrome() which takes the number as input parameter and returns "Yes" if it is palindrome otherwise returns "No"(Without quotes).
 
Expected Time Complexity: O(x)
Expected Space Complexity: O(x) where x is number of digits in n.
 
Constraints:
1 <= n <= 1000

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Starter code: #User function Template for python3



class Solution:

	def is_palindrome(self, n):

		# Code here

Solutions:
class Solution:

	def is_palindrome(self, n):
		self.n = n
		n = str(n)
		strait = n.strip()
		reverse = strait[::-1]
		n = int(n)
		if strait == reverse:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		reversed = str(n)[::-1]
		if str(reversed) == str(n):
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		a = str(n)
		if a == a[::-1]:
			return 'Yes'
		return 'No'


class Solution:

	def is_palindrome(self, n):
		i = 0
		j = len(str(n)) - 1
		s = str(n)
		while i < j:
			if s[i] != s[j]:
				return 'No'
			i += 1
			j -= 1
		return 'Yes'


class Solution:

	def is_palindrome(self, n):
		temp = n
		res = 0
		while n > 0:
			res = res * 10 + n % 10
			n = n // 10
		if res == temp:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		num = n
		rev = 0
		while num != 0:
			dig = num % 10
			rev = 10 * rev + dig
			num = num // 10
		if n == rev:
			return 'Yes'
		return 'No'


class Solution:

	def is_palindrome(self, n):
		dup = n
		rev = 0
		while n != 0:
			d = n % 10
			rev = rev * 10 + d
			n = n // 10
		if rev == dup:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		newNum = 0
		currNum = n
		while currNum > 0:
			currDigit = currNum % 10
			newNum = newNum * 10 + currDigit
			currNum = currNum // 10
		if newNum == n:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, N):
		n = N
		lis = n % 10
		while n > 0:
			lis = lis * 10
			n = n // 10
			lis += n % 10
		lis = int(lis / 10)
		if lis == N:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		org_string = str(n)
		rev_string = ''
		for i in org_string:
			rev_string = i + rev_string
		if org_string == rev_string:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		rev = 0
		temp = n
		while n > 0:
			last = n % 10
			rev = rev * 10 + last
			n = n // 10
		if rev == temp:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		y = str(n)
		z = y[::-1]
		if y == z:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		new = 0
		temp = n
		while temp != 0:
			digit = temp % 10
			new = new * 10 + digit
			temp = temp // 10
		return 'Yes' if new == n else 'No'


class Solution:

	def is_palindrome(self, n):
		nn = str(n)[::-1]
		nnn = int(nn)
		if n == nnn:
			return 'Yes'
		return 'No'


class Solution:

	def is_palindrome(self, n):
		num = n
		rev = 0
		while n != 0:
			rem = n % 10
			rev = rev * 10 + rem
			n = n // 10
		if num == rev:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		wno = n
		rev = 0
		while wno > 0:
			dig = wno % 10
			wno = wno // 10
			rev = rev * 10 + dig
		if rev == n:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		res = str(n) == str(n)[::-1]
		if res == True:
			ans = 'Yes'
		else:
			ans = 'No'
		return ans


class Solution:

	def is_palindrome(self, n):
		num = n
		sum = 0
		while n > 0:
			sum = sum * 10 + n % 10
			n //= 10
		if num == sum:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		n = str(n)
		a = [x for x in n]
		b = [x for x in n]
		b.reverse()
		flag = False
		for i in range(len(a) // 2):
			if a[i] != b[i]:
				flag = True
				break
		if flag:
			return 'No'
		else:
			return 'Yes'


class Solution:

	def is_palindrome(self, n):
		flag = True
		n1 = str(n)
		for i in range(len(n1) // 2):
			if n1[i] != n1[-i - 1]:
				flag = False
				break
		if flag:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		s = str(n)
		s = s[::-1]
		a = str(n)
		for i in range(0, len(s)):
			for j in range(1):
				if a[i] != s[i]:
					return 'No'
		return 'Yes'


class Solution:

	def is_palindrome(self, n):
		number = str(n)
		reverseNum = number[::-1]
		if number == reverseNum:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		temp = n
		reverse = 0
		while temp != 0:
			lastDigit = temp % 10
			reverse = reverse * 10 + lastDigit
			temp //= 10
		if n == reverse:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		temp = n
		reverse = 0
		i = len(str(n)) - 1
		while temp != 0:
			lastDigit = temp % 10
			reverse += lastDigit * 10 ** i
			temp //= 10
			i -= 1
		if n == reverse:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		n = str(n)
		k = len(n) - 1
		answer = ''
		while k >= 0:
			answer += n[k]
			k -= 1
		if answer == n:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		reverse = 0
		c = n
		while c != 0:
			reverse = reverse * 10 + c % 10
			c = c // 10
		if reverse == n:
			return 'Yes'
		return 'No'


class Solution:

	def is_palindrome(self, N):
		count = 0
		for i in range(0, len(str(N))):
			if str(N)[len(str(N)) - 1 - i] == str(N)[i]:
				count = count + 1
		if count == len(str(N)):
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		temp = n
		rev = 0
		while n != 0:
			digit = n % 10
			rev = rev * 10 + digit
			n = n // 10
		if temp != rev:
			s = 'No'
			return s
		else:
			s = 'Yes'
			return s


class Solution:

	def is_palindrome(self, n):
		ns = str(n)
		rev = ns[::-1]
		rev = int(rev)
		if n == rev:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		low = 0
		high = int(len(str(n))) - 1
		num = str(n)
		while low < high:
			if num[low] != num[high]:
				return 'No'
			low += 1
			high -= 1
		return 'Yes'


class Solution:

	def is_palindrome(self, n):
		num = str(n)
		rev = num[::-1]
		if num == rev:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		x = n
		reverse_num = 0
		while x > 0:
			last_digit = x % 10
			reverse_num = reverse_num * 10 + last_digit
			x = x // 10
		if reverse_num == n:
			return 'Yes'
		return 'No'


class Solution:

	def is_palindrome(self, n):
		n = str(n)
		new_n = []
		for i in n:
			new_n.append(i)
		z = ''.join(new_n[::-1])
		if z == n:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		(rev, ori) = (0, n)
		while n > 0:
			rev = rev * 10 + n % 10
			n //= 10
		if ori == rev:
			return 'Yes'
		return 'No'


class Solution:

	def is_palindrome(self, n):
		a = n
		res = 0
		while n != 0:
			res = n % 10 + res * 10
			n //= 10
		if res == a:
			return 'Yes'
		return 'No'


class Solution:

	def is_palindrome(self, n):
		x = n
		palindrome = 0
		while n != 0:
			number = n % 10
			palindrome = palindrome * 10 + number
			n = n // 10
		if palindrome == x:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		temp = n
		s = 0
		while n > 0:
			rem = n % 10
			s = s * 10 + rem
			n = n // 10
		if temp == s:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		s = str(n)
		k = list(s[::-1])
		for i in range(len(s)):
			if s[i] != k[i]:
				return 'No'
				break
		else:
			return 'Yes'


class Solution:

	def is_palindrome(self, n):
		p = []
		while n > 0:
			rem = n % 10
			p.append(rem)
			n = n // 10
		if p == p[::-1]:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		temp = n
		sum = 0
		while n != 0:
			r = n % 10
			n = n // 10
			sum = sum * 10 + r
		if sum == temp:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		return 'Yes' * (str(n) == str(n)[::-1]) or 'No'


class Solution:

	def is_palindrome(self, n):
		s = str(n)[-1::-1]
		if int(s) == n:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def is_palindrome(self, n):
		n = str(n)
		l = len(n)
		for i in range(len(str(n)) // 2):
			if n[i] != n[l - 1 - i]:
				return 'No'
		return 'Yes'


class Solution:

	def is_palindrome(self, n):
		t = str(n)
		k = 'Yes'
		o = 'No'
		if t == t[::-1]:
			return k
		else:
			return o