Marc's Cakewalk

  • + 0 comments

    Easy Java Sol:

    public static long marcsCakewalk(List<Integer> calorie) {
    
            Collections.sort(calorie, Collections.reverseOrder());
            int n = calorie.size();
            long miniMiles = 0;
    
            for(int i=0; i<n ;i++){
                double expo = Math.pow(2,i) * calorie.get(i);
                miniMiles = miniMiles + (long)expo;
            }
    
            return miniMiles;
    
        }