O(NlogN) Lower Bound Easy to understand
\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker){\n        unordered_map<int,int>mp; 
```\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker){\n        unordered_map<int,int>mp;  \n        int m=0,ans=0;\n        vector<vector<int>>v;\n        \n        for(int i=0;i<difficulty.size();i++)\n            v.push_back({difficulty[i],profit[i]});\n        \n        sort(v.begin(),v.end());\n        \n        for(int i=0;i<difficulty.size();i++)\n            mp[v[i][0]]=m=max(m,v[i][1]);\n        \n        sort(difficulty.begin(),difficulty.end());\n        \n        for(int a:worker){\n            int j=lower_bound(difficulty.begin(),difficulty.end(),a)-difficulty.begin();\n            \n            if(difficulty[j]>a || j==difficulty.size())\n                j--;\n            if(j>=0)\n                ans+=mp[difficulty[j]];\n        }\n        return ans;\n    }\n};\n```
['C', 'Binary Tree']