Created
May 29, 2023 04:51
-
-
Save mdrokz/2eac9e447acebaaaa54cbe6e23f4030f to your computer and use it in GitHub Desktop.
Leetcode problem 9 Palindrome number implemented in rust
This file contains 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 { | |
let y = x.to_string(); | |
let rev = y.chars().rev().collect::<String>(); | |
y == rev | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment