Chunk Upload Acknowledgment Tracker
Design a data structure to track chunk acknowledgments for a large file being uploaded in sequentially numbered, potentially out-of-order chunks. The structure must support initializing from a given chunk, acknowledging individual chunks, and efficiently querying the smallest unacknowledged chunk number.
Asked at:
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late July, 2026
Senior
A mobile application uploads a large file to a server by splitting it into sequentially numbered chunks. Chunks may be uploaded successfully out of order, and the server notifies your system whenever a chunk has been acknowledged. Your task is to design a data structure that efficiently tracks the next chunk that is still waiting to be acknowledged. interface UploadTracker { // Initializes the tracker. // All chunks with sequence numbers smaller than `nextChunk` // are assumed to have already been acknowledged. void init(int nextChunk); // Called whenever the upload of a chunk is acknowledged. void ack(int chunkNumber); // Returns the smallest chunk number that has not yet been acknowledged. int lastUploadedChunk(); }
Hello Interview Premium
Your account is free and you can post anonymously if you choose.