Problem 1315 · Medium

Sum of Nodes with Even-Valued Grandparent

Carry each node’s parent and grandparent down a depth-first walk and add values whose grandparent is even.

Open the interactive visualisation