Answers for "recursively fing root of tree"

C#
0

recursively fing root of tree

public TreeNode FindTarget(TreeNode root, int val)
{
   if (root == null || root.val == val) return root;

   if (root.val < val)
     return FindTarget(root.right, val);
   else
     return FindTarget(root.left, val);
}
Posted by: Guest on April-26-2022

C# Answers by Framework

Browse Popular Code Answers by Language