Marc's Cakewalk

  • + 0 comments

    My sol using JAVA :

    public static long marcsCakewalk(List<Integer> calorie) {
            // Write your code here
            long size = calorie.size();
            long sum = 0;
            Collections.sort(calorie, Collections.reverseOrder());
            for (int i = 0; i < size; i++)
                sum += (Math.pow(2, i) * calorie.get(i));
            return sum;
        }