All Posts
Leetcode 2335: Minimum Amount of Time to Fill Cups
You have a water dispenser that dispenses cold, warm, and hot water. Every second, you can either fill up 2 cups with different types of water, or 1 cup of any type of water. You are given an array ‘amount’ where amount[0], amount[1], and amount[2] represent the number of cold, warm, and hot water cups you need to fill, respectively. Your task is to determine the minimum number of seconds required to fill all the cups.
Leetcode 2357: Make Array Zero by Subtracting Equal Amounts
You are given a non-negative integer array nums. In each operation, you must:
- Choose a positive integer x that is less than or equal to the smallest non-zero element in nums.
- Subtract x from every positive element in nums.
Return the minimum number of operations to make every element in nums equal to 0.
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.