blob: e9ad1d408744fe37bea741a5f9147a3d9addaf13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
fn main() {
println!("Hello, world!");
}
struct Solution;
impl Solution {
pub fn is_palindrome(mut s: String) -> bool {
let str: Vec<u8> = unsafe { s.as_bytes_mut() }.iter_mut().filter(|x| x.is_ascii_alphanumeric()).map(|x| x.to_ascii_lowercase()).collect();
str.iter().take(str.len() / 2).eq(str.iter().rev().take(str.len() / 2))
}
}
|