素锦时年_1b00

关注

leetcode算法9.回文数

素锦时年_1b00

关注

阅读 100

2022-02-10

文章目录

  • 一、leetcode算法
    • 1、回文数
      • 1.1、题目
      • 1.2、思路
      • 1.3、答案

一、leetcode算法

1、回文数

1.1、题目

1.2、思路

1.3、答案

在这里插入图片描述

class Solution {
    public boolean isPalindrome(int x) {
        if(x < 0 || x % 10 ==0 && x != 0) return false;
        int num = 0;
        while(x > num ){
            num = num * 10 + x % 10;
            x /= 10;
        }
        return x == num || x == num / 10;
    }
}

相关推荐

_铁马冰河_

leetcode 9. 回文数

_铁马冰河_ 187 0 0

拾光的Shelly

【LeetCode】9. 回文数

拾光的Shelly 114 0 0

素的盐

LeetCode 9.回文数

素的盐 56 0 0

小美人鱼失去的腿

Leetcode算法系列| 9. 回文数

小美人鱼失去的腿 38 0 0

Hyggelook

9. 回文数

Hyggelook 131 0 0

飞进科技

Python描述 LeetCode 9. 回文数

飞进科技 149 0 0

WikongGuan

9. 回文数、Leetcode的Go实现

WikongGuan 61 0 0

兔八哥软件爱分享

【LeeCode】9. 回文数

兔八哥软件爱分享 105 0 0

i奇异

9.回文数.py

i奇异 127 0 0

火热如冰

[Golang]力扣Leetcode - 9.回文数(数学)

火热如冰 150 0 0

精彩评论(0)

0 0 举报