✅ Easy C++ Solution
Code\n\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {\n        int n = worker.size
# Code\n```\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {\n        int n = worker.size();\n        sort(worker.begin(),worker.end());\n        vector<pair<int,int>> nums(n);\n\n        for(int i=0;i<n;i++)\n        {\n            nums[i] = {difficulty[i],profit[i]};\n        }\n        sort(nums.begin(),nums.end());\n\n        int maxProfit = 0;\n        int tempProfit = 0;\n        for(int i=0,j=0;i<n;i++)\n        {\n            while(j<n && nums[j].first <= worker[i])\n            {\n                tempProfit = max(nums[j].second,tempProfit);\n                j++;\n            }\n            if(j>0 && nums[j-1].first <= worker[i])\n            {\n                maxProfit = maxProfit + tempProfit;\n            }\n        }\n        return maxProfit;\n    }\n};\n```
['C++']