Simple Java Solution Using TreeMap
\nclass Solution {\n    public int[] maximumBeauty(int[][] items, int[] queries) {\n        Arrays.sort(items,(a,b)->a[0]-b[0]); // Sort items by price in ascen
```\nclass Solution {\n    public int[] maximumBeauty(int[][] items, int[] queries) {\n        Arrays.sort(items,(a,b)->a[0]-b[0]); // Sort items by price in ascending order\n        int maxBeauty = 0;\n        TreeMap<Integer, Integer> tm = new TreeMap<>();\n        for(int[] item: items){\n            maxBeauty = Math.max(maxBeauty,item[1]); // rolling max of beauty seen\n            tm.put(item[0],maxBeauty);\n        }\n        int result[] = new int[queries.length];\n        int index=0;\n        for(int query: queries){\n            Integer key = tm.floorKey(query); // if entry for a price exists, value should have max beauty seen else pick floor price entry\n            result[index++] = (key==null)?0:tm.get(key); \n        }\n        return result;\n    }\n}\n```
[]