#3494

Find the Minimum Amount of Time to Brew Potions

specialist · 725 · lc medium +31 · 62.7% accepted · 508 likes · top 64%

Description

There are n wizards (each with a skill level in array skill) and m potions (with mana values in array mana). Each potion must pass through all wizards in sequence. Wizard i spends skill[i] * mana[j] time on potion j.

The handoff must be immediate: each wizard starts exactly when the previous finishes.

Return the minimum total time to brew all m potions.

Code

1
2
3