Link Search Menu Expand Document

Challenge - Resizing a Vector

  • Problem Statement

Given a vector with an even number of elements, remove the last element from the input vector, and then the middle element. Then insert the sum of the remaining elements to the end of the resulting vector.

  • Input
      A vector array
    
  • Output
      An updated vector array
    
  • Sample Input
     [1, 5, 7, 9]
    
  • Sample Output
      [1, 7, 8]
    

    Coding Exercise ``` fn test(my_vec: &mut Vec)-> &mut Vec{ // Write code here! my_vec }

``` Good luck! 🤞