873 B
873 B
Hints
General
Slices have additionally to the normal element access via indexing (slice[index]) many useful functions like split_at or getting subslices (slice[start..end]).
You can solve this exercise by just using boring old element access via indexing, but maybe the other provided functions can make your code cleaner and safer.
For Bonus Points
- To get your function working with all kind of elements which can be ordered, have a look at the Ord Trait.
- To get your function working directly on Vec and Array, you can use the AsRef Trait