C# - recursive - check every node has a left and right
public bool IsValidSerialization(string preorder) \n    {\n        string[] nodes = preorder.Split(new char[] { ',' });\n        int index = 0;\n        return 
    public bool IsValidSerialization(string preorder) \n    {\n        string[] nodes = preorder.Split(new char[] { ',' });\n        int index = 0;\n        return HasLeftAndRight(nodes, ref index) && index == nodes.Length - 1;\n    }\n    \n    public bool HasLeftAndRight(string[] nodes, ref int index)\n    {\n        if (index >= nodes.Length) return false;\n        if (nodes[index] == "#") return true;\n        index += 1;\n        bool hasLeft = HasLeftAndRight(nodes, ref index);\n        index += 1;\n        bool hasRight = HasLeftAndRight(nodes, ref index);\n        return hasLeft && hasRight;\n    }
[]