All Posts
Leetcode 1959: Minimum Total Space Wasted With K Resizing Operations
nums
. Additionally, you are given an integer k
, representing the maximum number of times you can resize the array. At each time step, the array’s size must be large enough to hold the elements in nums[i]
and any extra space will be wasted. Your goal is to minimize the total wasted space by resizing the array at most k
times.
You are tasked with designing a dynamic array where the number of elements that should be in the array at each time is provided in an integer array Leetcode 1976: Number of Ways to Arrive at Destination
n
intersections, and roads connecting them with specific travel times. Your task is to find the number of different ways you can travel from intersection 0 to intersection n-1 in the shortest time possible. Since the result could be large, return it modulo (10^9 + 7).
You are in a city with Leetcode 1981: Minimize the Difference Between Target and Chosen Elements
You are given an m x n integer matrix, where each row contains n integers. You are also given a target integer. Your task is to choose one integer from each row of the matrix such that the absolute difference between the target and the sum of the chosen elements is minimized. Return the minimum absolute difference.
Leetcode 1986: Minimum Number of Work Sessions to Finish the Tasks
You are assigned several tasks, each with a specified time required to complete. A work session allows you to work continuously for up to sessionTime consecutive hours before taking a break. Your goal is to determine the minimum number of work sessions required to complete all tasks under the following conditions:
- If a task is started in a session, it must be completed within that same session.
- You may complete the tasks in any order.
- You can begin a new task immediately after finishing the previous one.
Return the minimum number of work sessions needed to complete all tasks.