This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl Solution { | |
pub fn is_palindrome(x: i32) -> bool { | |
if x < 0 { | |
return false; | |
} | |
let mut x_copy = x; | |
let mut reverse: i32 = 0; | |
while x_copy > 0 { | |
reverse = (reverse * 10) + (x_copy % 10); |