← All Exercises

Rust Iterator Adapters

intermediaterust~20min

Background

Rust iterator adapters provide lazy, composable transformations that compile to efficient loops.

Problem

Write a Rust function that takes a vector of strings, filters by length, and returns a map of index to uppercase string.

Input

A vector of strings and a minimum length filter.

Output

A HashMap mapping original index to uppercased string for strings meeting the length requirement.

Sample tests

Sample 1

Input: ["hi","hello","ok","world"], min_len=3
Expected: {1:"HELLO", 3:"WORLD"}

Your solution

Learning objective

Learn iterator chaining, enumerate for indexing, filter with closures, and collect into HashMap.