Medium data structure and algorithm practice puzzle.
Given two 32 bit sequence numbers, return whether the first is newer than the second. Plain comparison is wrong: the counter wraps at 2^32, so 0 arriving after 4294967295 is the next byte and not four billion bytes of history. Measure the forward distance instead and call it newer when that distance is less than half the space, which is the rule in RFC 1982 and the reason a connection survives the wrap.
Solve it three ways: snap the jigsaw pieces together, fill in the blanks, or type it from scratch against the tests. This one is free.
Browse all 536 puzzles