Questions / Quant development, Networking & latency
Compare sequence numbers around wrap
A toy protocol uses RFC 1982 style eight-bit serial arithmetic and guarantees forward steps below 128. The last serial is 250 and the next is 5. What is the forward modular distance?
Answer it in the app It's free. You get hints, a second try if you miss, and a follow-up question.
Show the answer and worked solution
Answer: 11 sequence steps
- The forward distance is (5−250) mod 256=11. Because 11 is below half the range, the bounded-step contract identifies 5 as newer.
Interview shortcut. Forward distance = (new − old) mod 256.
In the app this has a follow-up where one thing about the setup changes. Try the follow-up.