HTTP range header
Your task
Parse an HTTP Range header against a known resource size. The header looks like 'bytes=START-END'. Support three forms: 'bytes=N-M' (explicit range), 'bytes=N-' (from N to end), and 'bytes=-N' (the last N bytes, a suffix range). Return [start, end] as inclusive 0-based byte offsets, clamping END to size-1. If the header is unsatisfiable (start beyond the resource, malformed, wrong unit, or a zero-length suffix), return [-1, -1].
Examples
parse_range(header: str, size: int) -> list[int]Example 1
Input
parse_range("bytes=0-499", 1000)Output
[0, 499]