Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 796 Bytes

_9. Palindrome Number.md

File metadata and controls

45 lines (32 loc) · 796 Bytes

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : May 22, 2024

Last updated : July 01, 2024


Related Topics : Math

Acceptance Rate : 57.82 %


Solutions

Java

class Solution {
    public boolean isPalindrome(int x) {
        if (x < 0) {
            return false;
        }

        int one = 0;
        int two = x;

        while (two > 0) {
            one = 10 * one + two % 10;
            two /= 10;
        }

        return x == one;
    }
}