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.
publicstaticintmigratoryBirds(List<Integer>arr){// Write your code hereint[]types={1,2,3,4,5};intmostSighted=0;intmaxType=0;for(inttype:types){intcountType=0;for(intsight:arr){if(sight==type){countType+=1;}}if(countType>mostSighted){mostSighted=countType;maxType=type;}}returnmaxType;}
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 →
Java solution here.