Problem 814 · Medium

Binary Tree Pruning

Post-order DFS removes every subtree that contains no 1.

Open the interactive visualisation