---
minutes: 30
---

# Exercise: Iterator Method Chaining

In this exercise, you will need to find and use some of the provided methods in
the [`Iterator`][1] trait to implement a complex calculation.

Copy the following code to <https://play.rust-lang.org/> and make the tests
pass. Use an iterator expression and `collect` the result to construct the
return value.

```rust,editable
{{#include exercise.rs:offset_differences}}
    todo!()
}

{{#include exercise.rs:unit-tests}}
```

[1]: https://doc.rust-lang.org/std/iter/trait.Iterator.html
