Tap here to switch tabs
Problem
Submissions

Problem: Find Time Required to Eliminate Bacterial Strains

Try to solve the Find Time Required to Eliminate Bacterial Strains problem.

Statement

You are given an integer array timeReq and an integer splitTime. There are timeReq.length bacterial strains that need to be eliminated, where the bacterial strain at index i requires timeReq[i] units of time to be eliminated by a single white blood cell (WBC).

Initially, at time 00, there is 11 WBC. At any moment, an available WBC can perform one of the following actions:

  • Split into 22 new WBCs, which takes splitTime units of time.

  • Eliminate an uneliminated bacterial strain i, which takes timeReq[i] units of time. Once a WBC begins eliminating a strain, it cannot be reused.

Return the minimum time required to eliminate all bacterial strains.

Constraints:

  • 2≤2 \leq timeReq.length ≤105\leq 10^5

  • 1≤1 \leq timeReq[i] ≤109\leq 10^9

  • 1≤1 \leq splitTime ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Time Required to Eliminate Bacterial Strains

Try to solve the Find Time Required to Eliminate Bacterial Strains problem.

Statement

You are given an integer array timeReq and an integer splitTime. There are timeReq.length bacterial strains that need to be eliminated, where the bacterial strain at index i requires timeReq[i] units of time to be eliminated by a single white blood cell (WBC).

Initially, at time 00, there is 11 WBC. At any moment, an available WBC can perform one of the following actions:

  • Split into 22 new WBCs, which takes splitTime units of time.

  • Eliminate an uneliminated bacterial strain i, which takes timeReq[i] units of time. Once a WBC begins eliminating a strain, it cannot be reused.

Return the minimum time required to eliminate all bacterial strains.

Constraints:

  • 2≤2 \leq timeReq.length ≤105\leq 10^5

  • 1≤1 \leq timeReq[i] ≤109\leq 10^9

  • 1≤1 \leq splitTime ≤109\leq 10^9