Arcesium | Staff Software Engineer | Hyderabad
Summary
I completed the virtual DSA round after the OA, where I was asked to design a function that processes out-of-order payloads in increasing sequence order.
Full Experience
After OA, I got an invite for virtual rounds.
OA - has 2 questions
- calling an external API, and return results based on some filters
- Binary search based (didn't remember exactly)
Round 1 (DSA)
Discussion about past projects mentioned on resume, followed by below question.
Design a function that receives a sequenceNumber and a payload. Payloads are expected to be processed in increasing sequence order, starting from sequence number 1.
Whenever a new payload arrives, the function should immediately release all contiguous payloads starting from the next expected sequence number.
If payloads arrive out of order, they should be buffered until all preceding payloads have been received.
Each payload must be released exactly once and should never be released again.
Input: (2, "B") -> Output: [] (1, "A") -> Output: ["A", "B"] (4, "D") -> Output: [] (3, "C") -> Output: ["C", "D"] (2, "B") -> Output: [] // Already released, ignore (5, "E") -> Output: ["E"]
I will keep this page updated as I progress through the interview process.
Interview Questions (1)
Process Out-of-Order Payloads in Sequence
Design a function that receives a sequenceNumber and a payload. Payloads must be processed in increasing sequence order, starting from sequence number 1. When a new payload arrives, the function should immediately release all contiguous payloads starting from the next expected sequence number. Out‑of‑order payloads are buffered until all preceding payloads have been received. Each payload is released exactly once and never released again.
Examples
- Input: (2, "B") → Output: []
- Input: (1, "A") → Output: ["A", "B"]
- Input: (4, "D") → Output: []
- Input: (3, "C") → Output: ["C", "D"]
- Input: (2, "B") → Output: [] // Already released, ignore
- Input: (5, "E") → Output: ["E"]