All Posts
Leetcode 2233: Maximum Product After K Increments
You are given an array of non-negative integers and an integer k. In one operation, you can choose any element from the array and increment it by 1. Your task is to determine the maximum product of the array elements after at most k operations. The result should be returned modulo 10^9 + 7.
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 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 2336: Smallest Number in Infinite Set
You have a set containing all positive integers starting from 1. You need to implement a class SmallestInfiniteSet that has the following methods:
- SmallestInfiniteSet() Initializes the set to contain all positive integers starting from 1.
- popSmallest() Removes and returns the smallest integer in the set.
- addBack(int num) Adds a positive integer num back into the set, if it’s not already present in the set.