Write a C++ program using `std::unordered_map` for fast key-value lookups.
First line: N queries. Next N lines: key-value pairs or lookup queries.
Print retrieved values.
1 <= N <= 100
3 apple 100 banana 200 apple
100
Unordered maps offer average $O(1)$ time complexity for insertions and lookups using hash tables.
#include <iostream>
#include <unordered_map>
#include <string>
int main() {
int n;
if (std::cin >> n) {
std::unordered_map<std::string, int> umap;
for (int i = 0; i < 2; i++) {
std::string k;
int v;
std::cin >> k >> v;
umap[k] = v;
}
// Write your unordered_map lookup logic here
}
return 0;
}Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used