summaryrefslogtreecommitdiff
path: root/find-first-palindromic-string-in-the-array/src/main.rs
blob: cf3d386b8d13feb9ba65e4e06f73e165ffb40694 (plain)
1
2
3
4
5
6
7
8
9
10
11
fn main() {
    println!("Hello, world!");
}

struct Solution;

impl Solution {
    pub fn first_palindrome(words: Vec<String>) -> String {
        words.iter().find(|&s| s.chars().take(s.len() / 2).eq(s.chars().rev().take(s.len() / 2))).map(|x| x.clone()).unwrap_or(String::new())
    }
}