Complete the code to push an element onto the stack.
stack.[1](5);
The push method adds an element to the top of the stack.
Complete the code to remove the top element from the stack.
let top = stack.[1]();The pop method removes and returns the top element from the stack.
Fix the error in the code to check the top element without removing it.
let top = stack.[1]().unwrap();The peek method returns a reference to the top element without removing it.
Fill both blanks to create a stack and add an element to it.
let mut stack = Vec::[1](); stack.[2](10);
Vec::new() creates a new empty stack (vector). push adds an element on top.
Fill all three blanks to pop the top element and print it if the stack is not empty.
if let Some([1]) = stack.[2]() { println!("Top element: {}", [3]); }
pop() removes the top element. if let Some(value) checks if stack is not empty. Then we print value.
