Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
390 B
1
Indexable
Never
Collections.sort(xp); // Step 1: Sort the experience points
        Set<Double> uniqueAverages = new HashSet<>(); // Step 3: Store unique averages
        
        int n = xp.size();
        for (int i = 0; i < n / 2; i++) {
            double average = (xp.get(i) + xp.get(n - 1 - i)) / 2.0;
            uniqueAverages.add(average); 
        }
        
        return uniqueAverages.size()
Leave a Comment