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.
staticintmigratoryBirds(intn,int[]ar){// Complete this functionint[]arr=newint[6];for(intid:ar){arr[id]++;}intmaxValue=0;intmaxPos=0;for(inti=1;i<6;i++){if(arr[i]>maxValue){maxValue=arr[i];maxPos=i;}}returnmaxPos;}
Migratory Birds
You are viewing a single comment's thread. Return to all comments →
Nice solution. A little optimization.