public int Value { get; set; }
public Node Left { get; set; }
public Node Right { get; set; }
public static bool pathSumUp(Node node, int x) {
return pathSumUp(node.Left, y) || pathSumUp(node.Right, y);
public static void Main()
Left = new Node { Value = 1 },
Right = new Node { Value = 5 }
Console.WriteLine(pathSumUp(tree, 4));
Console.WriteLine(pathSumUp(tree, 8));
Console.WriteLine(pathSumUp(tree, 11));
Console.WriteLine(pathSumUp(tree, 3));