diff --git a/Distinct_Numbers.cpp b/Distinct_Numbers.cpp new file mode 100644 index 0000000..4dd9344 --- /dev/null +++ b/Distinct_Numbers.cpp @@ -0,0 +1,45 @@ +#include +#define ll long long +using namespace std; + +int solution() +{ + + int n, count=0; + + //Taking input for number of elements in the array + cin>>n; + + //Declaring an array of size n + int a[n]; + + //Taking n inputs for n no. of elements of the array + for(int i=0; i>a[i]; + } + + //Declaring a set which only stores distinct elements + unordered_set s; + + //Inserting element inside set only if element is already no present and storing its count + for(int i=0; i