Medium data structure and algorithm practice puzzle.
Given a header as a list of 16 bit words, return its Internet checksum: add them all up, and whenever the running total overflows 16 bits, add the carry back in at the bottom, then return the bitwise complement. That end-around carry is what makes the sum independent of the order the words arrive in, which is the property that lets a router verify a header without reassembling anything.
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