Code RoomRadio frame payloads
EasyPrep Room Coding #4755

Radio frame payloads

CodingNetworking & APIsEntry–Mid~14 min

A telemetry gateway ships one measurement message across a radio link that carries at most mtu bytes in a frame. Every frame spends header_bytes on its own header before any payload, and that header rides on each frame, not only the first. The link also counts fragment offsets in units of 8 bytes, so every frame except the last must carry a payload that is a multiple of 8. Given total_bytes of payload to send, return the payload byte counts of the frames in send order, filling each frame as full as those rules allow before starting the next. The final frame carries whatever is left and is not rounded. Return an empty list when there is nothing to send, or when the header leaves room for fewer than 8 payload bytes.

Implement
fragment_payload_plan(total_bytes: int, mtu: int, header_bytes: int) → list[int]
Examples
in[1200,576,20]out[552,552,96]
in[40,1500,20]out[40]
in[0,1500,20]out[]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 14 min
InputExpectedGot
[1200,576,20][552,552,96]not run yetsample
[40,1500,20][40]not run yetsample
[0,1500,20][]not run yetsample