i completes one trip in exactly lap[i] minutes and starts the next trip right away. The shuttles run at the same time without affecting each other, and all of them start at minute 0.
Together they must complete at least quota trips. Return the smallest whole number of minutes by which that happens. Only finished trips count.lap=[2, 3, 6], quota=6 → 6
By minute 6 the shuttles have made 3, 2 and 1 trips: exactly 6. At minute 5 there would only be 2 + 1 + 0 = 3.
lap=[4, 4], quota=3 → 8
By minute 8 each shuttle has made 2 trips, 4 ≥ 3 in total; at minute 7 each has made only one.
lap=[5], quota=1 → 5
lap=[2, 3, 6], quota=6
6
Run checks the first 3 tests in your browser. Submit checks all 106 tests on the server, hidden ones included.