1080. Insufficient Nodes in Root to Leaf Paths
https://leetcode.com/problems/insufficient-nodes-in-root-to-leaf-paths
Description
Given the root of a binary tree and an integer limit, delete all insufficient nodes in the tree simultaneously, and return the root of the resulting binary tree.
A node is insufficient if every root to leaf path intersecting this node has a sum strictly less than limit.
A leaf is a node with no children.
Example 1:

Example 2:

Example 3:

Constraints:
The number of nodes in the tree is in the range
[1, 5000].-105 <= Node.val <= 105-109 <= limit <= 109
ac
Last updated
Was this helpful?