linux-sysprog · beginner · ~15 min

Chunks needed for workers

Compute a balanced work split (ceil division).

Challenge

Implement int chunks_needed(int items, int workers) returning how many items each worker handles when items are split as evenly as possible (ceiling division). Return 0 if workers <= 0.

Starter code

int chunks_needed(int items, int workers) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.