Drop redundant reads

Write codeEasy15 min

Your task

A genome assembler prunes its input before it stitches anything. The sequencer emits short reads, and a read that already sits whole inside another read carries no new sequence, so the pipeline drops it. Given reads, return the indexes of the reads to drop, ascending. Drop read i when some other read holds it as one contiguous stretch and that other read is longer, or when the other read has identical text and appears earlier in the list, since identical reads sit inside each other and the pipeline keeps the first copy. Matching is exact and case sensitive: lowercase marks a masked repeat region, so a lowercase read never matches an uppercase stretch. An empty read sits inside every read. Return an empty list when nothing is dropped.

Examples

contained_read_indexes(reads: list[str]) -> list[int]
Example 1
Inputcontained_read_indexes(["ACGTAC", "GTA", "TTTT"])
Output[1]
Example 2
Inputcontained_read_indexes(["AAGC", "AAGC", "GC"])
Output[1, 2]
Example 3
Inputcontained_read_indexes(["ACGT", "TGCA"])
Output[]