LeetCode - 9. Palindrome Number (Python)

조민수·2024년 6월 2일
0

LeetCode

목록 보기
4/61

Easy, Python - Palindrome

RunTime : 57 ms / Memory : 16.5 MB


문제

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


풀이

  • 지겹도록 풀어본 펠린드롬 문제
  • Easy 했다.
class Solution:
    def isPalindrome(self, x: int) -> bool:
        if x < 0:
            return False
        else:
            toStr = str(x)
            return toStr == toStr[::-1]
profile
사람을 좋아하는 Front-End 개발자

0개의 댓글