FAANG | Onsite | Splitting load/data
Anonymous User
2849

Hello,

Please provide your thoughts on how the following question could be approached.

--You are give a data size and we need to determine how many packages this data can be split into. The size of the package cannot exceed a given limit. Eg: the total data size is 30 units and the each individual package cannot exceed 9 units.
-- We would need to determine how many packages the total data can be split into, adhering to the following constraints:
--1. The number of packages that this data can be split should be minimized
--2. The individual package size should be minimized
--Eg: Total data: 30 units, package<=9 units. Possible valid solutions are [8, 8, 8, 6] or [8, 8, 7, 7] as they adhere to the above 2 constraints (and the individual package size limit) but [9, 9, 9, 3] is invalid since 9 is more than 8 in the [8,8,8,6] or [8,8,7,7] solution. Another invalid solution is [6,6,6,6,6] since it breaks the constraint#1 as this has 5 packages (which is more than # of packages in the 2 valid solutions).
-- if we add another constraint where we can split at specific points only, how should this be handled? Eg: if the data is 12 units and the max package size cannot exceed 6 units and we can split only at the 5th and 8th data point then a valid answer is [5, 7]. [6,6] is not valid since we can split only at the 5th and 8th data points.

Comments (8)