Unordered Set

Easy STL Containers
Solve in Playground →

Problem Statement

Write a C++ program using `std::unordered_set` to check for membership efficiently in average $O(1)$ time.

Input Format

First line: N elements to insert. Second line: Target element to search.

Output Format

Print 'Found' or 'Not Found'.

Constraints

1 <= N <= 1000

Sample Input

5
10 20 30 40 50
30

Sample Output

Found

Explanation

Unordered sets provide fast membership testing using hash-based storage.

Starter Code

#include <iostream>
#include <unordered_set>

int main() {
    int n, target;
    if (std::cin >> n) {
        std::unordered_set<int> uset;
        for (int i = 0; i < n; i++) {
            int val;
            std::cin >> val;
            uset.insert(val);
        }
        // Write your unordered_set search logic here

    }
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

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