less than 1 minute read

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 where n is the number of nodes in root

https://binarysearch.com/problems/Delete-Even-Leaves

Examples

Example 1

Input

  • root =

Output

  • answer =

Solution

Leave a comment