Skip to content

Iterators practice problems in Rust

Difficulty:
Category:
Tag:

Showing 40 of 40

Status Title Difficulty
any, all, find, position: audit a list of records Easy
Bounds checks: when they cost, and five safe ways to remove them Hard
Chains versus loops: top-k, and a function that must not allocate 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
Everything you can collect into Easy
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
Indexing in a loop is usually a borrow-checker workaround — and clippy knows Medium
IntoIterator: one bound that accepts five containers Medium
Iterator invalidation, and the bug class that stopped existing Medium
Iterator performance: where the abstraction leaks Medium
iter, iter_mut, into_iter: all three, one Vec Easy
iter_mut(): mutating every element without ever holding two &mut Medium
Joining owned strings Easy
Laziness: prove the pipeline interleaves 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
min and max: the tie-breaking rule nobody reads Medium
Ownership inside loops Medium
partition and unzip: two collections from one pass Medium
peekable and next_if: write a tokeniser Hard
`PhantomData`, variance and drop-check Hard
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
take_while and skip_while: split a message at the blank line Easy
The double-reference wall: &&x, copied and cloned Medium
The FnMut borrow gauntlet: a log you can read afterwards Medium
The Option combinator vocabulary 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