Implement a rooted tree whose nodes take their color from the nearest ancestor that has one, unless a color is set on the node itself — then make it work for ten million nodes.
Implement a rooted tree whose nodes take their color from the nearest ancestor that has one, unless a color is set on the node itself — then make it work for ten million nodes.
Opens with the full question.