Java - Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public long maximumHappinessSum(int[] happiness, int k) {\n        Arrays.sort(happiness);\n        long count=0;\n        //take a pq and add all of them into pq till k while adding add num - p where p is from 1 to k\n        PriorityQueue<Integer> pq = new PriorityQueue<>((a,b)->b-a);\n        for(int i=0;i<happiness.length;i++){\n            pq.add(happiness[i]);\n        }\n        int p=0;\n        for(int i=0;i<k;i++){\n            count+=Math.max(pq.poll()-p,0);\n            p++;\n        }\n        return count;\n    }\n}\n```
['Array', 'Sorting', 'Heap (Priority Queue)', 'Java']