Question: Amazon , Recent Online Assessment Questions | Amazon Developing Service | 14th August 2023 solution
 
void solve()
{
int n;
cin>>n;
set<int> s;
f(i,n)
{
    int x;
    cin>>x;
    s.insert(x);
}
int sz=s.size();
int ans=0;
for(int i=0;i<=n;i++)
{
   ans+=(n-i)*min(i+1,sz);
}
cout<<ans<<endl;
}
int main()
{
   
   solve();      
}
 
Login before adding your answer.
hey I also want to apply for the same, which Oa is this and where to apply pls share