You are viewing a single comment's thread. Return to all comments →
can u please tell me why this code is not able to pass all the test case
// the code goes here..
int main(){ int n,i,max=0,frequency=0;
int ar =(int) malloc(sizeof(int) * n);
scanf("%d", &n); for( i = 0; i < n; i++){ scanf("%d",&ar[i]); } for(i=0;i<n;i++){ if(ar[i]>max){ max=ar[i]; frequency=1; } else if(ar[i]==max){ frequency++; } } printf("%d",frequency); return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Birthday Cake Candles
You are viewing a single comment's thread. Return to all comments →
can u please tell me why this code is not able to pass all the test case
// the code goes here..
int main(){ int n,i,max=0,frequency=0;
int ar =(int) malloc(sizeof(int) * n);
}