Unique Beginner-Friendly Intuitive Solution (HashMap + Sorting)
Intuition\nTried Brute Force and Worked up on it.\n\n# Approach\nBrute Force but the searching for the max beauty for a particular query becomes easier with the
# Intuition\nTried Brute Force and Worked up on it.\n\n# Approach\nBrute Force but the searching for the max beauty for a particular query becomes easier with the STL.\n\n# Complexity\n- Time complexity:\nO(nlogn + mlogn)\n\n- Space complexity:\nO(n)\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> maximumBeauty(vector<vector<int>>& items, vector<int>& queries) {\n        // Sort items by price first, then by beauty\n        sort(items.begin(), items.end());\n        \n        // Create a map to store the maximum beauty for each price\n        map<int, int> priceToBeauty;\n        int maxBeauty = 0;\n        for (const auto& item : items) {\n            // Update maxBeauty if the current item\'s beauty is greater\n            maxBeauty = max(maxBeauty, item[1]);\n            priceToBeauty[item[0]] = maxBeauty;\n        }\n        // Result vector to store the results for each query\n        vector<int> res;\n        for (const auto& query : queries) {\n            // Find the max beauty for any price less than or equal to the query\n            auto it = priceToBeauty.upper_bound(query);\n            if (it == priceToBeauty.begin()) {\n                res.push_back(0); // No items available within the price range\n            } else {\n                res.push_back(prev(it)->second); // Previous max beauty\n            }\n        }\n        \n        return res;\n    }\n};\n\n```
['Array', 'Ordered Map', 'Sorting', 'Ordered Set', 'C++']