All Posts
Leetcode 2250: Count Number of Rectangles Containing Each Point
rectangles
, where each element rectangles[i] = [li, hi]
represents a rectangle with a bottom-left corner at (0, 0), a length li
, and a height hi
. Additionally, you are provided a 2D integer array points
, where each element points[j] = [xj, yj]
represents a point on a 2D plane. The task is to determine the number of rectangles that contain each point. A rectangle contains a point if the point satisfies 0 <= xj <= li
and 0 <= yj <= hi
. Points on the edges of rectangles are also considered to be inside.
You are given a 2D integer array Leetcode 2271: Maximum White Tiles Covered by a Carpet
tiles
, where each element tiles[i] = [li, ri]
represents that all integers from li
to ri
are painted white on a number line. Additionally, you are given an integer carpetLen
, which represents the length of a carpet that can be placed anywhere on the number line. Your task is to return the maximum number of white tiles that can be covered by placing the carpet in a way that it maximizes the number of white tiles covered.
You are given a 2D integer array Leetcode 2300: Successful Pairs of Spells and Potions
spells
and potions
, representing the strength of spells and potions, respectively. Each element in the arrays represents the strength of a specific spell or potion. You are also given an integer success
, which defines the minimum product of a spell and a potion required for a successful pair. For each spell, determine how many potions can pair with it to form a successful combination (i.e., their product is greater than or equal to success
).
You are given two arrays: Leetcode 2332: The Latest Time to Catch a Bus
You are given two arrays representing bus departure times and passenger arrival times, along with the maximum capacity of each bus. The task is to determine the latest time you may arrive at the bus station to catch a bus. You cannot arrive at the same time as another passenger.
Leetcode 2333: Minimum Sum of Squared Difference
You are given two integer arrays, nums1 and nums2, each of length n. You are also given two integers k1 and k2. Modify any element of nums1 or nums2 at most k1 or k2 times, respectively, to minimize the sum of squared differences between the two arrays.
Leetcode 2358: Maximum Number of Groups Entering a Competition
You are given a positive integer array grades which represents the grades of students. Your goal is to group these students into ordered non-empty groups where:
- The sum of the grades in the i-th group is less than the sum of the grades in the (i + 1)-th group.
- The number of students in the i-th group is less than the number of students in the (i + 1)-th group. Return the maximum number of groups that can be formed.