얼렁뚱땅 스며드는 Data Science

Algorithm/Daily Coding Tests Challenge

[Leetcode] Easy : Palindrome Number

Jesip14 2021. 8. 22. 15:19

Description

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.

 

My Solution

class Solution:
    def isPalindrome(self, x: int) -> bool:
        return str(x) == str(x)[::-1]