From 15e815c098ec0ce67d002e0ab649d84c3b0e4fd1 Mon Sep 17 00:00:00 2001 From: Anuk Indipa <61876990+anukindipa@users.noreply.github.com> Date: Wed, 6 Oct 2021 18:09:47 +0530 Subject: [PATCH] Added a solution Added Solution to Palindrome Number problem in LeetCode --- Leetcode_Palindrome_Number.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Leetcode_Palindrome_Number.py diff --git a/Leetcode_Palindrome_Number.py b/Leetcode_Palindrome_Number.py new file mode 100644 index 0000000..67e7ef0 --- /dev/null +++ b/Leetcode_Palindrome_Number.py @@ -0,0 +1,19 @@ +""" + + +Given an integer x, return true if x is palindrome integer. + +An integer is a palindrome when it reads the same backward as forward. For example, 121 is palindrome while 123 is not. + +""" +class Solution: + def isPalindrome(self, x: int) -> bool: + if(x<0): + return 0 + else: + y = str(x) + y = y [::-1] + if(x==int(y)): + return 1 + else: + return 0 \ No newline at end of file