quest

Sign in to start training

quest keeps your progress, streaks, and scores tied to your account — so you can pick up on any device.

Synced everywhere. Progress follows you across laptop and phone.
Streaks & stats. See your daily run and every score over time.
Your profile. A name and avatar for the work you do here.

We only use Google to sign you in and sync progress. No posting, no contacts — ever.

Core Intermediate

07  Ownership

The heart of Rust. These functions take ownership when they shouldn't -- borrow instead, so the caller keeps its values.

Step 1 / 3

Fix total_len so it borrows the vec and the caller can still use it.

Hints
  • Passing by value moves; borrow with &[T] to read.
  • The check calls total_len(&v) -- match that.
07_ownership.rs
Reset to starterCompiled in a sandbox; hidden checks must pass.
Reveal solution
fn total_len(items: &[String]) -> usize {
    items.iter().map(|s| s.len()).sum()
}