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.
publicstaticintbirthdayCakeCandles(List<Integer>candles){// Write your code hereHashMap<Integer,Integer>maps=newHashMap<>();for(intnum:candles){if(maps.containsKey(num)){maps.put(num,maps.get(num)+1);}else{maps.put(num,1);}}intmaxEle=maxing(candles);returnmaps.get(maxEle);}publicstaticintmaxing(List<Integer>arr){intmax=arr.get(0);for(inti=0;i<arr.size();i++){if(max<arr.get(i)){max=arr.get(i);}}returnmax;}
Cookie support is required to access HackerRank
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 →
Java Solution