Write a C++ program that reads two sorted arrays and finds their union (combined unique elements in sorted order).
Line 1: N1. Line 2: N1 sorted integers. Line 3: N2. Line 4: N2 sorted integers.
Print union elements separated by a space.
1 <= N1, N2 <= 500
3 1 3 5 3 2 3 6
1 2 3 5 6
Combines two sorted arrays, skipping duplicates to form the union.
#include <iostream>
#include <vector>
int main() {
int n1, n2;
if (std::cin >> n1) {
std::vector<int> a(n1);
for (int i = 0; i < n1; i++) std::cin >> a[i];
if (std::cin >> n2) {
std::vector<int> b(n2);
for (int i = 0; i < n2; i++) std::cin >> b[i];
// Write your code 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