All Posts
Leetcode 2055: Plates Between Candles
You are tasked with processing a string of plates (’*’) and candles (’|’) arranged on a table. For a set of queries, you must determine the number of plates that are enclosed by candles within specified substrings of the string.
Leetcode 2064: Minimized Maximum of Products Distributed to Any Store
You are given a number n representing the number of retail stores and an array of integers quantities. Each quantity[i] represents the number of products of the i-th product type available. The task is to distribute all the products to the stores in such a way that no store gets more than one product type, but may receive any quantity of that type. The goal is to minimize the maximum number of products assigned to any store. Return the smallest possible value of this maximum number of products assigned to a store.
Leetcode 2070: Most Beautiful Item for Each Query
You are given a list of items, where each item has a price and a beauty score. You are also given a list of price queries. For each query, find the maximum beauty of an item with a price less than or equal to the query price. If no such item exists, return 0.
Leetcode 2080: Range Frequency Queries
Design a data structure that allows you to efficiently find the frequency of a given value in a subarray. Implement the class RangeFreqQuery
with the following methods:
RangeFreqQuery(int[] arr)
initializes the data structure.int query(int left, int right, int value)
returns the frequency ofvalue
in the subarray fromleft
toright
.