[LeetCode]--7. Reverse Integer

    xiaoxiao2023-03-24  4

    Reverse digits of an integer.

    Example1: x = 123, return 321 Example2: x = -123, return -321

    我的第一感觉我就要把它弄成字符串,然后一下子弄出来,结果也实现了,可是超时了。

    public int reverse(int x) { String str = x + ""; String strX = ""; if (str.length() == 1) return x; if (str.charAt(0) != '-')
    转载请注明原文地址: https://ju.6miu.com/read-1202566.html
    最新回复(0)