Reverse a String
Easy
+2 pts
🎯 In Python, reversing a string is a one-liner: s[::-1]. Rust doesn't have slicing syntax like that, but it has something arguably more powerful: iterator adapters.
You already know .chars() gives you an iterator over characters. Rust iterators have a rich set of adapter methods that transform the sequence without consuming it:
let nums = vec![1, 2, 3, 4, 5];
let first_three: Vec<i32> = nums.iter()
.take(3)
.copied()
.collect();
// [1, 2, 3]
Notice .collect() at the end — this is a key Rust concept. Iterators are lazy: adapter methods like .take(), .map(), and …
Login to see the full exercise.