Guest User

Untitled

a guest
Jun 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. // This function is supposed to sort all non negative numbers in the indeces
  2. // that all non negative numbers are originally found
  3.  
  4. fn sortByHeight(a: &mut Vec<i32>) {
  5. let mut not_negative: Vec<i32> = a.iter().cloned().filter(|x| *x > 0).collect();
  6. not_negative.sort();
  7. for x in a {
  8. if *x > 0 {
  9. *x = not_negative.remove(0);
  10. }
  11. }
  12. }
  13.  
  14. fn main() {}
Add Comment
Please, Sign In to add comment