← All Exercises

HashMap Operations

basicrust~10min

Background

HashMap is Rust primary associative container for key-value data storage.

Problem

Create a HashMap, insert entries, look up values, and iterate over key-value pairs.

Input

Key-value pairs

Output

HashMap with lookup results

Sample tests

Sample 1

Input: insert("key", "value")
Expected: lookup returns value

Your solution

Learning objective

Learn Rust collection types and ownership in containers