All Posts
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 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.