We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
intmain(){intn;scanf("%d",&n);int*types=malloc(sizeof(int)*n);for(inttypes_i=0;types_i<n;types_i++){scanf("%d",&types[types_i]);}// your code goes hereintid[]={0,0,0,0,0};for(inti=0;i<n;i++){id[types[i]-1]++;}intmax=0,type=0;for(intj=0;j<5;j++){if(id[j]>id[max]){max=j;}}printf("%d",max+1);return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Migratory Birds
You are viewing a single comment's thread. Return to all comments →