C++ very easy to understand
class Solution {\npublic:\n    \n    int maxProfitAssignment(vector& difficulty, vector& profit, vector& worker) {\n        vector diff_pro(100001,0);\n        
class Solution {\npublic:\n    \n    int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {\n        vector<int> diff_pro(100001,0);\n        int res=0;\n        for(int i=0;i<difficulty.size();i++){\n            diff_pro[difficulty[i]]=max(diff_pro[difficulty[i]],profit[i]);\n        }\n        for(int i=1;i<100001;i++){\n            diff_pro[i]=max(diff_pro[i],diff_pro[i-1]);\n        }\n        for(int i=0;i<worker.size();i++){\n            res+=diff_pro[worker[i]];\n        }\n        return res;\n    }\n};
[]