Skip to content

Iterators practice problems in Rust

Difficulty:
Category & tags Filters active
Category:
Tag:

Showing 40 of 40

Title Difficulty
any, all, find, position: audit a list of records Easy
Bounds checks: five safe ways to express access Hard
Carry a running maximum through mutable iteration Medium
Chains versus loops: top-k, and a function that must not allocate Medium
Choose the first minimum and last maximum Medium
Closures 101: build a pipeline of boxed closures Easy
collect and the turbofish: three targets, one source Medium
Collecting an iterator of Results Medium
Collect sorted keys and build a last-value index Easy
Filter borrowed values into owned results Medium
flat_map: expand a range spec like "1-3,7,10-12" Medium
fold and try_fold: a total that refuses to overflow Medium
from_fn and successors: iterators without writing a struct Easy
Implement Iterator by hand: the Collatz sequence Medium
iter, iter_mut, into_iter: all three, one Vec Easy
Joining owned strings Easy
longest: writing your first 'a Medium
loop, while, for, and break with a value Easy
Make the lint happy: '_ in return paths Easy
Make your own collection iterable, all three ways Hard
map, filter, filter_map: parse host:port lines Easy
Ownership inside loops Medium
partition and unzip: split rows and group names Medium
peekable and next_if: write a tokeniser Hard
PhantomData, variance and drop-check Hard
Read a log after its closure finishes Medium
Remove matching values without invalidating iteration Medium
Reserve output space and report iterator size hints Medium
scan: a running balance that stops at the floor Medium
Set algebra with BTreeSet Easy
size_hint and DoubleEndedIterator: an iterator with two ends Hard
Split a message at its first blank line Easy
Subtract the minimum with a mutable iterator Medium
Sum collections and iterators with IntoIterator Medium
The Option combinator vocabulary Easy
Trace a lazy map, filter and take pipeline Easy
Vec surgery: retain, dedup and extract_if Medium
windows and chunks are slice methods, not iterator adapters Medium
Write your own adapters, with an extension trait Hard
zip and enumerate: pair two lists and report the leftovers Easy