Curriculum Collections & iteration Hash maps exercise 1 · mcq
Hash maps
TypeScript writes a string-keyed integer map as
Record<string, number>. Pick the Rust type that matches.
TypeScript reference
About this theme
HashMap<K, V> replaces many TypeScript object-as-map patterns, but lookups return Option<&V> and insertion may move keys and values. Planned exercises: 1. choose HashMap. 2. recognise insert. 3. choose .get() return type. 4. fill an import from std::collections. 5. fill entry(...).or_insert(...). 6. write a frequency counter. 7. write a lookup with a fallback. 8. translate TS record code. 9. fix a borrowed-key lookup without cloning unnecessarily.