
g0001_0100.s0009_palindrome_number.Solution.dart Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-all Show documentation
Show all versions of leetcode-in-all Show documentation
104 LeetCode algorithm problem solutions
// #Easy #Math #Udemy_Integers #2024_09_30_Time_518_ms_(95.59%)_Space_149.5_MB_(93.56%)
class Solution {
bool isPalindrome(int x) {
if (x < 0) {
return false;
}
int temp = x;
int rev = 0;
while (temp != 0) {
rev = temp % 10 + rev * 10;
temp ~/= 10;
}
return x == rev;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy