All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g0001_0100.s0009_palindrome_number.Solution.dart Maven / Gradle / Ivy

There is a newer version: 1.8
Show newest version
// #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