Back to problems

Chunking with an Unsplittable Header

Algorithm · Google · Easy

Problem: Splitting Data When the Header Must Stay Intact You must send data bytes together with a header whose size is header, while keeping the header whole. Rules: The header must remain in a single chunk. No chunk can exceed maxChunkSize bytes. A chunk containing only the header is allowed. You may divide data across chunks in any way. Produce any split that uses the fewest possible chunks. For example, with header=420, data=180, and maxChunkSize=500, one valid result is…

Checking your access…