You’re given a binary tree root (distinct node values) and an array to_delete.
Delete every node whose value is in to_delete. When a node is deleted, any non-null children become new roots (unless they’re also deleted).
Return the list of roots of the resulting forest, in any order.
Input: root = [1,2,3,4,5,6,7], to_delete = [3,5]
Output: [[1,2,null,4],[6],[7]]
Input: root = [1,2,4,null,3], to_delete = [3]
Output: [[1,2,4]]
Accepted:
Submission: