Easiest C++ Soln || Binary Search
\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& dif, vector<int>& pr, vector<int>& wo) {\n        int n=dif.size();\n        vector<pair<i
```\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& dif, vector<int>& pr, vector<int>& wo) {\n        int n=dif.size();\n        vector<pair<int,int>> v;\n        for(int i=0;i<n;i++){\n            v.push_back({dif[i],pr[i]});\n        }\n        sort(v.begin(),v.end());\n        int maxpro=v[0].second;\n        for(int i=1;i<v.size();i++){\n            maxpro=max(maxpro,v[i].second);\n            v[i].second=maxpro;\n        }\n        int ans=0;\n        for(auto &w:wo){\n            int tmp=0;\n            int i=0,j=n-1;\n            while(i<=j){\n                int m=(i+j)>>1;\n                if(v[m].first<=w){\n                    tmp=max(tmp,v[m].second);\n                    i=m+1;\n                }\n                else j=m-1;\n            }\n            ans+=tmp;\n        }\n        return ans;\n    }\n};\n```
['C', 'Binary Tree']