Complete the code to push an element onto the stack.
stack.push([1]);The push method adds the given value to the top of the stack.
Complete the code to create a new empty stack using a vector.
let mut stack: Vec<i32> = [1]::new();Stack type.List which is not a Rust standard type.Array which has fixed size.In Rust, a stack can be implemented using a Vec. The Vec::new() creates an empty vector.
Fix the error in the push operation to add 10 to the stack.
stack.[1](10);
pop which removes the top element.remove which removes an element by index.insert which inserts at a specific position.The correct method to add an element to the top of the stack is push.
Fill both blanks to push the variable item onto the stack and print the stack length.
stack.[1](item); println!("Stack size: {}", stack.[2]());
pop instead of push.clear which empties the stack.pop to get length instead of len.Use push to add item to the stack, and len() to get the current size.
Fill all three blanks to push the uppercase version of word onto the stack if its length is greater than 3.
if word.[1]() > 3 { stack.[2](word.[3]()); }
pop instead of push.to_lowercase instead of to_uppercase.Check length with len(), push with push, and convert to uppercase with to_uppercase().
