Beats 100% 💯 || 0ms ✅ || 3 line solution 🔥 || Shortest and Very Easy to understand for beginners
Code\n\nclass Solution {\npublic:\n    long long maximumHappinessSum(vector<int>& h, int k) {\n        sort(h.begin(), h.end(), greater<int>());\n        long l
# Code\n```\nclass Solution {\npublic:\n    long long maximumHappinessSum(vector<int>& h, int k) {\n        sort(h.begin(), h.end(), greater<int>());\n        long long tot = 0, c = 0;\n        while (k--) if (h[c] - c > 0) tot += h[c] - c; c++;\n        return tot;\n    }\n};\n```\n![66dabafc-1e25-4e05-b54d-4157c3ebe2af_1708833865.8845494.jpeg](https://assets.leetcode.com/users/images/8492a4d8-3557-4cb5-bd6f-5a79ae50fccf_1710044011.8387575.jpeg)\n
['C', 'Python', 'C++', 'Java', 'Python3', 'C#']