Complete the code to create a new empty vector.
let v = Vec::[1]();The Vec::new() function creates a new empty vector.
Complete the code to create a vector with capacity for 10 elements.
let v = Vec::[1](10);
The Vec::with_capacity(10) creates a vector with space for 10 elements.
Fix the error in the code to create a vector with initial elements.
let v = vec![1]1, 2, 3[1];
The vec! macro requires square brackets around the elements.
Fill both blanks to create a vector of integers from 1 to 5.
let v: Vec<i32> = ([1]..[2]).collect();
The range 1..6 includes 1 up to but not including 6, so it covers 1 to 5.
Fill all three blanks to create a vector of squares of numbers 1 to 4.
let v = (1..[1]).map(|[2]| [2] * [3]).collect::<Vec<i32>>();
The range 1..5 covers 1 to 4. The variable x is used in the closure to square each number.
