First element
100 points
Implement head, which returns a reference to the first element of a slice.
Required signature
pub fn head(list: &[i32]) -> &i32
Visible tests
-
returns_first_element#[test] fn returns_first_element() { let v = vec![10, 20, 30]; assert_eq!(*head(&v), 10); }
Your solution
Log in to submit a solution.