Episode processing timeline

Write codeEasy13 min

Your task

A podcast app imports episodes through two stages that run side by side: one decoder thread and one tagger thread. Episode i takes decode_seconds[i] on the decoder and tag_seconds[i] on the tagger, and the two lists have the same length. Each stage handles one episode at a time and takes them in the order given. The decoder starts at time 0 and begins each episode the instant it finishes the previous one. The tagger can begin an episode only once the decoder has finished that episode and the tagger has finished the previous one, whichever of the two happens later. Return a list where element i is the time the tagger finishes episode i. Durations may be zero, and an empty import returns an empty list.

Examples

pipeline_exit_times(decode_seconds: list[int], tag_seconds: list[int]) -> list[int]
Example 1
Inputpipeline_exit_times([3, 1, 2], [2, 4, 1])
Output[5, 9, 10]
Example 2
Inputpipeline_exit_times([1, 1, 1], [5, 5, 5])
Output[6, 11, 16]
Example 3
Inputpipeline_exit_times([5, 5], [1, 1])
Output[6, 11]