Delete Even Leaves
Given a binary tree root
, repeatedly delete all leaves that have even values. That is, if after deletions, a node becomes a leaf with an even value, it too should be deleted.
Constraints
n ≤ 100,000
wheren
is the number of nodes inroot
https://binarysearch.com/problems/Delete-Even-Leaves
Examples
Example 1
Input
- root =
Output
- answer =
Leave a comment