[Python3] sorting + binary search
\nclass Solution:\n    def maximumBeauty(self, items: List[List[int]], queries: List[int]) -> List[int]:\n        items.sort()\n        maxArr = [items[0][1]] *
```\nclass Solution:\n    def maximumBeauty(self, items: List[List[int]], queries: List[int]) -> List[int]:\n        items.sort()\n        maxArr = [items[0][1]] * len(items)\n\t\t# for each cell calculate maximum beautifulnes\n        for i in range(1, len(items)):\n            maxArr[i] = max(maxArr[i-1], items[i][1])\n        \n        onlyKeys = list(map(lambda x:x[0], items)) # since 3.9 python doesn\'t have `key` in bisect\n        \n        res = []\n        for q in queries:\n            # if minimum price is greated than query, no items can be found for query\n            notPossible = items[0][0] > q\n            if notPossible:\n                res.append(0)\n            else:\n                # otherwise find last cell with value less or equals to query\n                i = bisect.bisect_right(onlyKeys, q)\n                # lookup result in our maximum array by index\n                res.append(maxArr[i-1])\n        \n        return res\n```\t\t
[]