...

/

Solution Review: Remove Even Integers From an Array

Solution Review: Remove Even Integers From an Array

This review provides a detailed analysis of solving the "Remove Even Integers From an Array" challenge.

Solution #

Press + to interact
fn remove_even(arr: Vec<i32>) -> Vec<i32> {
arr
.into_iter()
.filter(|x| if x%2 == 0 { return false } else { return true })
.collect()
}

Explanation

The solution first uses into_iter() to get an iterator ...

Access this course and 1200+ top-rated courses and projects.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy