LeetCode算法入门- Palindrome Number-day2
生活随笔
收集整理的這篇文章主要介紹了
LeetCode算法入门- Palindrome Number-day2
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
LeetCode算法入門- Palindrome Number-day2
Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -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: 10
Output: false
Explanation: Reads 01 from right to left. Therefore it is not a palindrome.
方法一:
將int類型x進行反轉,如果反轉之后和之前的數字一樣,說明是回文,否則不是(記得排除負數的)
總結
以上是生活随笔為你收集整理的LeetCode算法入门- Palindrome Number-day2的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MYSQL的索引类型:PRIMARY,
- 下一篇: JVM005_synchronized、