SW/leetcode

9. Palindrome Number

실행컨텍스트 2023. 2. 17. 21:47
728x90

https://leetcode.com/problems/palindrome-number/

Palindrome Number - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com


var isPalindrome = function(x) {
if(x < 0){ return false; }
else{
let answer = '';
let tt = x.toString();
for(let i = tt.length-1; i >= 0; i--){
answer = answer.concat(tt[i]);
}
if(Number(answer) === x) return true;
else return false;
}
};

728x90

'SW > leetcode' 카테고리의 다른 글

35. Search Insert Position  (0) 2023.02.17
27. Remove Element  (0) 2022.08.16