Problem 5: Decorate Christmas Tree II (0 pts)
This time, Isla bought 20 super big Christmas trees, which all have more than 100000 nodes! Can you still work out in less than 5 seconds?
Hint1: You should scan every node only constant times.
Hint2: You can set up new attribute of Tree
instance in your solution to memorize something! It's not abstraction barrier violation!