Problem 2641 · Medium

Cousins in Binary Tree II

Group each level by parent, then replace every value with the level total minus its sibling group.

Open the interactive visualisation