For this ques dont work with arrs

my code is: for(int i=0;i<n;i++) { int x; cin>>x; a[x}++; } int y= *max_element(a,a+n); int c= INT_MIN; int k=0; for(int i=0;i<n;i++) { if(a[i]<c) { c=a[i]; k=i; } } cout<<k<<endl; wats wrong with this thanks in advace

it doesnt even work with binary search

@the.shubham.sri
while doing a[x]++ 0<=x<1e7
you cannot create array of size 1e7.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.