4012. Count of Unfinished Tasks After Each Shift
You are given two integer arrays
tasksandshifts.
tasks[i]represents the time required to complete thei_thtask.shifts[j]represents the amount of time available during thej^thshift.The tasks must be processed in order from left to right.
- Carry-over: If a task is not completed during a shift, processing continues from the same point in that task during the next shift.
- Restart: If all tasks are completed during a shift, the shift ends immediately. Any unused time in that shift is discarded, and the next shift begins again from task 0.
A task is unfinished if it has not been fully completed. This includes a task that is currently in progress.
Return an integer array
answhereans[j]is the number of unfinished tasks immediately after thej^thshift.
1 | class Solution { |