-
[LeetCode] Palindrome Number알고리즘 2021. 6. 22. 00:19
class Solution { public boolean isPalindrome(int x) { if (x < 0) { return false; } String strX = String.valueOf(x); String reverseX = String.valueOf(x); String tmp = ""; for(int i=reverseX.length()-1; i>=0; i--) { tmp += reverseX.charAt(i); } if (tmp.equals(strX)) { return true; } else { return false; } } }
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
'알고리즘' 카테고리의 다른 글
[코딩인터뷰완전분석] 1.2_순열확인_풀이 (0) 2021.08.24 [leetcode] Height Checker (0) 2021.08.24 [코딩인터뷰완전분석] 1.1_중복이 없는가_풀이 (0) 2021.08.24 알고리즘 학습법 (0) 2021.08.21 [LeetCode] Median of Two Sorted Arrays (0) 2021.06.17