Grace
grace's dev_note
Grace
전체 방문자
오늘
어제
  • 분류 전체보기
    • FrontEnd
      • Next.js
      • React
      • ReactNativ..
      • Vue
    • Javascript
      • 러닝 자바스크립트
      • 모던 자바스크립트
    • CS
    • DataScienc..
      • Data Struc..
      • LeetCode
    • BackEnd
      • Express
      • Node.js
      • Nest.js
    • DevOps
      • Docker
    • 매일메일
    • 회고
    • 코드캠프

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • PostgreSQL
  • Vue3
  • 함수
  • tanstack
  • Express
  • javascript
  • 알고리즘
  • vue-query
  • Vite
  • node.js
  • 번들러
  • backend
  • Vue.js
  • React Native
  • pinia
  • Vue
  • postgres
  • nest.js
  • 자바스크립트
  • vitejs

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
Grace

grace's dev_note

DataScience/LeetCode

[Easy] Palindrome Number

2022. 10. 11. 09:03

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 a palindrome while 123 is not.

Example 1:

Input: x = 121
Output: true
Explanation: 121 reads as 121 from left to right and from right to left.

Example 2:

Input: x = -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.

Example 3:

Input: x = 10
Output: false
Explanation: Reads 01 from right to left. Therefore it is not a palindrome.

 

Constraints:

  • -231 <= x <= 231 - 1
var isPalindrome = function(x) {
    return String(x) === (String(x).split('').reverse().join(''))
};
저작자표시 비영리 변경금지 (새창열림)

'DataScience > LeetCode' 카테고리의 다른 글

[Easy] Sqrt(x)  (0) 2022.11.17
[Easy] Plus One  (0) 2022.11.16
[Easy] Valid Parentheses  (0) 2022.11.02
[Easy] Roman to Integer  (0) 2022.10.12
[Easy] Two Sum  (0) 2022.10.06
    'DataScience/LeetCode' 카테고리의 다른 글
    • [Easy] Plus One
    • [Easy] Valid Parentheses
    • [Easy] Roman to Integer
    • [Easy] Two Sum
    Grace
    Grace
    기술 및 회고 블로그

    티스토리툴바