My issue
(Largest k)can some one pl explain
this test case
1
5
1 1 1 2 3 expected ans is 4
My code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll k(){
ll n;
cin>>n;
set<ll> s;
vector<ll> v(n);
for(int i = 0;i<n;i++){
ll d;
cin>>d;
s.insert(d);
v[i] = d;
}
if(v.size() == s.size()){
return n;
}
ll p = s.size();
ll a = n/p;
return a * p;
}
int main() {
// your code goes here
ll t;
cin>>t;
while(t--){
cout<<k()<<endl;
}
}
Problem Link: Largest K Practice Coding Problem