Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This function is supposed to sort all non negative numbers in the indeces
- // that all non negative numbers are originally found
- fn sortByHeight(a: &mut Vec<i32>) {
- let mut not_negative: Vec<i32> = a.iter().cloned().filter(|x| *x > 0).collect();
- not_negative.sort();
- for x in a {
- if *x > 0 {
- *x = not_negative.remove(0);
- }
- }
- }
- fn main() {}
Add Comment
Please, Sign In to add comment