728x90
https://leetcode.com/problems/palindrome-number/
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 |