Total Waiting Time for Handmade Items

Problem Overview

  • Compute total waiting time for N clients when one employee works in one-hour round-robin sessions.
  • Input: array T (length N), T[k] is hours for client k; Output: total waiting time mod 10^9 (last nine digits, no leading zeros).
  • After each hour, deliver finished items; unfinished ones move to the back of the queue.
  • Constraints: 1 ≤ N ≤ 100,000; 1 ≤ T[i] ≤ 10,000.
  • Microsoft interviews coding interview problem in scheduling/queues; real-world handmade items context; common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: