Leetcode 2070. Most Beautiful Item for Each Query
For each query price q, return the maximum beauty among items whose price is ≤ q (or 0 if none). With up to 1e5 items/queries and large prices, the typical approach is to sort items by price, build prefix maximum beauties, and answer each query via binary search or an offline two-pointer sweep.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.