easy cpp solution to understand
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> maximumBeauty(vector<vector<int>>& items, vector<int>& queries) {\n        ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);\n        int n = items.size();\n        int m = queries.size();\n        vector<int>v;\n\n        sort(items.begin(), items.end());\n\n        for(int i = 1;i < n;i++){\n            items[i][1] = max(items[i][1], items[i - 1][1]);\n        }\n\n        for(auto i : queries){\n            int low = 0;\n            int high = n - 1;\n            int ans = 0;\n            while(low <= high){\n                int mid = (low + high) / 2;\n                if(i >= items[mid][0]){\n                    ans = items[mid][1];\n                    low = mid + 1;\n                }\n                else high = mid - 1;\n            }\n            v.push_back(ans);\n        }\n        return v;\n    }\n};\n```
['Binary Search', 'C++']