Simple Solution using Heap
\n# Code\n\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {\n        priority_queue<
\n# Code\n```\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {\n        priority_queue<vector<int>>p;\n        priority_queue<int>q(worker.begin(),worker.end());\n\n        for(int i=0;i<profit.size();i++){\n            p.push({profit[i],difficulty[i]});\n        }\n        int val=0;\n        while(!p.empty() && !q.empty()){\n            if(p.top()[1]>q.top())p.pop();\n            else{\n                val+=p.top()[0];\n                q.pop();\n            }\n        }\n        return val;\n\n        \n    }\n};\n```
['Heap (Priority Queue)', 'C++']