PROBLEM LINK:
Practice
Author:shivamg4149
Editorialist:shivamg4149
DIFFICULTY:
Easy
EXPLANATION:
We have to simply find the different varieties of question going to come in exam.If the variety of question is less than k then return 0,else return varieties of questions-k.
TIME COMPLEXITY:
O(log(N)*N)
SOLUTIONS
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
long int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
set<int> st;
for(int i=0;i<n;i++)
st.insert(a[i]);
int ans=st.size()-k;
if(ans<0)
cout<<0<<endl;
else
cout<<ans<<endl;
}
}