Solving Delete Nodes And Return Forest in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

Return the roots of the trees in the remaining forest. You may return the result in any order.

Example 1:

Input: root = [1,2,3,4,5,6,7], to_delete = [3,5]
Output: [[1,2,null,4],[6],[7]]


  • to_delete.length <= 1000

  • to_delete.length <= 1000

See the full details of the problem Delete Nodes And Return Forest at LeetCode

Originally posted at: