Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Build Blocks

med
30 min
Try to solve the Minimum Time to Build Blocks problem.

Statement

You are given an integer array blocks, where blocks[i] denotes the time needed to build the iith block, and an integer split, representing the time required for a worker to split into two workers.

Initially, there is 11 worker available. A worker can perform one of two actions:

  • Build any unbuilt block blocks[i], which takes blocks[i] units of time.

  • Split into 22 workers, which takes split units of time.

Once a worker splits, both resulting workers can immediately and independently begin building blocks or splitting further. Each block can only be built by 11 worker. Multiple workers can work or split in parallel.

Return the minimum amount of time required to build all blocks.

Constraints:

  • 1≤1 \leq blocks.length ≤1000\leq 1000

  • 1≤1 \leq blocks[i] ≤105\leq 10^5

  • 1≤1 \leq split ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Build Blocks

med
30 min
Try to solve the Minimum Time to Build Blocks problem.

Statement

You are given an integer array blocks, where blocks[i] denotes the time needed to build the iith block, and an integer split, representing the time required for a worker to split into two workers.

Initially, there is 11 worker available. A worker can perform one of two actions:

  • Build any unbuilt block blocks[i], which takes blocks[i] units of time.

  • Split into 22 workers, which takes split units of time.

Once a worker splits, both resulting workers can immediately and independently begin building blocks or splitting further. Each block can only be built by 11 worker. Multiple workers can work or split in parallel.

Return the minimum amount of time required to build all blocks.

Constraints:

  • 1≤1 \leq blocks.length ≤1000\leq 1000

  • 1≤1 \leq blocks[i] ≤105\leq 10^5

  • 1≤1 \leq split ≤100\leq 100