Given two integers `vials` and `flasks`, and a 2D array `crates` where each sub-array contains two integers `v` and `f` representing the capacity of a crate for vials and flasks, determine the minimum number of crates required such that the ratio of vials to flasks in each crate is consistent with the overall ratio of vials to flasks.
Explanation: The overall ratio of vials to flasks is 2:3. To achieve this ratio, we can use 5 crates with capacities [2 3].
Analyze constraints and compute optimal solutions step-by-step.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak