Problem 1325 · Medium

Delete Leaves With a Given Value

Remove leaves bottom-up so that a parent becomes a leaf and can be removed too when it holds the target value.

Open the interactive visualisation