C++ || SORT
Code\n\nclass Solution {\npublic:\n    vector<int> maximumBeauty(vector<vector<int>>& v1, vector<int>& v) {\n        int n = v.size(),i;\n        vector<vector<
# Code\n```\nclass Solution {\npublic:\n    vector<int> maximumBeauty(vector<vector<int>>& v1, vector<int>& v) {\n        int n = v.size(),i;\n        vector<vector<int>> v2;\n        for(i=0;i<n;i++){\n            v2.push_back({v[i],i});\n        }\n        vector<int> ans(n,0);\n        sort(v1.begin(),v1.end());\n        sort(v2.begin(),v2.end());\n        // for(auto &i: v1)cout<<i[0]<<" "<<i[1]<<" #  ";cout<<endl;\n        // for(auto &i: v2)cout<<i[0]<<" "<<i[1]<<" #  ";cout<<endl;\n        int  j = 0, x = 0, a = v1.size(),b=v2.size();\n        i = 0;\n        while(j<b){\n            while(i<a&&v2[j][0]>=v1[i][0]){\n                x = max(v1[i][1],x);\n                i++;\n            }\n            ans[v2[j][1]] = x;\n            j++;\n        }\n        return ans;\n    }\n};\n```
['Array', 'Sorting', 'C++']