Missing sequence numbers

Write codeEasy11 min

Your task

Each event shipped by a log agent carries a sequence number, and the collector wants to know what got dropped in transit. You receive the sequence numbers that actually arrived, distinct positive integers, possibly out of order because of retries. Return every missing sequence number between the smallest and largest received values, in ascending order. If fewer than two numbers arrived, or the range is complete, return an empty list.

Examples

missing_sequences(seqs: list[int]) -> list[int]
Example 1
Inputmissing_sequences([7, 3, 5, 8])
Output[4, 6]