Hard data structure and algorithm practice puzzle.
Given a verification tree where every parent should equal the sum of its two children, return how many parents do not. Real Merkle trees combine children with a hash rather than a sum, but the structure and the argument are identical: one bad leaf makes every node above it disagree, so a single walk finds the damage and tells you where it is rather than only that it happened. This is how git detects a corrupted object and how ZFS finds a bad sector without reading the whole disk.
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