Wednesday, August 16, 2023

Challenge #1 Palindrome Number

Problem:

Given an integer x, return true if x is a palindrome, and false otherwise.

Solution:

'''
Author: Siddeshwari S
Mail: siddeshwariks@gmail.com
Date: 17-08-2023
'''
class Solution:
    #Function to check the Palindrome
    def isPalindrome(self, x: int) -> bool:
        if(-pow(2,31)<x<pow(2,31)-1):
            return str(x) == str(x)[::-1]
        else:
            return False