Company: Google The Big Code 2026
Difficulty: medium
The Chocolate Factory A chocolate factory has n machines. Machine i takes exactly t[i] minutes to produce one chocolate. All machines start working simultaneously at minute 0 and run continuously — a machine that finishes one chocolate immediately starts the next. The factory needs to produce [unclear] least k chocolates. Find the [unclear] number of minutes [unclear] for the factory to produce at least k [unclear] in total. Function Description: Implement the function minMinutes . The function should return the minimum number of minutes needed for all machines together to produce at least k chocolates. Function Parameters: int n — The number of machines. long long k — The total number of chocolates needed. vector<int> t — A list of n integers where t[i] is the time (in minutes) machine i t[unclear] a chocolate. Input Format: Line 1: A single integer n — the number of machines. Line 2: A single integer k — the total chocolates needed. Output Format: A single integer — the minimum