You are viewing a single comment's thread. Return to all comments →
public static long marcsCakewalk(List<Integer> calorie) { Comparator<Integer> comp = Integer::compare; List<Integer> cals = calorie.stream().sorted(comp.reversed()).collect(Collectors.toList()); double mincal = 0; for(int i=0;i<cals.size();i++) { mincal += Math.pow(2, i)*cals.get(i); } return (long)mincal; }
Seems like cookies are disabled on this browser, please enable them to open this website
Marc's Cakewalk
You are viewing a single comment's thread. Return to all comments →