1
// What we do is a basic DFS from root to leaf, here I used preorder.4
TreeNode *sufficientSubset(TreeNode *root, int limit) {5
// Base cases to check if there is no root node6
if (!root) return root;7
// or else if there are no leaf nodes to the root node and thus we simply8
// check if the root node is less than the limit or not, if it is less we9
// return null or else we know what to return.10
if (!root->left && !root->right) {11
if (root->val < limit)16
// We then start out DFS traversal, every time decreasing the limit with17
// the current node's value and after that, we move over ahead and check18
// the base conditions again and see if any case has been satisfied or not19
root->left = sufficientSubset(root->left, limit - root->val);20
root->right = sufficientSubset(root->right, limit - root->val);22
if (!root->left && !root->right)