My issue
give me the solution for this
My code
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main() {
int N;
cin >> N; // Read the number of elements
vector<int> Arr(N);
for (int i = 0; i < N; i++) {
cin >> Arr[i]; // Read array elements
}
set<int> uniqueNumbers(Arr.begin(), Arr.end()); // Store unique elements (sorted automatically)
// Print exactly the three smallest unique numbers
int count = 0;
for (int num : uniqueNumbers) {
cout << num << endl;
count++;
if (count == 3) break; // Stop after printing 3 numbers
}
return 0;
}
Learning course: Learn Programming and Problem Solving using C++
Problem Link: https://www.codechef.com/learn/course/sit-cpp-fall/SITFALL63/problems/CPPFALL461