Laser cutter job order

Write codeEasy15 min

Your task

A sign shop shares one laser cutter across the jobs waiting for it, so no long job can hold the machine all morning. Each entry in jobs is one waiting job written as "panel-a|40": a name, a pipe, then the whole minutes of cutting it still needs. The list is in waiting order, names are unique, and every job needs at least one minute. The operator takes the job at the front of the line and runs it for at most slice_minutes. A job that reaches zero minutes leaves the shop. A job that still needs time goes to the back of the line and waits for another turn. Return the job names in the order they finish.

Examples

cutter_finish_order(jobs: list[str], slice_minutes: int) -> list[str]
Example 1
Inputcutter_finish_order(["panel-a|40", "panel-b|15", "panel-c|30"], 20)
Output["panel-b", "panel-a", "panel-c"]
Example 2
Inputcutter_finish_order(["door|10", "shelf|10", "lid|10"], 25)
Output["door", "shelf", "lid"]
Example 3
Inputcutter_finish_order(["trim|9", "base|4"], 3)
Output["base", "trim"]