include<bits stdc++.h="">using namespace std; int main () { int k; cin>>k; for(int j=0;j<k;j++){ int="" n;="" cin="">>n; int a[n];
int maxCount=0; int number; int index=0;
int count=0;
cout<<number<<" "<<maxCount<<endl; } } asked 06 Dec, 17:55

TS : 8 1 10 Your Output : 8 1 Correct Ans : 1 1 (In case of ties in maximum frequency, select the smaller element.) In maxcount==count case when you update your number you also need to change the index to i. Just add index=i in false case in your ternary operator, you'll get AC. answered 06 Dec, 19:26
